-
-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow scripts to override default property values #7593
Comments
Something I'd like to add in here is that historically we would use scenes here, when you create a scene with a certain Godot type as the root node, you can set the default values in the properties in that scene, and they would become the overriding defaults when that scene was added as a child scene. Perfect. But ever since we've added Ergo, we've started to rebuild the plugin to not rely on the scenes, but have the scripts handle all logic including creating further child nodes. edit Note that my solution to this problem would be to simply allow defining the default by either redefining the variable like so:
and Godot seeing this is an existing property and simply overriding whatever is changed and leaving the rest of the property in tact,
|
|
As a complement, it would be nice also to be able to send this notification again on demand, because this notification could be also use to create new nodes for example. |
How would creating another node mean you should receive this notification? A nice is only created once |
Not sure to understand. Sorry, my english level is probably the cause :( My purpose is:
As an example, here is what I'd like to be able to do on a new node creation:
I hope with clarify my purpose (and I hope my purpose is not stupid :)) |
A node is only created once, you can't "recreate" it, this will be called when a node is created, once |
You're right, so my needs are: I'd like a setup notification that would be automaticly called on node and to be called on demand. But clearly, the main need for me is a notification when the node is created. For the possibility to run the setup again, I can do it with other mecanism, you're right. My "As a complement" in my precedent post should be ignore in this topics. |
Trying to be clear on this:
|
Describe the project you are working on
Maintaining the Godot XR Tools library
Describe the problem or limitation you are having in your project
Godot XR Tools provides many types of nodes for users to create XR experiences:
Godot XR Tools has many scenes which exist purely to provide working default values for properties provided by the C++ scene objects such as collision layers and masks. Our users are continuously trying to use the Add Child Node dialog in the scene-tree editor which results in broken objects due to these properties not being configured correctly.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
We would like a way for the scripts to override the creation values for properties in the base C++ nodes.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
A script can already change the default revert value for C++ implemented properties by implementing the
_property_can_revert()
and_property_get_revert()
methods.Changing the initial value after "Add New Node" could be achieved via a new notification (NOTIFICATION_CREATED) which is invoked only when a new node is created (either via Add New Node, or dynamically in code) - not when it is instantiated from a PackedScene or duplicated.
The script would then be able to contain the following code:
If this enhancement will not be used often, can it be worked around with a few lines of script?
The current approach of providing pre-configured scenes and extensive user documentation appears to be the only workaround at this time; however it creates significant user issues.
Is there a reason why this should be core and not an add-on in the asset library?
No means of implementing it outside of the core has been found.
The text was updated successfully, but these errors were encountered: