Skip to content
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

Export members are duplicated on Inspector when using @tool #82169

Closed
sepTN opened this issue Sep 23, 2023 · 2 comments · Fixed by #82186
Closed

Export members are duplicated on Inspector when using @tool #82169

sepTN opened this issue Sep 23, 2023 · 2 comments · Fixed by #82186

Comments

@sepTN
Copy link
Contributor

sepTN commented Sep 23, 2023

Godot version

4.2.dev

System information

Windows 11

Issue description

There's a bug on 4.2.dev where the Inspector will shows the duplicated exported members of a child class that extends its parent class.

  • Only happens in the latest 4.2.dev
  • Reopening the same project in 4.1.1.stable, works as expected
  • Removing the @tool and then reopening the project again, doesn't trigger the bug

Steps to reproduce

  • Make a new scene call it animal.tscn
  • Attach new script to it animal.gd with this content
@tool
class_name Animal extends Node2D

@export var height := 50
@export var weight := 10
@export var limbs := 4
  • Make a new scene call it dog.tscn
  • Attach a new script to it dog.gd that extends the animal.gd with this content
@tool
class_name Dog extends Animal

@export var dog_name := "Barkie"
@export var owner_name := "Joe"
  • Open the project using 4.2.dev and you will see the exported members are duplicated
    image

  • Open the same project using the 4.1.1.stable and you will see that it works as intended, no exported members duplication
    image

Minimal reproduction project

sample.zip

@kleonc
Copy link
Member

kleonc commented Sep 23, 2023

Fine in v4.2.dev4.official [549fcce].
Broken since v4.2.dev5.official [e3e2528].

Possibly by #81079? 🤔 cc @dalexeev

@tool only makes it be shown in the inspector, but get_property_list() returns duplicated properties regardless of @tool.

Results of:

for p in get_property_list():
	print(p)

for dog.gd within the MRP:

v4.2.dev4.official [549fcce]
{ "name": "Node", "class_name": &"", "type": 0, "hint": 0, "hint_string": "", "usage": 128 }
{ "name": "_import_path", "class_name": &"", "type": 22, "hint": 0, "hint_string": "", "usage": 10 }
{ "name": "name", "class_name": &"", "type": 21, "hint": 0, "hint_string": "", "usage": 0 }
{ "name": "unique_name_in_owner", "class_name": &"", "type": 1, "hint": 0, "hint_string": "", "usage": 2 }
{ "name": "scene_file_path", "class_name": &"", "type": 4, "hint": 0, "hint_string": "", "usage": 0 }
{ "name": "owner", "class_name": &"Node", "type": 24, "hint": 17, "hint_string": "Node", "usage": 0 }
{ "name": "multiplayer", "class_name": &"MultiplayerAPI", "type": 24, "hint": 17, "hint_string": "MultiplayerAPI", "usage": 0 }
{ "name": "Process", "class_name": &"", "type": 0, "hint": 0, "hint_string": "process_", "usage": 64 }
{ "name": "process_mode", "class_name": &"", "type": 2, "hint": 2, "hint_string": "Inherit,Pausable,When Paused,Always,Disabled", "usage": 6 }
{ "name": "process_priority", "class_name": &"", "type": 2, "hint": 0, "hint_string": "", "usage": 6 }
{ "name": "process_physics_priority", "class_name": &"", "type": 2, "hint": 0, "hint_string": "", "usage": 6 }
{ "name": "Thread Group", "class_name": &"", "type": 0, "hint": 0, "hint_string": "process_thread", "usage": 256 }
{ "name": "process_thread_group", "class_name": &"", "type": 2, "hint": 2, "hint_string": "Inherit,Main Thread,Sub Thread", "usage": 6 }
{ "name": "process_thread_group_order", "class_name": &"", "type": 2, "hint": 0, "hint_string": "", "usage": 0 }
{ "name": "process_thread_messages", "class_name": &"", "type": 2, "hint": 6, "hint_string": "Process,Physics Process", "usage": 0 }
{ "name": "Editor Description", "class_name": &"", "type": 0, "hint": 0, "hint_string": "editor_", "usage": 64 }
{ "name": "editor_description", "class_name": &"", "type": 4, "hint": 18, "hint_string": "", "usage": 6 }
{ "name": "CanvasItem", "class_name": &"", "type": 0, "hint": 0, "hint_string": "", "usage": 128 }
{ "name": "Visibility", "class_name": &"", "type": 0, "hint": 0, "hint_string": "", "usage": 64 }
{ "name": "visible", "class_name": &"", "type": 1, "hint": 0, "hint_string": "", "usage": 6 }
{ "name": "modulate", "class_name": &"", "type": 20, "hint": 0, "hint_string": "", "usage": 6 }
{ "name": "self_modulate", "class_name": &"", "type": 20, "hint": 0, "hint_string": "", "usage": 6 }
{ "name": "show_behind_parent", "class_name": &"", "type": 1, "hint": 0, "hint_string": "", "usage": 6 }
{ "name": "top_level", "class_name": &"", "type": 1, "hint": 0, "hint_string": "", "usage": 6 }
{ "name": "clip_children", "class_name": &"", "type": 2, "hint": 2, "hint_string": "Disabled,Clip Only,Clip + Draw", "usage": 6 }
{ "name": "light_mask", "class_name": &"", "type": 2, "hint": 7, "hint_string": "", "usage": 6 }
{ "name": "visibility_layer", "class_name": &"", "type": 2, "hint": 7, "hint_string": "", "usage": 6 }
{ "name": "Ordering", "class_name": &"", "type": 0, "hint": 0, "hint_string": "", "usage": 64 }
{ "name": "z_index", "class_name": &"", "type": 2, "hint": 1, "hint_string": "-4096,4096,1", "usage": 6 }
{ "name": "z_as_relative", "class_name": &"", "type": 1, "hint": 0, "hint_string": "", "usage": 6 }
{ "name": "y_sort_enabled", "class_name": &"", "type": 1, "hint": 0, "hint_string": "", "usage": 6 }
{ "name": "Texture", "class_name": &"", "type": 0, "hint": 0, "hint_string": "texture_", "usage": 64 }
{ "name": "texture_filter", "class_name": &"", "type": 2, "hint": 2, "hint_string": "Inherit,Nearest,Linear,Nearest Mipmap,Linear Mipmap,Nearest Mipmap Anisotropic,Linear Mipmap Anisotropic", "usage": 6 }
{ "name": "texture_repeat", "class_name": &"", "type": 2, "hint": 2, "hint_string": "Inherit,Disabled,Enabled,Mirror", "usage": 6 }
{ "name": "Material", "class_name": &"", "type": 0, "hint": 0, "hint_string": "", "usage": 64 }
{ "name": "material", "class_name": &"CanvasItemMaterial,ShaderMaterial", "type": 24, "hint": 17, "hint_string": "CanvasItemMaterial,ShaderMaterial", "usage": 6 }
{ "name": "use_parent_material", "class_name": &"", "type": 1, "hint": 0, "hint_string": "", "usage": 6 }
{ "name": "Node2D", "class_name": &"", "type": 0, "hint": 0, "hint_string": "", "usage": 128 }
{ "name": "Transform", "class_name": &"", "type": 0, "hint": 0, "hint_string": "", "usage": 64 }
{ "name": "position", "class_name": &"", "type": 5, "hint": 1, "hint_string": "-99999,99999,0.001,or_less,or_greater,hide_slider,suffix:px", "usage": 6 }
{ "name": "rotation", "class_name": &"", "type": 3, "hint": 1, "hint_string": "-360,360,0.1,or_less,or_greater,radians", "usage": 6 }
{ "name": "rotation_degrees", "class_name": &"", "type": 3, "hint": 0, "hint_string": "", "usage": 0 }
{ "name": "scale", "class_name": &"", "type": 5, "hint": 5, "hint_string": "", "usage": 6 }
{ "name": "skew", "class_name": &"", "type": 3, "hint": 1, "hint_string": "-89.9,89.9,0.1,radians", "usage": 6 }
{ "name": "transform", "class_name": &"", "type": 11, "hint": 0, "hint_string": "suffix:px", "usage": 0 }
{ "name": "global_position", "class_name": &"", "type": 5, "hint": 0, "hint_string": "suffix:px", "usage": 0 }
{ "name": "global_rotation", "class_name": &"", "type": 3, "hint": 0, "hint_string": "radians", "usage": 0 }
{ "name": "global_rotation_degrees", "class_name": &"", "type": 3, "hint": 0, "hint_string": "", "usage": 0 }
{ "name": "global_scale", "class_name": &"", "type": 5, "hint": 0, "hint_string": "", "usage": 0 }
{ "name": "global_skew", "class_name": &"", "type": 3, "hint": 0, "hint_string": "radians", "usage": 0 }
{ "name": "global_transform", "class_name": &"", "type": 11, "hint": 0, "hint_string": "suffix:px", "usage": 0 }
{ "name": "script", "class_name": &"Script", "type": 24, "hint": 17, "hint_string": "Script", "usage": 1048582 }
{ "name": "dog.gd", "class_name": &"", "type": 0, "hint": 0, "hint_string": "res://dog.gd", "usage": 128 }
{ "name": "dog_name", "class_name": &"", "type": 4, "hint": 0, "hint_string": "String", "usage": 4102 }
{ "name": "owner_name", "class_name": &"", "type": 4, "hint": 0, "hint_string": "String", "usage": 4102 }
{ "name": "animal.gd", "class_name": &"", "type": 0, "hint": 0, "hint_string": "res://animal.gd", "usage": 128 }
{ "name": "height", "class_name": &"", "type": 2, "hint": 0, "hint_string": "int", "usage": 4102 }
{ "name": "weight", "class_name": &"", "type": 2, "hint": 0, "hint_string": "int", "usage": 4102 }
{ "name": "limbs", "class_name": &"", "type": 2, "hint": 0, "hint_string": "int", "usage": 4102 }
v4.2.dev5.official [e3e2528]
{ "name": "Node", "class_name": &"", "type": 0, "hint": 0, "hint_string": "Node", "usage": 128 }
{ "name": "_import_path", "class_name": &"", "type": 22, "hint": 0, "hint_string": "", "usage": 10 }
{ "name": "name", "class_name": &"", "type": 21, "hint": 0, "hint_string": "", "usage": 0 }
{ "name": "unique_name_in_owner", "class_name": &"", "type": 1, "hint": 0, "hint_string": "", "usage": 2 }
{ "name": "scene_file_path", "class_name": &"", "type": 4, "hint": 0, "hint_string": "", "usage": 0 }
{ "name": "owner", "class_name": &"Node", "type": 24, "hint": 17, "hint_string": "Node", "usage": 0 }
{ "name": "multiplayer", "class_name": &"MultiplayerAPI", "type": 24, "hint": 17, "hint_string": "MultiplayerAPI", "usage": 0 }
{ "name": "Process", "class_name": &"", "type": 0, "hint": 0, "hint_string": "process_", "usage": 64 }
{ "name": "process_mode", "class_name": &"", "type": 2, "hint": 2, "hint_string": "Inherit,Pausable,When Paused,Always,Disabled", "usage": 6 }
{ "name": "process_priority", "class_name": &"", "type": 2, "hint": 0, "hint_string": "", "usage": 6 }
{ "name": "process_physics_priority", "class_name": &"", "type": 2, "hint": 0, "hint_string": "", "usage": 6 }
{ "name": "Thread Group", "class_name": &"", "type": 0, "hint": 0, "hint_string": "process_thread", "usage": 256 }
{ "name": "process_thread_group", "class_name": &"", "type": 2, "hint": 2, "hint_string": "Inherit,Main Thread,Sub Thread", "usage": 6 }
{ "name": "process_thread_group_order", "class_name": &"", "type": 2, "hint": 0, "hint_string": "", "usage": 0 }
{ "name": "process_thread_messages", "class_name": &"", "type": 2, "hint": 6, "hint_string": "Process,Physics Process", "usage": 0 }
{ "name": "Editor Description", "class_name": &"", "type": 0, "hint": 0, "hint_string": "editor_", "usage": 64 }
{ "name": "editor_description", "class_name": &"", "type": 4, "hint": 18, "hint_string": "", "usage": 6 }
{ "name": "CanvasItem", "class_name": &"", "type": 0, "hint": 0, "hint_string": "CanvasItem", "usage": 128 }
{ "name": "Visibility", "class_name": &"", "type": 0, "hint": 0, "hint_string": "", "usage": 64 }
{ "name": "visible", "class_name": &"", "type": 1, "hint": 0, "hint_string": "", "usage": 6 }
{ "name": "modulate", "class_name": &"", "type": 20, "hint": 0, "hint_string": "", "usage": 6 }
{ "name": "self_modulate", "class_name": &"", "type": 20, "hint": 0, "hint_string": "", "usage": 6 }
{ "name": "show_behind_parent", "class_name": &"", "type": 1, "hint": 0, "hint_string": "", "usage": 6 }
{ "name": "top_level", "class_name": &"", "type": 1, "hint": 0, "hint_string": "", "usage": 6 }
{ "name": "clip_children", "class_name": &"", "type": 2, "hint": 2, "hint_string": "Disabled,Clip Only,Clip + Draw", "usage": 6 }
{ "name": "light_mask", "class_name": &"", "type": 2, "hint": 7, "hint_string": "", "usage": 6 }
{ "name": "visibility_layer", "class_name": &"", "type": 2, "hint": 7, "hint_string": "", "usage": 6 }
{ "name": "Ordering", "class_name": &"", "type": 0, "hint": 0, "hint_string": "", "usage": 64 }
{ "name": "z_index", "class_name": &"", "type": 2, "hint": 1, "hint_string": "-4096,4096,1", "usage": 6 }
{ "name": "z_as_relative", "class_name": &"", "type": 1, "hint": 0, "hint_string": "", "usage": 6 }
{ "name": "y_sort_enabled", "class_name": &"", "type": 1, "hint": 0, "hint_string": "", "usage": 6 }
{ "name": "Texture", "class_name": &"", "type": 0, "hint": 0, "hint_string": "texture_", "usage": 64 }
{ "name": "texture_filter", "class_name": &"", "type": 2, "hint": 2, "hint_string": "Inherit,Nearest,Linear,Nearest Mipmap,Linear Mipmap,Nearest Mipmap Anisotropic,Linear Mipmap Anisotropic", "usage": 6 }
{ "name": "texture_repeat", "class_name": &"", "type": 2, "hint": 2, "hint_string": "Inherit,Disabled,Enabled,Mirror", "usage": 6 }
{ "name": "Material", "class_name": &"", "type": 0, "hint": 0, "hint_string": "", "usage": 64 }
{ "name": "material", "class_name": &"CanvasItemMaterial,ShaderMaterial", "type": 24, "hint": 17, "hint_string": "CanvasItemMaterial,ShaderMaterial", "usage": 6 }
{ "name": "use_parent_material", "class_name": &"", "type": 1, "hint": 0, "hint_string": "", "usage": 6 }
{ "name": "Node2D", "class_name": &"", "type": 0, "hint": 0, "hint_string": "Node2D", "usage": 128 }
{ "name": "Transform", "class_name": &"", "type": 0, "hint": 0, "hint_string": "", "usage": 64 }
{ "name": "position", "class_name": &"", "type": 5, "hint": 1, "hint_string": "-99999,99999,0.001,or_less,or_greater,hide_slider,suffix:px", "usage": 6 }
{ "name": "rotation", "class_name": &"", "type": 3, "hint": 1, "hint_string": "-360,360,0.1,or_less,or_greater,radians", "usage": 6 }
{ "name": "rotation_degrees", "class_name": &"", "type": 3, "hint": 0, "hint_string": "", "usage": 0 }
{ "name": "scale", "class_name": &"", "type": 5, "hint": 5, "hint_string": "", "usage": 6 }
{ "name": "skew", "class_name": &"", "type": 3, "hint": 1, "hint_string": "-89.9,89.9,0.1,radians", "usage": 6 }
{ "name": "transform", "class_name": &"", "type": 11, "hint": 0, "hint_string": "suffix:px", "usage": 0 }
{ "name": "global_position", "class_name": &"", "type": 5, "hint": 0, "hint_string": "suffix:px", "usage": 0 }
{ "name": "global_rotation", "class_name": &"", "type": 3, "hint": 0, "hint_string": "radians", "usage": 0 }
{ "name": "global_rotation_degrees", "class_name": &"", "type": 3, "hint": 0, "hint_string": "", "usage": 0 }
{ "name": "global_scale", "class_name": &"", "type": 5, "hint": 0, "hint_string": "", "usage": 0 }
{ "name": "global_skew", "class_name": &"", "type": 3, "hint": 0, "hint_string": "radians", "usage": 0 }
{ "name": "global_transform", "class_name": &"", "type": 11, "hint": 0, "hint_string": "suffix:px", "usage": 0 }
{ "name": "script", "class_name": &"Script", "type": 24, "hint": 17, "hint_string": "Script", "usage": 1048582 }
{ "name": "dog.gd", "class_name": &"", "type": 0, "hint": 0, "hint_string": "res://dog.gd", "usage": 128 }
{ "name": "height", "class_name": &"", "type": 2, "hint": 0, "hint_string": "int", "usage": 4102 }
{ "name": "weight", "class_name": &"", "type": 2, "hint": 0, "hint_string": "int", "usage": 4102 }
{ "name": "limbs", "class_name": &"", "type": 2, "hint": 0, "hint_string": "int", "usage": 4102 }
{ "name": "dog_name", "class_name": &"", "type": 4, "hint": 0, "hint_string": "String", "usage": 4102 }
{ "name": "owner_name", "class_name": &"", "type": 4, "hint": 0, "hint_string": "String", "usage": 4102 }
{ "name": "animal.gd", "class_name": &"", "type": 0, "hint": 0, "hint_string": "res://animal.gd", "usage": 128 }
{ "name": "height", "class_name": &"", "type": 2, "hint": 0, "hint_string": "int", "usage": 4102 }
{ "name": "weight", "class_name": &"", "type": 2, "hint": 0, "hint_string": "int", "usage": 4102 }
{ "name": "limbs", "class_name": &"", "type": 2, "hint": 0, "hint_string": "int", "usage": 4102 }

Diff:

@@ -1 +1 @@
-{ "name": "Node", "class_name": &"", "type": 0, "hint": 0, "hint_string": "", "usage": 128 }
+{ "name": "Node", "class_name": &"", "type": 0, "hint": 0, "hint_string": "Node", "usage": 128 }
@@ -18 +18 @@
-{ "name": "CanvasItem", "class_name": &"", "type": 0, "hint": 0, "hint_string": "", "usage": 128 }
+{ "name": "CanvasItem", "class_name": &"", "type": 0, "hint": 0, "hint_string": "CanvasItem", "usage": 128 }
@@ -38 +38 @@
-{ "name": "Node2D", "class_name": &"", "type": 0, "hint": 0, "hint_string": "", "usage": 128 }
+{ "name": "Node2D", "class_name": &"", "type": 0, "hint": 0, "hint_string": "Node2D", "usage": 128 }
@@ -53,0 +54,3 @@
+{ "name": "height", "class_name": &"", "type": 2, "hint": 0, "hint_string": "int", "usage": 4102 }
+{ "name": "weight", "class_name": &"", "type": 2, "hint": 0, "hint_string": "int", "usage": 4102 }
+{ "name": "limbs", "class_name": &"", "type": 2, "hint": 0, "hint_string": "int", "usage": 4102 }

@tokengamedev
Copy link

I also faced the issue but, could not reproduce it. For me it was calling the setter method twice also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants