-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Add is_built_in() method to Resource #50352
Conversation
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.
Let's merge, but maybe warrants a rebase first to be sure it still builds fine.
4144248
to
e393c2a
Compare
Rebased. I also replaced a few more conditions (that likely popped out since the PR was made). I seen a few partial conditions, which only check for |
Would probably be worth reviewing in a follow-up PR, I guess the intent was to check if it's a builtin resource. What else would use |
The ones left out are: Lines 4338 to 4340 in 78931aa
This is used in lots of places. Some of them ( res.get_path().is_resource_file() ) could be replaced by is_built_in() .
godot/editor/dependency_editor.cpp Lines 174 to 180 in 78931aa
Doesn't look related to file paths. godot/editor/editor_file_system.cpp Lines 122 to 127 in 78931aa
No idea here. Lines 1200 to 1208 in 78931aa
It uses the index of "::", but the performance probably doesn't matter here. Could be replaced. Lines 2159 to 2168 in 78931aa
Same as above. godot/editor/filesystem_dock.cpp Lines 1245 to 1249 in 78931aa
Not sure here. godot/editor/debugger/editor_debugger_inspector.cpp Lines 152 to 160 in 78931aa
Could be replaced probably. godot/editor/plugins/script_editor_plugin.cpp Lines 722 to 723 in 78931aa
It checks !path.is_resource_file() later, so it confused me a bit.
|
Thanks! |
A built-in Resource can be recognized by its path, which may be:
::
local://
? idk, I've seen it in few placesThere were such checks all over the codebase, but they were inconsistent, which led to some bugs, e.g. #45950 or partially #49086 (
_is_built_in_script()
is not checking for empty paths, so the issue isn't fully fixed).To fix inconsistencies I added
is_built_in()
to resources. I replaced equivalent conditions with this method.