From 569e0ca147b9341b81ee3b57cfbd59ddc393b1b5 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Thu, 9 Dec 2021 16:34:44 +0900 Subject: [PATCH] add VRMShaders.Symbols --- .../VrmScriptedImporterEditorGUI.cs | 9 +++++---- Assets/VRM10/Runtime/IO/Vrm10Data.cs | 11 +++++++---- .../VRMShaders/GLTF/IO/Runtime/Util/Symbols.cs | 18 ++++++++++++++++++ .../GLTF/IO/Runtime/Util/Symbols.cs.meta | 11 +++++++++++ 4 files changed, 41 insertions(+), 8 deletions(-) create mode 100644 Assets/VRMShaders/GLTF/IO/Runtime/Util/Symbols.cs create mode 100644 Assets/VRMShaders/GLTF/IO/Runtime/Util/Symbols.cs.meta diff --git a/Assets/VRM10/Editor/ScriptedImporter/VrmScriptedImporterEditorGUI.cs b/Assets/VRM10/Editor/ScriptedImporter/VrmScriptedImporterEditorGUI.cs index 07e0cff36..97df735f5 100644 --- a/Assets/VRM10/Editor/ScriptedImporter/VrmScriptedImporterEditorGUI.cs +++ b/Assets/VRM10/Editor/ScriptedImporter/VrmScriptedImporterEditorGUI.cs @@ -117,12 +117,13 @@ namespace UniVRM10 case Vrm10FileType.Vrm0: EditorGUILayout.HelpBox(m_result.Message, m_model != null ? MessageType.Info : MessageType.Warning); -#if VRM_DEVELOP - if (GUILayout.Button("debug export")) + if (VRMShaders.Symbols.VRM_DEVELOP) { - File.WriteAllBytes("tmp.vrm", m_result.MigratedBytes); + if (GUILayout.Button("debug export")) + { + File.WriteAllBytes("tmp.vrm", m_result.MigratedBytes); + } } -#endif // migration check boxs base.OnInspectorGUI(); diff --git a/Assets/VRM10/Runtime/IO/Vrm10Data.cs b/Assets/VRM10/Runtime/IO/Vrm10Data.cs index 9dc63571f..b5fffaec1 100644 --- a/Assets/VRM10/Runtime/IO/Vrm10Data.cs +++ b/Assets/VRM10/Runtime/IO/Vrm10Data.cs @@ -120,10 +120,13 @@ namespace UniVRM10 throw new NullReferenceException("oldMeta"); } result = new Vrm10Data(migratedData, vrm, Vrm10FileType.Vrm0, "vrm0: migrated", oldMeta); -#if VRM_DEVELOP - // 右手左手座標変換でバッファが破壊的変更されるので、コピーを作っている - result.MigratedBytes = migrated.Select(x => x).ToArray(); -#endif + + if (VRMShaders.Symbols.VRM_DEVELOP) + { + // 右手左手座標変換でバッファが破壊的変更されるので、コピーを作っている + result.MigratedBytes = migrated.Select(x => x).ToArray(); + } + return true; } diff --git a/Assets/VRMShaders/GLTF/IO/Runtime/Util/Symbols.cs b/Assets/VRMShaders/GLTF/IO/Runtime/Util/Symbols.cs new file mode 100644 index 000000000..7035e055e --- /dev/null +++ b/Assets/VRMShaders/GLTF/IO/Runtime/Util/Symbols.cs @@ -0,0 +1,18 @@ +namespace VRMShaders +{ + public static class Symbols + { + /// + /// #if 文を局所化する。 + /// VRMShaders が最下層になるため、ここに配置している + /// + /// + public const bool VRM_DEVELOP = +#if VRM_DEVELOP +true +#else +false +#endif + ; + } +} diff --git a/Assets/VRMShaders/GLTF/IO/Runtime/Util/Symbols.cs.meta b/Assets/VRMShaders/GLTF/IO/Runtime/Util/Symbols.cs.meta new file mode 100644 index 000000000..d60f2fbd2 --- /dev/null +++ b/Assets/VRMShaders/GLTF/IO/Runtime/Util/Symbols.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ffb4175afef01ea48ad7669a8b12d93f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: