Skip to content

Commit a5b74c4

Browse files
dhsavellEvergreen
authored andcommitted
[UUM-76080] Fix additional SG Node Reference graphs being dirtied on open
1 parent 70abd7b commit a5b74c4

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

Packages/com.unity.shadergraph/Editor/Drawing/MaterialGraphEditWindow.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ public void AssetWasDeleted()
486486
UpdateTitle();
487487
}
488488

489-
public void UpdateTitle()
489+
public void UpdateTitle(bool ignoreUnsavedChanges = false)
490490
{
491491
string assetPath = AssetDatabase.GUIDToAssetPath(selectedGuid);
492492
string shaderName = Path.GetFileNameWithoutExtension(assetPath);
@@ -501,7 +501,7 @@ public void UpdateTitle()
501501
title = title + " (nothing loaded)";
502502
else
503503
{
504-
if (GraphHasChangedSinceLastSerialization())
504+
if (!ignoreUnsavedChanges && GraphHasChangedSinceLastSerialization())
505505
{
506506
hasUnsavedChanges = true;
507507
// This is the message EditorWindow will show when prompting to close while dirty
@@ -1260,6 +1260,7 @@ public void Initialize(string assetGuid)
12601260
using (GraphLoadMarker.Auto())
12611261
{
12621262
m_LastSerializedFileContents = File.ReadAllText(path, Encoding.UTF8);
1263+
12631264
graphObject = CreateInstance<GraphObject>();
12641265
graphObject.hideFlags = HideFlags.HideAndDontSave;
12651266
graphObject.graph = new GraphData
@@ -1268,6 +1269,7 @@ public void Initialize(string assetGuid)
12681269
isSubGraph = isSubGraph,
12691270
messageManager = messageManager
12701271
};
1272+
12711273
MultiJson.Deserialize(graphObject.graph, m_LastSerializedFileContents);
12721274
graphObject.graph.OnEnable();
12731275
graphObject.graph.ValidateGraph();
@@ -1281,8 +1283,7 @@ public void Initialize(string assetGuid)
12811283
};
12821284
}
12831285

1284-
UpdateTitle();
1285-
1286+
UpdateTitle(ignoreUnsavedChanges: true);
12861287
Repaint();
12871288
}
12881289
catch (Exception)

0 commit comments

Comments
 (0)