protected override void OnEnable() { base.OnEnable(); EditorApplication.editorApplicationQuit += EditorApplicationQuit; Undo.undoRedoPerformed += UndoRedoPerformed; m_KeyboardPanningID = GUIUtility.GetPermanentControlID(); m_MousePanningID = GUIUtility.GetPermanentControlID(); }
public MemoryTreeList(EditorWindow editorWindow, MemoryTreeList detailview) { this.m_MemorySelection = new MemoryElementSelection(); this.m_EditorWindow = editorWindow; this.m_DetailView = detailview; this.m_ControlID = GUIUtility.GetPermanentControlID(); this.SetupSplitter(); }
public MemoryTreeList(IProfilerWindowController profilerWindow, MemoryTreeList detailview) { m_MemorySelection = new MemoryElementSelection(); m_ProfilerWindow = profilerWindow; m_DetailView = detailview; m_ControlID = GUIUtility.GetPermanentControlID(); SetupSplitter(); }
protected override void OnEnable() { base.OnEnable(); EditorApplication.editorApplicationQuit = (UnityAction)Delegate.Combine(EditorApplication.editorApplicationQuit, new UnityAction(this.EditorApplicationQuit)); Undo.undoRedoPerformed = (Undo.UndoRedoCallback)Delegate.Combine(Undo.undoRedoPerformed, new Undo.UndoRedoCallback(this.UndoRedoPerformed)); this.m_KeyboardPanningID = GUIUtility.GetPermanentControlID(); this.m_MousePanningID = GUIUtility.GetPermanentControlID(); }
public override void OnCreated() { if (!(containerWindow is SceneView view)) { Debug.LogError("Scene Orientation Overlay was added to an EditorWindow that is not a Scene View."); return; } SetupRenderTexture(); // Register fade animators for cones for (int i = 0; i < dirVisible.Length; i++) { dirVisible[i].valueChanged.AddListener(view.Repaint); } for (int i = 0; i < dirNameVisible.Length; i++) { dirNameVisible[i].valueChanged.AddListener(view.Repaint); } m_RotationLocked.valueChanged.AddListener(view.Repaint); m_Visible.valueChanged.AddListener(view.Repaint); // Set correct label to be enabled from beginning int labelIndex = GetLabelIndexForView(view, view.rotation * Vector3.forward, view.orthographic); for (int i = 0; i < dirNameVisible.Length; i++) { dirNameVisible[i].value = (i == labelIndex); } m_RotationLocked.value = !view.isRotationLocked; m_Visible.value = (labelIndex != 8); GameObject cameraGO = EditorUtility.CreateGameObjectWithHideFlags("SceneCamera", HideFlags.HideAndDontSave, typeof(Camera)); m_Camera = cameraGO.GetComponent <Camera>(); m_Camera.enabled = false; m_Camera.cameraType = CameraType.SceneView; SwitchDirNameVisible(labelIndex); if (m_ViewDirectionControlIDs == null) { m_ViewDirectionControlIDs = new int[kDirectionRotations.Length]; for (int i = 0; i < m_ViewDirectionControlIDs.Length; ++i) { m_ViewDirectionControlIDs[i] = GUIUtility.GetPermanentControlID(); } m_CenterButtonControlID = GUIUtility.GetPermanentControlID(); m_RotationLockControlID = GUIUtility.GetPermanentControlID(); m_PerspectiveIsoControlID = GUIUtility.GetPermanentControlID(); } UpdateHeaderAndBackground(); }
private void InitList(SerializedObject serializedObject, SerializedProperty elements, IList elementList, bool draggable, bool displayHeader, bool displayAddButton, bool displayRemoveButton) { this.id = GUIUtility.GetPermanentControlID(); this.m_SerializedObject = serializedObject; this.m_Elements = elements; this.m_ElementList = elementList; this.m_Draggable = draggable; this.m_Dragging = false; this.m_SlideGroup = new GUISlideGroup(); this.displayAdd = displayAddButton; this.m_DisplayHeader = displayHeader; this.displayRemove = displayRemoveButton; if (this.m_Elements != null && !this.m_Elements.editable) { this.m_Draggable = false; } if (this.m_Elements != null && !this.m_Elements.isArray) { Debug.LogError("Input elements should be an Array SerializedProperty"); } }
public void Register(SceneView view) { // Register fade animators for cones for (int i = 0; i < dirVisible.Length; i++) { dirVisible[i].valueChanged.AddListener(view.Repaint); } for (int i = 0; i < dirNameVisible.Length; i++) { dirNameVisible[i].valueChanged.AddListener(view.Repaint); } m_RotationLocked.valueChanged.AddListener(view.Repaint); m_Visible.valueChanged.AddListener(view.Repaint); // Set correct label to be enabled from beginning int labelIndex = GetLabelIndexForView(view, view.rotation * Vector3.forward, view.orthographic); for (int i = 0; i < dirNameVisible.Length; i++) { dirNameVisible[i].value = (i == labelIndex); } m_RotationLocked.value = !view.isRotationLocked; m_Visible.value = (labelIndex != 8); SwitchDirNameVisible(labelIndex); if (m_ViewDirectionControlIDs == null) { m_ViewDirectionControlIDs = new int[kDirectionRotations.Length]; for (int i = 0; i < m_ViewDirectionControlIDs.Length; ++i) { m_ViewDirectionControlIDs[i] = GUIUtility.GetPermanentControlID(); } m_CenterButtonControlID = GUIUtility.GetPermanentControlID(); m_RotationLockControlID = GUIUtility.GetPermanentControlID(); m_PerspectiveIsoControlID = GUIUtility.GetPermanentControlID(); } }
private void Init() { if (this.id == -1) { this.id = GUIUtility.GetPermanentControlID(); } if (this.m_TimeArea == null) { this.m_TimeArea = new TimeArea(false); this.m_TimeArea.hRangeLocked = false; this.m_TimeArea.vRangeLocked = true; this.m_TimeArea.hSlider = false; this.m_TimeArea.vSlider = false; this.m_TimeArea.margin = 10f; this.m_TimeArea.scaleWithWindow = true; this.m_TimeArea.hTicks.SetTickModulosForFrameRate(30f); } if (this.styles == null) { this.styles = new Styles(); } }
void Init(TreeViewState state) { if (state == null) { throw new ArgumentNullException("state", "Invalid TreeViewState: it is null"); } m_TreeView = new TreeViewController(null, state); m_DataSource = new TreeViewControlDataSource(m_TreeView, this); m_GUI = new TreeViewControlGUI(m_TreeView, this); m_Dragging = new TreeViewControlDragging(m_TreeView, this); m_TreeView.Init(new Rect(), m_DataSource, m_GUI, m_Dragging); m_TreeView.searchChanged += SearchChanged; m_TreeView.selectionChangedCallback += SelectionChanged; m_TreeView.itemSingleClickedCallback += SingleClickedItem; m_TreeView.itemDoubleClickedCallback += DoubleClickedItem; m_TreeView.contextClickItemCallback += ContextClickedItem; m_TreeView.contextClickOutsideItemsCallback += ContextClicked; m_TreeView.expandedStateChanged += ExpandedStateChanged; m_TreeView.keyboardInputCallback += KeyEvent; m_TreeViewKeyControlID = GUIUtility.GetPermanentControlID(); }
public int GetPermanentControlID() { return(GUIUtility.GetPermanentControlID()); }
protected virtual void OnEnable() { m_PermanentControlID = GUIUtility.GetPermanentControlID(); }
public EffectDragging() { this.m_DragControlID = GUIUtility.GetPermanentControlID(); }
public SearchField() { this.m_ControlID = GUIUtility.GetPermanentControlID(); }
bool HandleEvent(EventType type, Event evt, WindowState state) { if (m_Id == 0) { m_Id = GUIUtility.GetPermanentControlID(); } bool isHandled = false; switch (type) { case EventType.ScrollWheel: isHandled = MouseWheel(evt, state); break; case EventType.MouseUp: { if (GUIUtility.hotControl == m_Id) { isHandled = MouseUp(evt, state); GUIUtility.hotControl = 0; evt.Use(); } } break; case EventType.MouseDown: { isHandled = evt.clickCount < 2 ? MouseDown(evt, state) : DoubleClick(evt, state); if (isHandled) { GUIUtility.hotControl = m_Id; } } break; case EventType.MouseDrag: { if (GUIUtility.hotControl == m_Id) { isHandled = MouseDrag(evt, state); } } break; case EventType.KeyDown: isHandled = KeyDown(evt, state); break; case EventType.KeyUp: isHandled = KeyUp(evt, state); break; case EventType.ContextClick: isHandled = ContextClick(evt, state); break; case EventType.ValidateCommand: isHandled = ValidateCommand(evt, state); break; case EventType.ExecuteCommand: isHandled = ExecuteCommand(evt, state); break; } if (isHandled) { evt.Use(); } return(isHandled); }
public void OnGUI(WindowState state, EventType rawType, Vector2 mousePosition) { if (m_Id == 0) { m_Id = GUIUtility.GetPermanentControlID(); } if (state == null || state.GetWindow().treeView == null) { return; } var evt = Event.current; if (rawType == EventType.MouseDown || evt.type == EventType.MouseDown) { if (state.IsCurrentEditingASequencerTextField()) { return; } m_ActiveRect = TimelineWindow.instance.sequenceContentRect; //remove the track header splitter overlap m_ActiveRect.x += k_HeaderSplitterOverlap; m_ActiveRect.width -= k_HeaderSplitterOverlap; if (!m_ActiveRect.Contains(mousePosition)) { return; } if (!CanStartRectangle(evt)) { return; } if (enableAutoPan) { m_TimeAreaAutoPanner = new TimeAreaAutoPanner(state); } m_StartPoint = new TimelinePoint(state, mousePosition); m_EndPixel = mousePosition; GUIUtility.hotControl = m_Id; //HACK: Because the treeView eats all the events, steal the hotControl if necessary... evt.Use(); return; } switch (evt.GetTypeForControl(m_Id)) { case EventType.KeyDown: { if (GUIUtility.hotControl == m_Id) { if (evt.keyCode == KeyCode.Escape) { m_TimeAreaAutoPanner = null; GUIUtility.hotControl = 0; evt.Use(); } } return; } case EventType.MouseDrag: { if (GUIUtility.hotControl != m_Id) { return; } m_EndPixel = mousePosition; evt.Use(); return; } case EventType.MouseUp: { if (GUIUtility.hotControl != m_Id) { return; } m_TimeAreaAutoPanner = null; var rect = CurrentRectangle(); if (IsValidRect(rect)) { OnFinish(evt, state, rect); } GUIUtility.hotControl = 0; evt.Use(); return; } } if (GUIUtility.hotControl == m_Id) { if (evt.type == EventType.Repaint) { var r = CurrentRectangle(); if (IsValidRect(r)) { using (new GUIViewportScope(m_ActiveRect)) { DrawRectangle(r); } } } if (m_TimeAreaAutoPanner != null) { m_TimeAreaAutoPanner.OnGUI(evt); } } }
public MultiColumnHeader(MultiColumnHeaderState state) { m_State = state; m_HeaderButtonsControlID = GUIUtility.GetPermanentControlID(); }