private void BakeSettings() { if (GUILayout.Button("Set default parameters", new GUILayoutOption[1] { GUILayout.Width(150f) })) { GUIUtility.keyboardControl = 0; StaticOcclusionCulling.SetDefaultOcclusionBakeSettings(); } GUILayout.Label(OcclusionCullingWindow.s_Styles.defaultParameterText.tooltip, EditorStyles.helpBox, new GUILayoutOption[0]); EditorGUI.BeginChangeCheck(); float num1 = EditorGUILayout.FloatField(OcclusionCullingWindow.s_Styles.smallestOccluder, StaticOcclusionCulling.smallestOccluder, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { StaticOcclusionCulling.smallestOccluder = num1; } EditorGUI.BeginChangeCheck(); float num2 = EditorGUILayout.FloatField(OcclusionCullingWindow.s_Styles.smallestHole, StaticOcclusionCulling.smallestHole, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { StaticOcclusionCulling.smallestHole = num2; } EditorGUI.BeginChangeCheck(); float num3 = EditorGUILayout.Slider(OcclusionCullingWindow.s_Styles.backfaceThreshold, StaticOcclusionCulling.backfaceThreshold, 5f, 100f, new GUILayoutOption[0]); if (!EditorGUI.EndChangeCheck()) { return; } StaticOcclusionCulling.backfaceThreshold = num3; }
private void BakeSettings() { float width = 150f; GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Width(width) }; if (GUILayout.Button("Set default parameters", options)) { GUIUtility.keyboardControl = 0; StaticOcclusionCulling.SetDefaultOcclusionBakeSettings(); } GUILayout.Label(s_Styles.defaultParameterText.tooltip, EditorStyles.helpBox, new GUILayoutOption[0]); EditorGUI.BeginChangeCheck(); float num2 = EditorGUILayout.FloatField(s_Styles.smallestOccluder, StaticOcclusionCulling.smallestOccluder, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { StaticOcclusionCulling.smallestOccluder = num2; } EditorGUI.BeginChangeCheck(); float num3 = EditorGUILayout.FloatField(s_Styles.smallestHole, StaticOcclusionCulling.smallestHole, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { StaticOcclusionCulling.smallestHole = num3; } EditorGUI.BeginChangeCheck(); float num4 = EditorGUILayout.Slider(s_Styles.backfaceThreshold, StaticOcclusionCulling.backfaceThreshold, 5f, 100f, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { StaticOcclusionCulling.backfaceThreshold = num4; } }
void BakeSettings() { // Button for setting default values float buttonWidth = 150; if (GUILayout.Button("Set default parameters", GUILayout.Width(buttonWidth))) { Undo.RegisterCompleteObjectUndo(StaticOcclusionCulling.occlusionCullingSettings, "Set Default Parameters"); GUIUtility.keyboardControl = 0; // Force focus out from potentially selected field for default parameters setting StaticOcclusionCulling.SetDefaultOcclusionBakeSettings(); } // Label for default parameter setting GUILayout.Label(s_Styles.defaultParameterText.tooltip, EditorStyles.helpBox); // Edit Smallest Occluder EditorGUI.BeginChangeCheck(); float smallestOccluder = EditorGUILayout.FloatField(s_Styles.smallestOccluder, StaticOcclusionCulling.smallestOccluder); if (EditorGUI.EndChangeCheck()) { Undo.RegisterCompleteObjectUndo(StaticOcclusionCulling.occlusionCullingSettings, "Change Smallest Occluder"); StaticOcclusionCulling.smallestOccluder = smallestOccluder; } // Edit smallest hole EditorGUI.BeginChangeCheck(); float smallestHole = EditorGUILayout.FloatField(s_Styles.smallestHole, StaticOcclusionCulling.smallestHole); if (EditorGUI.EndChangeCheck()) { Undo.RegisterCompleteObjectUndo(StaticOcclusionCulling.occlusionCullingSettings, "Change Smallest Hole"); StaticOcclusionCulling.smallestHole = smallestHole; } // Edit backface threshold EditorGUI.BeginChangeCheck(); float backfaceThreshold = EditorGUILayout.Slider(s_Styles.backfaceThreshold, StaticOcclusionCulling.backfaceThreshold, 5.0F, 100.0F); if (EditorGUI.EndChangeCheck()) { Undo.RegisterCompleteObjectUndo(StaticOcclusionCulling.occlusionCullingSettings, "Change Backface Threshold"); StaticOcclusionCulling.backfaceThreshold = backfaceThreshold; } }