diff --git a/Assets/VRM10/Editor/Components/SpringBone/VRM10SelectorWindow.cs b/Assets/VRM10/Editor/Components/SpringBone/VRM10SelectorWindow.cs
new file mode 100644
index 0000000000..fa1de5c9d1
--- /dev/null
+++ b/Assets/VRM10/Editor/Components/SpringBone/VRM10SelectorWindow.cs
@@ -0,0 +1,202 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using UnityEditor;
+using UnityEngine;
+
+namespace UniVRM10
+{
+ ///
+ /// ヒエラルキーから VRM10SpringBone と VRM10ColliderGroup を集めてリスト表示する
+ ///
+ public class VRM10SelectorWindow : EditorWindow
+ {
+ const string MENU_KEY = VRMVersion.MENU + "/VRM selector window";
+ const string WINDOW_TITLE = "VRM selector";
+
+ [MenuItem(MENU_KEY, false, 1)]
+ private static void ExportFromMenu()
+ {
+ var window = (VRM10SelectorWindow)GetWindow(typeof(VRM10SelectorWindow));
+ window.titleContent = new GUIContent(WINDOW_TITLE);
+ window.Show();
+ window.Root = Selection.activeTransform;
+ }
+
+ void OnEnable()
+ {
+ // Debug.Log("OnEnable");
+ Undo.willFlushUndoRecord += Repaint;
+ Selection.selectionChanged += Repaint;
+ }
+
+ void OnDisable()
+ {
+ // Debug.Log("OnDisable");
+ Selection.selectionChanged -= Repaint;
+ Undo.willFlushUndoRecord -= Repaint;
+ }
+
+ Transform m_root;
+ Transform Root
+ {
+ get => m_root;
+ set
+ {
+ if (m_root == value)
+ {
+ return;
+ }
+ if (value != null && !value.gameObject.scene.IsValid())
+ {
+ // skip prefab
+ return;
+ }
+ m_root = value;
+
+ m_springs = null;
+ m_colliderGroups = null;
+ m_boneMap = null;
+ }
+ }
+
+ static bool s_foldHumanoidBones = true;
+ static HumanBodyBones[] s_bones;
+ public Dictionary m_boneMap;
+
+ static bool s_foldSprings = true;
+ public VRM10SpringBone[] m_springs;
+
+ static bool s_foldColliders = true;
+ public VRM10SpringBoneColliderGroup[] m_colliderGroups;
+
+ void Reload()
+ {
+ var backup = Root;
+ Root = null;
+ Root = backup;
+ }
+
+ Vector2 m_scrollPosition;
+
+ private void OnGUI()
+ {
+ Root = (Transform)EditorGUILayout.ObjectField("vrm1 root", m_root, typeof(Transform), true);
+
+ if (m_springs != null && m_springs.Length > 0 && m_springs[0] == null)
+ {
+ Reload();
+ }
+
+ m_scrollPosition = EditorGUILayout.BeginScrollView(m_scrollPosition);
+
+ var isScroll = Event.current.isScrollWheel;
+ if (isScroll)
+ {
+ m_scrollPosition += Event.current.delta * EditorGUIUtility.singleLineHeight;
+ if (m_scrollPosition.y < 0)
+ {
+ m_scrollPosition = Vector2.zero;
+ }
+ }
+ DrawContent();
+ var bottom = EditorGUILayout.GetControlRect();
+ if (isScroll)
+ {
+ var maxScroll = bottom.y - (this.position.size.y - EditorGUIUtility.singleLineHeight * 2);
+ // Debug.Log($"{bottom.y}: {this.position.size.y}: {maxScroll}");
+ if (m_scrollPosition.y > maxScroll)
+ {
+ m_scrollPosition = new Vector2(0, maxScroll);
+ }
+ Repaint();
+ }
+ EditorGUILayout.EndScrollView();
+ }
+
+ void DrawContent()
+ {
+ if (m_root != null)
+ {
+ if (s_bones == null)
+ {
+ var values = Enum.GetValues(typeof(HumanBodyBones));
+ s_bones = new HumanBodyBones[values.Length - 1];
+ int j = 0;
+ foreach (HumanBodyBones bone in values)
+ {
+ if (bone != HumanBodyBones.LastBone)
+ {
+ s_bones[j++] = bone;
+ }
+ }
+ }
+ if (m_boneMap == null)
+ {
+ var animator = m_root.GetComponent();
+ if (animator != null)
+ {
+ m_boneMap = new Dictionary();
+ foreach (var bone in s_bones)
+ {
+ var t = animator.GetBoneTransform(bone);
+ if (t != null)
+ {
+ m_boneMap.Add(bone, t);
+ }
+ }
+ }
+ }
+ if (m_springs == null)
+ {
+ m_springs = m_root.GetComponentsInChildren();
+ }
+ if (m_colliderGroups == null)
+ {
+ m_colliderGroups = m_root.GetComponentsInChildren();
+ }
+ }
+
+ GUI.enabled = false;
+ s_foldHumanoidBones = EditorGUILayout.Foldout(s_foldHumanoidBones, "human bones");
+ if (s_foldHumanoidBones)
+ {
+ if (m_boneMap != null)
+ {
+ foreach (var bone in s_bones)
+ {
+ if (m_boneMap.TryGetValue(bone, out Transform t))
+ {
+
+ }
+ EditorGUILayout.ObjectField(bone.ToString(), t, typeof(Transform), true);
+ }
+ }
+ }
+
+ s_foldSprings = EditorGUILayout.Foldout(s_foldSprings, "springs");
+ if (s_foldSprings)
+ {
+ if (m_springs != null)
+ {
+ foreach (var s in m_springs)
+ {
+ EditorGUILayout.ObjectField(s, typeof(VRM10SpringBone), true);
+ }
+ }
+ }
+
+ s_foldColliders = EditorGUILayout.Foldout(s_foldColliders, "colliders");
+ if (s_foldColliders)
+ {
+ if (m_colliderGroups != null)
+ {
+ foreach (var c in m_colliderGroups)
+ {
+ EditorGUILayout.ObjectField(c, typeof(VRM10SpringBoneColliderGroup), true);
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/Assets/VRM10/Editor/Components/SpringBone/VRM10SpringSelectorWindow.cs.meta b/Assets/VRM10/Editor/Components/SpringBone/VRM10SelectorWindow.cs.meta
similarity index 83%
rename from Assets/VRM10/Editor/Components/SpringBone/VRM10SpringSelectorWindow.cs.meta
rename to Assets/VRM10/Editor/Components/SpringBone/VRM10SelectorWindow.cs.meta
index 9bbae36016..581179e2bd 100644
--- a/Assets/VRM10/Editor/Components/SpringBone/VRM10SpringSelectorWindow.cs.meta
+++ b/Assets/VRM10/Editor/Components/SpringBone/VRM10SelectorWindow.cs.meta
@@ -1,5 +1,5 @@
fileFormatVersion: 2
-guid: a38b6d598e4f6c9458cd0a819302b438
+guid: 96fdd3a9c7c5ca44b977ef564a2cf15b
MonoImporter:
externalObjects: {}
serializedVersion: 2
diff --git a/Assets/VRM10/Editor/Components/SpringBone/VRM10SpringSelectorWindow.cs b/Assets/VRM10/Editor/Components/SpringBone/VRM10SpringSelectorWindow.cs
deleted file mode 100644
index 99a2aae3a5..0000000000
--- a/Assets/VRM10/Editor/Components/SpringBone/VRM10SpringSelectorWindow.cs
+++ /dev/null
@@ -1,118 +0,0 @@
-using System;
-using UnityEditor;
-using UnityEngine;
-
-namespace UniVRM10
-{
- ///
- /// ヒエラルキーから VRM10SpringBone と VRM10ColliderGroup を集めてリスト表示する
- ///
- public class VRM10SpringSelectorWindow : EditorWindow
- {
- const string MENU_KEY = VRMVersion.MENU + "/SpringBone Window";
-
- [MenuItem(MENU_KEY, false, 1)]
- private static void ExportFromMenu()
- {
- var window = (VRM10SpringSelectorWindow)GetWindow(typeof(VRM10SpringSelectorWindow));
- window.titleContent = new GUIContent("SpringBone selector");
- window.Show();
- window.Root = Selection.activeTransform;
- }
-
- void OnEnable()
- {
- // Debug.Log("OnEnable");
- Undo.willFlushUndoRecord += Repaint;
- Selection.selectionChanged += Repaint;
- }
-
- void OnDisable()
- {
- // Debug.Log("OnDisable");
- Selection.selectionChanged -= Repaint;
- Undo.willFlushUndoRecord -= Repaint;
- }
-
- Transform m_root;
- Transform Root
- {
- get => m_root;
- set
- {
- if (m_root == value)
- {
- return;
- }
- if (value != null && !value.gameObject.scene.IsValid())
- {
- // skip prefab
- return;
- }
- m_root = value;
- if (m_root != null)
- {
- m_springs = m_root.GetComponentsInChildren();
- m_colliderGroups = m_root.GetComponentsInChildren();
- }
- }
- }
-
- static bool s_foldSprings = true;
- public VRM10SpringBone[] m_springs;
-
- static bool s_foldColliders = true;
- public VRM10SpringBoneColliderGroup[] m_colliderGroups;
-
- void Reload()
- {
- var backup = Root;
- Root = null;
- Root = backup;
- }
-
- Vector2 m_scrollPosition;
-
- private void OnGUI()
- {
- Root = (Transform)EditorGUILayout.ObjectField("vrm1 root", m_root, typeof(Transform), true);
-
- if (m_springs != null && m_springs.Length > 0 && m_springs[0] == null)
- {
- Reload();
- }
-
- m_scrollPosition = EditorGUILayout.BeginScrollView(m_scrollPosition);
- DrawContent();
- EditorGUILayout.EndScrollView();
- }
-
- void DrawContent()
- {
- GUI.enabled = false;
- s_foldSprings = EditorGUILayout.Foldout(s_foldSprings, "springs");
- if (s_foldSprings)
- {
- if (m_springs != null)
- {
- foreach (var s in m_springs)
- {
- EditorGUILayout.ObjectField(s, typeof(VRM10SpringBone), true);
- }
- }
- }
-
- s_foldColliders = EditorGUILayout.Foldout(s_foldColliders, "colliders");
- if (s_foldColliders)
- {
- if (m_colliderGroups != null)
- {
- foreach (var c in m_colliderGroups)
- {
- EditorGUILayout.ObjectField(c, typeof(VRM10SpringBoneColliderGroup), true);
- }
- }
- }
- }
- }
-}