public static SubscribeToolbarEvent ( Action listener ) : void | ||
listener | Action | |
Résultat | void |
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; }
void OnEnable() { s_Instance = this; #if UNITY_2019_1_OR_NEWER SceneView.duringSceneGui += OnSceneGUI; #else SceneView.onSceneGUIDelegate += OnSceneGUI; #endif ProGridsInterface.SubscribePushToGridEvent(PushToGrid); ProGridsInterface.SubscribeToolbarEvent(ProGridsToolbarOpen); MeshSelection.objectSelectionChanged += OnObjectSelectionChanged; ProGridsToolbarOpen(ProGridsInterface.SceneToolbarIsExtended()); #if !UNITY_2018_2_OR_NEWER s_ResetOnSceneGUIState = typeof(SceneView).GetMethod("ResetOnSceneGUIState", BindingFlags.Instance | BindingFlags.NonPublic); #endif VertexManipulationTool.beforeMeshModification += BeforeMeshModification; VertexManipulationTool.afterMeshModification += AfterMeshModification; LoadSettings(); InitGUI(); UpdateSelection(); SetOverrideWireframe(true); if (selectModeChanged != null) { selectModeChanged(selectMode); } }
void OnEnable() { s_Instance = this; SceneView.duringSceneGui += OnSceneGUI; ProGridsInterface.SubscribePushToGridEvent(PushToGrid); ProGridsInterface.SubscribeToolbarEvent(ProGridsToolbarOpen); MeshSelection.objectSelectionChanged += OnObjectSelectionChanged; ProGridsToolbarOpen(ProGridsInterface.SceneToolbarIsExtended()); VertexManipulationTool.beforeMeshModification += BeforeMeshModification; VertexManipulationTool.afterMeshModification += AfterMeshModification; ToolManager.activeToolChanged += ActiveToolChanged; LoadSettings(); InitGUI(); EditorApplication.delayCall += () => UpdateSelection(); SetOverrideWireframe(true); if (selectModeChanged != null) { selectModeChanged(selectMode); } }