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 OpenEditorToolbar() { if (s_EditorToolbar != null) { DestroyImmediate(s_EditorToolbar); } s_EditorToolbar = ScriptableObject.CreateInstance <EditorToolbar>(); s_EditorToolbar.hideFlags = HideFlags.HideAndDontSave; s_EditorToolbar.InitWindowProperties(this); }
void Menu_ToggleIconMode() { s_IsIconGui.value = !s_IsIconGui.value; if (s_EditorToolbar != null) { DestroyImmediate(s_EditorToolbar); } s_EditorToolbar = ScriptableObject.CreateInstance <EditorToolbar>(); s_EditorToolbar.hideFlags = HideFlags.HideAndDontSave; s_EditorToolbar.InitWindowProperties(this); }
void InitGUI() { if (s_EditorToolbar != null) { UObject.DestroyImmediate(s_EditorToolbar); } s_EditorToolbar = ScriptableObject.CreateInstance <EditorToolbar>(); s_EditorToolbar.hideFlags = HideFlags.HideAndDontSave; s_EditorToolbar.InitWindowProperties(this); VertexTranslationInfoStyle = new GUIStyle(); VertexTranslationInfoStyle.normal.background = EditorGUIUtility.whiteTexture; VertexTranslationInfoStyle.normal.textColor = new Color(1f, 1f, 1f, .6f); VertexTranslationInfoStyle.padding = new RectOffset(3, 3, 3, 0); }
void IconModeChanged() { m_Toolbar.Dispose(); m_Toolbar = new EditorToolbar(this); }