private void OnButtonGUI(Rect sourcePosition) { if (GUI.Button(sourcePosition, "Edit Graph")) { GraphWindow.OpenActive(GraphReference.New((IMacro)metadata.value, true)); } }
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 OnEditButtonGUI(Rect position) { EditorGUI.BeginDisabledGroup(reference == null); if (GUI.Button(position, "Edit Graph", Styles.editButton)) { GraphWindow.OpenActive(reference); } EditorGUI.EndDisabledGroup(); }
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); }