Expressions: add $parent binding paths - #804
Open
pgilfernandez wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As requested here, this PR adds a symbolic
$parentpath prefix to Friction expression bindings.Expressions can now access properties from an object's transform parent without referencing that object by name.
Usage
Access the direct parent's translation:
Access a grandparent by chaining
$parent:Any number of parent levels can be requested:
$parentmust appear at the beginning of a property path.Parent resolution
$parentfollows Friction's actual transform-parent relationship, rather than only the visual containment hierarchy.This means it supports:
$parent.$parent.If the requested parent does not exist, the binding is marked as invalid.
Dynamic rebinding
Bindings beginning with
$parentremain symbolic instead of being converted into object-name paths.When an object's transform parent changes, Friction emits a logical path update and resolves the binding again. Expressions therefore follow the new parent automatically without needing to be reopened or edited.
Dependency handling
Existing expression dependency and cycle validation remains active.
A binding through
$parentis treated like any other property binding, so circular expression dependencies are rejected.Editor integration
The expression editor now provides:
$parentsyntax highlighting.$parentautocomplete.$parent.For example:
Serialization
No EV or XEV format changes are required.
$parentpaths are stored inside the existing expression binding string and resolved when the expression is loaded.Validation
Test builds: