SceneView.duringSceneGui

This commit is contained in:
ousttrue 2026-06-26 11:17:39 +09:00
parent b0acd0e0c3
commit 4b8dbcf7ec
2 changed files with 32 additions and 17 deletions

View File

@ -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);
}
}
}
}
}
}

View File

@ -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)