예제 #1
0
        public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props)
        {
            this.FindProperties(props);

            this.m_MaterialEditor = materialEditor;

            //Style similar to Standard shader
            m_MaterialEditor.SetDefaultGUIWidths();
            m_MaterialEditor.UseDefaultMargins();
            EditorGUIUtility.labelWidth = 0f;

            EditorGUI.BeginChangeCheck();

            //Draw fields
            DoHeader();

            DoMapsArea();
            DoColorArea();

            if (EditorGUI.EndChangeCheck())
            {
                //Apply changes
            }

            GUIHelper.DrawExtraFields(m_MaterialEditor);

            if (showHelp)
            {
                GUIHelper.DrawWindInfo();
            }

            GUIHelper.DrawFooter();
        }
예제 #2
0
        public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props)
        {
            this.m_MaterialEditor = materialEditor;
            targetMat             = materialEditor.target as Material;

            this.FindProperties(props);

            //Style similar to Standard shader
            m_MaterialEditor.SetDefaultGUIWidths();
            m_MaterialEditor.UseDefaultMargins();
            EditorGUIUtility.labelWidth = 0f;

#if UNITY_2019_3_OR_NEWER
            if (UnityEngine.Rendering.GraphicsSettings.currentRenderPipeline != null &&
                !targetMat.shader.name.Contains("Universal Render Pipeline"))
            {
                EditorGUILayout.HelpBox("A render pipeline is in use, but this material is using a shader for the Built-in render pipeline.\n\nShaders and materials can be converted through the Help window", MessageType.Error);
                EditorGUILayout.Space();
            }
#endif

            EditorGUI.BeginChangeCheck();

            //Draw fields
            DoHeader();

            DoMapsArea();
            DoColorArea();

            if (EditorGUI.EndChangeCheck())
            {
                //Apply changes
            }

            GUILayout.Label("Advanced Options", EditorStyles.boldLabel);

            GUIHelper.DrawExtraFields(m_MaterialEditor);

            m_MaterialEditor.ShaderProperty(_UseSpeedTreeWind, new GUIContent("Sample SpeedTree wind"));
            if (showHelp)
            {
                EditorGUILayout.HelpBox("If this is a tree created using the SpeedTree Unity Modeler, this toggle will make the shader read the wind information as stored by SpeedTree.", MessageType.None);
            }

            if (showHelp)
            {
                GUIHelper.DrawWindInfo();
            }

            GUIHelper.DrawFooter();
        }
        public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props)
        {
            if (windController == null)
            {
                LocateWindController();
            }

            //Receive
            visualizeVectors = WindController._visualizeVectors;

            this.m_MaterialEditor = materialEditor;
            targetMat             = (Material)materialEditor.target;

            this.FindProperties(props);

            //Style similar to Standard shader
            m_MaterialEditor.SetDefaultGUIWidths();
            m_MaterialEditor.UseDefaultMargins();
            EditorGUIUtility.labelWidth = 0f;

#if UNITY_2019_3_OR_NEWER
            if (UnityEngine.Rendering.GraphicsSettings.currentRenderPipeline != null &&
                !targetMat.shader.name.Contains("Universal Render Pipeline"))
            {
                EditorGUILayout.HelpBox("A render pipeline is in use, but this material is using a shader for the Built-in render pipeline.\n\nShaders and materials can be converted through the Help window", MessageType.Error);
                EditorGUILayout.Space();
            }
#endif

            EditorGUI.BeginChangeCheck();

            //Draw fields
            DoHeader();

            DoMapsArea();
            DoColorArea();
            DoAnimationArea();

            if (EditorGUI.EndChangeCheck())
            {
                //Send
                WindController.VisualizeVectors(visualizeVectors);
            }

            GUILayout.Label("Advanced Options", EditorStyles.boldLabel);

            GUIHelper.DrawExtraFields(m_MaterialEditor);

            GUIHelper.DrawFooter();
        }
        public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props)
        {
            this.FindProperties(props);

            this.m_MaterialEditor = materialEditor;

            //Style similar to Standard shader
            m_MaterialEditor.SetDefaultGUIWidths();
            m_MaterialEditor.UseDefaultMargins();
            EditorGUIUtility.labelWidth = 0f;

            EditorGUI.BeginChangeCheck();

            //Draw fields
            DoHeader();

            DoMapsArea();
            DoColorArea();

            if (EditorGUI.EndChangeCheck())
            {
                //Apply changes
            }

            GUILayout.Label("Advanced Options", EditorStyles.boldLabel);

            GUIHelper.DrawExtraFields(m_MaterialEditor);

            m_MaterialEditor.ShaderProperty(_UseSpeedTreeWind, new GUIContent("Sample SpeedTree wind"));
            if (showHelp)
            {
                EditorGUILayout.HelpBox("If this is a tree created using the SpeedTree Unity Modeler, this toggle will make the shader read the wind information as stored by SpeedTree.", MessageType.None);
            }

            EditorGUI.BeginDisabledGroup(_UseSpeedTreeWind.floatValue == 1);
            m_MaterialEditor.ShaderProperty(_UseLegacyVertexColors, new GUIContent("Legacy vertex color layout"));
            if (_UseSpeedTreeWind.floatValue == 0)
            {
                EditorGUILayout.HelpBox("Since version 1.2.1 the Blue and Alpha channel have been swapped. If your custom tree uses the old layout, check this.", MessageType.None);
            }
            EditorGUI.EndDisabledGroup();

            if (showHelp)
            {
                GUIHelper.DrawWindInfo();
            }

            GUIHelper.DrawFooter();
        }
예제 #5
0
        public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props)
        {
            if (windController == null)
            {
                LocateWindController();
            }
            this.FindProperties(props);

            //Receive
            visualizeVectors = WindController._visualizeVectors;

            this.m_MaterialEditor = materialEditor;

            //Style similar to Standard shader
            m_MaterialEditor.SetDefaultGUIWidths();
            m_MaterialEditor.UseDefaultMargins();
            EditorGUIUtility.labelWidth = 0f;

            EditorGUI.BeginChangeCheck();

            //Draw fields
            DoHeader();

            DoMapsArea();
            DoColorArea();
            DoAnimationArea();

            if (EditorGUI.EndChangeCheck())
            {
                //Send
                WindController.VisualizeVectors(visualizeVectors);
            }

            GUILayout.Label("Advanced Options", EditorStyles.boldLabel);

            GUIHelper.DrawExtraFields(m_MaterialEditor);

            EditorGUI.BeginDisabledGroup(_UseSpeedTreeWind.floatValue == 1);
            m_MaterialEditor.ShaderProperty(_UseLegacyVertexColors, new GUIContent("Legacy vertex color layout"));
            if (_UseSpeedTreeWind.floatValue == 0)
            {
                EditorGUILayout.HelpBox("Since version 1.2.1 the Blue and Alpha channel have been swapped. If your custom tree uses the old layout, check this.", MessageType.None);
            }
            EditorGUI.EndDisabledGroup();

            GUIHelper.DrawFooter();
        }
예제 #6
0
        public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props)
        {
            if (windController == null)
            {
                LocateWindController();
            }
            this.FindProperties(props);

            //Receive
            visualizeVectors = WindController._visualizeVectors;

            this.m_MaterialEditor = materialEditor;

            //Style similar to Standard shader
            m_MaterialEditor.SetDefaultGUIWidths();
            m_MaterialEditor.UseDefaultMargins();
            EditorGUIUtility.labelWidth = 0f;

            //GetGlobalTexture is only available since Unity 5.5
#if UNITY_5_5_OR_NEWER
            hasPigmentMap = (Shader.GetGlobalTexture("_PigmentMap")) ? true : false;
#endif

            EditorGUI.BeginChangeCheck();

            //Draw fields
            DoHeader();

            DoMapsArea();
            DoColorArea();
            DoAnimationArea();
            DoBendingArea();
            DoHeightmapArea();
            DoPigmentMapArea();

            if (EditorGUI.EndChangeCheck())
            {
                //Send
                WindController.VisualizeVectors(visualizeVectors);
            }

            GUIHelper.DrawExtraFields(m_MaterialEditor);
            GUIHelper.DrawFooter();
        }
        public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props)
        {
            this.FindProperties(props);

            this.m_MaterialEditor = materialEditor;

            //Style similar to Standard shader
            m_MaterialEditor.SetDefaultGUIWidths();
            m_MaterialEditor.UseDefaultMargins();
            EditorGUIUtility.labelWidth = 0f;

            EditorGUI.BeginChangeCheck();

            //Draw fields
            DoHeader();

            DoMapsArea();
            DoColorArea();

            if (EditorGUI.EndChangeCheck())
            {
                //Apply changes
            }

            GUILayout.Label("Advanced Options", EditorStyles.boldLabel);

            GUIHelper.DrawExtraFields(m_MaterialEditor);

            m_MaterialEditor.ShaderProperty(_UseSpeedTreeWind, new GUIContent("Sample SpeedTree wind"));
            if (showHelp)
            {
                EditorGUILayout.HelpBox("If this is a tree created using the SpeedTree Unity Modeler, this toggle will make the shader read the wind information as stored by SpeedTree.", MessageType.None);
            }

            if (showHelp)
            {
                GUIHelper.DrawWindInfo();
            }

            GUIHelper.DrawFooter();
        }
        public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props)
        {
            if (windController == null)
            {
                LocateWindController();
            }
            this.FindProperties(props);

            //Receive
            visualizeVectors = WindController._visualizeVectors;

            this.m_MaterialEditor = materialEditor;

            //Style similar to Standard shader
            m_MaterialEditor.SetDefaultGUIWidths();
            m_MaterialEditor.UseDefaultMargins();
            EditorGUIUtility.labelWidth = 0f;

            EditorGUI.BeginChangeCheck();

            //Draw fields
            DoHeader();

            DoMapsArea();
            DoColorArea();
            DoAnimationArea();

            if (EditorGUI.EndChangeCheck())
            {
                //Send
                WindController.VisualizeVectors(visualizeVectors);
            }

            GUILayout.Label("Advanced Options", EditorStyles.boldLabel);

            GUIHelper.DrawExtraFields(m_MaterialEditor);

            GUIHelper.DrawFooter();
        }