mirror of
https://github.com/Siccity/xNode.git
synced 2025-12-20 09:16:01 +08:00
Added focus selected node
This commit is contained in:
parent
1d43244a8f
commit
5597e565d1
@ -32,7 +32,8 @@ namespace XNodeEditor {
|
||||
|
||||
if (GUILayout.Button("Edit graph", GUILayout.Height(40))) {
|
||||
SerializedProperty graphProp = serializedObject.FindProperty("graph");
|
||||
NodeEditorWindow.Open(graphProp.objectReferenceValue as XNode.NodeGraph);
|
||||
NodeEditorWindow w = NodeEditorWindow.Open(graphProp.objectReferenceValue as XNode.NodeGraph);
|
||||
w.Home(); // Focus selected node
|
||||
}
|
||||
|
||||
GUILayout.Space(EditorGUIUtility.singleLineHeight);
|
||||
|
||||
@ -187,12 +187,13 @@ namespace XNodeEditor {
|
||||
}
|
||||
|
||||
/// <summary>Open the provided graph in the NodeEditor</summary>
|
||||
public static void Open(XNode.NodeGraph graph) {
|
||||
if (!graph) return;
|
||||
public static NodeEditorWindow Open(XNode.NodeGraph graph) {
|
||||
if (!graph) return null;
|
||||
|
||||
NodeEditorWindow w = GetWindow(typeof(NodeEditorWindow), false, "xNode", true) as NodeEditorWindow;
|
||||
w.wantsMouseMove = true;
|
||||
w.graph = graph;
|
||||
return w;
|
||||
}
|
||||
|
||||
/// <summary> Repaint all open NodeEditorWindows. </summary>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user