public static void DoWireframeSurfaceOptions(WireframeProperties properties, MaterialEditor materialEditor, Material material) { materialEditor.ShaderProperty(properties.wireframeSmoothness, Styles.wireframeSmoothnessText); if (material.HasProperty("_WorkflowMode")) { bool isSpecularWorkFlow = (LitGUI.WorkflowMode)material.GetFloat("_WorkflowMode") == LitGUI.WorkflowMode.Specular; if (isSpecularWorkFlow) { materialEditor.ShaderProperty(properties.wireframeSpecColor, Styles.wireframeSpecularText); } else { materialEditor.ShaderProperty(properties.wireframeMetallic, Styles.wireframeMetallicText); } } EditorGUI.BeginChangeCheck(); Color emissionColor = properties.wireframeEmissionColor.colorValue; emissionColor = EditorGUILayout.ColorField(Styles.wireframeEmissionText, emissionColor, true, false, true, GUILayout.ExpandWidth(false)); if (EditorGUI.EndChangeCheck()) { properties.wireframeEmissionColor.colorValue = emissionColor; } }
public static void DoWireframe(WireframeProperties properties, MaterialEditor materialEditor, Material material) { EditorGUI.BeginChangeCheck(); var wireframemode = (int)properties.wireframeMode.floatValue; wireframemode = EditorGUILayout.Popup(Styles.wireframeModeText, wireframemode, Styles.wireframeModeName); if (EditorGUI.EndChangeCheck()) { properties.wireframeMode.floatValue = wireframemode; } EditorGUI.indentLevel++; EditorGUI.BeginChangeCheck(); var wireframeSize = properties.wireframeSize.floatValue; wireframeSize = EditorGUILayout.FloatField(Styles.wireframeSizeText, wireframeSize, GUILayout.ExpandWidth(false)); if (EditorGUI.EndChangeCheck()) { properties.wireframeSize.floatValue = wireframeSize; } materialEditor.ShaderProperty(properties.wireframeQuad, Styles.wireframeQuadText); EditorGUI.BeginChangeCheck(); Color baseColor = properties.wireframeBaseColor.colorValue; baseColor = EditorGUILayout.ColorField(Styles.wireframeColorText, baseColor, true, true, false, GUILayout.ExpandWidth(false)); if (EditorGUI.EndChangeCheck()) { properties.wireframeBaseColor.colorValue = baseColor; } if (properties.wireframeSmoothness != null) { DoWireframeSurfaceOptions(properties, materialEditor, material); } EditorGUI.indentLevel--; if (properties.wireframeStyle != null) { materialEditor.ShaderProperty(properties.wireframeStyle, Styles.wireframeStyleText); bool enableStyle = properties.wireframeStyle.floatValue != 0; if (enableStyle) { EditorGUI.indentLevel++; DoWireframeStyle(properties, materialEditor); EditorGUI.indentLevel--; } } }
public static void DoWireframeStyle(WireframeProperties properties, MaterialEditor materialEditor) { materialEditor.ShaderProperty(properties.wireframeSqueeze, Styles.wireframeSqueezeText); bool enableSqueeze = properties.wireframeSqueeze.floatValue != 0; EditorGUI.BeginDisabledGroup(!enableSqueeze); EditorGUI.indentLevel++; materialEditor.ShaderProperty(properties.wireframeSqueezeMin, Styles.wireframeSqueezeMinText); materialEditor.ShaderProperty(properties.wireframeSqueezeMax, Styles.wireframeSqueezeMaxText); EditorGUI.indentLevel--; EditorGUI.EndDisabledGroup(); materialEditor.ShaderProperty(properties.wireframeDash, Styles.wireframeDashText); bool enableDash = properties.wireframeDash.floatValue != 0; EditorGUI.BeginDisabledGroup(!enableDash); EditorGUI.indentLevel++; WireframeMode wireframeMode = (WireframeMode)properties.wireframeMode.floatValue; if (wireframeMode == WireframeMode.BarycentricSpace) { EditorGUI.BeginChangeCheck(); var dashRepeat = (int)properties.wireframeDashRepeat.floatValue; dashRepeat = EditorGUILayout.IntSlider(Styles.wireframeDashRepeatText, dashRepeat, 1, 10); if (EditorGUI.EndChangeCheck()) { properties.wireframeDashRepeat.floatValue = dashRepeat; } } else { materialEditor.ShaderProperty(properties.wireframeDashRepeat, Styles.wireframeDashRepeatText); } materialEditor.ShaderProperty(properties.wireframeDashLength, Styles.wireframeDashLengthText); if (wireframeMode == WireframeMode.BarycentricSpace) { materialEditor.ShaderProperty(properties.wireframeDashOverlap, Styles.wireframeDashOverlapText); } EditorGUI.indentLevel--; EditorGUI.EndDisabledGroup(); }