Ability to Edit @export Variables of Base Classes in Child Classes in Editor #7832
TheOneWayTruth
started this conversation in
Editor
Replies: 1 comment
-
At the end of the day all exporting does is add the PROPERTY_USAGE_DEFAULT flag to the property's Info. You can do the same by overriding For your case, what you could do is keep the base class' properties un-exported. Then in one of your child classes, you could write: func _get_property_list():
var properties := [
{
"name": "my_property",
"type": TYPE_INT,
"usage": PROPERTY_USAGE_DEFAULT,
}
]
return properties Given the right parameters this will export your property just like the annotation would. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Description:
Currently, in Godot, it's not straightforward to edit
@export
variables of base classes in child classes directly through the editor. While using setter methods as a workaround is possible, it's not the most intuitive or clean approach, and it can be seen as a workaround rather than an elegant solution.Proposal:
I propose improving the editor's functionality to allow for the direct editing of
@export
variables of base classes in child classes, without the need for setter methods. Additionally, this enhancement could include the ability to annotate@export
variables with@exportChild
to indicate that they are intended to be overridden by child classes.Use Case:
The ability to edit
@export
variables of base classes in child classes is beneficial for scenarios where a base class defines common properties, and child classes need to customize or tweak these properties for individual instances. By introducing the@exportChild
annotation for@export
variables, developers can explicitly indicate which variables should be overridden by child classes, making it clear which properties are intended for customization.Beta Was this translation helpful? Give feedback.
All reactions