0 votes

I have a script defining a custom node. It's a tool script, and it overrides _get_configuration_warning(). One of situations I want it to warn about is certain invalid combinations of values for exported variables. Unfortunately, when I change those values in the inspector to the invalid combo, the warning doesn't appear unless I either save the script (even when nothing changed in it), or I add/remove some child nodes.

I see that Node has a method called update_configuration_warning() in the C++ source, but it doesn't seem to be exposed to gdscript.

Is there some other way to force the editor to check _get_configuration_warning() from code? Or maybe I'm approaching this problem the wrong way?

asked Oct 31, 2019 in Engine by andrej88 (23 points)
edited Oct 31, 2019 by andrej88

2 Answers

+1 vote

Found a workaround, not sure if it might have some unwanted side effects but it seems to work. I wrote custom setters for the exported variables, each of which end with the following:

if is_inside_tree():
    get_tree().emit_signal("node_configuration_warning_changed", self)

(without the isinsidetree() check, it crashes when loading the scene)

answered Oct 31, 2019 by andrej88 (23 points)
edited Oct 31, 2019 by andrej88
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.