-
Notifications
You must be signed in to change notification settings - Fork 66
Scene hierarchy tree view example #7
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
base: master
Are you sure you want to change the base?
Scene hierarchy tree view example #7
Conversation
added.RegisterWatch(go, UpdateName); | ||
UpdateChildren(added, go.transform); | ||
added.RegisterWatch(go.transform, UpdateChildren); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, we need a lambda here because the delegate does not send the VE with it.
We should change all VisualElement delegates to send the 'this' as context.
{ | ||
if (data == null) | ||
return; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be multiple labels if we change the template.
void OnToggle(VisualContainer treeViewItem) | ||
{ | ||
GameObject go = treeViewItem.data as GameObject; | ||
Debug.Assert(go != null, "No GO attached to item!"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's see how in the next PR we can have a ViewData service to store and retrieve that.
// Off the cuff?
var v = ViewDataStore.GetOrCreateDefault(key);
var v = ViewDataStore.Store(key, 5);
} | ||
Toggle toggle = treeViewItem.Q<Toggle>(); | ||
toggle.enabled = gos.Count > 0; | ||
toggle.on = toggle.enabled && m_ExpandedGOs.Contains(transform.gameObject.GetInstanceID()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
toggle state known duplicate code
Simple example of custom tree view for the scene hierarchy.
It uses UXML draft implementation in conjunction with UQuery.
Also benefits from some adjustments of DataWatch which is now available in all contexts.