private void OpenGraphAsset(UnityObject unityObject, bool shouldSetSceneAsDirty) { shouldCloseWindow = true; ScriptGraphAsset scriptGraphAsset = unityObject as ScriptGraphAsset; GraphReference graphReference = null; if (scriptGraphAsset != null) { graphReference = GraphReference.New(scriptGraphAsset, true); } else { StateGraphAsset stateGraphAsset = unityObject as StateGraphAsset; if (stateGraphAsset != null) { graphReference = GraphReference.New(stateGraphAsset, true); } } if (shouldSetSceneAsDirty) { EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene()); } GraphWindow.OpenActive(graphReference); GUIUtility.ExitGUI(); }
private void OnButtonGUI(Rect sourcePosition) { if (GUI.Button(sourcePosition, "Edit Graph")) { GraphWindow.OpenActive(GraphReference.New((IMacro)metadata.value, true)); } }
protected void CreateGraph() { m_Macro = ScriptableObject.CreateInstance <ScriptGraphAsset>(); AssetDatabase.CreateAsset(m_Macro, k_AssetPath); m_Graph = m_Macro.graph; m_Canvas = new FlowCanvas(m_Graph); m_Reference = GraphReference.New(m_Macro, false); m_GameObject = new GameObject(); m_Machine = m_GameObject.AddComponent <FlowMachine>(); m_Machine.nest.macro = m_Macro; }
private void DropAreaGUI() { Event currentEvent = Event.current; Rect activeArea = GUILayoutUtility.GetRect(0, 0, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); switch (currentEvent.type) { case EventType.DragUpdated: case EventType.DragPerform: if (!activeArea.Contains(currentEvent.mousePosition)) { return; } DragAndDrop.visualMode = DragAndDropVisualMode.Copy; if (currentEvent.type == EventType.DragPerform) { DragAndDrop.AcceptDrag(); foreach (UnityObject draggedObject in DragAndDrop.objectReferences) { ScriptGraphAsset scriptGraphAsset = draggedObject as ScriptGraphAsset; if (scriptGraphAsset != null) { shouldCloseWindow = true; GraphWindow.OpenActive(GraphReference.New(scriptGraphAsset, true)); break; } } } break; } }
private void OpenGraphAsset(UnityObject unityObject) { shouldCloseWindow = true; ScriptGraphAsset scriptGraphAsset = unityObject as ScriptGraphAsset; GraphReference graphReference = null; if (scriptGraphAsset != null) { graphReference = GraphReference.New(scriptGraphAsset, true); } else { StateGraphAsset stateGraphAsset = unityObject as StateGraphAsset; if (stateGraphAsset != null) { graphReference = GraphReference.New(stateGraphAsset, true); } } GraphWindow.OpenActive(graphReference); }
public static bool OnOpenVFX(int instanceID, int line) { UnityObject obj = EditorUtility.InstanceIDToObject(instanceID); GraphReference reference = null; if (obj is IMacro macro) { reference = GraphReference.New(macro, true); } else if (obj is IGraphRoot root) { reference = GraphReference.New(root, false); } if (obj is IGraphNesterElement nesterElement) { reference = LudiqGraphsEditorUtility.editedContext.value.reference.ChildReference(nesterElement, false); } if (reference == null) { return(false); } GraphWindow.OpenActive(reference); return(true); }
public GraphReference ToReference(bool ensureValid) { return(GraphReference.New(EditorUtility.InstanceIDToObject(rootObjectInstanceID), parentElementGuids, ensureValid)); }