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

Exported variables are not updated in the inspector when their value is changed via GDScript #21009

Closed
andrea-calligaris opened this issue Aug 14, 2018 · 11 comments · Fixed by godotengine/godot-docs#3398

Comments

@andrea-calligaris
Copy link
Contributor

v3.0.5 stable, Xubuntu
Making a plugin, if you change the property value of a node via GDScript, that is reflected on the inspector. This doesn't happen with exports, so you have to manually refresh the inspector clicking on something else.
Example project attached.
Example project.zip

@vnen
Copy link
Member

vnen commented Aug 15, 2018

I think this is expected. The export is done so you change the value for the specific scene, overriding the default. So the value on the scene is kept even if you change the default.

@andrea-calligaris
Copy link
Contributor Author

Hrmm... I don't think you understood the problem. It's about the inspector not being refreshed, not about the change of the actual value, which occurs fine. I'm not "changing the default", I am changing the actual value of the exported variable.
Have you tried the example? It contains detailed instructions. If you click on another node and then click back on the effected node, you will see that the value is changed. The inspector just didn't refresh that change right away.

@Zylann
Copy link
Contributor

Zylann commented Dec 27, 2018

I have a similar issue, in my custom node some properties are dynamic depending on which enum value is selected (uses _get_property_list), but to see them update I am forced to inspect something else and go back to my node.
Is there an issue about this already?

@timoschwarzer
Copy link
Contributor

I have the same issue. For example, if you make an EditorPlugin that moves Node2Ds, the inspector does not display the updated transform values. If I move the Node2D using the default move tool, the inspector does update.
IMO there should be a method in EditorPlugin to indicate that a node's property has changed. (e.g. node_property_updated(node: Node))

@Zylann
Copy link
Contributor

Zylann commented Dec 30, 2018

In C++, what triggers this is _change_notify("property_name"): https://github.com/godotengine/godot/blob/master/scene/2d/node_2d.cpp#L54

@timoschwarzer
Copy link
Contributor

@Zylann Thanks! That should be exposed to GDScript IMO.

@Zylann
Copy link
Contributor

Zylann commented Dec 30, 2018

@timoschwarzer however I wonder what @reduz thinks about this because last time I found this, he wasn't super-happy with this hack

@Razzlegames
Copy link
Contributor

In gdscript I used this to update any exported variables if changed in the tool script code: property_list_changed_notify(). Didn't check, but probably calls the C++ _change_notify for all properties etc.

@hiulit
Copy link

hiulit commented Jan 8, 2020

In gdscript I used this to update any exported variables if changed in the tool script code: property_list_changed_notify(). Didn't check, but probably calls the C++ _change_notify for all properties etc.

This worked for me. Thanks!

@sean256
Copy link

sean256 commented Apr 16, 2020

Considering property_list_changed_notify exists and it works, is this even a bug?

@Calinou
Copy link
Member

Calinou commented Apr 17, 2020

@sean256 I think we still need to document this in the GDScript exports documentation.

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.

9 participants