Pose mode improvements

This commit is contained in:
Katboi01
2023-12-18 17:20:34 +01:00
parent f928a802d7
commit 9405816231
31 changed files with 8225 additions and 387 deletions
+29 -3
View File
@@ -1,21 +1,47 @@
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using static SerializableBone;
public class UIHandleBone : UIHandle
{
public Transform Bone => Target as Transform;
public Transform Bone => Target;
public List<BoneTags> Tags;
public static UIHandleBone CreateAsChild(Transform owner, List<BoneTags> boneTags)
{
return CreateAsChild(owner.gameObject, boneTags);
}
public static UIHandleBone CreateAsChild(GameObject owner, List<BoneTags> boneTags)
{
var handle = new GameObject(owner.name + "_Handle").AddComponent<UIHandleBone>();
handle.transform.parent = owner.transform;
handle.transform.localPosition = Vector3.zero;
handle.transform.localScale = Vector3.one;
handle.Init(owner, boneTags).SetScale(0.8f);
return handle;
}
public UIHandleBone Init(GameObject owner, List<BoneTags> boneTags)
{
Target = owner.transform;
Tags = boneTags;
Init(owner);
base.Init(owner);
if (Tags.Contains(BoneTags.Left)) SetColor(Color.green);
if (Tags.Contains(BoneTags.Right)) SetColor(Color.blue);
SetScale(2f);
Popup.AddButton("Reset All", TransformResetAll);
Popup.AddButton("Reset Position", TransformResetPosition);
Popup.AddButton("Reset Rotation", TransformResetRotation);
Popup.AddButton("Reset Scale", TransformResetScale);
return this;
}
protected override bool ShouldBeHidden()
{
return _forceDisplayOff || !UmaViewerUI.Instance.HandleManager.EnabledHandles.Intersect(Tags).Any();
}
}