static void OnGUIContents(SpiralStairsGenerator generator, bool isSceneGUI) { GUILayout.BeginVertical(GUIStyleUtility.ContentEmpty); { EditorGUI.BeginChangeCheck(); var totalSteps = Mathf.Max(IntValueSettings(generator.TotalSteps, TotalStepsContent, TotalStepsTooltip, isSceneGUI), 1); if (EditorGUI.EndChangeCheck()) { generator.TotalSteps = totalSteps; } EditorGUI.BeginChangeCheck(); var stepDepth = Mathf.Max(FloatUnitsSettings(generator.StepDepth, StepDepthContent, StepDepthTooltip, isSceneGUI), SpiralStairsSettings.kMinStepDepth); if (EditorGUI.EndChangeCheck()) { generator.StepDepth = stepDepth; } EditorGUI.BeginChangeCheck(); var stepHeight = Mathf.Max(FloatUnitsSettings(generator.StepHeight, StepHeightContent, StepHeightTooltip, isSceneGUI), SpiralStairsSettings.kMinStepHeight); if (EditorGUI.EndChangeCheck()) { generator.StepHeight = stepHeight; } GUILayout.Space(4); EditorGUI.BeginChangeCheck(); var stairsWidth = Mathf.Max(FloatUnitsSettings(generator.StairsWidth, StairsWidthContent, StairsWidthTooltip, isSceneGUI), 0.01f); if (EditorGUI.EndChangeCheck()) { generator.StairsWidth = stairsWidth; } EditorGUI.BeginChangeCheck(); var stairsHeight = Mathf.Max(FloatUnitsSettings(generator.StairsHeight, StairsHeightContent, StairsHeightTooltip, isSceneGUI), 0.01f); if (EditorGUI.EndChangeCheck()) { generator.StairsHeight = stairsHeight; } EditorGUI.BeginChangeCheck(); var stairsDepth = Mathf.Max(FloatUnitsSettings(generator.StairsDepth, StairsDepthContent, StairsDepthTooltip, isSceneGUI), 0.01f); if (EditorGUI.EndChangeCheck()) { generator.StairsDepth = stairsDepth; } GUILayout.Space(4); EditorGUI.BeginChangeCheck(); var extraDepth = Mathf.Max(FloatUnitsSettings(generator.ExtraDepth, ExtraDepthContent, ExtraDepthTooltip, isSceneGUI), 0); if (EditorGUI.EndChangeCheck()) { generator.ExtraDepth = extraDepth; } EditorGUI.BeginChangeCheck(); var extraHeight = Mathf.Max(FloatUnitsSettings(generator.ExtraHeight, ExtraHeightContent, ExtraHeightTooltip, isSceneGUI), 0); if (EditorGUI.EndChangeCheck()) { generator.ExtraHeight = extraHeight; } } GUILayout.EndVertical(); }
public static bool OnShowGUI(SpiralStairsGenerator generator, bool isSceneGUI) { GUIStyleUtility.InitStyles(); OnGUIContents(generator, isSceneGUI); return(true); }
void ResetTool() { RealtimeCSG.Grid.ForceGrid = false; if (!freedrawGenerator) { freedrawGenerator = ScriptableObject.CreateInstance <FreeDrawGenerator>(); freedrawGenerator.snapFunction = CSGBrushEditorManager.SnapPointToGrid; freedrawGenerator.raySnapFunction = CSGBrushEditorManager.SnapPointToRay; freedrawGenerator.shapeCancelled = OnShapeCancelledEvent; freedrawGenerator.shapeCommitted = OnShapeCommittedEvent; } if (!cylinderGenerator) { cylinderGenerator = ScriptableObject.CreateInstance <CylinderGenerator>(); cylinderGenerator.snapFunction = CSGBrushEditorManager.SnapPointToGrid; cylinderGenerator.raySnapFunction = CSGBrushEditorManager.SnapPointToRay; cylinderGenerator.shapeCancelled = OnShapeCancelledEvent; cylinderGenerator.shapeCommitted = OnShapeCommittedEvent; } if (!boxGenerator) { boxGenerator = ScriptableObject.CreateInstance <BoxGenerator>(); boxGenerator.snapFunction = CSGBrushEditorManager.SnapPointToGrid; boxGenerator.raySnapFunction = CSGBrushEditorManager.SnapPointToRay; boxGenerator.shapeCancelled = OnShapeCancelledEvent; boxGenerator.shapeCommitted = OnShapeCommittedEvent; } if (!sphereGenerator) { sphereGenerator = ScriptableObject.CreateInstance <SphereGenerator>(); sphereGenerator.snapFunction = CSGBrushEditorManager.SnapPointToGrid; sphereGenerator.raySnapFunction = CSGBrushEditorManager.SnapPointToRay; sphereGenerator.shapeCancelled = OnShapeCancelledEvent; sphereGenerator.shapeCommitted = OnShapeCommittedEvent; } if (!linearStairsGenerator) { linearStairsGenerator = ScriptableObject.CreateInstance <LinearStairsGenerator>(); linearStairsGenerator.snapFunction = CSGBrushEditorManager.SnapPointToGrid; linearStairsGenerator.raySnapFunction = CSGBrushEditorManager.SnapPointToRay; linearStairsGenerator.shapeCancelled = OnShapeCancelledEvent; linearStairsGenerator.shapeCommitted = OnShapeCommittedEvent; } if (!spiralStairsGenerator) { spiralStairsGenerator = ScriptableObject.CreateInstance <SpiralStairsGenerator>(); spiralStairsGenerator.snapFunction = CSGBrushEditorManager.SnapPointToGrid; spiralStairsGenerator.raySnapFunction = CSGBrushEditorManager.SnapPointToRay; spiralStairsGenerator.shapeCancelled = OnShapeCancelledEvent; spiralStairsGenerator.shapeCommitted = OnShapeCommittedEvent; } var generator = InternalCurrentGenerator; if (generator != null) { var obj = generator as ScriptableObject; if (obj) { generator.Init(); } } }