Ejemplo n.º 1
0
        public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props)
        {
            material            = materialEditor.target as Material;
            this.props          = props;
            this.materialEditor = materialEditor;

            // Init
            Prop.Initialize(props);
            Layout.Initialize(materialEditor);
            ShaderSetup.Initialize(materialEditor);

            if (ShaderSetup.isProjector)
            {
                ShaderPropertiesGUI(material);
            }
            else
            {
                base.OnGUI(materialEditor, props);
            }

            if (firstTimeApply)
            {
                ShaderSetup.MaterialChanged();
                firstTimeApply = false;
            }
        }
Ejemplo n.º 2
0
 public override void ShaderPropertiesGUI(Material material)
 {
     EditorGUILayout.BeginHorizontal();
     GUILayout.Space(-7);
     EditorGUILayout.BeginVertical();
     EditorGUI.BeginChangeCheck();
     DrawGUI();
     if (EditorGUI.EndChangeCheck())
     {
         ShaderSetup.MaterialChanged();
     }
     EditorGUILayout.EndVertical();
     GUILayout.Space(1);
     EditorGUILayout.EndHorizontal();
 }
Ejemplo n.º 3
0
        void DrawBlendMode()
        {
            var renderModeDrawer = ShaderSetup.isProjector ? Prop._ModeProj : null;

            if (Prop._Mode.Draw(0, renderModeDrawer))
            {
                bmode = ShaderSetup.GetBlendMode();
                ShaderSetup.SetZWrite(); //only set zwrite when changing the render mode, because there is a zwrite option in the GUI
            }
            //BlendModePopup();
            if (!ShaderSetup.isProjector)
            {
                bmode = ShaderSetup.GetBlendMode();
            }

            if (bmode == WFSBlendMode.Cutout)
            {
                Prop._Cutoff.Draw(indentation: 2);

                if (ShaderSetup.isUnlit)
                {
                    EditorGUI.BeginChangeCheck();
                    Prop._TwoSided.Draw(indentation: 2);
                    if (EditorGUI.EndChangeCheck())
                    {
                        var isTwosided = Prop._TwoSided._bool;
                        var mode       = isTwosided ? CullMode.Off : CullMode.Back;
                        Prop._Cull._float = (float)mode;
                    }
                }
                else
                {
                    Prop._TwoSided.Draw(indentation: 2);
                }
            }

            if (bmode == WFSBlendMode.Cutout && Prop._Cull._int != (int)CullMode.Back && Prop._TwoSided._bool && !ShaderSetup.isUnlit)
            {
                Prop._Cull._float = (int)CullMode.Back;
            }
        }
Ejemplo n.º 4
0
 public override void AssignNewShaderToMaterial(Material material, Shader oldShader, Shader newShader)
 {
     ShaderSetup.Initialize(material, newShader);
     base.AssignNewShaderToMaterial(material, oldShader, newShader);
     ShaderSetup.MaterialChanged();
 }