diff --git a/Editor/Scripts/GLTFExportMenu.cs b/Editor/Scripts/GLTFExportMenu.cs index 9103b510f..924429fca 100644 --- a/Editor/Scripts/GLTFExportMenu.cs +++ b/Editor/Scripts/GLTFExportMenu.cs @@ -131,4 +131,26 @@ private static void Export(Transform[] transforms, bool binary, string sceneName } } } + + internal static class GLTFCreateMenu + { + [MenuItem("Assets/Create/UnityGLTF/Material", false)] + private static void CreateNewAsset() + { + ProjectWindowUtil.CreateAssetWithContent("New glTF Material.gltf", @"{ + ""asset"": { + ""generator"": ""UnityGLTF"", + ""version"": ""2.0"" + }, + ""materials"": [ + { + ""name"": ""Material"", + ""pbrMetallicRoughness"": { + ""metallicFactor"": 0.0 + } + } + ] +}"); + } + } } diff --git a/Editor/Scripts/ShaderGraph/InternalShaderGraph/PBRGraphGUI.cs b/Editor/Scripts/ShaderGraph/InternalShaderGraph/PBRGraphGUI.cs index 65a1ad053..d14390673 100644 --- a/Editor/Scripts/ShaderGraph/InternalShaderGraph/PBRGraphGUI.cs +++ b/Editor/Scripts/ShaderGraph/InternalShaderGraph/PBRGraphGUI.cs @@ -65,9 +65,12 @@ public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] pro // Force GUI changes to be allowed, despite being in an immutable context. // We can store the changes back to .glTF when saving. if (immutableMaterialCanBeModified) + { GUI.enabled = true; + EditorGUILayout.HelpBox("(Experimental) This material is part of a glTF asset. Changes will be stored back to the .glTF file when saving.", MessageType.Warning); + } - // Need to set these via reflection... + // Need to set these via reflection... // m_MaterialEditor = materialEditor; // m_Properties = properties; if (m_MaterialEditor == null) m_MaterialEditor = typeof(BuiltInBaseShaderGUI).GetField(nameof(m_MaterialEditor), BindingFlags.Instance | BindingFlags.NonPublic);