Evaluating ExpressionNodes #4481
arcadiogarcia
started this conversation in
Ideas
Replies: 1 comment
-
FYI @Sergio0694 @JustinXinLiu who are more familiar with this space. |
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
-
I use ExpressionNodes heavily to create composition animations, and in many cases I find myself wishing I was able to evaluate the current value of an expression node. This would be useful in the following situations:
My proposal:
ExpressionNodes should have an Evaluate method that returns the current value of that expression (using the appropriate data type for each class: boolean for BooleanNode, Quaternion for QuaternionNode, etc...). The value would be calculated by recursively iterating through the nodes and evaluating them, computing the operation indicated by NodeType, all the way down to the constant values and reference properties. This wouldn't create any significant overhead for people that don't need this feature, while allowing users to evaluate any expression node at any point in time (before, during, and after it has been used to animate a property).
E.g. this is what a partial implementation for QuaternionNode would look like:
I have an incomplete implementation locally and have been using it successfully to do things like using the value of ongoing expression animations to trigger actions, and automatically create animations that interpolate between two existing expression animations.
I'd be happy to send a PR request with the full implementation, but before I start writing a comprehensive implementation (there's a lot of ExpressionNodeType/valuetype combinations!) I wanted to check if this is something other people would be interested in / opposed to / have thoughts about.
Beta Was this translation helpful? Give feedback.
All reactions