public UnlitSettingsView(UnlitMasterNode node)
        {
            m_Node = node;

            PropertySheet ps = new PropertySheet();

            ps.Add(new PropertyRow(new Label("Surface")), (row) =>
            {
                row.Add(new EnumField(SurfaceType.Opaque), (field) =>
                {
                    field.value = m_Node.surfaceType;
                    field.OnValueChanged(ChangeSurface);
                });
            });

            ps.Add(new PropertyRow(new Label("Blend")), (row) =>
            {
                row.Add(new EnumField(AlphaMode.Additive), (field) =>
                {
                    field.value = m_Node.alphaMode;
                    field.OnValueChanged(ChangeAlphaMode);
                });
            });

            ps.Add(new PropertyRow(new Label("Two Sided")), (row) =>
            {
                row.Add(new Toggle(), (toggle) =>
                {
                    toggle.value = m_Node.twoSided.isOn;
                    toggle.OnToggleChanged(ChangeTwoSided);
                });
            });

            Add(ps);
        }
Beispiel #2
0
        public PBRSettingsView(AbstractMaterialNode node) : base(node)
        {
            m_Node = node as PBRMasterNode;

            PropertySheet ps = new PropertySheet();

            ps.Add(new PropertyRow(new Label("Workflow")), (row) =>
            {
                row.Add(new EnumField(PBRMasterNode.Model.Metallic), (field) =>
                {
                    field.value = m_Node.model;
                    field.RegisterValueChangedCallback(ChangeWorkFlow);
                });
            });

            ps.Add(new PropertyRow(new Label("Surface")), (row) =>
            {
                row.Add(new EnumField(SurfaceType.Opaque), (field) =>
                {
                    field.value = m_Node.surfaceType;
                    field.RegisterValueChangedCallback(ChangeSurface);
                });
            });

            ps.Add(new PropertyRow(new Label("Blend")), (row) =>
            {
                row.Add(new EnumField(AlphaMode.Additive), (field) =>
                {
                    field.value = m_Node.alphaMode;
                    field.RegisterValueChangedCallback(ChangeAlphaMode);
                });
            });

            ps.Add(new PropertyRow(new Label("Fragment Normal Space")), (row) =>
            {
                row.Add(new EnumField(NormalDropOffSpace.Tangent), (field) =>
                {
                    field.value = m_Node.normalDropOffSpace;
                    field.RegisterValueChangedCallback(ChangeSpaceOfNormalDropOffMode);
                });
            });

            ps.Add(new PropertyRow(new Label("Two Sided")), (row) =>
            {
                row.Add(new Toggle(), (toggle) =>
                {
                    toggle.value = m_Node.twoSided.isOn;
                    toggle.OnToggleChanged(ChangeTwoSided);
                });
            });

            Add(ps);
            Add(GetShaderGUIOverridePropertySheet());
        }
Beispiel #3
0
        private void ProcessOverrideEnabledToggle(bool newValue)
        {
            string storedValue  = m_CanChangeShaderGUI.ShaderGUIOverride;
            string preferredGUI = GraphUtil.CurrentPipelinePreferredShaderGUI(m_MasterNode as IMasterNode);

            m_CanChangeShaderGUI.OverrideEnabled = newValue;

            // Display the ShaderGUI text field only when the override is enabled
            if (m_CanChangeShaderGUI.OverrideEnabled)
            {
                m_PropertySheet.Add(m_OverrideFieldRow);

                // Display the pipeline's default upon activation, if it has one. Otherwise set up field to display user setting.
                if (string.IsNullOrEmpty(storedValue) && !string.IsNullOrEmpty(preferredGUI))
                {
                    ProcessShaderGUIField(preferredGUI, false);
                }
                else
                {
                    ProcessShaderGUIField(storedValue, false);
                }
            }
            else if (m_PropertySheet.Contains(m_OverrideFieldRow))
            {
                m_PropertySheet.Remove(m_OverrideFieldRow);

                // Upon disable, set the value back to null (for pipeline switching reasons, among other reasons)
                if (storedValue == preferredGUI)
                {
                    m_CanChangeShaderGUI.ShaderGUIOverride = null;
                }
            }

            AddWarningIfNeeded();
        }
Beispiel #4
0
        protected PropertySheet GetShaderGUIOverridePropertySheet()
        {
            m_PropertySheet = new PropertySheet();

            Toggle enabledToggle = new Toggle();

            m_PropertySheet.Add(new PropertyRow(new Label("Override ShaderGUI")), (row) =>
            {
                enabledToggle = new Toggle();
                row.Add(enabledToggle, (toggle) =>
                {
                    toggle.value = m_CanChangeShaderGUI.OverrideEnabled;
                    toggle.OnToggleChanged(ChangeOverrideEnabled);
                });
            });

            m_OverrideFieldRow   = new PropertyRow(new Label("ShaderGUI"));
            m_ShaderGUITextField = new TextField();
            m_OverrideFieldRow.Add(m_ShaderGUITextField, (text) =>
            {
                text.isDelayed = true;
                text.RegisterValueChangedCallback(ChangeShaderGUIOverride);
            });

            // Set up such that both fields have the correct values (if displayed) & spawn warning if needed
            ProcessOverrideEnabledToggle(m_CanChangeShaderGUI.OverrideEnabled);

            m_PropertySheet.tooltip = k_ShaderGUIToolTip;

            return(m_PropertySheet);
        }
        public ToonSettingsView(ToonMasterNode node)
        {
            m_Node = node;

            PropertySheet ps = new PropertySheet();

            ps.Add(new PropertyRow(new Label("Workflow")), (row) =>
            {
                row.Add(new EnumField(ToonMasterNode.Model.Metallic), (field) =>
                {
                    field.value = m_Node.model;
                    field.RegisterValueChangedCallback(ChangeWorkFlow);
                });
            });

            ps.Add(new PropertyRow(new Label("Surface")), (row) =>
            {
                row.Add(new EnumField(SurfaceType.Opaque), (field) =>
                {
                    field.value = m_Node.surfaceType;
                    field.RegisterValueChangedCallback(ChangeSurface);
                });
            });

            ps.Add(new PropertyRow(new Label("Blend")), (row) =>
            {
                row.Add(new EnumField(AlphaMode.Additive), (field) =>
                {
                    field.value = m_Node.alphaMode;
                    field.RegisterValueChangedCallback(ChangeAlphaMode);
                });
            });

            ps.Add(new PropertyRow(new Label("Two Sided")), (row) =>
            {
                row.Add(new Toggle(), (toggle) =>
                {
                    toggle.value = m_Node.twoSided.isOn;
                    toggle.OnToggleChanged(ChangeTwoSided);
                });
            });

            Add(ps);
        }
        public UnlitSettingsView(AbstractMaterialNode node) : base(node)
        {
            m_Node = node as UnlitMasterNode;

            PropertySheet ps = new PropertySheet();

            ps.Add(new PropertyRow(new Label("Surface")), (row) =>
            {
                row.Add(new EnumField(SurfaceType.Opaque), (field) =>
                {
                    field.value = m_Node.surfaceType;
                    field.RegisterValueChangedCallback(ChangeSurface);
                });
            });

            ps.Add(new PropertyRow(new Label("Blend")), (row) =>
            {
                row.Add(new EnumField(AlphaMode.Additive), (field) =>
                {
                    field.value = m_Node.alphaMode;
                    field.RegisterValueChangedCallback(ChangeAlphaMode);
                });
            });

            ps.Add(new PropertyRow(new Label("Two Sided")), (row) =>
            {
                row.Add(new Toggle(), (toggle) =>
                {
                    toggle.value = m_Node.twoSided.isOn;
                    toggle.OnToggleChanged(ChangeTwoSided);
                });
            });

            Add(ps);
            Add(GetShaderGUIOverridePropertySheet());
        }
Beispiel #7
0
        public CustomSettingsView(CustomMasterNode node)
        {
            this.node = node;

            PropertySheet ps = new PropertySheet();

            ps.Add(new PropertyRow(new Label("Outline")), (row) =>
            {
                row.Add(new Toggle(), (toggle) =>
                {
                    toggle.value = node.Outline.isOn;
                    toggle.OnToggleChanged(ChangeOutline);
                });
            });

            Add(ps);
        }
        private void ProcessOverrideEnabledToggle(bool newValue)
        {
            string storedValue = m_CanChangeShaderGUI.ShaderGUIOverride;

            m_CanChangeShaderGUI.OverrideEnabled = newValue;

            // Display the ShaderGUI text field only when the override is enabled
            if (m_CanChangeShaderGUI.OverrideEnabled)
            {
                m_PropertySheet.Add(m_OverrideFieldRow);

                ProcessShaderGUIField(storedValue, false);
            }
            else if (m_PropertySheet.Contains(m_OverrideFieldRow))
            {
                m_PropertySheet.Remove(m_OverrideFieldRow);
            }

            AddWarningIfNeeded();
        }
        void AddDefaultSettings()
        {
            PropertySheet ps = new PropertySheet();
            bool          hasDefaultSettings = false;

            if (node.canSetPrecision)
            {
                hasDefaultSettings = true;
                ps.Add(new PropertyRow(new Label("Precision")), (row) =>
                {
                    row.Add(new EnumField(node.precision), (field) =>
                    {
                        field.RegisterValueChangedCallback(evt =>
                        {
                            if (evt.newValue.Equals(node.precision))
                            {
                                return;
                            }

                            var editorView = GetFirstAncestorOfType <GraphEditorView>();
                            var nodeList   = m_GraphView.Query <MaterialNodeView>().ToList();

                            editorView.colorManager.SetNodesDirty(nodeList);
                            node.owner.owner.RegisterCompleteObjectUndo("Change precision");
                            node.precision = (Precision)evt.newValue;
                            node.owner.ValidateGraph();
                            editorView.colorManager.UpdateNodeViews(nodeList);
                            node.Dirty(ModificationScope.Graph);
                        });
                    });
                });
            }

            if (hasDefaultSettings)
            {
                m_Settings.Add(ps);
            }
        }
        public HDLitSettingsView(HDLitMasterNode node)
        {
            m_Node = node;
            PropertySheet ps = new PropertySheet();

            int indentLevel = 0;

            ps.Add(new PropertyRow(CreateLabel("Surface Type", indentLevel)), (row) =>
            {
                row.Add(new EnumField(SurfaceType.Opaque), (field) =>
                {
                    field.value = m_Node.surfaceType;
                    field.OnValueChanged(ChangeSurfaceType);
                });
            });

            if (m_Node.surfaceType == SurfaceType.Transparent)
            {
                ++indentLevel;
                if (!m_Node.HasRefraction())
                {
                    ps.Add(new PropertyRow(CreateLabel("Blend Mode", indentLevel)), (row) =>
                    {
                        row.Add(new EnumField(HDLitMasterNode.AlphaModeLit.Additive), (field) =>
                        {
                            field.value = GetAlphaModeLit(m_Node.alphaMode);
                            field.OnValueChanged(ChangeBlendMode);
                        });
                    });
                }

                ps.Add(new PropertyRow(CreateLabel("Blend Preserves Specular", indentLevel)), (row) =>
                {
                    row.Add(new Toggle(), (toggle) =>
                    {
                        toggle.value = m_Node.blendPreserveSpecular.isOn;
                        toggle.OnToggleChanged(ChangeBlendPreserveSpecular);
                    });
                });

                ps.Add(new PropertyRow(CreateLabel("Fog", indentLevel)), (row) =>
                {
                    row.Add(new Toggle(), (toggle) =>
                    {
                        toggle.value = m_Node.transparencyFog.isOn;
                        toggle.OnToggleChanged(ChangeTransparencyFog);
                    });
                });

                ps.Add(new PropertyRow(CreateLabel("Draw Before Refraction", indentLevel)), (row) =>
                {
                    row.Add(new Toggle(), (toggle) =>
                    {
                        toggle.value = m_Node.drawBeforeRefraction.isOn;
                        toggle.OnToggleChanged(ChangeDrawBeforeRefraction);
                    });
                });

                if (!m_Node.drawBeforeRefraction.isOn)
                {
                    ps.Add(new PropertyRow(CreateLabel("Refraction Model", indentLevel)), (row) =>
                    {
                        row.Add(new EnumField(ScreenSpaceLighting.RefractionModel.None), (field) =>
                        {
                            field.value = m_Node.refractionModel;
                            field.OnValueChanged(ChangeRefractionModel);
                        });
                    });
                }

                ps.Add(new PropertyRow(CreateLabel("Distortion", indentLevel)), (row) =>
                {
                    row.Add(new Toggle(), (toggle) =>
                    {
                        toggle.value = m_Node.distortion.isOn;
                        toggle.OnToggleChanged(ChangeDistortion);
                    });
                });

                if (m_Node.distortion.isOn)
                {
                    ++indentLevel;
                    ps.Add(new PropertyRow(CreateLabel("Mode", indentLevel)), (row) =>
                    {
                        row.Add(new EnumField(DistortionMode.Add), (field) =>
                        {
                            field.value = m_Node.distortionMode;
                            field.OnValueChanged(ChangeDistortionMode);
                        });
                    });
                    ps.Add(new PropertyRow(CreateLabel("Depth Test", indentLevel)), (row) =>
                    {
                        row.Add(new Toggle(), (toggle) =>
                        {
                            toggle.value = m_Node.distortionDepthTest.isOn;
                            toggle.OnToggleChanged(ChangeDistortionDepthTest);
                        });
                    });
                    --indentLevel;
                }

                ps.Add(new PropertyRow(CreateLabel("Back Then Front Rendering", indentLevel)), (row) =>
                {
                    row.Add(new Toggle(), (toggle) =>
                    {
                        toggle.value = m_Node.backThenFrontRendering.isOn;
                        toggle.OnToggleChanged(ChangeBackThenFrontRendering);
                    });
                });

                m_SortPiorityField = new IntegerField();
                ps.Add(new PropertyRow(CreateLabel("Sort Priority", indentLevel)), (row) =>
                {
                    row.Add(m_SortPiorityField, (field) =>
                    {
                        field.value = m_Node.sortPriority;
                        field.OnValueChanged(ChangeSortPriority);
                    });
                });
                --indentLevel;
            }

            ps.Add(new PropertyRow(CreateLabel("Alpha Cutoff", indentLevel)), (row) =>
            {
                row.Add(new Toggle(), (toggle) =>
                {
                    toggle.value = m_Node.alphaTest.isOn;
                    toggle.OnToggleChanged(ChangeAlphaTest);
                });
            });

            if (m_Node.surfaceType == SurfaceType.Transparent && m_Node.alphaTest.isOn)
            {
                ++indentLevel;
                ps.Add(new PropertyRow(CreateLabel("Alpha Cutoff Depth Prepass", indentLevel)), (row) =>
                {
                    row.Add(new Toggle(), (toggle) =>
                    {
                        toggle.value = m_Node.alphaTestDepthPrepass.isOn;
                        toggle.OnToggleChanged(ChangeAlphaTestPrepass);
                    });
                });

                ps.Add(new PropertyRow(CreateLabel("Alpha Cutoff Depth Postpass", indentLevel)), (row) =>
                {
                    row.Add(new Toggle(), (toggle) =>
                    {
                        toggle.value = m_Node.alphaTestDepthPostpass.isOn;
                        toggle.OnToggleChanged(ChangeAlphaTestPostpass);
                    });
                });
                --indentLevel;
            }

            ps.Add(new PropertyRow(CreateLabel("Double Sided", indentLevel)), (row) =>
            {
                row.Add(new EnumField(DoubleSidedMode.Disabled), (field) =>
                {
                    field.value = m_Node.doubleSidedMode;
                    field.OnValueChanged(ChangeDoubleSidedMode);
                });
            });

            ps.Add(new PropertyRow(CreateLabel("Material Type", indentLevel)), (row) =>
            {
                row.Add(new EnumField(HDLitMasterNode.MaterialType.Standard), (field) =>
                {
                    field.value = m_Node.materialType;
                    field.OnValueChanged(ChangeMaterialType);
                });
            });

            ++indentLevel;
            if (m_Node.materialType == HDLitMasterNode.MaterialType.SubsurfaceScattering)
            {
                ps.Add(new PropertyRow(CreateLabel("Transmission", indentLevel)), (row) =>
                {
                    row.Add(new Toggle(), (toggle) =>
                    {
                        toggle.value = m_Node.sssTransmission.isOn;
                        toggle.OnToggleChanged(ChangeSSSTransmission);
                    });
                });
            }

            if (m_Node.materialType == HDLitMasterNode.MaterialType.SpecularColor)
            {
                ps.Add(new PropertyRow(CreateLabel("Energy Conserving Specular", indentLevel)), (row) =>
                {
                    row.Add(new Toggle(), (toggle) =>
                    {
                        toggle.value = m_Node.energyConservingSpecular.isOn;
                        toggle.OnToggleChanged(ChangeEnergyConservingSpecular);
                    });
                });
            }
            --indentLevel;

            ps.Add(new PropertyRow(CreateLabel("Receive Decals", indentLevel)), (row) =>
            {
                row.Add(new Toggle(), (toggle) =>
                {
                    toggle.value = m_Node.receiveDecals.isOn;
                    toggle.OnToggleChanged(ChangeDecal);
                });
            });

            ps.Add(new PropertyRow(CreateLabel("Receives SSR", indentLevel)), (row) =>
            {
                row.Add(new Toggle(), (toggle) =>
                {
                    toggle.value = m_Node.receiveSSR.isOn;
                    toggle.OnToggleChanged(ChangeSSR);
                });
            });

            ps.Add(new PropertyRow(CreateLabel("Specular AA", indentLevel)), (row) =>
            {
                row.Add(new Toggle(), (toggle) =>
                {
                    toggle.value = m_Node.specularAA.isOn;
                    toggle.OnToggleChanged(ChangeSpecularAA);
                });
            });

            ps.Add(new PropertyRow(CreateLabel("Specular Occlusion Mode", indentLevel)), (row) =>
            {
                row.Add(new EnumField(SpecularOcclusionMode.Off), (field) =>
                {
                    field.value = m_Node.specularOcclusionMode;
                    field.OnValueChanged(ChangeSpecularOcclusionMode);
                });
            });

            Add(ps);
        }
Beispiel #11
0
        public FabricSettingsView(FabricMasterNode node)
        {
            m_Node = node;
            PropertySheet ps = new PropertySheet();

            int indentLevel = 0;

            ps.Add(new PropertyRow(CreateLabel("Surface Type", indentLevel)), (row) =>
            {
                row.Add(new EnumField(SurfaceType.Opaque), (field) =>
                {
                    field.value = m_Node.surfaceType;
                    field.OnValueChanged(ChangeSurfaceType);
                });
            });

            if (m_Node.surfaceType == SurfaceType.Transparent)
            {
                ++indentLevel;

                ps.Add(new PropertyRow(CreateLabel("Blend Preserves Specular", indentLevel)), (row) =>
                {
                    row.Add(new Toggle(), (toggle) =>
                    {
                        toggle.value = m_Node.blendPreserveSpecular.isOn;
                        toggle.OnToggleChanged(ChangeBlendPreserveSpecular);
                    });
                });

                ps.Add(new PropertyRow(CreateLabel("Fog", indentLevel)), (row) =>
                {
                    row.Add(new Toggle(), (toggle) =>
                    {
                        toggle.value = m_Node.transparencyFog.isOn;
                        toggle.OnToggleChanged(ChangeTransparencyFog);
                    });
                });

                ps.Add(new PropertyRow(CreateLabel("Back Then Front Rendering", indentLevel)), (row) =>
                {
                    row.Add(new Toggle(), (toggle) =>
                    {
                        toggle.value = m_Node.backThenFrontRendering.isOn;
                        toggle.OnToggleChanged(ChangeBackThenFrontRendering);
                    });
                });

                m_SortPiorityField = new IntegerField();
                ps.Add(new PropertyRow(CreateLabel("Sort Priority", indentLevel)), (row) =>
                {
                    row.Add(m_SortPiorityField, (field) =>
                    {
                        field.value = m_Node.sortPriority;
                        field.OnValueChanged(ChangeSortPriority);
                    });
                });
                --indentLevel;
            }

            ps.Add(new PropertyRow(CreateLabel("Alpha Cutoff", indentLevel)), (row) =>
            {
                row.Add(new Toggle(), (toggle) =>
                {
                    toggle.value = m_Node.alphaTest.isOn;
                    toggle.OnToggleChanged(ChangeAlphaTest);
                });
            });

            if (m_Node.surfaceType == SurfaceType.Transparent && m_Node.alphaTest.isOn)
            {
                ++indentLevel;
                ps.Add(new PropertyRow(CreateLabel("Alpha Cutoff Depth Prepass", indentLevel)), (row) =>
                {
                    row.Add(new Toggle(), (toggle) =>
                    {
                        toggle.value = m_Node.alphaTestDepthPrepass.isOn;
                        toggle.OnToggleChanged(ChangeAlphaTestPrepass);
                    });
                });

                ps.Add(new PropertyRow(CreateLabel("Alpha Cutoff Depth Postpass", indentLevel)), (row) =>
                {
                    row.Add(new Toggle(), (toggle) =>
                    {
                        toggle.value = m_Node.alphaTestDepthPostpass.isOn;
                        toggle.OnToggleChanged(ChangeAlphaTestPostpass);
                    });
                });
                --indentLevel;
            }

            ps.Add(new PropertyRow(CreateLabel("Double Sided", indentLevel)), (row) =>
            {
                row.Add(new EnumField(DoubleSidedMode.Disabled), (field) =>
                {
                    field.value = m_Node.doubleSidedMode;
                    field.OnValueChanged(ChangeDoubleSidedMode);
                });
            });

            ps.Add(new PropertyRow(CreateLabel("Energy Conserving Specular", indentLevel)), (row) =>
            {
                row.Add(new Toggle(), (toggle) =>
                {
                    toggle.value = m_Node.energyConservingSpecular.isOn;
                    toggle.OnToggleChanged(ChangeEnergyConservingSpecular);
                });
            });

            ps.Add(new PropertyRow(CreateLabel("Material Type", indentLevel)), (row) =>
            {
                row.Add(new EnumField(FabricMasterNode.MaterialType.CottonWool), (field) =>
                {
                    field.value = m_Node.materialType;
                    field.OnValueChanged(ChangeMaterialType);
                });
            });

            ps.Add(new PropertyRow(CreateLabel("Transmission", indentLevel)), (row) =>
            {
                row.Add(new Toggle(), (toggle) =>
                {
                    toggle.value = m_Node.transmission.isOn;
                    toggle.OnToggleChanged(ChangeTransmission);
                });
            });


            ps.Add(new PropertyRow(CreateLabel("Subsurface Scattering", indentLevel)), (row) =>
            {
                row.Add(new Toggle(), (toggle) =>
                {
                    toggle.value = m_Node.subsurfaceScattering.isOn;
                    toggle.OnToggleChanged(ChangeSubsurfaceScattering);
                });
            });



            ps.Add(new PropertyRow(CreateLabel("Receive Decals", indentLevel)), (row) =>
            {
                row.Add(new Toggle(), (toggle) =>
                {
                    toggle.value = m_Node.receiveDecals.isOn;
                    toggle.OnToggleChanged(ChangeDecal);
                });
            });

            ps.Add(new PropertyRow(CreateLabel("Receives SSR", indentLevel)), (row) =>
            {
                row.Add(new Toggle(), (toggle) =>
                {
                    toggle.value = m_Node.receiveSSR.isOn;
                    toggle.OnToggleChanged(ChangeSSR);
                });
            });

            ps.Add(new PropertyRow(CreateLabel("Specular Occlusion Mode", indentLevel)), (row) =>
            {
                row.Add(new EnumField(SpecularOcclusionMode.Off), (field) =>
                {
                    field.value = m_Node.specularOcclusionMode;
                    field.OnValueChanged(ChangeSpecularOcclusionMode);
                });
            });

            Add(ps);
        }
        public StackLitSettingsView(StackLitMasterNode node)
        {
            m_Node = node;
            PropertySheet ps = new PropertySheet();

            int indentLevel = 0;

            ps.Add(new PropertyRow(CreateLabel("Surface Type", indentLevel)), (row) =>
            {
                row.Add(new EnumField(SurfaceType.Opaque), (field) =>
                {
                    field.value = m_Node.surfaceType;
                    field.OnValueChanged(ChangeSurfaceType);
                });
            });

            if (m_Node.surfaceType == SurfaceType.Transparent)
            {
                ++indentLevel;

                // No refraction in StackLit, always show this:
                ps.Add(new PropertyRow(CreateLabel("Blending Mode", indentLevel)), (row) =>
                {
                    row.Add(new EnumField(StackLitMasterNode.AlphaModeLit.Additive), (field) =>
                    {
                        field.value = GetAlphaModeLit(m_Node.alphaMode);
                        field.OnValueChanged(ChangeBlendMode);
                    });
                });

                ps.Add(new PropertyRow(CreateLabel("Blend Preserves Specular", indentLevel)), (row) =>
                {
                    row.Add(new Toggle(), (toggle) =>
                    {
                        toggle.value = m_Node.blendPreserveSpecular.isOn;
                        toggle.OnToggleChanged(ChangeBlendPreserveSpecular);
                    });
                });

                ps.Add(new PropertyRow(CreateLabel("Fog", indentLevel)), (row) =>
                {
                    row.Add(new Toggle(), (toggle) =>
                    {
                        toggle.value = m_Node.transparencyFog.isOn;
                        toggle.OnToggleChanged(ChangeTransparencyFog);
                    });
                });

                ps.Add(new PropertyRow(CreateLabel("Distortion", indentLevel)), (row) =>
                {
                    row.Add(new Toggle(), (toggle) =>
                    {
                        toggle.value = m_Node.distortion.isOn;
                        toggle.OnToggleChanged(ChangeDistortion);
                    });
                });

                if (m_Node.distortion.isOn)
                {
                    ++indentLevel;
                    ps.Add(new PropertyRow(CreateLabel("Mode", indentLevel)), (row) =>
                    {
                        row.Add(new EnumField(DistortionMode.Add), (field) =>
                        {
                            field.value = m_Node.distortionMode;
                            field.OnValueChanged(ChangeDistortionMode);
                        });
                    });
                    ps.Add(new PropertyRow(CreateLabel("Depth Test", indentLevel)), (row) =>
                    {
                        row.Add(new Toggle(), (toggle) =>
                        {
                            toggle.value = m_Node.distortionDepthTest.isOn;
                            toggle.OnToggleChanged(ChangeDistortionDepthTest);
                        });
                    });
                    --indentLevel;
                }

                m_SortPiorityField = new IntegerField();
                ps.Add(new PropertyRow(CreateLabel("Sort Priority", indentLevel)), (row) =>
                {
                    row.Add(m_SortPiorityField, (field) =>
                    {
                        field.value = m_Node.sortPriority;
                        field.OnValueChanged(ChangeSortPriority);
                    });
                });
                --indentLevel;
            }

            ps.Add(new PropertyRow(CreateLabel("Alpha Cutoff", indentLevel)), (row) =>
            {
                row.Add(new Toggle(), (toggle) =>
                {
                    toggle.value = m_Node.alphaTest.isOn;
                    toggle.OnToggleChanged(ChangeAlphaTest);
                });
            });

            ps.Add(new PropertyRow(CreateLabel("Double Sided", indentLevel)), (row) =>
            {
                row.Add(new EnumField(DoubleSidedMode.Disabled), (field) =>
                {
                    field.value = m_Node.doubleSidedMode;
                    field.OnValueChanged(ChangeDoubleSidedMode);
                });
            });

            // Rest of UI looks like this:
            //
            //  baseParametrization
            //    energyConservingSpecular
            //
            //  anisotropy
            //  coat
            //  coatNormal
            //  dualSpecularLobe
            //    dualSpecularLobeParametrization
            //    capHazinessWrtMetallic
            //  iridescence
            //  subsurfaceScattering
            //  transmission
            //
            //  receiveDecals
            //  receiveSSR
            //  geometricSpecularAA
            //  specularOcclusion
            //
            //  anisotropyForAreaLights
            //  recomputeStackPerLight
            //  shadeBaseUsingRefractedAngles

            // Base parametrization:

            ps.Add(new PropertyRow(CreateLabel("Base Color Parametrization", indentLevel)), (row) =>
            {
                row.Add(new EnumField(StackLit.BaseParametrization.BaseMetallic), (field) =>
                {
                    field.value = m_Node.baseParametrization;
                    field.OnValueChanged(ChangeBaseParametrization);
                });
            });

            if (m_Node.baseParametrization == StackLit.BaseParametrization.SpecularColor)
            {
                ++indentLevel;
                ps.Add(new PropertyRow(CreateLabel("Energy Conserving Specular", indentLevel)), (row) =>
                {
                    row.Add(new Toggle(), (toggle) =>
                    {
                        toggle.value = m_Node.energyConservingSpecular.isOn;
                        toggle.OnToggleChanged(ChangeEnergyConservingSpecular);
                    });
                });
                --indentLevel;
            }

            // Material type enables:
            ps.Add(new PropertyRow(CreateLabel("Material Core Features", indentLevel)), (row) => {});
            ++indentLevel;

            ps.Add(new PropertyRow(CreateLabel("Anisotropy", indentLevel)), (row) =>
            {
                row.Add(new Toggle(), (toggle) =>
                {
                    toggle.value = m_Node.anisotropy.isOn;
                    toggle.OnToggleChanged(ChangeAnisotropy);
                });
            });

            ps.Add(new PropertyRow(CreateLabel("Coat", indentLevel)), (row) =>
            {
                row.Add(new Toggle(), (toggle) =>
                {
                    toggle.value = m_Node.coat.isOn;
                    toggle.OnToggleChanged(ChangeCoat);
                });
            });

            if (m_Node.coat.isOn)
            {
                ++indentLevel;
                ps.Add(new PropertyRow(CreateLabel("Coat Normal", indentLevel)), (row) =>
                {
                    row.Add(new Toggle(), (toggle) =>
                    {
                        toggle.value = m_Node.coatNormal.isOn;
                        toggle.OnToggleChanged(ChangeCoatNormal);
                    });
                });
                --indentLevel;
            }

            ps.Add(new PropertyRow(CreateLabel("Dual Specular Lobe", indentLevel)), (row) =>
            {
                row.Add(new Toggle(), (toggle) =>
                {
                    toggle.value = m_Node.dualSpecularLobe.isOn;
                    toggle.OnToggleChanged(ChangeDualSpecularLobe);
                });
            });

            if (m_Node.dualSpecularLobe.isOn)
            {
                ++indentLevel;
                ps.Add(new PropertyRow(CreateLabel("Dual SpecularLobe Parametrization", indentLevel)), (row) =>
                {
                    row.Add(new EnumField(StackLit.DualSpecularLobeParametrization.HazyGloss), (field) =>
                    {
                        field.value = m_Node.dualSpecularLobeParametrization;
                        field.OnValueChanged(ChangeDualSpecularLobeParametrization);
                    });
                });
                if ((m_Node.baseParametrization == StackLit.BaseParametrization.BaseMetallic) &&
                    (m_Node.dualSpecularLobeParametrization == StackLit.DualSpecularLobeParametrization.HazyGloss))
                {
                    ps.Add(new PropertyRow(CreateLabel("Cap Haziness For Non Metallic", indentLevel)), (row) =>
                    {
                        row.Add(new Toggle(), (toggle) =>
                        {
                            toggle.value = m_Node.capHazinessWrtMetallic.isOn;
                            toggle.OnToggleChanged(ChangeCapHazinessWrtMetallic);
                        });
                    });
                }
                --indentLevel;
            }

            ps.Add(new PropertyRow(CreateLabel("Iridescence", indentLevel)), (row) =>
            {
                row.Add(new Toggle(), (toggle) =>
                {
                    toggle.value = m_Node.iridescence.isOn;
                    toggle.OnToggleChanged(ChangeIridescence);
                });
            });

            if (m_Node.surfaceType != SurfaceType.Transparent)
            {
                ps.Add(new PropertyRow(CreateLabel("Subsurface Scattering", indentLevel)), (row) =>
                {
                    row.Add(new Toggle(), (toggle) =>
                    {
                        toggle.value = m_Node.subsurfaceScattering.isOn;
                        toggle.OnToggleChanged(ChangeSubsurfaceScattering);
                    });
                });
            }

            ps.Add(new PropertyRow(CreateLabel("Transmission", indentLevel)), (row) =>
            {
                row.Add(new Toggle(), (toggle) =>
                {
                    toggle.value = m_Node.transmission.isOn;
                    toggle.OnToggleChanged(ChangeTransmission);
                });
            });
            --indentLevel; // ...Material type enables.

            ps.Add(new PropertyRow(CreateLabel("Receive Decals", indentLevel)), (row) =>
            {
                row.Add(new Toggle(), (toggle) =>
                {
                    toggle.value = m_Node.receiveDecals.isOn;
                    toggle.OnToggleChanged(ChangeReceiveDecals);
                });
            });

            ps.Add(new PropertyRow(CreateLabel("Receive SSR", indentLevel)), (row) =>
            {
                row.Add(new Toggle(), (toggle) =>
                {
                    toggle.value = m_Node.receiveSSR.isOn;
                    toggle.OnToggleChanged(ChangeReceiveSSR);
                });
            });

            ps.Add(new PropertyRow(CreateLabel("Specular AA (for geometry)", indentLevel)), (row) =>
            {
                row.Add(new Toggle(), (toggle) =>
                {
                    toggle.value = m_Node.geometricSpecularAA.isOn;
                    toggle.OnToggleChanged(ChangeGeometricSpecularAA);
                });
            });

            ps.Add(new PropertyRow(CreateLabel("Specular Occlusion", indentLevel)), (row) =>
            {
                row.Add(new Toggle(), (toggle) =>
                {
                    toggle.value = m_Node.specularOcclusion.isOn;
                    toggle.OnToggleChanged(ChangeSpecularOcclusion);
                });
            });

            ps.Add(new PropertyRow(CreateLabel("Advanced Options", indentLevel)), (row) => {});
            ++indentLevel;

            ps.Add(new PropertyRow(CreateLabel("Anisotropy For Area Lights", indentLevel)), (row) =>
            {
                row.Add(new Toggle(), (toggle) =>
                {
                    toggle.value = m_Node.anisotropyForAreaLights.isOn;
                    toggle.OnToggleChanged(ChangeAnisotropyForAreaLights);
                });
            });

            if (m_Node.coat.isOn || m_Node.iridescence.isOn)
            {
                ps.Add(new PropertyRow(CreateLabel("Per Punctual/Directional Lights:", indentLevel)), (row) => { });
                ++indentLevel;
            }
            if (m_Node.coat.isOn)
            {
                ps.Add(new PropertyRow(CreateLabel("Base Layer Uses Refracted Angles", indentLevel)), (row) =>
                {
                    row.Add(new Toggle(), (toggle) =>
                    {
                        toggle.value = m_Node.shadeBaseUsingRefractedAngles.isOn;
                        toggle.OnToggleChanged(ChangeShadeBaseUsingRefractedAngles);
                    });
                });
            }
            if (m_Node.coat.isOn || m_Node.iridescence.isOn)
            {
                ps.Add(new PropertyRow(CreateLabel("Recompute Stack & Iridescence", indentLevel)), (row) =>
                {
                    row.Add(new Toggle(), (toggle) =>
                    {
                        toggle.value = m_Node.recomputeStackPerLight.isOn;
                        toggle.OnToggleChanged(ChangeRecomputeStackPerLight);
                    });
                });
            }
            if (m_Node.coat.isOn || m_Node.iridescence.isOn)
            {
                --indentLevel; // Per Punctual/Directional Lights:
            }

            ps.Add(new PropertyRow(CreateLabel("Show And Enable StackLit Debugs", indentLevel)), (row) =>
            {
                row.Add(new Toggle(), (toggle) =>
                {
                    toggle.value = m_Node.debug.isOn;
                    toggle.OnToggleChanged(ChangeDebug);
                });
            });

            --indentLevel; //...Advanced options

            Add(ps);
        }
Beispiel #13
0
        public SimpleLitSettingsView(SimpleLitMasterNode node)
        {
            m_Node = node;

            PropertySheet ps = new PropertySheet();

            ps.Add(new PropertyRow(new Label("Surface")), (row) =>
            {
                row.Add(new EnumField(SurfaceType.Opaque), (field) =>
                {
                    field.value = m_Node.surfaceType;
                    field.RegisterValueChangedCallback(ChangeSurface);
                });
            });

            ps.Add(new PropertyRow(new Label("RenderQueue")), (row) =>
            {
                row.Add(new EnumField(SurfaceMaterialTags.RenderQueue.Geometry), (field) =>
                {
                    field.value = m_Node.surfaceType;
                    field.RegisterValueChangedCallback(ChangeRenderQueue);
                });
            });

            ps.Add(new PropertyRow(new Label("ZTest")), (row) =>
            {
                row.Add(new EnumField(ZTest.LEqual), (field) =>
                {
                    field.value = m_Node.zTest;
                    field.RegisterValueChangedCallback(ChangeZTest);
                });
            });

            ps.Add(new PropertyRow(new Label("ZWrite")), (row) =>
            {
                row.Add(new EnumField(ZWrite.On), (field) =>
                {
                    field.value = m_Node.zWrite;
                    field.RegisterValueChangedCallback(ChangeZWrite);
                });
            });

            ps.Add(new PropertyRow(new Label("Blend")), (row) =>
            {
                row.Add(new EnumField(AlphaMode.Additive), (field) =>
                {
                    field.value = m_Node.alphaMode;
                    field.RegisterValueChangedCallback(ChangeAlphaMode);
                });
            });

            ps.Add(new PropertyRow(new Label("Two Sided")), (row) =>
            {
                row.Add(new Toggle(), (toggle) =>
                {
                    toggle.value = m_Node.twoSided.isOn;
                    toggle.OnToggleChanged(ChangeTwoSided);
                });
            });

            Add(ps);
        }