Skip to content

Commit

Permalink
Merge pull request #78 from godotengine/ExculedThings
Browse files Browse the repository at this point in the history
Remove disabled classes from CreatingAllThings
  • Loading branch information
qarmin authored Nov 28, 2022
2 parents bab196a + 5526436 commit 2922104
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
18 changes: 5 additions & 13 deletions CreatingAllThings/CreatingAllThings.gd
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,17 @@ var exceptions: Array = []


func _ready():
exceptions = Engine.get_singleton_list()
var classes_to_check = BasicData.get_list_of_available_classes()

var cl: Array = Array(ClassDB.get_class_list())
cl.sort()
for name_of_class in cl:
for name_of_class in classes_to_check:
# Repeat 3 times, to be sure that code don't crash in unreleated function
for _i in range(3):
if !ClassDB.can_instantiate(name_of_class):
continue
if name_of_class in exceptions:
continue
if name_of_class.to_lower().find("server") != -1:
continue

print("########### " + name_of_class)
print('GDSCRIPT CODE: var thing = ClassDB.instantiate("' + name_of_class + '")')
print("GDSCRIPT CODE: str(" + name_of_class + ")")

var thing = ClassDB.instantiate(name_of_class)

# Sometimes even printing cause crash
print("GDSCRIPT CODE: str(" + name_of_class + ")")
str(thing)

if thing is Node:
Expand Down
2 changes: 2 additions & 0 deletions Start.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1")

0 comments on commit 2922104

Please sign in to comment.