mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-09 12:29:23 -05:00
menu 名と dialog 名を整理
- menu 名を関連クラスの `public const string MENU_NAME` にした(特に validate=true で2回同名で呼ぶところ) - menu 表示名と dialog のタイトルを同じ文字列にした
This commit is contained in:
@@ -4,18 +4,12 @@ using UnityEngine;
|
||||
|
||||
namespace UniGLTF
|
||||
{
|
||||
public static class TopMenuImplementation
|
||||
public static class GltfImportMenu
|
||||
{
|
||||
public static void ExportGameObjectToGltfFile()
|
||||
{
|
||||
var window = (GltfExportWindow)GltfExportWindow.GetWindow(typeof(GltfExportWindow));
|
||||
window.titleContent = new GUIContent("Gltf Exporter");
|
||||
window.Show();
|
||||
}
|
||||
|
||||
public const string MENU_NAME = "glTF importer (*.gltf|*.glb|*.zip)";
|
||||
public static void ImportGltfFileToGameObject()
|
||||
{
|
||||
var path = EditorUtility.OpenFilePanel("open glb", "",
|
||||
var path = EditorUtility.OpenFilePanel(MENU_NAME + ": open glb", "",
|
||||
#if UNITY_EDITOR_OSX
|
||||
// https://github.com/vrm-c/UniVRM/issues/1837
|
||||
"glb"
|
||||
@@ -98,11 +92,5 @@ namespace UniGLTF
|
||||
var asset = unitypath.LoadAsset<GameObject>();
|
||||
Selection.activeObject = asset;
|
||||
}
|
||||
|
||||
public static void GenerateSerializationCode()
|
||||
{
|
||||
SerializerGenerator.GenerateSerializer();
|
||||
DeserializerGenerator.GenerateSerializer();
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/UniGLTF/Editor/GltfImportMenu.cs.meta
Normal file
11
Assets/UniGLTF/Editor/GltfImportMenu.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 31e28050bb28edd40a730d8e05ddcde5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -7,8 +7,7 @@ namespace UniGLTF.MeshUtility
|
||||
{
|
||||
public class MeshUtilityDialog : EditorWindow
|
||||
{
|
||||
const string TITLE = "Mesh Utility Window";
|
||||
|
||||
public const string MENU_NAME = "glTF MeshUtility";
|
||||
enum MeshProcessDialogTabs
|
||||
{
|
||||
MeshSeparator,
|
||||
@@ -35,7 +34,7 @@ namespace UniGLTF.MeshUtility
|
||||
{
|
||||
var window =
|
||||
(MeshUtilityDialog)EditorWindow.GetWindow(typeof(MeshUtilityDialog));
|
||||
window.titleContent = new GUIContent(TITLE);
|
||||
window.titleContent = new GUIContent(MENU_NAME);
|
||||
window.Show();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Android;
|
||||
|
||||
namespace UniGLTF
|
||||
{
|
||||
@@ -12,25 +13,31 @@ namespace UniGLTF
|
||||
private const string UserGltfMenuPrefix = UniGLTFVersion.MENU;
|
||||
private const string DevelopmentMenuPrefix = UniGLTFVersion.MENU + "/Development";
|
||||
|
||||
|
||||
[MenuItem(UserGltfMenuPrefix + "/Version: " + UniGLTFVersion.UNIGLTF_VERSION, validate = true)]
|
||||
private static bool ShowVersionValidation() => false;
|
||||
|
||||
[MenuItem(UserGltfMenuPrefix + "/Version: " + UniGLTFVersion.UNIGLTF_VERSION, priority = 0)]
|
||||
private static void ShowVersion() { }
|
||||
|
||||
[MenuItem(UserGltfMenuPrefix + "/Export to GLB", priority = 1)]
|
||||
private static void ExportGameObjectToGltf() => TopMenuImplementation.ExportGameObjectToGltfFile();
|
||||
|
||||
[MenuItem(UserGltfMenuPrefix + "/Import from GLTF (*.gltf|*.glb|*.zip)", priority = 2)]
|
||||
private static void ImportGltfFile() => TopMenuImplementation.ImportGltfFileToGameObject();
|
||||
[MenuItem(UserGltfMenuPrefix + "/" + GltfExportWindow.MENU_NAME, priority = 1)]
|
||||
private static void ExportGameObjectToGltf() => GltfExportWindow.ExportGameObjectToGltfFile();
|
||||
|
||||
[MenuItem(UserGltfMenuPrefix + "/MeshUtility Wizard", priority = 10)]
|
||||
|
||||
[MenuItem(UserGltfMenuPrefix + "/" + GltfImportMenu.MENU_NAME, priority = 2)]
|
||||
private static void ImportGltfFile() => GltfImportMenu.ImportGltfFileToGameObject();
|
||||
|
||||
|
||||
[MenuItem(UserGltfMenuPrefix + "/" + MeshUtility.MeshUtilityDialog.MENU_NAME, priority = 10)]
|
||||
private static void OpenMeshProcessingWindow() => MeshUtility.MeshUtilityDialog.OpenWindow();
|
||||
|
||||
#if VRM_DEVELOP
|
||||
[MenuItem(DevelopmentMenuPrefix + "/Generate Serialization Code", priority = 20)]
|
||||
private static void GenerateSerializationCode() => TopMenuImplementation.GenerateSerializationCode();
|
||||
|
||||
private static void GenerateSerializationCode()
|
||||
{
|
||||
SerializerGenerator.GenerateSerializer();
|
||||
DeserializerGenerator.GenerateSerializer();
|
||||
}
|
||||
|
||||
[MenuItem(DevelopmentMenuPrefix + "/Generate UniJSON ConcreteCast", priority = 21)]
|
||||
private static void GenerateUniJsonConcreteCastCode() => UniJSON.ConcreteCast.GenerateGenericCast();
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 173b43f1467d4054921297a5c2e55d05
|
||||
timeCreated: 1638961414
|
||||
@@ -9,7 +9,13 @@ namespace UniGLTF
|
||||
{
|
||||
public class GltfExportWindow : ExportDialogBase
|
||||
{
|
||||
|
||||
public const string MENU_NAME = "glTF Exporter";
|
||||
public static void ExportGameObjectToGltfFile()
|
||||
{
|
||||
var window = (GltfExportWindow)GltfExportWindow.GetWindow(typeof(GltfExportWindow));
|
||||
window.titleContent = new GUIContent(MENU_NAME);
|
||||
window.Show();
|
||||
}
|
||||
|
||||
enum Tabs
|
||||
{
|
||||
|
||||
@@ -106,5 +106,6 @@ namespace UniGLTF
|
||||
|
||||
public const string VRM_VERSION = "UniVRM-" + VERSION;
|
||||
public const string MENU = "VRM0";
|
||||
public const string MENU_NAME = "Version: " + PackageVersion.VRM_VERSION;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,10 +11,11 @@ namespace VRM
|
||||
{
|
||||
public class VRMExporterWizard : ExportDialogBase
|
||||
{
|
||||
public const string MENU_NAME = "VRM 0.x Exporter";
|
||||
public static void OpenExportMenu()
|
||||
{
|
||||
var window = (VRMExporterWizard)GetWindow(typeof(VRMExporterWizard));
|
||||
window.titleContent = new GUIContent("VRM Exporter");
|
||||
window.titleContent = new GUIContent(MENU_NAME);
|
||||
window.Show();
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace VRM
|
||||
{
|
||||
public static class VRMHumanoidNormalizerMenu
|
||||
{
|
||||
public const string MENU_NAME = "VRM 0.x Freeze T-Pose";
|
||||
public static bool NormalizeValidation()
|
||||
{
|
||||
var root = Selection.activeObject as GameObject;
|
||||
|
||||
@@ -7,9 +7,10 @@ namespace VRM
|
||||
{
|
||||
public static class VRMImporterMenu
|
||||
{
|
||||
public const string MENU_NAME = "VRM 0.x Importer";
|
||||
public static void OpenImportMenu()
|
||||
{
|
||||
var path = EditorUtility.OpenFilePanel("open vrm", "", "vrm");
|
||||
var path = EditorUtility.OpenFilePanel(MENU_NAME + ": open vrm", "", "vrm");
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace VRM
|
||||
{
|
||||
public class VrmMeshIntegratorWizard : ScriptableWizard
|
||||
{
|
||||
public const string MENU_NAME = "VRM 0.x MeshUtility";
|
||||
const string ASSET_SUFFIX = ".mesh.asset";
|
||||
|
||||
enum HelpMessage
|
||||
@@ -95,7 +96,7 @@ namespace VRM
|
||||
|
||||
public static void CreateWizard()
|
||||
{
|
||||
ScriptableWizard.DisplayWizard<VrmMeshIntegratorWizard>("MeshIntegratorWizard", "Integrate and close window", "Integrate");
|
||||
ScriptableWizard.DisplayWizard<VrmMeshIntegratorWizard>(MENU_NAME, "Integrate and close window", "Integrate");
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace VRM
|
||||
internal static class VRMSpringBoneUtilityEditor
|
||||
{
|
||||
#region save
|
||||
|
||||
public const string SAVE_MENU_NAME = "VRM 0.x Save SpringBone to JSON";
|
||||
public static bool SaveSpringBoneToJsonValidation()
|
||||
{
|
||||
var root = Selection.activeObject as GameObject;
|
||||
@@ -57,7 +57,7 @@ namespace VRM
|
||||
#endregion
|
||||
|
||||
#region load
|
||||
|
||||
public const string LOAD_MENU_NAME = "VRM 0.x Load SpringBone from JSON";
|
||||
public static bool LoadSpringBoneFromJsonValidation()
|
||||
{
|
||||
var root = Selection.activeObject as GameObject;
|
||||
|
||||
@@ -9,38 +9,40 @@ namespace VRM
|
||||
private const string UserMenuPrefix = PackageVersion.MENU;
|
||||
private const string DevelopmentMenuPrefix = PackageVersion.MENU + "/Development";
|
||||
|
||||
[MenuItem(UserMenuPrefix + "/Version: " + PackageVersion.VRM_VERSION, validate = true)]
|
||||
private static bool ShowVersionValidation() => false;
|
||||
|
||||
[MenuItem(UserMenuPrefix + "/Version: " + PackageVersion.VRM_VERSION, priority = 0)]
|
||||
[MenuItem(UserMenuPrefix + "/" + PackageVersion.MENU_NAME, validate = true)]
|
||||
private static bool ShowVersionValidation() => false;
|
||||
[MenuItem(UserMenuPrefix + "/" + PackageVersion.MENU_NAME, priority = 0)]
|
||||
private static void ShowVersion() { }
|
||||
|
||||
[MenuItem(UserMenuPrefix + "/Export to VRM 0.x", priority = 1)]
|
||||
|
||||
[MenuItem(UserMenuPrefix + "/" + VRMExporterWizard.MENU_NAME, priority = 1)]
|
||||
private static void ExportToVrmFile() => VRMExporterWizard.OpenExportMenu();
|
||||
|
||||
[MenuItem(UserMenuPrefix + "/Import from VRM 0.x", priority = 2)]
|
||||
|
||||
[MenuItem(UserMenuPrefix + "/" + VRMImporterMenu.MENU_NAME, priority = 2)]
|
||||
private static void ImportFromVrmFile() => VRMImporterMenu.OpenImportMenu();
|
||||
|
||||
[MenuItem(UserMenuPrefix + "/Freeze T-Pose", validate = true)]
|
||||
private static bool FreezeTPoseValidation() => VRMHumanoidNormalizerMenu.NormalizeValidation();
|
||||
|
||||
[MenuItem(UserMenuPrefix + "/Freeze T-Pose", priority = 20)]
|
||||
[MenuItem(UserMenuPrefix + "/" + VRMHumanoidNormalizerMenu.MENU_NAME, validate = true)]
|
||||
private static bool FreezeTPoseValidation() => VRMHumanoidNormalizerMenu.NormalizeValidation();
|
||||
[MenuItem(UserMenuPrefix + "/" + VRMHumanoidNormalizerMenu.MENU_NAME, priority = 20)]
|
||||
private static void FreezeTPose() => VRMHumanoidNormalizerMenu.Normalize();
|
||||
|
||||
[MenuItem(UserMenuPrefix + "/MeshIntegratorWizard", priority = 21)]
|
||||
|
||||
[MenuItem(UserMenuPrefix + "/" + VrmMeshIntegratorWizard.MENU_NAME, priority = 21)]
|
||||
private static void OpenMeshIntegratorWizard() => VrmMeshIntegratorWizard.CreateWizard();
|
||||
|
||||
[MenuItem(UserMenuPrefix + "/Save SpringBone to JSON", validate = true)]
|
||||
private static bool SaveSpringBoneToJsonValidation() => VRMSpringBoneUtilityEditor.SaveSpringBoneToJsonValidation();
|
||||
|
||||
[MenuItem(UserMenuPrefix + "/Save SpringBone to JSON", priority = 22)]
|
||||
[MenuItem(UserMenuPrefix + "/" + VRMSpringBoneUtilityEditor.SAVE_MENU_NAME, validate = true)]
|
||||
private static bool SaveSpringBoneToJsonValidation() => VRMSpringBoneUtilityEditor.SaveSpringBoneToJsonValidation();
|
||||
[MenuItem(UserMenuPrefix + "/" + VRMSpringBoneUtilityEditor.SAVE_MENU_NAME, priority = 22)]
|
||||
private static void SaveSpringBoneToJson() => VRMSpringBoneUtilityEditor.SaveSpringBoneToJson();
|
||||
|
||||
[MenuItem(UserMenuPrefix + "/Load SpringBone from JSON", validate = true)]
|
||||
private static bool LoadSpringBoneFromJsonValidation() => VRMSpringBoneUtilityEditor.LoadSpringBoneFromJsonValidation();
|
||||
|
||||
[MenuItem(UserMenuPrefix + "/Load SpringBone from JSON", priority = 23)]
|
||||
private static void LoadSpringBoneFromJson() => VRMSpringBoneUtilityEditor.LoadSpringBoneFromJson();
|
||||
[MenuItem(UserMenuPrefix + "/" + VRMSpringBoneUtilityEditor.LOAD_MENU_NAME, validate = true)]
|
||||
private static bool LoadSpringBoneFromJsonValidation() => VRMSpringBoneUtilityEditor.LoadSpringBoneFromJsonValidation();
|
||||
[MenuItem(UserMenuPrefix + "/" + VRMSpringBoneUtilityEditor.LOAD_MENU_NAME, priority = 23)]
|
||||
|
||||
|
||||
#if VRM_DEVELOP
|
||||
|
||||
@@ -10,12 +10,12 @@ namespace UniVRM10
|
||||
/// </summary>
|
||||
public class VRM10Window : EditorWindow
|
||||
{
|
||||
public const string WINDOW_TITLE = "VRM1.0 Model Editor";
|
||||
public const string MENU_NAME = "VRM-1.0 Window";
|
||||
|
||||
public static VRM10Window Open()
|
||||
{
|
||||
var window = (VRM10Window)GetWindow(typeof(VRM10Window));
|
||||
window.titleContent = new GUIContent(WINDOW_TITLE);
|
||||
window.titleContent = new GUIContent(MENU_NAME);
|
||||
window.Show();
|
||||
window.Root = UnityEditor.Selection.activeTransform?.GetComponent<Vrm10Instance>();
|
||||
return window;
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace UniVRM10
|
||||
public MeshIntegrationTab(EditorWindow editor, Vrm10MeshUtility meshUtility)
|
||||
{
|
||||
_meshUti = meshUtility;
|
||||
_splitter = new VerticalSplitter(editor, 50, 50);
|
||||
_splitter = new VerticalSplitter(editor, 200, 50);
|
||||
|
||||
_groupList = new ReorderableList(_meshUti.MeshIntegrationGroups, typeof(MeshIntegrationGroup));
|
||||
_groupList.drawHeaderCallback = (Rect rect) =>
|
||||
|
||||
@@ -10,7 +10,8 @@ namespace UniVRM10
|
||||
{
|
||||
public class Vrm10MeshUtilityDialog : EditorWindow
|
||||
{
|
||||
const string TITLE = "Vrm10 Mesh Utility Window";
|
||||
public const string MENU_NAME = "VRM-1.0 MeshUtility";
|
||||
|
||||
enum Tabs
|
||||
{
|
||||
Freeze,
|
||||
@@ -22,7 +23,7 @@ namespace UniVRM10
|
||||
{
|
||||
var window =
|
||||
(Vrm10MeshUtilityDialog)EditorWindow.GetWindow(typeof(Vrm10MeshUtilityDialog));
|
||||
window.titleContent = new GUIContent(TITLE);
|
||||
window.titleContent = new GUIContent(MENU_NAME);
|
||||
window.Show();
|
||||
}
|
||||
|
||||
|
||||
@@ -13,9 +13,11 @@ namespace UniVRM10
|
||||
{
|
||||
public class VRM10ExportDialog : ExportDialogBase
|
||||
{
|
||||
public const string MENU_NAME = "VRM-1.0 Exporter";
|
||||
|
||||
public static void Open()
|
||||
{
|
||||
var window = GetWindow<VRM10ExportDialog>("VRM-1.0 Exporter");
|
||||
var window = GetWindow<VRM10ExportDialog>(MENU_NAME);
|
||||
window.Show();
|
||||
}
|
||||
|
||||
@@ -279,7 +281,7 @@ namespace UniVRM10
|
||||
var exporter = new UniVRM10.Vrm10Exporter(new EditorTextureSerializer(), m_settings.MeshExportSettings);
|
||||
var option = new VrmLib.ExportArgs
|
||||
{
|
||||
sparse = m_settings.MorphTargetUseSparse,
|
||||
sparse = m_settings.MorphTargetUseSparse,
|
||||
};
|
||||
exporter.Export(root, model, converter, option, Vrm ? Vrm.Meta : m_tmpObject.Meta);
|
||||
|
||||
|
||||
@@ -193,7 +193,7 @@ namespace UniVRM10
|
||||
if (instance.Vrm != null)
|
||||
{
|
||||
EditorGUILayout.HelpBox("SpringBone gizmo etc...", MessageType.Info);
|
||||
if (GUILayout.Button("Open " + VRM10Window.WINDOW_TITLE))
|
||||
if (GUILayout.Button("Open " + VRM10Window.MENU_NAME))
|
||||
{
|
||||
VRM10Window.Open();
|
||||
}
|
||||
|
||||
@@ -9,17 +9,17 @@ namespace UniVRM10
|
||||
private const string DevelopmentMenuPrefix = VRM10SpecVersion.MENU + "/Development";
|
||||
private const string ExperimentalMenuPrefix = VRM10SpecVersion.MENU + "/Experimental";
|
||||
|
||||
[MenuItem(UserMenuPrefix + "/Export VRM-1.0", priority = 1)]
|
||||
[MenuItem(UserMenuPrefix + "/" + VRM10ExportDialog.MENU_NAME, priority = 1)]
|
||||
private static void OpenExportDialog() => VRM10ExportDialog.Open();
|
||||
|
||||
[MenuItem(UserMenuPrefix + "/MeshUtility", priority = 2)]
|
||||
[MenuItem(UserMenuPrefix + "/" + Vrm10MeshUtilityDialog.MENU_NAME, priority = 2)]
|
||||
private static void OpenMeshUtility() => Vrm10MeshUtilityDialog.OpenWindow();
|
||||
|
||||
[MenuItem(ExperimentalMenuPrefix + "/Convert BVH to VRM-Animation", priority = 100)]
|
||||
[MenuItem(ExperimentalMenuPrefix + "/" + VrmAnimationMenu.MENU_NAME, priority = 100)]
|
||||
private static void ConvertVrmAnimation() => VrmAnimationMenu.BvhToVrmAnimationMenu();
|
||||
|
||||
#if VRM_DEVELOP
|
||||
[MenuItem(UserMenuPrefix + "/VRM1 Window", false, 2)]
|
||||
[MenuItem(UserMenuPrefix + "/" + VRM10Window.MENU_NAME, false, 2)]
|
||||
private static void OpenWindow() => VRM10Window.Open();
|
||||
|
||||
[MenuItem(DevelopmentMenuPrefix + "/Generate from JsonSchema")]
|
||||
|
||||
@@ -10,6 +10,8 @@ namespace UniVRM10
|
||||
{
|
||||
internal static class VrmAnimationMenu
|
||||
{
|
||||
public const string MENU_NAME = "Convert BVH to VRM-Animation";
|
||||
|
||||
public static void BvhToVrmAnimationMenu()
|
||||
{
|
||||
var path = EditorUtility.OpenFilePanel("select bvh", null, "bvh");
|
||||
|
||||
Reference in New Issue
Block a user