• Godot HelpGUI
  • Godot-Engine Property UI: Show/Hide Property on certain condition

Hi, there (already asked this on irc):

How can I realize 'conditional' properties in the inspector. I want one property only to be visible if some special elements are selected. Actually like in the Material-Inspector, where properties get visible for "ClearCoat" as soon it is enabled.my code looks like this: https://pastebin.com/AE31XugP and I want "navmesh_groupname" only be visible when in bake_selection_mode BAKE_SELECTION_MODE_GROUPS_WITH_CHILDREN or BAKE_SELECTION_MODE_GROUPS_EXPLICIT is selected.

I looked at the "CleatCoat"-Code, where the properties are set and definied, but can't make out any logic that would handle showing/hiding...

Any hint would be very appreciated. It is for the navmesh-baking by groups ( https://github.com/godotengine/godot/pull/15110 )

2 years later

CheckBox has a signal called "toggled". If you connect that to your script, it has a parameter for if it's enabled or not enabled. You can set the visibility of the elements to this value.

This isn't supported if you use the built-in export syntax, so you'll have to override _get_property_list() in the script to do this. Unfortunately, this also means you lose the simplicity benefits of the export keyword.

I'm actually trying to achieve the same thing with GDScript in a plugin I'm working on. If you figure out something, let us know. I know you are most likely working in C++, but I could still learn something from it. :)

Edit: Nevermind! I found this function called property_list_changed_notify(). There should be something like that in C++.

3 years later