[EventHandlerAttribute(EventType.MouseDown, -2)] // Absolute second to call! private static void HandleSelecting(NodeEditorInputInfo inputInfo) { if (inputInfo.inputEvent.button == 0 && inputInfo.editorState.focusedNode != inputInfo.editorState.selectedNode) { // Select focussed Node unfocusControlsForState = inputInfo.editorState; inputInfo.editorState.selectedNode = inputInfo.editorState.focusedNode; #if UNITY_EDITOR NodeEditorState state = inputInfo.editorState; Node prevSelection = state.selectedNode, newSelection = state.focusedNode; UndoPro.UndoProManager.RecordOperation( () => NodeEditorUndoActions.SetNodeSelection(state, newSelection), () => NodeEditorUndoActions.SetNodeSelection(state, prevSelection), "Node Selection", false, true); #endif } #if UNITY_EDITOR if (inputInfo.editorState.selectedNode != null) { UnityEditor.Selection.activeObject = inputInfo.editorState.selectedNode; } else if (UnityEditor.Selection.activeObject is Node) { UnityEditor.Selection.activeObject = inputInfo.editorState.canvas; } #endif }
[EventHandlerAttribute(EventType.MouseDown, -2)] // Absolute second to call! private static void HandleSelecting(NodeEditorInputInfo inputInfo) { if (inputInfo.inputEvent.button == 0 && inputInfo.editorState.focusedNode != inputInfo.editorState.selectedNode) { // Select focussed Node inputInfo.editorState.selectedNode = inputInfo.editorState.focusedNode; #if UNITY_EDITOR NodeEditorState state = inputInfo.editorState; Node prevSelection = state.selectedNode, newSelection = state.focusedNode; UndoPro.UndoProManager.RecordOperation( () => NodeEditorUndoActions.SetNodeSelection(state, newSelection), () => NodeEditorUndoActions.SetNodeSelection(state, prevSelection), "Node Selection", false, true); #endif // Make sure previous controls get unfocussed later, but except if control is in newly selected node unfocusControlsForState = inputInfo.editorState; unfocusControlsHot = GUIUtility.hotControl; unfocusControlsKeyboard = GUIUtility.keyboardControl; } #if UNITY_EDITOR if (inputInfo.editorState.selectedNode != null) { UnityEditor.Selection.activeObject = inputInfo.editorState.selectedNode; } else if (UnityEditor.Selection.activeObject is Node) { UnityEditor.Selection.activeObject = inputInfo.editorState.canvas; } #endif }