Skip to content

Commit

Permalink
[doc] Add explanation for property check
Browse files Browse the repository at this point in the history
  • Loading branch information
JostMK committed Feb 20, 2024
1 parent efb0923 commit da066ab
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions addons/hide_private_properties/inspector_plugin.gd
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
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

Expand All @@ -13,6 +15,8 @@ func _parse_property(object: Object, type: Variant.Type, name: String, hint_type
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
Expand Down

0 comments on commit da066ab

Please sign in to comment.