static void DisplayControls(SceneView sceneView) { InitStyles(); EditorGUI.BeginChangeCheck(); { var enabled = HaveNodesInSelection(); var values = editModes.Values; if (values.Count > 0) { using (new EditorGUI.DisabledScope(!enabled)) { var style = styles.toggleStyleMid; var groupRect = EditorGUILayout.GetControlRect(false, style.fixedHeight + style.margin.vertical, ChiselOverlay.kMinWidthLayout); groupRect.xMin -= 3; groupRect.yMin += 3; var startX = style.margin.left + groupRect.x + 4; var buttonStep = style.fixedWidth + style.margin.left; var position = new Rect(startX, groupRect.y, style.fixedWidth, style.fixedHeight); int xPos = 0; var count = values.Count; var index = 0; for (int i = 0; i < count; i++) { var editMode = values[i]; var toggleStyle = (index == 0) ? styles.toggleStyleLeft : (index == count - 1) && (count < 7) ? styles.toggleStyleRight : styles.toggleStyleMid; position.x = startX + (xPos * buttonStep); EditModeButton(position, enabled, editMode, toggleStyle); index++; xPos++; } // TODO: assign hotkey to rebuild, and possibly move it elsewhere to avoid it seemingly like a necessary action. xPos = 7; position.x = startX + (xPos * buttonStep); var buttonStyle = (index == 7) ? styles.toggleStyleRight : styles.toggleStyle; if (kRebuildButton == null) { kRebuildButton = ChiselEditorResources.GetIconContent(kRebuildIconName, kRebuildTooltip)[0]; } if (GUI.Toggle(position, false, kRebuildButton, buttonStyle)) { Rebuild(); } } } ChiselPlacementToolsSelectionWindow.RenderCreationTools(); } if (EditorGUI.EndChangeCheck()) { ChiselEditorSettings.Save(); } }
public override void OnGUI() { EditorGUI.BeginChangeCheck(); { ChiselPlacementToolsSelectionWindow.RenderCreationTools(); } if (EditorGUI.EndChangeCheck()) { ChiselEditorSettings.Save(); } }