protected override void OnNodeInspectorGUI() { if (GUILayout.Button("Refresh")) { GatherPorts(); } //if (sourceFunction == null){ var functions = graph.GetAllNodesOfType <CustomFunctionEvent>(); var currentFunc = functions.FirstOrDefault(i => i.UID == sourceFunctionUID); var newFunc = EditorUtils.Popup <CustomFunctionEvent>("Target Function", currentFunc, functions); if (newFunc != currentFunc) { SetFunction(newFunc); } //} base.OnNodeInspectorGUI(); if (sourceFunction != null && !string.IsNullOrEmpty(sourceFunction.identifier.value) && GUILayout.Button("Find Source FunctionNode")) { sourceFunctionNode = null; var targetFunctionNode = graph.GetAllNodesOfType <CustomFunctionEvent>().FirstOrDefault(z => z.identifier.value == sourceFunction.identifier.value); if (targetFunctionNode != null) { sourceFunctionNode = targetFunctionNode; } } if (sourceFunctionNode != null && GUILayout.Button(string.Format("functionNode:{0}", sourceFunctionNode.identifier.value))) { NodeCanvas.Editor.GraphEditorUtility.activeElement = sourceFunctionNode; } }
//... public void SetFunction(CustomFunctionEvent func) { sourceFunctionUID = func != null? func.UID : null; sourceFunction = func != null? func : null; GatherPorts(); }
//... public void SetFunction(CustomFunctionEvent func) { _sourceOutputUID = func != null ? func.UID : null; _sourceFunctionRef = new System.WeakReference <CustomFunctionEvent>(func); GatherPorts(); }