mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-27 23:35:45 +00:00
* Update levelAsset creation so it can be flagged to be creating a subScene preemptively, improving workflow when creating a SubScene level asset 'in place' via the inspector.
* Fixed issue of creating new SubScene using the full level template instead of a blank level file * Fixed subScene inspector field handling so clicking the create new will mark the 'in place' created level asset as a subscene appropriately * Changed up persistenceManager logic when parsing objects out - especially with specialty fields - to use Strings instead of const char* to simplify memory juggling and improve stability * Rolled back specialty array field outputs for decal roads and convex shapes to have the field names in the output again * Added sanity check for MeshRoad's when writing out via specialty array field to ensure there are profile nodes before trying to write any * Added sanity check to avoid pointlessly writing out meshroad and river position field into subScene file as it could cause a transform double-up and cause them to move when loading from a subscene
This commit is contained in:
parent
f71f4e051f
commit
0d338f2d51
10 changed files with 124 additions and 84 deletions
|
|
@ -4,7 +4,13 @@ function AssetBrowser::setupCreateNewLevelAsset(%this)
|
|||
NewAssetPropertiesInspector.addField("LevelName", "Level Name", "String", "Human-readable name of new level", "", "", %this.newAssetSettings);
|
||||
NewAssetPropertiesInspector.addField("levelPreviewImage", "Level Preview Image", "Image", "Preview Image for the level", "", "", %this.newAssetSettings);
|
||||
|
||||
NewAssetPropertiesInspector.addField("isSubScene", "Is SubScene", "bool", "Is this levelAsset intended as a subScene", "", "", %this.newAssetSettings);
|
||||
//If we forcefully set it elsewhere, adhere
|
||||
if($createLevelAssetIsSubScene == true)
|
||||
%this.newAssetSettings.isSubScene = true;
|
||||
else
|
||||
%this.newAssetSettings.isSubScene = false;
|
||||
|
||||
NewAssetPropertiesInspector.addField("isSubScene", "Is SubScene", "bool", "Is this levelAsset intended as a subScene", %this.newAssetSettings.isSubScene, "", %this.newAssetSettings);
|
||||
|
||||
NewAssetPropertiesInspector.endGroup();
|
||||
}
|
||||
|
|
@ -27,6 +33,7 @@ function AssetBrowser::createLevelAsset(%this)
|
|||
%tamlpath = %assetPath @ %assetName @ ".asset.taml";
|
||||
%levelPath = %assetPath @ %assetName @ %misExtension;
|
||||
|
||||
|
||||
%asset = new LevelAsset()
|
||||
{
|
||||
AssetName = %assetName;
|
||||
|
|
@ -55,7 +62,24 @@ function AssetBrowser::createLevelAsset(%this)
|
|||
echo("Unable to copy template level file!");
|
||||
}
|
||||
|
||||
replaceInFile(%levelPath, "EditorTemplateLevel", %assetName);
|
||||
if(%asset.isSubScene)
|
||||
{
|
||||
%fileObj = new FileObject();
|
||||
if (!%fileObj.openForWrite(%levelPath))
|
||||
{
|
||||
echo("Unable to write subScene file!");
|
||||
}
|
||||
else
|
||||
{
|
||||
%fileObj.writeLine("");
|
||||
%fileObj.close();
|
||||
%fileObj.delete();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
replaceInFile(%levelPath, "EditorTemplateLevel", %assetName);
|
||||
}
|
||||
|
||||
//Generate the associated files
|
||||
DecalManagerSave( %assetPath @ %asset.DecalsFile );
|
||||
|
|
@ -87,6 +111,8 @@ function AssetBrowser::setupCreateNewSubScene(%this)
|
|||
|
||||
function AssetBrowser::editLevelAsset(%this, %assetDef)
|
||||
{
|
||||
echo("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
|
||||
echo(%assetDef @ ".isSubScene = " @ %assetDef.isSubScene);
|
||||
if(!%assetDef.isSubScene)
|
||||
schedule( 1, 0, "EditorOpenMission", %assetDef);
|
||||
}
|
||||
|
|
@ -157,7 +183,15 @@ function AssetBrowser::buildLevelAssetPreview(%this, %assetDef, %previewData)
|
|||
{
|
||||
%previewData.assetName = %assetDef.assetName;
|
||||
%previewData.assetPath = %assetDef.getLevelPath();
|
||||
%previewData.doubleClickCommand = "schedule( 1, 0, \"EditorOpenMission\", "@%assetDef@");";
|
||||
|
||||
if(%this.selectMode || %assetDef.isSubScene)
|
||||
{
|
||||
%previewData.doubleClickCommand = "AssetBrowser.selectAsset( AssetBrowser.selectedAsset );";
|
||||
}
|
||||
else
|
||||
{
|
||||
%previewData.doubleClickCommand = "schedule( 1, 0, \"EditorOpenMission\", "@%assetDef@");";
|
||||
}
|
||||
|
||||
%levelPreviewImage = %assetDef.PreviewImage;
|
||||
|
||||
|
|
@ -176,7 +210,10 @@ function AssetBrowser::buildLevelAssetPreview(%this, %assetDef, %previewData)
|
|||
|
||||
function createAndAssignLevelAsset(%moduleName, %assetName)
|
||||
{
|
||||
$createAndAssignField.apply(%moduleName @ ":" @ %assetName);
|
||||
if(AssetDatabase.isDeclaredAsset(%moduleName))
|
||||
$createAndAssignField.apply(%moduleName);
|
||||
else
|
||||
$createAndAssignField.apply(%moduleName @ ":" @ %assetName);
|
||||
}
|
||||
|
||||
function EWorldEditor::createSelectedAsSubScene( %this, %object )
|
||||
|
|
|
|||
|
|
@ -124,6 +124,8 @@ function AssetBrowser::setupCreateNewAsset(%this, %assetType, %moduleName, %call
|
|||
%command = %this @ ".setupCreateNew"@%assetType @"();";
|
||||
eval(%command);
|
||||
}
|
||||
|
||||
NewAssetPropertiesInspector.refresh();
|
||||
}
|
||||
|
||||
function NewAssetPropertiesInspector::updateNewAssetField(%this)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue