mirror of
https://github.com/Siccity/xNode.git
synced 2026-03-26 22:49:02 +08:00
!B(NodeEditorWindow) multiple NodeEditorWindow,Target error
This commit is contained in:
parent
33a516b6e2
commit
daf7fb9f9f
@ -33,7 +33,17 @@ namespace XNodeEditor {
|
|||||||
|
|
||||||
foreach (var window in windows)
|
foreach (var window in windows)
|
||||||
{
|
{
|
||||||
window.Close();
|
if (window)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
window.Close();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
DestroyImmediate(window);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +113,8 @@ namespace XNodeEditor {
|
|||||||
public float zoom { get { return _zoom; } set { _zoom = Mathf.Clamp(value, NodeEditorPreferences.GetSettings().minZoom, NodeEditorPreferences.GetSettings().maxZoom); Repaint(); } }
|
public float zoom { get { return _zoom; } set { _zoom = Mathf.Clamp(value, NodeEditorPreferences.GetSettings().minZoom, NodeEditorPreferences.GetSettings().maxZoom); Repaint(); } }
|
||||||
private float _zoom = 1;
|
private float _zoom = 1;
|
||||||
|
|
||||||
void OnFocus() {
|
void OnFocus()
|
||||||
|
{
|
||||||
current = this;
|
current = this;
|
||||||
ValidateGraphEditor();
|
ValidateGraphEditor();
|
||||||
if (graphEditor != null && NodeEditorPreferences.GetSettings().autoSave) AssetDatabase.SaveAssets();
|
if (graphEditor != null && NodeEditorPreferences.GetSettings().autoSave) AssetDatabase.SaveAssets();
|
||||||
@ -239,15 +250,26 @@ namespace XNodeEditor {
|
|||||||
|
|
||||||
if (!w)
|
if (!w)
|
||||||
{
|
{
|
||||||
w = CreateWindow<NodeEditorWindow>("xNode");
|
w = EditorWindow.CreateInstance<NodeEditorWindow>();
|
||||||
|
w.titleContent = new GUIContent("xNode");
|
||||||
}
|
}
|
||||||
|
|
||||||
w.Show(true);
|
w.Show(true);
|
||||||
w.Focus();
|
w.Focus();
|
||||||
|
|
||||||
|
if (w.graphEditor == null)
|
||||||
|
{
|
||||||
|
NodeGraphEditor graphEditor = NodeGraphEditor.GetEditor(graph, w);
|
||||||
|
w.graphEditor = graphEditor;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//refresh target
|
||||||
|
w.graphEditor.target = graph;
|
||||||
|
}
|
||||||
|
|
||||||
w.wantsMouseMove = true;
|
w.wantsMouseMove = true;
|
||||||
w.graph = graph;
|
w.graph = graph;
|
||||||
NodeGraphEditor graphEditor = NodeGraphEditor.GetEditor(graph, w);
|
|
||||||
NodeEditorWindow.current.graphEditor = graphEditor;
|
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user