mirror of
https://github.com/originalnicodr/CinematicUnityExplorer.git
synced 2025-07-18 17:38:01 +08:00
Added a label next to the expand/collapse button and increased the minimum height of the bones panel.
This commit is contained in:
@ -18,7 +18,10 @@ namespace UnityExplorer.UI.Panels
|
|||||||
public AxisComponentControl CurrentSlidingAxisControl { get; set; }
|
public AxisComponentControl CurrentSlidingAxisControl { get; set; }
|
||||||
public BonesManager Owner;
|
public BonesManager Owner;
|
||||||
private ButtonRef inspectButton;
|
private ButtonRef inspectButton;
|
||||||
private ButtonRef expandBones;
|
|
||||||
|
private GameObject expandBonesRow;
|
||||||
|
private ButtonRef expandBonesButton;
|
||||||
|
private Text expandBonesText;
|
||||||
private LayoutElement spaceLayout;
|
private LayoutElement spaceLayout;
|
||||||
static private int TREE_LEVEL_IDENTATION = 20;
|
static private int TREE_LEVEL_IDENTATION = 20;
|
||||||
|
|
||||||
@ -38,10 +41,12 @@ namespace UnityExplorer.UI.Panels
|
|||||||
Owner = bonesManager;
|
Owner = bonesManager;
|
||||||
|
|
||||||
if (boneTree.childTrees.Count == 0){
|
if (boneTree.childTrees.Count == 0){
|
||||||
expandBones.Component.gameObject.SetActive(false);
|
expandBonesRow.SetActive(false);
|
||||||
} else {
|
} else {
|
||||||
expandBones.Component.gameObject.SetActive(true);
|
expandBonesRow.SetActive(true);
|
||||||
expandBones.ButtonText.text = IsTreeExpanded() ? "▼" : "▶";
|
bool isTreeExpanded = IsTreeExpanded();
|
||||||
|
expandBonesButton.ButtonText.text = isTreeExpanded ? "▼" : "▶";
|
||||||
|
expandBonesText.text = isTreeExpanded ? "Collapse bones" : "Expand bones";
|
||||||
}
|
}
|
||||||
|
|
||||||
spaceLayout.minWidth = TREE_LEVEL_IDENTATION * boneTree.level;
|
spaceLayout.minWidth = TREE_LEVEL_IDENTATION * boneTree.level;
|
||||||
@ -52,7 +57,8 @@ namespace UnityExplorer.UI.Panels
|
|||||||
// Collapse
|
// Collapse
|
||||||
List<BoneTree> treesToRemove = boneTree.childTrees.Select(t => t.flatten()).SelectMany(l => l).ToList();
|
List<BoneTree> treesToRemove = boneTree.childTrees.Select(t => t.flatten()).SelectMany(l => l).ToList();
|
||||||
Owner.boneTrees = Owner.boneTrees.Except(treesToRemove).ToList();
|
Owner.boneTrees = Owner.boneTrees.Except(treesToRemove).ToList();
|
||||||
expandBones.ButtonText.text = "▶";
|
expandBonesButton.ButtonText.text = "▶";
|
||||||
|
expandBonesText.text = "Expand bones";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Expand
|
// Expand
|
||||||
@ -60,7 +66,8 @@ namespace UnityExplorer.UI.Panels
|
|||||||
if (index == -1) return;
|
if (index == -1) return;
|
||||||
|
|
||||||
Owner.boneTrees.InsertRange(index + 1, boneTree.childTrees);
|
Owner.boneTrees.InsertRange(index + 1, boneTree.childTrees);
|
||||||
expandBones.ButtonText.text = "▼";
|
expandBonesButton.ButtonText.text = "▼";
|
||||||
|
expandBonesText.text = "Collapse bones";
|
||||||
}
|
}
|
||||||
|
|
||||||
Owner.boneScrollPool.Refresh(true, false);
|
Owner.boneScrollPool.Refresh(true, false);
|
||||||
@ -114,9 +121,16 @@ namespace UnityExplorer.UI.Panels
|
|||||||
rotationControl = ComponentControl.Create(this, baseCell, "Rotation", TransformType.Rotation, 10f);
|
rotationControl = ComponentControl.Create(this, baseCell, "Rotation", TransformType.Rotation, 10f);
|
||||||
scaleControl = ComponentControl.Create(this, baseCell, "Scale", TransformType.Scale, 0.1f);
|
scaleControl = ComponentControl.Create(this, baseCell, "Scale", TransformType.Scale, 0.1f);
|
||||||
|
|
||||||
expandBones = UIFactory.CreateButton(baseCell, "ExpandBones", IsTreeExpanded() ? "⯆" : "▶", new Color(0.05f, 0.05f, 0.05f));
|
expandBonesRow = UIFactory.CreateUIObject("ExpandBonesRow", baseCell);
|
||||||
UIFactory.SetLayoutElement(expandBones.Component.gameObject, minHeight: 25, minWidth: 25);
|
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(expandBonesRow, false, false, true, true, 4, childAlignment: TextAnchor.MiddleLeft);
|
||||||
expandBones.OnClick += ExpandOrCollapseBoneTree;
|
UIFactory.SetLayoutElement(expandBonesRow, minHeight: 25, flexibleWidth: 9999, flexibleHeight: 800);
|
||||||
|
|
||||||
|
expandBonesButton = UIFactory.CreateButton(expandBonesRow, "ExpandBonesButton", IsTreeExpanded() ? "⯆" : "▶", new Color(0.05f, 0.05f, 0.05f));
|
||||||
|
UIFactory.SetLayoutElement(expandBonesButton.Component.gameObject, minHeight: 25, minWidth: 25);
|
||||||
|
expandBonesButton.OnClick += ExpandOrCollapseBoneTree;
|
||||||
|
|
||||||
|
expandBonesText = UIFactory.CreateLabel(expandBonesRow, $"ExpandBonesText", IsTreeExpanded() ? "Collapse bones" : "Expand bones");
|
||||||
|
UIFactory.SetLayoutElement(expandBonesText.gameObject, minWidth: 100, minHeight: 25);
|
||||||
|
|
||||||
return UIRoot;
|
return UIRoot;
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ namespace UnityExplorer.UI.Panels
|
|||||||
{
|
{
|
||||||
public override string Name => $"Bones Manager";
|
public override string Name => $"Bones Manager";
|
||||||
public override int MinWidth => 1000;
|
public override int MinWidth => 1000;
|
||||||
public override int MinHeight => 400;
|
public override int MinHeight => 800;
|
||||||
public override Vector2 DefaultAnchorMin => Vector2.zero;
|
public override Vector2 DefaultAnchorMin => Vector2.zero;
|
||||||
public override Vector2 DefaultAnchorMax => Vector2.zero;
|
public override Vector2 DefaultAnchorMax => Vector2.zero;
|
||||||
public Toggle turnOffAnimatorToggle;
|
public Toggle turnOffAnimatorToggle;
|
||||||
|
Reference in New Issue
Block a user