Description
Godot version
4.0 beta8
System information
Windows10, AMD Ryzen 9 3900XT, RTX3070, Vulkan
Issue description
When making a conditional property, by overriding _get_property_list
and _set
and _get
, the inspector is not updated unless you de- and reselect the node, when you have a field (in C# it does not matter whether it is public or private) that has the same name as something that the propertylist contains. E.g. the following does not work:
@tool
extends Node2D
var ShowSecondProperty : bool
func _get_property_list():
var ret: Array = []
ret.append({"name": "ShowSecondProperty", "type": TYPE_BOOL})
if(ShowSecondProperty):
ret.append({"name": "SecondProperty", "type": TYPE_BOOL})
return ret
func _set(property, value):
if(property == "ShowSecondProperty"):
ShowSecondProperty = value
notify_property_list_changed()
return true
return false
func _get(property):
if(property == "ShowSecondProperty"):
return ShowSecondProperty
return null
but renaming the field to _showSecondProperty
would. So, there must be no field in the class that has the name "ShowSecondProperty"
which is added to the PropertyList.
I attached a replication project that demonstrates this behavior for both C# and GDscript.
This might or might not be related to #43238.
I am not entirely sure whether this is a bug or just the lack of an error message or hint of some kind, but I just lost two hours of my time and a bit of sanity figuring this out.
Steps to reproduce
Append the script to a Node and observe the behavior when you modify the script's properties in the inspector.