internal static void OnToolGUI(EditorWindow window) { activeToolContext.OnToolGUI(window); if (Tools.s_Hidden || instance.m_ActiveTool == null) { return; } var current = instance.m_ActiveTool; using (new EditorGUI.DisabledScope(!current.IsAvailable())) { current.OnToolGUI(window); } var evt = Event.current; if (evt.type == EventType.KeyDown && evt.keyCode == KeyCode.Escape) { if (!Tools.viewToolActive && !EditorToolUtility.IsManipulationTool(EditorToolUtility.GetEnumWithEditorTool(current, instance.m_ActiveToolContext)) && additionalContextToolTypesCache.All(toolType => toolType != current.GetType())) { RestorePreviousPersistentTool(); evt.Use(); } else { //if is in a Manipulation or additional tool leaves the current context to return to GameObject Context ToolManager.SetActiveContext <GameObjectToolContext>(); } } }
static void UpdateToolContext() { if (selectMode.IsPositionMode() && ToolManager.activeContextType != typeof(PositionToolContext)) { ToolManager.SetActiveContext <PositionToolContext>(); } else if (selectMode.IsTextureMode() && ToolManager.activeContextType != typeof(TextureToolContext)) { ToolManager.SetActiveContext <TextureToolContext>(); } else if (!selectMode.IsPositionMode()) { ToolManager.SetActiveContext <GameObjectToolContext>(); } }