コード例 #1
0
        override public void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties)
        {
            if (propertyContainer == null)
            {
                propertyContainer = new MaterialPropertyContainer(properties);
                propertyContainer.FoldoutSub("Stencil", sub =>
                {
                    sub.IntSlider("Ref", "_StencilRef", 0, 255);
                    sub.IntSlider("Read Mask", "_StencilReadMask", 0, 255);
                    sub.IntSlider("Write Mask", "_StencilWriteMask", 0, 255);
                    sub.EnumPopup <UnityEngine.Rendering.CompareFunction>("Comp", "_StencilComp");
                    sub.EnumPopup <UnityEngine.Rendering.StencilOp>("Pass", "_StencilPass");
                    sub.EnumPopup <UnityEngine.Rendering.StencilOp>("Fail", "_StencilFail");
                    sub.EnumPopup <UnityEngine.Rendering.StencilOp>("Z Fail", "_StencilZFail");
                });
            }

            base.OnGUI(materialEditor, propertyContainer.RestProperties);

            propertyContainer.Draw(materialEditor);
        }
コード例 #2
0
        public void FoldoutSub(string label, System.Action <MaterialPropertyContainer> foldoutAction)
        {
            int  subContainerIndex = subContainers.Count;
            bool foldout           = false;
            MaterialPropertyContainer subContainer = new MaterialPropertyContainer(this);

            var style = new GUIStyle(EditorStyles.foldout);

            style.fontStyle = FontStyle.Bold;

            drawActions.Add((materialEditor, targets) =>
            {
                if (foldout = EditorGUILayout.Foldout(foldout, label, style))
                {
                    using (new EditorGUI.IndentLevelScope())
                    {
                        subContainer.Draw(materialEditor);
                    }
                }
            });

            foldoutAction.Invoke(subContainer);
        }
コード例 #3
0
 private MaterialPropertyContainer(MaterialPropertyContainer parent)
 {
     this.restProperties = parent.restProperties;
 }