protected void DrawTools() { GUIContent[] contents = new GUIContent[tools.Count]; for (int i = 0; i < tools.Count; ++i) { contents[i] = new GUIContent(tools[i].icon, tools[i].name); } EditorGUILayout.Space(); GUILayout.Box(GUIContent.none, ObiEditorUtils.GetSeparatorLineStyle()); EditorGUILayout.Space(); EditorGUILayout.BeginVertical(EditorStyles.inspectorDefaultMargins); EditorGUI.BeginChangeCheck(); int newSelectedTool = ObiEditorUtils.DoToolBar(currentToolIndex, contents); EditorGUILayout.EndVertical(); if (EditorGUI.EndChangeCheck()) { if (currentTool != null) { currentTool.OnDisable(); } currentToolIndex = newSelectedTool; if (currentTool != null) { currentTool.OnEnable(); } SceneView.RepaintAll(); } if (currentTool != null) { EditorGUILayout.BeginVertical(EditorStyles.inspectorDefaultMargins); EditorGUILayout.LabelField(currentTool.name, EditorStyles.boldLabel); string help = currentTool.GetHelpString(); if (!help.Equals(string.Empty)) { EditorGUILayout.LabelField(help, EditorStyles.helpBox); } EditorGUILayout.EndVertical(); currentTool.OnInspectorGUI(); } }
public void BrushModes(ObiBrushBase paintBrush) { // Initialize the brush if there's no mode set: if (paintBrush.brushMode == null && brushModes.Count > 0) { paintBrush.brushMode = brushModes[0]; } GUIContent[] contents = new GUIContent[brushModes.Count]; for (int i = 0; i < brushModes.Count; ++i) { contents[i] = new GUIContent(brushModes[i].name); } EditorGUI.BeginChangeCheck(); selectedBrushMode = ObiEditorUtils.DoToolBar(selectedBrushMode, contents); if (EditorGUI.EndChangeCheck()) { paintBrush.brushMode = brushModes[selectedBrushMode]; } }