0 votes

Hello,

How do I hide/show exposed properties in tool nodes dinamically?.
For example a tool node with an exposed enum with many options: flying_enemy, ground_enemy, aquatic_enemy. When the type is changed, show the properties of the type picked and hide the rest.

in Engine by (75 points)
edited by

I think you can override _get_property_list in GDScript and return explicitely all export metadata, as an array of this:

# (code copied from a project where I wanted to hide a variable
# by not including PROPERTY_USAGE_EDITOR in "usage", but still have it saved)
return [
    {
        "name": "_data",
        "type": TYPE_ARRAY,
        "usage": PROPERTY_USAGE_STORAGE
    }, etc
]

However I never got "dynamic" properties to work correctly. I know it's exactly what C++ does (ButtonArray items for example) but in GDScript I may be missing something. The doc is a bit short on it http://docs.godotengine.org/en/stable/classes/class_object.html?highlight=get_property_list#class-object-get-property-list, also check the PROPERTY_USAGE_* enums in the built-in help

Please log in or register to answer this question.

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.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.