From 3b470978d964048c436b74a00dc2b8b481da854e Mon Sep 17 00:00:00 2001 From: ousttrue Date: Thu, 7 Nov 2024 19:29:13 +0900 Subject: [PATCH] remove VRM10Window --- .../VRM10SpringBoneColliderEditor.cs | 10 +- Assets/VRM10/Editor/Components/VRM10Window.cs | 156 ------------------ .../Editor/Components/VRM10Window.cs.meta | 11 -- Assets/VRM10/Editor/Vrm10InstanceEditor.cs | 9 - Assets/VRM10/Editor/Vrm10TopMenu.cs | 3 - 5 files changed, 5 insertions(+), 184 deletions(-) delete mode 100644 Assets/VRM10/Editor/Components/VRM10Window.cs delete mode 100644 Assets/VRM10/Editor/Components/VRM10Window.cs.meta diff --git a/Assets/VRM10/Editor/Components/SpringBone/VRM10SpringBoneColliderEditor.cs b/Assets/VRM10/Editor/Components/SpringBone/VRM10SpringBoneColliderEditor.cs index 06bc6ded3..2ad132ac9 100644 --- a/Assets/VRM10/Editor/Components/SpringBone/VRM10SpringBoneColliderEditor.cs +++ b/Assets/VRM10/Editor/Components/SpringBone/VRM10SpringBoneColliderEditor.cs @@ -20,11 +20,11 @@ namespace UniVRM10 public override void OnInspectorGUI() { - if (VRM10Window.Active == target) - { - GUI.backgroundColor = Color.cyan; - Repaint(); - } + // if (VRM10Window.Active == target) + // { + // GUI.backgroundColor = Color.cyan; + // Repaint(); + // } var property = serializedObject.FindProperty("m_Script"); var component = (VRM10SpringBoneCollider)target; EditorGUILayout.PropertyField(property, new GUIContent("Script (" + component.GetIdentificationName() + ")")); diff --git a/Assets/VRM10/Editor/Components/VRM10Window.cs b/Assets/VRM10/Editor/Components/VRM10Window.cs deleted file mode 100644 index 9256d9fe0..000000000 --- a/Assets/VRM10/Editor/Components/VRM10Window.cs +++ /dev/null @@ -1,156 +0,0 @@ -using System; -using System.Linq; -using UnityEditor; -using UnityEngine; -using UniGLTF; - -namespace UniVRM10 -{ - /// - /// VRM10操作 Window - /// - public class VRM10Window : EditorWindow - { - public const string MENU_NAME = "VRM 1.0 Window"; - - public static VRM10Window Open() - { - var window = (VRM10Window)GetWindow(typeof(VRM10Window)); - window.titleContent = new GUIContent(MENU_NAME); - window.Show(); - window.Root = UnityEditor.Selection.activeTransform?.GetComponentOrNull(); - return window; - } - - void OnEnable() - { - // Debug.Log("OnEnable"); - Undo.willFlushUndoRecord += Repaint; - UnityEditor.Selection.selectionChanged += Repaint; - - SceneView.duringSceneGui += OnSceneGUI; - } - - void OnDisable() - { - s_treeView = null; - - SceneView.duringSceneGui -= OnSceneGUI; - // Debug.Log("OnDisable"); - UnityEditor.Selection.selectionChanged -= Repaint; - Undo.willFlushUndoRecord -= Repaint; - - Tools.hidden = false; - } - - SerializedObject m_so; - int? m_root; - Vrm10Instance Root - { - get => m_root.HasValue ? (EditorUtility.InstanceIDToObject(m_root.Value) as Vrm10Instance) : null; - set - { - int? id = value != null ? value.GetInstanceID() : default; - if (m_root == id) - { - return; - } - if (value != null && !value.gameObject.scene.IsValid()) - { - // skip prefab - return; - } - m_root = id; - m_so = value != null ? new SerializedObject(value) : null; - } - } - - /// - /// Scene 上の 3D 表示 - /// - /// * Joint/Collider の Picker - /// - /// - void OnSceneGUI(SceneView sceneView) - { - Tools.hidden = true; - Draw3D(Root, m_so); - } - - /// - /// Window 上の GUI - /// - /// * 対象 VRM の保持 - /// * 選択 Joint/Collider の表示 - /// - /// - private void OnGUI() - { - if (Root == null) - { - if (UnityEditor.Selection.activeTransform != null) - { - var root = UnityEditor.Selection.activeTransform.Ancestors().Select(x => x.GetComponentOrNull()).FirstOrDefault(x => x != null); - if (root != null) - { - Root = root; - } - } - } - - // Root - Root = (Vrm10Instance)EditorGUILayout.ObjectField("Editing Model", Root, typeof(Vrm10Instance), true); - if (Root == null) - { - return; - } - - // active - EditorGUI.BeginDisabledGroup(true); - EditorGUILayout.ObjectField("Selected Object", Active, typeof(MonoBehaviour), true); - EditorGUI.EndDisabledGroup(); - - // if (m_so == null) - // { - // m_so = new SerializedObject(Root); - // } - // if (m_so == null) - // { - // return; - // } - // m_so.Update(); - // SpringBoneEditor.Draw2D(Root, m_so); - // m_so.ApplyModifiedProperties(); - } - - SpringBoneTreeView s_treeView; - SpringBoneTreeView GetTree(Vrm10Instance target, SerializedObject so) - { - if (s_treeView == null || s_treeView.Target != target) - { - var state = new UnityEditor.IMGUI.Controls.TreeViewState(); - s_treeView = new SpringBoneTreeView(state, target, so); - s_treeView.Reload(); - } - return s_treeView; - } - - public static MonoBehaviour Active; - - /// - /// 3D の Handle 描画 - /// - public void Draw3D(Vrm10Instance target, SerializedObject so) - { - var tree = GetTree(target, so); - if (tree != null && target != null) - { - if (tree.Draw3D(target.SpringBone)) - { - Repaint(); - } - Active = tree.Active; - } - } - } -} diff --git a/Assets/VRM10/Editor/Components/VRM10Window.cs.meta b/Assets/VRM10/Editor/Components/VRM10Window.cs.meta deleted file mode 100644 index 1f7d77ff2..000000000 --- a/Assets/VRM10/Editor/Components/VRM10Window.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d10db1ad6a9273e4698465a666033569 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VRM10/Editor/Vrm10InstanceEditor.cs b/Assets/VRM10/Editor/Vrm10InstanceEditor.cs index fa2c984be..2a75a41e6 100644 --- a/Assets/VRM10/Editor/Vrm10InstanceEditor.cs +++ b/Assets/VRM10/Editor/Vrm10InstanceEditor.cs @@ -188,15 +188,6 @@ namespace UniVRM10 { SetupVRM10Object(instance); } - - if (instance.Vrm != null) - { - EditorGUILayout.HelpBox("SpringBone gizmo etc...", MessageType.Info); - if (GUILayout.Button("Open " + VRM10Window.MENU_NAME)) - { - VRM10Window.Open(); - } - } } base.OnInspectorGUI(); diff --git a/Assets/VRM10/Editor/Vrm10TopMenu.cs b/Assets/VRM10/Editor/Vrm10TopMenu.cs index 3749c5e63..e0cc2d8eb 100644 --- a/Assets/VRM10/Editor/Vrm10TopMenu.cs +++ b/Assets/VRM10/Editor/Vrm10TopMenu.cs @@ -21,9 +21,6 @@ namespace UniVRM10 private static void ConvertVrmAnimation() => VrmAnimationMenu.BvhToVrmAnimationMenu(); #if VRM_DEVELOP - [MenuItem(ExperimentalMenuPrefix + "/" + VRM10Window.MENU_NAME, false, 23)] - private static void OpenWindow() => VRM10Window.Open(); - [MenuItem(DevelopmentMenuPrefix + "/Generate from JsonSchema", false, 100)] private static void Generate() => Vrm10SerializerGenerator.Run(false);