protected internal void InitBase() { NodeEditor.RecalculateFrom(this); if (!NodeEditor.curNodeCanvas.nodes.Contains(this)) { NodeEditor.curNodeCanvas.nodes.Add(this); } #if UNITY_EDITOR if (String.IsNullOrEmpty(name)) { name = UnityEditor.ObjectNames.NicifyVariableName(GetID); } #endif NodeEditor.RepaintClients(); }
private static void HandleSelecting(NodeEditorInputInfo inputInfo) { NodeEditorState state = inputInfo.editorState; if (inputInfo.inputEvent.button == 0 && state.focusedNode != state.selectedNode) { unfocusControlsForState = state; state.selectedNode = state.focusedNode; NodeEditor.RepaintClients(); #if UNITY_EDITOR if (state.selectedNode != null) { UnityEditor.Selection.activeObject = state.selectedNode; } #endif } }
private static void HandleNodeDragging(NodeEditorInputInfo inputInfo) { NodeEditorState state = inputInfo.editorState; if (state.dragNode) { if (state.selectedNode != null && GUIUtility.hotControl == 0) { state.dragOffset = inputInfo.inputPos - state.dragStart; state.selectedNode.rect.position = state.dragPos + state.dragOffset * state.zoom; NodeEditorCallbacks.IssueOnMoveNode(state.selectedNode); NodeEditor.RepaintClients(); } else { state.dragNode = false; } } }
public void LoadNodeCanvas(string path) { if (!File.Exists(path) || (nodeCanvas = NodeEditorSaveManager.LoadNodeCanvas(path, true)) == null) { NewNodeCanvas(); return; } editorState = NodeEditorSaveManager.ExtractEditorState(nodeCanvas, MainEditorStateIdentifier); openedCanvasPath = path; #if UNITY_EDITOR if (useCache) { SaveCache(); } #endif NodeEditor.RecalculateAll(nodeCanvas); NodeEditor.RepaintClients(); }
private static void HandleZooming(NodeEditorInputInfo inputInfo) { inputInfo.editorState.zoom = (float)Math.Round(Math.Min(6.0, Math.Max(0.6, inputInfo.editorState.zoom + inputInfo.inputEvent.delta.y / 15)), 2); NodeEditor.RepaintClients(); }
public void SaveNodeCanvas(string path) { nodeCanvas.editorStates = new NodeEditorState[] { editorState }; NodeEditorSaveManager.SaveNodeCanvas(path, nodeCanvas, true); NodeEditor.RepaintClients(); }
public void SetCanvas(NodeCanvas canvas) { nodeCanvas = canvas; editorState = NodeEditorSaveManager.ExtractEditorState(nodeCanvas, MainEditorStateIdentifier); NodeEditor.RepaintClients(); }