internal static void DoBuiltinToolSettings(Rect rect, GUIStyle buttonLeftStyle, GUIStyle buttonRightStyle) { GUI.SetNextControlName("ToolbarToolPivotPositionButton"); Tools.pivotMode = (PivotMode)EditorGUI.CycleButton(new Rect(rect.x, rect.y, rect.width / 2, rect.height), (int)Tools.pivotMode, s_PivotIcons, buttonLeftStyle); if (Tools.current == Tool.Scale && Selection.transforms.Length < 2) { GUI.enabled = false; } GUI.SetNextControlName("ToolbarToolPivotOrientationButton"); PivotRotation tempPivot = (PivotRotation)EditorGUI.CycleButton(new Rect(rect.x + rect.width / 2, rect.y, rect.width / 2, rect.height), (int)Tools.pivotRotation, s_PivotRotation, buttonRightStyle); if (Tools.pivotRotation != tempPivot) { Tools.pivotRotation = tempPivot; if (tempPivot == PivotRotation.Global) { Tools.ResetGlobalHandleRotation(); } } if (Tools.current == Tool.Scale) { GUI.enabled = true; } if (GUI.changed) { Tools.RepaintAllToolViews(); } }
private void DoPivotButtons(Rect rect) { Tools.pivotMode = (PivotMode)EditorGUI.CycleButton(new Rect(rect.x, rect.y, rect.width / 2f, rect.height), (int)Tools.pivotMode, Toolbar.s_PivotIcons, "ButtonLeft"); if (Tools.current == Tool.Scale && Selection.transforms.Length < 2) { GUI.enabled = false; } PivotRotation pivotRotation = (PivotRotation)EditorGUI.CycleButton(new Rect(rect.x + rect.width / 2f, rect.y, rect.width / 2f, rect.height), (int)Tools.pivotRotation, Toolbar.s_PivotRotation, "ButtonRight"); if (Tools.pivotRotation != pivotRotation) { Tools.pivotRotation = pivotRotation; if (pivotRotation == PivotRotation.Global) { Tools.ResetGlobalHandleRotation(); } } if (Tools.current == Tool.Scale) { GUI.enabled = true; } if (GUI.changed) { Tools.RepaintAllToolViews(); } }
private void DoToolButtons() { GUI.changed = false; int num = (int)((!Tools.viewToolActive) ? Tools.current : Tool.View); for (int i = 1; i < 5; i++) { Toolbar.s_ShownToolIcons[i] = Toolbar.s_ToolIcons[i - 1 + ((i != num) ? 0 : 4)]; Toolbar.s_ShownToolIcons[i].tooltip = Toolbar.s_ToolIcons[i - 1].tooltip; } Toolbar.s_ShownToolIcons[0] = Toolbar.s_ViewToolIcons[(int)(Tools.viewTool + ((num != 0) ? 0 : 4))]; num = GUI.Toolbar(new Rect(10f, 5f, 160f, 24f), num, Toolbar.s_ShownToolIcons, "Command"); if (GUI.changed) { Tools.current = (Tool)num; } Tools.pivotMode = (PivotMode)EditorGUI.CycleButton(new Rect(190f, 8f, 64f, 18f), (int)Tools.pivotMode, Toolbar.s_PivotIcons, "ButtonLeft"); if (Tools.current == Tool.Scale && Selection.transforms.Length < 2) { GUI.enabled = false; } PivotRotation pivotRotation = (PivotRotation)EditorGUI.CycleButton(new Rect(254f, 8f, 64f, 18f), (int)Tools.pivotRotation, Toolbar.s_PivotRotation, "ButtonRight"); if (Tools.pivotRotation != pivotRotation) { Tools.pivotRotation = pivotRotation; if (pivotRotation == PivotRotation.Global) { Tools.ResetGlobalHandleRotation(); } } if (Tools.current == Tool.Scale) { GUI.enabled = true; } if (GUI.changed) { Tools.RepaintAllToolViews(); } }
internal static void ControlsHack() { Event evt = Event.current; if (kViewKey.activated) { Tools.current = 0; ResetGlobalHandleRotation(); evt.Use(); if (Toolbar.get) { Toolbar.get.Repaint(); } else { Debug.LogError("Press Play twice for sceneview keyboard shortcuts to work"); } } if (kMoveKey.activated) { Tools.current = Tool.Move; ResetGlobalHandleRotation(); evt.Use(); if (Toolbar.get) { Toolbar.get.Repaint(); } else { Debug.LogError("Press Play twice for sceneview keyboard shortcuts to work"); } } if (kRotateKey.activated) { Tools.current = Tool.Rotate; ResetGlobalHandleRotation(); evt.Use(); if (Toolbar.get) { Toolbar.get.Repaint(); } else { Debug.LogError("Press Play twice for sceneview keyboard shortcuts to work"); } } if (kScaleKey.activated) { Tools.current = Tool.Scale; ResetGlobalHandleRotation(); evt.Use(); if (Toolbar.get) { Toolbar.get.Repaint(); } else { Debug.LogError("Press Play twice for sceneview keyboard shortcuts to work"); } } if (kRectKey.activated) { Tools.current = Tool.Rect; ResetGlobalHandleRotation(); evt.Use(); if (Toolbar.get) { Toolbar.get.Repaint(); } else { Debug.LogError("Press Play twice for sceneview keyboard shortcuts to work"); } } if (kTransformKey.activated) { Tools.current = Tool.Transform; ResetGlobalHandleRotation(); evt.Use(); if (Toolbar.get) { Toolbar.get.Repaint(); } else { Debug.LogError("Press Play twice for sceneview keyboard shortcuts to work"); } } if (kPivotMode.activated) { pivotMode = (PivotMode)(1 - (int)pivotMode); ResetGlobalHandleRotation(); evt.Use(); Tools.RepaintAllToolViews(); } if (kPivotRotation.activated) { pivotRotation = (PivotRotation)(1 - (int)pivotRotation); ResetGlobalHandleRotation(); evt.Use(); Tools.RepaintAllToolViews(); } }
internal static void ControlsHack() { Event current = Event.current; if (Tools.kViewKey.activated) { Tools.current = Tool.View; Tools.ResetGlobalHandleRotation(); current.Use(); if (Toolbar.get) { Toolbar.get.Repaint(); } else { Debug.LogError("Press Play twice for sceneview keyboard shortcuts to work"); } } if (Tools.kMoveKey.activated) { Tools.current = Tool.Move; Tools.ResetGlobalHandleRotation(); current.Use(); if (Toolbar.get) { Toolbar.get.Repaint(); } else { Debug.LogError("Press Play twice for sceneview keyboard shortcuts to work"); } } if (Tools.kRotateKey.activated) { Tools.current = Tool.Rotate; Tools.ResetGlobalHandleRotation(); current.Use(); if (Toolbar.get) { Toolbar.get.Repaint(); } else { Debug.LogError("Press Play twice for sceneview keyboard shortcuts to work"); } } if (Tools.kScaleKey.activated) { Tools.current = Tool.Scale; Tools.ResetGlobalHandleRotation(); current.Use(); if (Toolbar.get) { Toolbar.get.Repaint(); } else { Debug.LogError("Press Play twice for sceneview keyboard shortcuts to work"); } } if (Tools.kRectKey.activated) { Tools.current = Tool.Rect; Tools.ResetGlobalHandleRotation(); current.Use(); if (Toolbar.get) { Toolbar.get.Repaint(); } else { Debug.LogError("Press Play twice for sceneview keyboard shortcuts to work"); } } if (Tools.kPivotMode.activated) { Tools.pivotMode = PivotMode.Pivot - (int)Tools.pivotMode; Tools.ResetGlobalHandleRotation(); current.Use(); Tools.RepaintAllToolViews(); } if (Tools.kPivotRotation.activated) { Tools.pivotRotation = PivotRotation.Global - (int)Tools.pivotRotation; Tools.ResetGlobalHandleRotation(); current.Use(); Tools.RepaintAllToolViews(); } }