mirror of
https://github.com/GrahamKracker/UnityExplorer.git
synced 2025-07-10 05:53:55 +08:00
Use HashSet and List instead of Dictionary for TransformTree caching, fix logic
This commit is contained in:
@ -8,27 +8,31 @@ namespace UnityExplorer.UI.Widgets
|
||||
{
|
||||
public class CachedTransform
|
||||
{
|
||||
public Transform RefTransform { get; }
|
||||
public TransformTree Tree { get; }
|
||||
public Transform Value { get; private set; }
|
||||
public int InstanceID { get; private set; }
|
||||
public CachedTransform Parent { get; internal set; }
|
||||
|
||||
public string Name { get; internal set; }
|
||||
public int ChildCount { get; internal set; }
|
||||
//public string Name { get; internal set; }
|
||||
//public int ChildCount { get; internal set; }
|
||||
public int Depth { get; internal set; }
|
||||
|
||||
public bool Expanded { get; set; }
|
||||
public bool Expanded => Tree.IsCellExpanded(InstanceID);
|
||||
|
||||
public CachedTransform(Transform transform, CachedTransform parent = null)
|
||||
public CachedTransform(TransformTree tree, Transform transform, CachedTransform parent = null)
|
||||
{
|
||||
RefTransform = transform;
|
||||
Expanded = false;
|
||||
Tree = tree;
|
||||
Value = transform;
|
||||
Parent = parent;
|
||||
Update();
|
||||
Update(transform);
|
||||
}
|
||||
|
||||
public void Update()
|
||||
public void Update(Transform transform)
|
||||
{
|
||||
Name = RefTransform.name;
|
||||
ChildCount = RefTransform.childCount;
|
||||
Value = transform;
|
||||
InstanceID = transform.GetInstanceID();
|
||||
//Name = Value.name;
|
||||
//ChildCount = Value.childCount;
|
||||
Depth = Parent?.Depth + 1 ?? 0;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user