Merge pull request #672 from ousttrue/feature/rename_menu

Feature/rename menu
This commit is contained in:
ousttrue
2021-01-14 19:55:43 +09:00
committed by GitHub
19 changed files with 91 additions and 92 deletions

View File

@@ -7,10 +7,10 @@ namespace UniGLTF
{
public static class ImporterMenu
{
[MenuItem(UniGLTFVersion.MENU + "/Import", priority = 1)]
[MenuItem(UniGLTFVersion.MENU + "/Import(gltf, glb)", priority = 1)]
public static void ImportMenu()
{
var path = EditorUtility.OpenFilePanel("open gltf", "", "gltf,glb,zip");
var path = EditorUtility.OpenFilePanel("open gltf", "", "gltf,glb");
if (string.IsNullOrEmpty(path))
{
return;

View File

@@ -8,7 +8,7 @@ namespace MeshUtility
{
public class MeshUtility
{
public const string MENU_PARENT = "Mesh Utility/";
public const string MENU_PARENT = "UniGLTF/Mesh Utility/";
public const int MENU_PRIORITY = 11;
private const string ASSET_SUFFIX = ".mesh.asset";
@@ -55,7 +55,7 @@ namespace MeshUtility
}
}
[MenuItem("Mesh Utility/MeshUtility Docs", priority = MeshUtility.MENU_PRIORITY)]
[MenuItem(MENU_PARENT + "MeshSeparator Docs", priority = MeshUtility.MENU_PRIORITY)]
public static void LinkToMeshSeparatorDocs()
{
Application.OpenURL("https://github.com/vrm-c/UniVRM/blob/master/Assets/UniGLTF/MeshUtility/README.md");
@@ -282,5 +282,70 @@ namespace MeshUtility
Debug.LogFormat("CreateAsset: {0}", assetPath);
AssetDatabase.CreateAsset(newMesh, assetPath);
}
#if UNITY_EDITOR
[MenuItem(MENU_PARENT + "Integrate Static Mesh", validate = true)]
public static bool CanIntegrateSelected()
{
return Selection.activeObject != null && Selection.activeObject is GameObject;
}
[MenuItem(MENU_PARENT + "Integrate Static Mesh", priority = 3)]
public static void IntegrateSelected()
{
var go = Selection.activeObject as GameObject;
var meshWithMaterials = StaticMeshIntegrator.Integrate(go.transform);
// save as asset
var assetPath = "";
#if UNITY_2018_2_OR_NEWER
var prefab = PrefabUtility.GetCorrespondingObjectFromSource(go);
#else
var prefab = PrefabUtility.GetPrefabParent(go);
#endif
if (prefab != null)
{
var prefabPath = AssetDatabase.GetAssetPath(prefab);
assetPath = string.Format("{0}/{1}_{2}{3}",
Path.GetDirectoryName(prefabPath),
Path.GetFileNameWithoutExtension(prefabPath),
go.name,
ASSET_SUFFIX
);
}
else
{
var path = EditorUtility.SaveFilePanel(
"Save mesh",
"Assets",
go.name + ".asset",
"asset");
if (string.IsNullOrEmpty(path))
{
return;
}
assetPath = UnityPath.FromFullpath(path).Value;
}
assetPath = AssetDatabase.GenerateUniqueAssetPath(assetPath);
Debug.LogFormat("CreateAsset: {0}", assetPath);
AssetDatabase.CreateAsset(meshWithMaterials.Mesh, assetPath);
// add component
var meshObject = new GameObject(go.name + ".integrated");
if (go.transform.parent != null)
{
meshObject.transform.SetParent(go.transform.parent, false);
}
meshObject.transform.localPosition = go.transform.localPosition;
meshObject.transform.localRotation = go.transform.localRotation;
meshObject.transform.localScale = go.transform.localScale;
var filter = meshObject.AddComponent<MeshFilter>();
filter.sharedMesh = meshWithMaterials.Mesh;
var renderer = meshObject.AddComponent<MeshRenderer>();
renderer.sharedMaterials = meshWithMaterials.Materials;
}
#endif
}
}

View File

@@ -7,7 +7,7 @@ using UnityEditor;
#endif
namespace UniGLTF
namespace MeshUtility
{
public static class StaticMeshIntegrator
{
@@ -118,69 +118,5 @@ namespace UniGLTF
};
}
#if UNITY_EDITOR
[MenuItem("Mesh Utility/Integrate Static Mesh", validate = true)]
public static bool CanIntegrateSelected()
{
return Selection.activeObject != null && Selection.activeObject is GameObject;
}
[MenuItem("Mesh Utility/Integrate Static Mesh", priority = 3)]
public static void IntegrateSelected()
{
var go = Selection.activeObject as GameObject;
var meshWithMaterials = Integrate(go.transform);
// save as asset
var assetPath = "";
#if UNITY_2018_2_OR_NEWER
var prefab = PrefabUtility.GetCorrespondingObjectFromSource(go);
#else
var prefab = PrefabUtility.GetPrefabParent(go);
#endif
if (prefab != null)
{
var prefabPath = AssetDatabase.GetAssetPath(prefab);
assetPath = string.Format("{0}/{1}_{2}{3}",
Path.GetDirectoryName(prefabPath),
Path.GetFileNameWithoutExtension(prefabPath),
go.name,
ASSET_SUFFIX
);
}
else
{
var path = EditorUtility.SaveFilePanel(
"Save mesh",
"Assets",
go.name+".asset",
"asset");
if (string.IsNullOrEmpty(path))
{
return;
}
assetPath = UnityPath.FromFullpath(path).Value;
}
assetPath = AssetDatabase.GenerateUniqueAssetPath(assetPath);
Debug.LogFormat("CreateAsset: {0}", assetPath);
AssetDatabase.CreateAsset(meshWithMaterials.Mesh, assetPath);
// add component
var meshObject = new GameObject(go.name + ".integrated");
if (go.transform.parent != null)
{
meshObject.transform.SetParent(go.transform.parent, false);
}
meshObject.transform.localPosition = go.transform.localPosition;
meshObject.transform.localRotation = go.transform.localRotation;
meshObject.transform.localScale = go.transform.localScale;
var filter = meshObject.AddComponent<MeshFilter>();
filter.sharedMesh = meshWithMaterials.Mesh;
var renderer = meshObject.AddComponent<MeshRenderer>();
renderer.sharedMaterials = meshWithMaterials.Materials;
}
#endif
}
}

View File

@@ -3,6 +3,6 @@
public static partial class UniGLTFVersion
{
public const string UNIGLTF_VERSION = "UniGLTF-" + VERSION;
public const string MENU = "VRM/" + UNIGLTF_VERSION;
public const string MENU = "UniGLTF";
}
}
}

View File

@@ -43,7 +43,7 @@ namespace UniJSON
typeof(double),
};
[MenuItem("VRM/UniJSON/Generate ConcreteCast")]
[MenuItem("UniGLTF/UniJSON/Generate ConcreteCast")]
public static void GenerateGenericCast()
{
var s = new StringBuilder();

View File

@@ -15,7 +15,7 @@ namespace UniJSON
#if UNITY_EDITOR && VRM_DEVELOP
const int NET35MAX = 4;
const int ARGS = 6;
const string GENERATE_PATH = "/VRM/UniJSON/Scripts/GenericCallUtility/GenericExpressionCallFactory.g.cs";
const string GENERATE_PATH = "UniGLTF/UniJSON/Scripts/GenericCallUtility/GenericExpressionCallFactory.g.cs";
static System.Collections.Generic.IEnumerable<string> GetArgs(string prefix, int n)
{
@@ -25,7 +25,7 @@ namespace UniJSON
}
}
[MenuItem("VRM/UniJSON/Generate GenericExpressionCallFactory")]
[MenuItem("UniGLTF/UniJSON/Generate GenericExpressionCallFactory")]
static void Generate()
{
var sb = new StringBuilder();

View File

@@ -24,7 +24,7 @@ namespace UniJSON
#if UNITY_EDITOR && VRM_DEVELOP
const int NET35MAX = 4;
const int ARGS = 6;
const string GENERATE_PATH = "/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.g.cs";
const string GENERATE_PATH = "/UniGLTF/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.g.cs";
static System.Collections.Generic.IEnumerable<string> GetArgs(string prefix, int n)
{
@@ -34,7 +34,7 @@ namespace UniJSON
}
}
[MenuItem("VRM/UniJSON/Generate GenericInvokeCallFactory")]
[MenuItem("UniGLTF/UniJSON/Generate GenericInvokeCallFactory")]
static void Generate()
{
var sb = new StringBuilder();

View File

@@ -11,6 +11,6 @@
"name": "VRM Consortium"
},
"dependencies": {
"com.vrmc.vrmshaders": "0.63.2"
"com.vrmc.vrmshaders": "0.64.0"
}
}

View File

@@ -10,7 +10,7 @@ namespace VRM
{
public class VRMExporterWizard : EditorWindow
{
const string CONVERT_HUMANOID_KEY = VRMVersion.MENU + "/Export humanoid";
const string CONVERT_HUMANOID_KEY = VRMVersion.MENU + "/Export " + VRMVersion.VRM_VERSION;
[MenuItem(CONVERT_HUMANOID_KEY, false, 1)]
private static void ExportFromMenu()

View File

@@ -16,7 +16,7 @@ namespace VRM
[DisallowMultipleComponent]
public static class MeshIntegratorEditor
{
const string MENU_KEY = "Mesh Utility/MeshIntegrator";
const string MENU_KEY = VRMVersion.MENU + "/MeshIntegrator";
const string ASSET_SUFFIX = ".mesh.asset";
[MenuItem(MENU_KEY, true)]

View File

@@ -4,8 +4,8 @@ namespace VRM
public static partial class VRMVersion
{
public const int MAJOR = 0;
public const int MINOR = 63;
public const int PATCH = 2;
public const string VERSION = "0.63.2";
public const int MINOR = 64;
public const int PATCH = 0;
public const string VERSION = "0.64.0";
}
}

View File

@@ -100,6 +100,6 @@ namespace VRM
}
public const string VRM_VERSION = "UniVRM-" + VERSION;
public const string MENU = "VRM/" + VRM_VERSION;
public const string MENU = "VRM0";
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "com.vrmc.univrm",
"version": "0.63.2",
"version": "0.64.0",
"displayName": "VRM",
"description": "VRM importer",
"unity": "2018.4",
@@ -14,7 +14,7 @@
"name": "VRM Consortium"
},
"dependencies": {
"com.vrmc.vrmshaders": "0.63.2",
"com.vrmc.vrmshaders": "0.64.0",
"com.vrmc.unigltf": "2.0.0"
}
}

View File

@@ -10,7 +10,7 @@ namespace UniVRM10
{
public class VRMSpringBoneWindow : EditorWindow
{
[MenuItem("VRM/UniVRM-" + UniVRM10.VRMVersion.VERSION + "/VRMSpringBoneWindow")]
[MenuItem(VRMVersion.MENU + "/VRMSpringBoneWindow")]
public static void ShowEditorWindow()
{
var wnd = GetWindow<VRMSpringBoneWindow>();

View File

@@ -19,7 +19,7 @@ namespace UniVRM10
/// </summary>
public static class Menu
{
[MenuItem("VRM/UniVRM-" + UniVRM10.VRMVersion.VERSION + "/Generate from JsonSchema")]
[MenuItem(UniVRM10.VRMVersion.MENU + "/Generate from JsonSchema")]
public static void Main()
{
var root = new DirectoryInfo(Path.GetFullPath(Path.Combine(Application.dataPath, "../../")));

View File

@@ -102,8 +102,6 @@ namespace UniVRM10
public string Pre;
}
public const string VRM_VERSION = "UniVRM-" + VERSION;
public const string MENU = "VRM/" + VRM_VERSION;
public const string MENU = "VRM1/";
}
}

View File

@@ -11,7 +11,7 @@ namespace UniGLTF
public static class ShaderPropMenu
{
#if VRM_DEVELOP
[MenuItem("VRM/ShaderProperty/PreExport ShaderProps")]
[MenuItem("VRMShaders/PreExport ShaderProps")]
#endif
public static void PreExport()
{

View File

@@ -1,6 +1,6 @@
{
"name": "com.vrmc.vrmshaders",
"version": "0.63.2",
"version": "0.64.0",
"displayName": "VRM Shaders",
"description": "VRM Shaders",
"unity": "2018.4",