Merge pull request #306 from Areloch/MiscFixes20200828

Misc Fixes for level saving and selecting asset paths
This commit is contained in:
Brian Roberts 2020-08-30 07:24:04 -05:00 committed by GitHub
commit 82f7db3d48
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 87 additions and 35 deletions

View file

@ -364,14 +364,17 @@ function EditorSaveMissionAs( %levelAsset )
$Server::MissionFile = %missionName;
%Server::LevelAsset = %levelAssetDef;
//Update the scene name to comply to the new level's name
GetRootScene().name = %levelAssetDef.AssetName;
//Do the save
EditorSaveMission();
//TODO: doublecheck that we rename the scene properly
//Make sure we have a selected module so we can create our module
//if(AssetBrowser.selectedModule $= "")
// Canvas.pushDialog(
//Last, we're going to load the level proper in the editor
updateEditorRecentLevelsList(%levelAsset);
//If we've opened a valid level, clear the saveAs tag as it's not really applicable now
EditorGui.saveAs = false;
}
function EditorAutoSaveMission()
@ -485,33 +488,7 @@ function EditorOpenMission(%levelAsset)
%levelAssetId = %levelAsset;
}
EditorSettings.setValue("WorldEditor/lastEditedLevel", %levelAssetId);
//update the recent levels list
%recentLevels = EditorSettings.value("WorldEditor/recentLevelsList");
%recentCount = getTokenCount(%recentLevels, ",");
%updatedRecentList = %levelAssetId;
%updatedRecentCount = 1;
for(%i=0; %i < %recentCount; %i++)
{
%recentEntry = getToken(%recentLevels, ",", %i);
if(%levelAssetId $= %recentEntry)
continue;
%updatedRecentList = %updatedRecentList @ "," @ %recentEntry;
%updatedRecentCount++;
if(%updatedRecentCount == 10)
break;
}
EditorSettings.setValue("WorldEditor/recentLevelsList", %updatedRecentList);
updateRecentLevelsListing();
updateEditorRecentLevelsList(%levelAssetId);
%filename = %assetDef.getlevelFile();
@ -590,6 +567,37 @@ function MakeSelectionASublevel()
%b = EWorldEditor.getSelectedObject(1);*/
}
function updateEditorRecentLevelsList(%levelAssetId)
{
EditorSettings.setValue("WorldEditor/lastEditedLevel", %levelAssetId);
//update the recent levels list
%recentLevels = EditorSettings.value("WorldEditor/recentLevelsList");
%recentCount = getTokenCount(%recentLevels, ",");
%updatedRecentList = %levelAssetId;
%updatedRecentCount = 1;
for(%i=0; %i < %recentCount; %i++)
{
%recentEntry = getToken(%recentLevels, ",", %i);
if(%levelAssetId $= %recentEntry)
continue;
%updatedRecentList = %updatedRecentList @ "," @ %recentEntry;
%updatedRecentCount++;
if(%updatedRecentCount == 10)
break;
}
EditorSettings.setValue("WorldEditor/recentLevelsList", %updatedRecentList);
updateRecentLevelsListing();
}
function EditorExportToCollada()
{