private static void OnTopToolbarGUI(int windowID) { EditorGUILayout.BeginHorizontal(); MainMode currentMode = CurrentSettings.CurrentMode; if (CurrentSettings.OverrideMode != OverrideMode.None) { currentMode = (MainMode)(-1); } MainMode newMainMode = SabreGUILayout.DrawEnumGrid(currentMode, GUILayout.Width(50)); if (newMainMode != currentMode) { csgModel.SetCurrentMode(newMainMode); } /* * bool isClipMode = (CurrentSettings.OverrideMode == OverrideMode.Clip); * if(SabreGUILayout.Toggle(isClipMode, "Clip")) * { * csgModel.SetOverrideMode(OverrideMode.Clip); * } * else * { * if(isClipMode) * { * csgModel.ExitOverrideMode(); * } * } * * bool isDrawMode = (CurrentSettings.OverrideMode == OverrideMode.Draw); * * if(SabreGUILayout.Toggle(isDrawMode, "Draw")) * { * csgModel.SetOverrideMode(OverrideMode.Draw); * } * else * { * if(isDrawMode) * { * csgModel.ExitOverrideMode(); * } * } */ EditorGUILayout.EndHorizontal(); }
private static void OnTopToolbarGUI(int windowID) { EditorGUILayout.BeginHorizontal(); // csgModel.SetCurrentMode(SabreGUILayout.DrawEnumGrid(CurrentSettings.CurrentMode, GUILayout.Width(67))); csgModel.SetCurrentMode(SabreGUILayout.DrawEnumGrid(CurrentSettings.CurrentMode, GUILayout.Width(50))); /* * bool isClipMode = (CurrentSettings.OverrideMode == OverrideMode.Clip); * if(SabreGUILayout.Toggle(isClipMode, "Clip")) * { * csgModel.SetOverrideMode(OverrideMode.Clip); * } * else * { * if(isClipMode) * { * csgModel.ExitOverrideMode(); * } * } * * bool isDrawMode = (CurrentSettings.OverrideMode == OverrideMode.Draw); * * if(SabreGUILayout.Toggle(isDrawMode, "Draw")) * { * csgModel.SetOverrideMode(OverrideMode.Draw); * } * else * { * if(isDrawMode) * { * csgModel.ExitOverrideMode(); * } * } */ EditorGUILayout.EndHorizontal(); }
private void OnToolbarGUI(int windowID) { EditorGUILayout.Space(); restrictToFace = SabreGUILayout.Toggle(restrictToFace, "Restrict To Face"); drawingMode = SabreGUILayout.DrawEnumGrid(drawingMode); // radius slider EditorGUILayout.BeginHorizontal(); GUI.color = Color.black; GUILayout.Label("Radius"); GUI.color = Color.white; brushRadius = EditorGUILayout.Slider("", brushRadius, 0.1f, 5f, GUILayout.MaxWidth(128)); EditorGUILayout.EndHorizontal(); // opacity slider EditorGUILayout.BeginHorizontal(); GUI.color = Color.black; GUILayout.Label("Opacity"); GUI.color = Color.white; switch (drawingMode) { case DrawingMode.Color: colorBrushStrength = EditorGUILayout.Slider("", colorBrushStrength, 0f, 1f, GUILayout.MaxWidth(128)); break; case DrawingMode.R: redBrushStrength = EditorGUILayout.Slider("", redBrushStrength, 0f, 1f, GUILayout.MaxWidth(128)); break; case DrawingMode.G: greenBrushStrength = EditorGUILayout.Slider("", greenBrushStrength, 0f, 1f, GUILayout.MaxWidth(128)); break; case DrawingMode.B: blueBrushStrength = EditorGUILayout.Slider("", blueBrushStrength, 0f, 1f, GUILayout.MaxWidth(128)); break; case DrawingMode.Alpha: alphaBrushStrength = EditorGUILayout.Slider("", alphaBrushStrength, 0f, 1f, GUILayout.MaxWidth(128)); break; } EditorGUILayout.EndHorizontal(); switch (drawingMode) { case DrawingMode.Color: // color picker field colorBrushColor = SabreGUILayout.ColorField(new GUIContent("Color"), colorBrushColor, false, false, GUILayout.MaxWidth(183)); // color blending mode EditorGUILayout.BeginHorizontal(); GUI.color = Color.black; GUILayout.Label("Blending"); GUI.color = Color.white; colorBrushBlendingMode = (BlendingMode)EditorGUILayout.EnumPopup(colorBrushBlendingMode, GUILayout.MaxWidth(96)); EditorGUILayout.EndHorizontal(); break; case DrawingMode.R: // red color slider EditorGUILayout.BeginHorizontal(); GUI.color = Color.black; GUILayout.Label("Red"); GUI.color = Color.white; redBrushColor = EditorGUILayout.Slider("", redBrushColor, 0f, 1f, GUILayout.MaxWidth(128)); EditorGUILayout.EndHorizontal(); break; case DrawingMode.G: // green color slider EditorGUILayout.BeginHorizontal(); GUI.color = Color.black; GUILayout.Label("Green"); GUI.color = Color.white; greenBrushColor = EditorGUILayout.Slider("", greenBrushColor, 0f, 1f, GUILayout.MaxWidth(128)); EditorGUILayout.EndHorizontal(); break; case DrawingMode.B: // blue color slider EditorGUILayout.BeginHorizontal(); GUI.color = Color.black; GUILayout.Label("Blue"); GUI.color = Color.white; blueBrushColor = EditorGUILayout.Slider("", blueBrushColor, 0f, 1f, GUILayout.MaxWidth(128)); EditorGUILayout.EndHorizontal(); break; case DrawingMode.Alpha: // alpha color slider EditorGUILayout.BeginHorizontal(); GUI.color = Color.black; GUILayout.Label("Alpha"); GUI.color = Color.white; alphaBrushColor = EditorGUILayout.Slider("", alphaBrushColor, 0f, 1f, GUILayout.MaxWidth(128)); EditorGUILayout.EndHorizontal(); break; } // draw color palette: DrawToolbarPalette(); }
private static void OnTopToolbarGUI(int windowID) { csgModel.SetCurrentMode(SabreGUILayout.DrawEnumGrid(CurrentSettings.CurrentMode, GUILayout.Width(50))); }