public static void OnInspectorGUI(EditorWindow window, float height) { lastGuiRect = Rect.MinMaxRect(-1, -1, -1, -1); var tool = CSGBrushEditorManager.ActiveTool as MeshEditBrushTool; GUIStyleUtility.InitStyles(); InitLocalStyles(); OnGUIContents(false, tool); }
public static void OnInspectorGUI(GenerateBrushTool tool, EditorWindow window, float height) { lastGuiRect = Rect.MinMaxRect(-1, -1, -1, -1); tool.CurrentGenerator.StartGUI(); GUIStyleUtility.InitStyles(); InitLocalStyles(); OnGUIContents(tool, false, height); tool.CurrentGenerator.FinishGUI(); }
static void OnHierarchyWindowItemOnGUI(int instanceID, Rect selectionRect) { var o = EditorUtility.InstanceIDToObject(instanceID) as GameObject; if (selectionRect.Contains(Event.current.mousePosition)) { Transform t = (o == null) ? null : o.transform; OnHandleDragAndDrop(inSceneView: false, transformInInspector: t, selectionRect: selectionRect); } if (o == null) { return; } GUIStyleUtility.InitStyles(); var node = o.GetComponent <CSGNode>(); if (node == null || !node.enabled || (node.hideFlags & (HideFlags.HideInHierarchy | HideFlags.HideInInspector)) != 0) { return; } CSGOperationType operationType = CSGOperationType.Additive; var brush = node as CSGBrush; if (brush != null) { operationType = brush.OperationType; var skin = GUIStyleUtility.Skin; GUI.Label(selectionRect, skin.hierarchyOperations[(int)operationType], GUIStyleUtility.rightAlignedLabel); return; } var operation = node as CSGOperation; if (operation != null) { var skin = GUIStyleUtility.Skin; if (!operation.PassThrough) { operationType = operation.OperationType; var operationTypeIndex = (int)operationType; if (operationTypeIndex >= 0 && operationTypeIndex < skin.hierarchyOperations.Length) { GUI.Label(selectionRect, skin.hierarchyOperations[operationTypeIndex], GUIStyleUtility.rightAlignedLabel); } } else { GUI.Label(selectionRect, skin.hierarchyPassThrough, GUIStyleUtility.rightAlignedLabel); } return; } }
public static void OnInspectorGUI(EditorWindow window, float height) { lastGuiRect = Rect.MinMaxRect(-1, -1, -1, -1); var tool = CSGBrushEditorManager.ActiveTool as ClipBrushTool; doCommit = false; // unity bug workaround doCancel = false; // unity bug workaround GUIStyleUtility.InitStyles(); InitLocalStyles(); OnGUIContents(false, tool); if (tool != null) { if (doCommit) { tool.Commit(); // unity bug workaround } if (doCancel) { tool.Cancel(); // unity bug workaround } } }
public static void OnSceneGUI(Rect windowRect, MeshEditBrushTool tool) { GUIStyleUtility.InitStyles(); InitLocalStyles(); GUILayout.BeginHorizontal(GUIStyleUtility.ContentEmpty); { GUILayout.BeginVertical(GUIStyleUtility.ContentEmpty); { GUILayout.BeginVertical(GUIStyleUtility.ContentEmpty); { GUILayout.FlexibleSpace(); GUIStyleUtility.ResetGUIState(); GUIStyle windowStyle = GUI.skin.window; GUILayout.BeginVertical(ContentMeshLabel, windowStyle, GUIStyleUtility.ContentEmpty); { OnGUIContents(true, tool); } GUILayout.EndVertical(); var currentArea = GUILayoutUtility.GetLastRect(); lastGuiRect = currentArea; var buttonArea = currentArea; buttonArea.x += buttonArea.width - 17; buttonArea.y += 2; buttonArea.height = 13; buttonArea.width = 13; if (GUI.Button(buttonArea, GUIContent.none, "WinBtnClose")) { CSGBrushEditorWindow.GetWindow(); } TooltipUtility.SetToolTip(GUIStyleUtility.PopOutTooltip, buttonArea); int controlID = GUIUtility.GetControlID(SceneViewMeshOverlayHash, FocusType.Keyboard, currentArea); switch (Event.current.GetTypeForControl(controlID)) { case EventType.MouseDown: { if (currentArea.Contains(Event.current.mousePosition)) { GUIUtility.hotControl = controlID; GUIUtility.keyboardControl = controlID; Event.current.Use(); } break; } case EventType.MouseMove: { if (currentArea.Contains(Event.current.mousePosition)) { Event.current.Use(); } break; } case EventType.MouseUp: { if (GUIUtility.hotControl == controlID) { GUIUtility.hotControl = 0; GUIUtility.keyboardControl = 0; Event.current.Use(); } break; } case EventType.MouseDrag: { if (GUIUtility.hotControl == controlID) { Event.current.Use(); } break; } case EventType.ScrollWheel: { if (currentArea.Contains(Event.current.mousePosition)) { Event.current.Use(); } break; } } } GUILayout.EndVertical(); } GUILayout.EndVertical(); GUILayout.FlexibleSpace(); } GUILayout.EndHorizontal(); }
public static bool OnShowGUI(BoxGenerator generator, bool isSceneGUI) { GUIStyleUtility.InitStyles(); OnGUIContents(generator, isSceneGUI); return(true); }
public static void ShowGUI(SceneView sceneView, bool haveOffset = true) { if (!localStyles) { miniTextStyle = new GUIStyle(EditorStyles.miniLabel); miniTextStyle.contentOffset = new Vector2(0, -1); textInputStyle = new GUIStyle(EditorStyles.miniTextField); textInputStyle.padding.top--; textInputStyle.margin.top += 2; localStyles = true; } GUIStyleUtility.InitStyles(); if (sceneView != null) { float height = sceneView.position.height; //Screen.height; float width = sceneView.position.width; //Screen.width; Rect bottomBarRect; if (haveOffset) { #if UNITY_5_5_OR_NEWER bottomBarRect = new Rect(0, height - (GUIStyleUtility.BottomToolBarHeight + 18), width, GUIStyleUtility.BottomToolBarHeight); #else bottomBarRect = new Rect(0, height - (GUIStyleUtility.BottomToolBarHeight + SceneView.kToolbarHeight + 1), width, GUIStyleUtility.BottomToolBarHeight); #endif } else { bottomBarRect = new Rect(0, height - (GUIStyleUtility.BottomToolBarHeight + 1), width, GUIStyleUtility.BottomToolBarHeight); } try { Handles.BeginGUI(); bool prevGUIChanged = GUI.changed; if (Event.current.type == EventType.Repaint) { GUIStyleUtility.BottomToolBarStyle.Draw(bottomBarRect, false, false, false, false); } OnBottomBarGUI(sceneView, bottomBarRect); GUI.changed = prevGUIChanged || GUI.changed; int controlID = GUIUtility.GetControlID(BottomBarGUIHash, FocusType.Keyboard, bottomBarRect); var type = Event.current.GetTypeForControl(controlID); //Debug.Log(controlID + " " + GUIUtility.hotControl + " " + type + " " + bottomBarRect.Contains(Event.current.mousePosition)); switch (type) { case EventType.MouseDown: { if (bottomBarRect.Contains(Event.current.mousePosition)) { GUIUtility.hotControl = controlID; GUIUtility.keyboardControl = controlID; Event.current.Use(); } break; } case EventType.MouseMove: { if (bottomBarRect.Contains(Event.current.mousePosition)) { Event.current.Use(); } break; } case EventType.MouseUp: { if (GUIUtility.hotControl == controlID) { GUIUtility.hotControl = 0; GUIUtility.keyboardControl = 0; Event.current.Use(); } break; } case EventType.MouseDrag: { if (GUIUtility.hotControl == controlID) { Event.current.Use(); } break; } case EventType.ScrollWheel: { if (bottomBarRect.Contains(Event.current.mousePosition)) { Event.current.Use(); } break; } } //TooltipUtility.HandleAreaOffset(new Vector2(-bottomBarRect.xMin, -bottomBarRect.yMin)); } finally { Handles.EndGUI(); } } }