Eversoul support WIP

Updated line renderer material for handles
Handle fixes
Fixes
This commit is contained in:
2024-04-23 12:25:12 +02:00
parent 11fd1a3d92
commit e5beb1c25a
161 changed files with 18361 additions and 408 deletions

View File

@@ -80,7 +80,7 @@ public class UIHandle : MonoBehaviour
if (Collider.transform.localScale.x != 0 && transform.lossyScale.x != 0)
{
Collider.radius = 35 /* magic number */ * (1 / transform.lossyScale.x) * GetRadiusOnScreen(camera, Collider.transform.position, Handle.transform.localScale.x);
Collider.radius = Mathf.Abs(35 /* magic number */ * (1 / transform.lossyScale.x) * GetRadiusOnScreen(camera, Collider.transform.position, Handle.transform.localScale.x));
Collider.radius = Mathf.Clamp(Collider.radius, 0.001f, 2);
}
@@ -127,7 +127,7 @@ public class UIHandle : MonoBehaviour
/// <summary> For future, `offset` param will allow popups to be spaced out when selecting more than 1 handle at a time. </summary>
public void TogglePopup(int offset = 0)
{
Popup.Offset = offset * Popup.GetComponent<RectTransform>().sizeDelta.x;
Popup.Offset = offset * (Popup.transform as RectTransform).sizeDelta.x * ModelViewerInterface.GetInstance().MainCanvas.scaleFactor;
ModelViewerInterface.ToggleVisible(Popup.gameObject);
}

View File

@@ -1,3 +1,4 @@
using UnityEditor;
using UnityEngine;
public class UIHandleMain : UIHandle
@@ -17,9 +18,26 @@ public class UIHandleMain : UIHandle
Popup.AddButton("Reset Position", TransformResetPosition);
Popup.AddButton("Reset Rotation", TransformResetRotation);
Popup.AddButton("Reset Scale", TransformResetScale);
Popup.AddButton("Reset Children", ResetBones);
Popup.AddButton("Delete", () => Destroy(Owner));
return this;
}
public void ResetBones()
{
using (var context = new KeyframeToggleContext(Owner, false))
{
foreach (var bone in Owner.GetComponentsInChildren<UIHandle>())
{
bone.TransformResetAll();
}
}
Owner.SetKeyframe();
}
protected override bool ShouldBeHidden()
{
return _forceDisplayOff || !HandleManager.Instance.EnabledHandles.Contains(SerializableBone.BoneTags.Root);
}
}