mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-19 22:53:47 +00:00
- Reimplements autosave logic to handle levels, subscenes and terrains in a more consistent, reliable way.
- Adds entry to RMB menu in Asset Browser to restore an asset to a backup copy taken from autosaves - Adds reparent out-of-bounds objects button to SceneGroup inspector - Adds ability to have SubScene have a different loading bounds from the actual subscene bounds, allowing load triggering to happen ahead of the bounds of the subscene itself - Fixes asset importer handling of animFPS field to be the correct type - Adds onInspect handling to GameBase allowing better handling for any game class type with editor integration - Add getAssetLooseFileCount and getAssetLooseFile to AssetManager to be able to iterate over all loose files associated to an asset - Add standard/default preload function def to forestItem - Fixes handling of text placement on GuiIconButtonCtrl when text is set to the right - Adds setGlobalCenter utility function - Adds ability to set guiInputCtrl active state - Matched util functions for tracking if left and right mouse buttons are down to EditTSCtrl alongside the existing middle mouse - Add empty element sanity check to appMesh loader - Add callback for GameBase when game is created - Add default graphics options config for steamdeck - Fix typo in assetImportConfig default - Filters SceneGroup utility buttons in inspector to only show for relevent class types
This commit is contained in:
parent
70502d1b0f
commit
bb7ee38bf4
33 changed files with 978 additions and 237 deletions
|
|
@ -520,4 +520,87 @@ function AssetBrowser::openFolderLocation(%this, %folderPath)
|
|||
systemCommand(%cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
function AssetBrowser::getAssetBackupCount(%this, %assetId)
|
||||
{
|
||||
//process it and then check if we have any autosave backups
|
||||
%processedId = strReplace(EditAssetPopup.assetId, ":", "_");
|
||||
%autosavePath = "tools/autosave/" @ %processedId @ "/";
|
||||
|
||||
RestoreBackupListPopup.clearItems();
|
||||
|
||||
if(isDirectory(%autosavePath))
|
||||
{
|
||||
%dirs = getDirectoryList(%autosavePath);
|
||||
%count = getFieldCount(%dirs);
|
||||
|
||||
return %count;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
function AssetBrowser::restoreAssetBackup(%this, %assetId, %index)
|
||||
{
|
||||
if(!AssetDatabase.isDeclaredAsset(%assetId))
|
||||
{
|
||||
error("AssetBrowser::restoreAssetBackup() - Attempted to restore backed up version of asset: " @ %assetId @ " but asset is not validly declared!");
|
||||
return;
|
||||
}
|
||||
|
||||
//process it and then check if we have any autosave backups
|
||||
%processedId = strReplace(%assetId, ":", "_");
|
||||
%autosavePath = "tools/autosave/" @ %processedId @ "/";
|
||||
|
||||
if(isDirectory(%autosavePath))
|
||||
{
|
||||
%dirs = getDirectoryList(%autosavePath);
|
||||
%count = getFieldCount(%dirs);
|
||||
if(%count > 0)
|
||||
{
|
||||
%saveArray = new ArrayObject(){};
|
||||
//loop over the entries and find the oldest one
|
||||
for(%f=0; %f < %count; %f++)
|
||||
{
|
||||
%saveArray.add(getField(%dirs, %f));
|
||||
}
|
||||
|
||||
%saveArray.sortk();
|
||||
|
||||
%folderName = %saveArray.getKey(%index);
|
||||
|
||||
//now we just copy the contents of the folder into our assetId path and refresh
|
||||
%assetPath = AssetDatabase.getAssetPath(%assetId);
|
||||
|
||||
%autosaveFullPath = %autosavePath @ "/" @ %folderName @ "/";
|
||||
%autosaveFullPath = strReplace(%autosaveFullPath, "//", "/");
|
||||
|
||||
%file = findFirstFile( %autosaveFullPath @ "*.*" );
|
||||
while( %file !$= "" )
|
||||
{
|
||||
%fileName = fileName(%file);
|
||||
%assetFileName = %assetPath @ "/" @ %fileName;
|
||||
|
||||
warn("| Copying file from: " @ %file @ " to: " @ %assetFileName);
|
||||
if(!pathCopy(%file, %assetFileName, false))
|
||||
{
|
||||
error("AssetBrowser::restoreAssetBackup() - Something went wrong when copying the file: " @ %file @ " to " @ %assetFileName);
|
||||
}
|
||||
|
||||
%file = findNextFile( %autosaveFullPath @ "*.*" );
|
||||
}
|
||||
|
||||
AssetBrowser.reloadAsset(%assetId);
|
||||
}
|
||||
else
|
||||
{
|
||||
error("AssetBrowser::restoreAssetBackup() - Attempted to restore backed up version of asset: " @ %assetId @ " but no autosaves were found!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error("AssetBrowser::restoreAssetBackup() - Attempted to restore backed up version of asset: " @ %assetId @ " but autosave directory doesn't exist!");
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue