-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Block resources: Dehardcode scene paths #30
Conversation
|
||
func _populate_block_scenes_by_class(): | ||
for _class in ProjectSettings.get_global_class_list(): | ||
if not _class.base.ends_with("Block"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this being a substring match. Can we instead use ClassDB.is_parent_class
https://docs.godotengine.org/en/stable/classes/class_classdb.html#class-classdb-method-is-parent-class to see if the class is a subclass of Block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! Checking...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried comparing like this:
if not ClassDB.is_parent_class(_class.base, &"Block"):
continue
And with "Block" (no &).. and it didn't work :(
@wjt ready for review again, please note the last fixup. |
@manuq I just went over everything and it looks good to me! Maybe you could do some kind of while loop to see if the parent class is |
Yeah. OK thanks, I'll squash the commits and merge. |
Use the block class in the resources instead of the scene path. This decouples the block data from the block UI. Refactoring the scenes shouldn't break the block data.
b81c2f7
to
c884839
Compare
Use the block class in the resources instead of the scene path. This decouples the block data from the block UI. Refactoring the scenes shouldn't break the block data.