void ChangeSortPriority(ChangeEvent <int> evt) { m_Node.sortPriority = HDRenderQueue.ClampsTransparentRangePriority(evt.newValue); // Force the text to match. m_SortPiorityField.value = m_Node.sortPriority; if (Equals(m_Node.sortPriority, evt.newValue)) { return; } m_Node.owner.owner.RegisterCompleteObjectUndo("Sort Priority Change"); }
protected virtual void BaseMaterialPropertiesGUI() { SurfaceTypePopup(); if (surfaceTypeValue == SurfaceType.Transparent) { EditorGUI.indentLevel++; if (blendMode != null && showBlendModePopup) { BlendModePopup(); } EditorGUI.indentLevel++; if (enableBlendModePreserveSpecularLighting != null && blendMode != null && showBlendModePopup) { m_MaterialEditor.ShaderProperty(enableBlendModePreserveSpecularLighting, StylesBaseUnlit.enableBlendModePreserveSpecularLightingText); } EditorGUI.indentLevel--; if (transparentSortPriority != null) { EditorGUI.BeginChangeCheck(); m_MaterialEditor.ShaderProperty(transparentSortPriority, StylesBaseUnlit.transparentSortPriorityText); if (EditorGUI.EndChangeCheck()) { transparentSortPriority.floatValue = HDRenderQueue.ClampsTransparentRangePriority((int)transparentSortPriority.floatValue); } } if (enableFogOnTransparent != null) { m_MaterialEditor.ShaderProperty(enableFogOnTransparent, StylesBaseUnlit.enableTransparentFogText); } if (transparentBackfaceEnable != null) { m_MaterialEditor.ShaderProperty(transparentBackfaceEnable, StylesBaseUnlit.transparentBackfaceEnableText); } if (transparentDepthPrepassEnable != null) { m_MaterialEditor.ShaderProperty(transparentDepthPrepassEnable, StylesBaseUnlit.transparentDepthPrepassEnableText); } if (transparentDepthPostpassEnable != null) { m_MaterialEditor.ShaderProperty(transparentDepthPostpassEnable, StylesBaseUnlit.transparentDepthPostpassEnableText); } EditorGUI.indentLevel--; } // This function must finish with double sided option (see LitUI.cs) if (doubleSidedEnable != null) { m_MaterialEditor.ShaderProperty(doubleSidedEnable, StylesBaseUnlit.doubleSidedEnableText); } if (alphaCutoffEnable != null) { m_MaterialEditor.ShaderProperty(alphaCutoffEnable, StylesBaseUnlit.alphaCutoffEnableText); } if (alphaCutoffEnable != null && alphaCutoffEnable.floatValue == 1.0f) { EditorGUI.indentLevel++; m_MaterialEditor.ShaderProperty(alphaCutoff, StylesBaseUnlit.alphaCutoffText); if (useShadowThreshold != null) { m_MaterialEditor.ShaderProperty(useShadowThreshold, StylesBaseUnlit.useShadowThresholdText); } if (alphaCutoffShadow != null && useShadowThreshold != null && useShadowThreshold.floatValue == 1.0f) { EditorGUI.indentLevel++; m_MaterialEditor.ShaderProperty(alphaCutoffShadow, StylesBaseUnlit.alphaCutoffShadowText); EditorGUI.indentLevel--; } // With transparent object and few specific materials like Hair, we need more control on the cutoff to apply // This allow to get a better sorting (with prepass), better shadow (better silhouettes fidelity) etc... if (surfaceTypeValue == SurfaceType.Transparent) { if (transparentDepthPrepassEnable != null && transparentDepthPrepassEnable.floatValue == 1.0f) { m_MaterialEditor.ShaderProperty(alphaCutoffPrepass, StylesBaseUnlit.alphaCutoffPrepassText); } if (transparentDepthPostpassEnable != null && transparentDepthPostpassEnable.floatValue == 1.0f) { m_MaterialEditor.ShaderProperty(alphaCutoffPostpass, StylesBaseUnlit.alphaCutoffPostpassText); } } EditorGUI.indentLevel--; } }