mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-08-06 17:54:14 -05:00
SceneView.duringSceneGui
This commit is contained in:
parent
b0acd0e0c3
commit
4b8dbcf7ec
|
|
@ -12,7 +12,6 @@ namespace UniVRM10
|
|||
ObjectField m_target;
|
||||
SerializedObject serializedObject;
|
||||
ListView m_springs;
|
||||
public int SelectedIndex => m_springs.selectedIndex;
|
||||
Vrm10Instance Vrm
|
||||
{
|
||||
get
|
||||
|
|
@ -93,5 +92,37 @@ namespace UniVRM10
|
|||
selected.style.marginLeft = 12;
|
||||
splitView.Add(selected);
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
SceneView.duringSceneGui += OnSceneGUI;
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
SceneView.duringSceneGui -= OnSceneGUI;
|
||||
}
|
||||
|
||||
void OnSceneGUI(SceneView sceneView)
|
||||
{
|
||||
HandleUtility.Repaint();
|
||||
|
||||
// 選択中の SpringBone
|
||||
if (m_springs != null && m_springs.selectedIndex >= 0
|
||||
&& m_springs.selectedIndex < Vrm.SpringBone.Springs.Count)
|
||||
{
|
||||
Handles.color = Color.red;
|
||||
var selected = Vrm.SpringBone.Springs[m_springs.selectedIndex];
|
||||
for (int i = 1; i < selected.Joints.Count; ++i)
|
||||
{
|
||||
var head = selected.Joints[i - 1];
|
||||
var tail = selected.Joints[i];
|
||||
if (head != null && tail != null)
|
||||
{
|
||||
Handles.DrawLine(head.transform.position, tail.transform.position);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -463,22 +463,6 @@ namespace UniVRM10
|
|||
|
||||
// 親指のガイド
|
||||
DrawThumbGuide(target as Vrm10Instance);
|
||||
|
||||
// 選択中の SpringBone
|
||||
if (m_springBone != null && m_springBone.SelectedIndex >= 0 && m_springBone.SelectedIndex < m_instance.SpringBone.Springs.Count)
|
||||
{
|
||||
Handles.color = Color.red;
|
||||
var selected = m_instance.SpringBone.Springs[m_springBone.SelectedIndex];
|
||||
for (int i = 1; i < selected.Joints.Count; ++i)
|
||||
{
|
||||
var head = selected.Joints[i - 1];
|
||||
var tail = selected.Joints[i];
|
||||
if (head != null && tail != null)
|
||||
{
|
||||
Handles.DrawLine(head.transform.position, tail.transform.position);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void DrawThumbGuide(Vrm10Instance instance)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user