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

Exporting Node variable can't trigger setget in tool mode. #69283

Closed
hapenia opened this issue Nov 28, 2022 · 6 comments
Closed

Exporting Node variable can't trigger setget in tool mode. #69283

hapenia opened this issue Nov 28, 2022 · 6 comments

Comments

@hapenia
Copy link

hapenia commented Nov 28, 2022

Godot version

4.0 beta 6

System information

This is system-independent.

Issue description

As title.

This is because when the exported node variable a_variable is modified, the editor actually modifies the variable metadata/_ editor_prop_ptr_a_variable, so the setget defined in the @ tool script does not work.

image

Steps to reproduce

@tool
extends Node

@export var a_export_node: Node :
    set(v):
         print("set!")
         a_export_node = v

Minimal reproduction project

very easy to reproduce.

@hoklai1997
Copy link

Godot version
4.0 beta 10

This is still an issue with setget in tool mode. Tested with the following code:

@tool
extends Node2D

@export var foo: bool:
	set(value):
		print("foo setter invoked")
		foo = value

In-Editor toggle boolean: Set foo
Run Scene: foo setter invoked

@hapenia
Copy link
Author

hapenia commented Jan 3, 2023

Godot version 4.0 beta 10

This is still an issue with setget in tool mode. Tested with the following code:

@tool
extends Node2D

@export var foo: bool:
	set(value):
		print("foo setter invoked")
		foo = value

In-Editor toggle boolean: Set foo Run Scene: foo setter invoked

Maybe it is another issue? This issue is focusing on exporting variable that is Node type. And the problem is in editor metadata. Your code can work in previous version, at least the time when I report this.

@hoklai1997
Copy link

I just double checked, the issue was in not reloading the scene to get the most current script behaviour. Closing the scene and reopening resolved the problem. :face_palm:

@Frontrider
Copy link

Does not work. Exported nodes remain nulls in the editor as of 4.0.2.

@jdboris
Copy link

jdboris commented Jun 24, 2023

To clarify, OP's bug is still happening in v4.0.3.stable.official. Setting primitive type values in the editor does trigger the setter, but setting Node type values doesn't. I still see Set metadata/_editor_prop_ptr_value in the Output. NodePath does work as a workaround though

@raulsntos
Copy link
Member

@raulsntos raulsntos added this to the 4.1 milestone Jul 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants