-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[merge] Fix property not found warning in Hide Private Properties
- Loading branch information
Showing
3 changed files
with
18 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,23 @@ | ||
extends EditorInspectorPlugin | ||
|
||
func _can_handle(object: Object) -> bool: | ||
# Early return if property does not exist, prevents triggering a warning for | ||
# some objects that overwrite the 'get' method. | ||
if not _has_property(object, "scene_file_path"): | ||
return false | ||
|
||
var scene_path: Variant = object.get("scene_file_path") | ||
return scene_path != null && scene_path != "" && object != EditorInterface.get_edited_scene_root() | ||
|
||
func _parse_property(object: Object, type: Variant.Type, name: String, hint_type: PropertyHint, hint_string: String, usage_flags: int, wide: bool) -> bool: | ||
if name.begins_with("_"): | ||
return true | ||
return false | ||
|
||
func _has_property(object: Object, propertyName: String) -> bool: | ||
# Note: Checking if the property exists using the 'in' keyword also triggers | ||
# the warning in 'core/config/project_settings.cpp:_get' (v4.2.1) | ||
for property in object.get_property_list(): | ||
if property.name == propertyName: | ||
return true | ||
return false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters