mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 15:44:36 +00:00
Misc fixes associated to looseAssetFiles handling and lookups for LevelAssets
- Adds proper marking of Load status for levelAsset, so if no mis file is defined then the asset fails to load and has proper error code - Adjusts the get*Path() util methods for getting stuff like postFXPrefix or decal files to have a fallback if one isn't currently defined in the assetDef, as it could be a broken link but the file does exist - Adjusts saving logic of level so it will properly update the levelAsset for postfx prefix or decal files so if they were added after creation of the assetdef, they're saved and updated as expected - Adjusts the setter methods for the *File fields to correctly separate the File variable and Path variable to make things behave more clearly and consistently. - Keeps checks for *.mis.decals file pattern, but shifts new creations of decals files to just be *.decals to better match other level-associated files like *.nav or *.forest
This commit is contained in:
parent
85ffb307cd
commit
f6f06121ab
5 changed files with 108 additions and 26 deletions
|
|
@ -29,7 +29,7 @@ function LevelAsset::onCreateNew(%this)
|
|||
AssetName = %assetName;
|
||||
versionId = 1;
|
||||
LevelFile = %assetName @ %misExtension;
|
||||
DecalsFile = %assetName @ ".mis.decals";
|
||||
DecalsFile = %assetName @ ".decals";
|
||||
PostFXPresetFile = %assetName @ ".postfxpreset." @ $TorqueScriptFileExtension;
|
||||
ForestFile = %assetName @ ".forest";
|
||||
NavmeshFile = %assetName @ ".nav";
|
||||
|
|
|
|||
|
|
@ -2004,6 +2004,10 @@ function beginLevelImport()
|
|||
{
|
||||
%asset.decalsFile = %fileBase @ ".decal";
|
||||
}
|
||||
else if(isFile(%filePath @ "/" @ %fileBase @ "decal"))
|
||||
{
|
||||
%asset.decalsFile = %fileBase @ "decal";
|
||||
}
|
||||
else if(isFile(%filePath @ "/" @ %fileBase @ "mis.decal"))
|
||||
{
|
||||
%asset.decalsFile = %fileBase @ "mis.decal";
|
||||
|
|
|
|||
|
|
@ -361,20 +361,36 @@ function EditorSaveMission()
|
|||
%obj.onSaveMission( $Server::MissionFile );
|
||||
}
|
||||
|
||||
//We'll sanity check that we have a valid file association to our level asset first
|
||||
//Force a refresh of the associated paths if they're valid files when we save out the assetDef
|
||||
%presetFile = $Server::LevelAsset.getPostFXPresetPath();
|
||||
|
||||
if(!isFile(%presetFile))
|
||||
if(isFile(%presetFile))
|
||||
{
|
||||
//if it isn't valid, we'll fabricate a new one just to be sure
|
||||
$Server::LevelAsset.PostFXPresetFile = fileBase($Server::LevelAsset.getLevelPath()) @ $PostFXManager::fileExtension;
|
||||
|
||||
$Server::LevelAsset.saveAsset();
|
||||
$Server::LevelAsset.refresh();
|
||||
|
||||
%presetFile = $Server::LevelAsset.getPostFXPresetPath();
|
||||
$Server::LevelAsset.postFXPresetFile = fileName(%presetFile);
|
||||
}
|
||||
|
||||
%decalsFile = $Server::LevelAsset.getDecalsPath();
|
||||
if(isFile(%decalsFile))
|
||||
{
|
||||
echo("===================================================================");
|
||||
echo("DECALS FILE BE: " @ fileName(%decalsFile));
|
||||
$Server::LevelAsset.decalsFile = fileName(%decalsFile);
|
||||
}
|
||||
|
||||
%forestFile = $Server::LevelAsset.getForestPath();
|
||||
if(isFile(%forestFile))
|
||||
{
|
||||
$Server::LevelAsset.forestFile = fileName(%forestFile);
|
||||
}
|
||||
|
||||
%navMeshFile = $Server::LevelAsset.getNavmeshPath();
|
||||
if(isFile(%navMeshFile))
|
||||
{
|
||||
$Server::LevelAsset.navmeshFile = fileName(%navMeshFile);
|
||||
}
|
||||
|
||||
$Server::LevelAsset.saveAsset();
|
||||
$Server::LevelAsset.refresh();
|
||||
|
||||
//Save out the PostFX config
|
||||
PostFXManager::savePresetHandler( %presetFile );
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue