Can a custom node's tool script force the editor to re-check configuration warnings?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By andrej88

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?

:bust_in_silhouette: Reply From: andrej88

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 is_inside_tree() check, it crashes when loading the scene)

:bust_in_silhouette: Reply From: Jack Wilsdon

update_configuration_warning() is now exposed (since 3.2), which can be used to tell the editor to update the warning.