void OnEnable() { // maximize does this weird crap where it doesn't disable or enable windows in the current layout when // entering or exiting maximized mode, but _does_ Enable/Disable the new maximized window instance. when // that happens the ProBuilderEditor loses the s_Instance due to that maximized instance taking over. // so in order to prevent the problems that occur when multiple instances of ProBuilderEditor, instead // ensure that there is always one true instance. we'll also skip initializing what are basically singleton // managers as well (ex, tool manager) if (s_Instance == null) { s_Instance = this; } ProBuilderToolManager.selectModeChanged += OnSelectModeChanged; m_Toolbar = new EditorToolbar(this); m_ToolManager = s_Instance == this ? new ProBuilderToolManager() : null; SceneView.duringSceneGui += OnSceneGUI; ProGridsInterface.SubscribePushToGridEvent(PushToGrid); ProGridsInterface.SubscribeToolbarEvent(ProGridsToolbarOpen); MeshSelection.objectSelectionChanged += OnObjectSelectionChanged; ProGridsToolbarOpen(ProGridsInterface.SceneToolbarIsExtended()); VertexManipulationTool.beforeMeshModification += BeforeMeshModification; VertexManipulationTool.afterMeshModification += AfterMeshModification; LoadSettings(); InitGUI(); EditorApplication.delayCall += () => UpdateSelection(); SetOverrideWireframe(true); selectMode = s_LastActiveSelectMode; }
/// <summary> /// Toggles between the SelectMode values and updates the graphic handles as necessary. /// </summary> internal void ToggleSelectionMode() { ProBuilderToolManager.NextMeshSelectMode(); Refresh(); }