Refresh for child count or name changes in TransformTree

This commit is contained in:
Sinai 2021-05-08 06:18:28 +10:00
parent 3d94b51d40
commit 57aace26d3
2 changed files with 16 additions and 4 deletions

View File

@ -14,6 +14,8 @@ namespace UnityExplorer.UI.Widgets
public CachedTransform Parent { get; internal set; }
public int Depth { get; internal set; }
public int ChildCount { get; internal set; }
public string Name { get; internal set; }
public bool Expanded => Tree.IsCellExpanded(InstanceID);
@ -26,10 +28,19 @@ namespace UnityExplorer.UI.Widgets
Update(transform, depth);
}
public void Update(Transform transform, int depth)
public bool Update(Transform transform, int depth)
{
Value = transform;
Depth = depth;
bool ret = false;
if (Value != transform || depth != Depth || ChildCount != transform.childCount || Name != transform.name)
{
Value = transform;
Depth = depth;
ChildCount = transform.childCount;
Name = transform.name;
ret = true;
}
return ret;
}
}
}

View File

@ -139,7 +139,8 @@ namespace UnityExplorer.UI.Widgets
if (displayedObjects.Contains(instanceID))
{
cached = (CachedTransform)displayedObjects[(object)instanceID];
cached.Update(transform, depth);
if (cached.Update(transform, depth))
needRefresh = true;
}
else
{