mirror of
https://github.com/Siccity/xNode.git
synced 2025-12-20 17:26:02 +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))) {
|
if (GUILayout.Button("Edit graph", GUILayout.Height(40))) {
|
||||||
SerializedProperty graphProp = serializedObject.FindProperty("graph");
|
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);
|
GUILayout.Space(EditorGUIUtility.singleLineHeight);
|
||||||
|
|||||||
@ -187,12 +187,13 @@ namespace XNodeEditor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Open the provided graph in the NodeEditor</summary>
|
/// <summary>Open the provided graph in the NodeEditor</summary>
|
||||||
public static void Open(XNode.NodeGraph graph) {
|
public static NodeEditorWindow Open(XNode.NodeGraph graph) {
|
||||||
if (!graph) return;
|
if (!graph) return null;
|
||||||
|
|
||||||
NodeEditorWindow w = GetWindow(typeof(NodeEditorWindow), false, "xNode", true) as NodeEditorWindow;
|
NodeEditorWindow w = GetWindow(typeof(NodeEditorWindow), false, "xNode", true) as NodeEditorWindow;
|
||||||
w.wantsMouseMove = true;
|
w.wantsMouseMove = true;
|
||||||
w.graph = graph;
|
w.graph = graph;
|
||||||
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Repaint all open NodeEditorWindows. </summary>
|
/// <summary> Repaint all open NodeEditorWindows. </summary>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user