Editor Fields and Advanced Expression Evaluation #8066
Replies: 2 comments 5 replies
-
At least the first thing missing is a reference to the object, without it the expression cannot use the object properties. It is worth, the way this is done, giving it a reference will also allow calling methods on it (with the caveat of tool scripts). The other part of this is that evaluation needs to happen per object, so it can have a different result for each of the selected objects. I do not know how much trouble that could be, but it seems worth looking into. For the controls case in particular, you are probably going to want a container for those controls to handle resizes, or you also have to tweak anchors and margins, which gives me another idea: what about a container that takes an expression and uses it to organize its children? Edit: I should point out I'm just throwing the idea out there. |
Beta Was this translation helpful? Give feedback.
-
Based on a conversation around this particular proposal I've explored this as an editor addon to some degree as a proof of concept with some success. For this test I arbitrarily chose a few rules and passed them to the Expression as parameters: My overall finding so far though is that this would probably work best as a dedicated parser more similar to Unity's version rather than a GDScript expression evaluation. My reasoning being:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Who Am I:
I am a recent Unity to Godot convert and have been using Godot steadily more and more over the last weeks.
I've used Unity for a handful of years now, and have discovered numerous helpful quirks and features of the editor along the way that truly are a time saver in many scenarios.
What I'm Requesting:
One of the first things I noticed I miss sorely in Godot vs Unity is advanced Expression evaluation in the editor for properties of Nodes(GameObjects).
For direct reference to this feature within Unity, refer to: Unity Docs - Editing Value Properties under the header Numeric field expressions
In this example image from the page above, a user is in the process of inputting a Sin/Cos function into the Transform property of a selection of objects. After exiting the field with tab/enter, the editor then evaluates the user's expression and maps the selected objects accordingly.
Within Godot, similar eval functionality exists but it appears to be limited to only the very basic operators and parentheses support.
My proposal is for Godot to implement advanced expression evaluation for Editor fields to allow Godot users, advanced and beginner alike, more options and power for accurately manipulating node properties. This could go beyond simple transform/rotations, perhaps one could even spread Animation keyframes with similar behavior..
Why it's useful to everyone
I fully believe everyone could benefit from this feature, despite how small and 'hidden' it could be after implementation. Many Unity users don't even know this feature exists, and it may be the same for Godot - however, it is indeed a very powerful tool for those who are aware of its potential (IE, editor expression evaluation functionality beyond simple
5*5
), and I believe it should be praised more for its utility than it currently is in the Unity Documentation.This functionality streamlines - by a vast degree - the task of creating precise arrangements of nodes in-editor, in a mathematically sound and precise manner. Circles, ovals, and random or linear arrangements are all instantly within reach without needing to manually move each node or manage it with code.
Some examples:
Primarily, this improvement would assist in enhancing developer creativity by alleviating frustrations one may encounter while designing levels and other tools without needing to write 'one use' code or mess with external plugins and tools that are slow or unreliable, or worse, their ability for inclusion is dependent on project restrictions such as target platform.
There are no doubt many packages currently available that offer similar scattering functionality, but still these are external packages that are dependent on Godot Engine version and external maintenance.
This is my first time doing this - If this is poor form or I have left out crucial info, I apologize!
Beta Was this translation helpful? Give feedback.
All reactions