Skip to content

Commit 585aa2a

Browse files
authored
Fix Exporting and Renaming model systems before they are loaded. (#220)
1 parent 44a805e commit 585aa2a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Code/XTMF/Editing/ProjectEditingSession.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,6 @@ public bool RenameModelSystem(ProjectModelSystem pms, string newName, ref string
324324
{
325325
lock (_EditingSessionsLock)
326326
{
327-
328327
var index = Project.IndexOf(pms);
329328
if (index < 0)
330329
{
@@ -341,6 +340,7 @@ public bool RenameModelSystem(ProjectModelSystem pms, string newName, ref string
341340
InvokeModelSystemNameChanged();
342341
}
343342
//In any case we need to save this change so everything updates accordingly
343+
Project.EnsureModelSystemLoaded(index);
344344
Project.ModelSystemStructure[index].Name = newName;
345345
}
346346
else
@@ -422,6 +422,7 @@ public bool ExportModelSystem(int modelSystemIndex, string fileName, ref string
422422
lock (_EditingSessions)
423423
{
424424
// If it is currently being edited, save that version
425+
Project.EnsureModelSystemLoaded(modelSystemIndex);
425426
var root = Project.ModelSystemStructure[modelSystemIndex];
426427
var editingSession = _EditingSessions.FirstOrDefault(s => s.Session != null && s.Session.IsEditing(root));
427428
if (editingSession.Session != null)

0 commit comments

Comments
 (0)