mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 07:04:36 +00:00
Consolidates and standardizes terrain creation between the editor, asset browser and creator panel
Also shifts terrain data importing into the new terrain asset window instead of separate in the File menu Also removes redundant loadMaterials call that caused duplicates in the Terrain Painter material list
This commit is contained in:
parent
e9dba74891
commit
f7ce1efd62
8 changed files with 104 additions and 125 deletions
|
|
@ -1121,14 +1121,22 @@ function AssetBrowserPreviewButton::onRightClick(%this)
|
|||
}
|
||||
|
||||
if(%assetType $= "LevelAsset")
|
||||
{
|
||||
EditLevelAssetPopup.showPopup(Canvas);
|
||||
}
|
||||
else if(%assetType $= "Folder")
|
||||
{
|
||||
EditFolderPopup.dirPath = %this.moduleName @ "/" @ %this.assetName;
|
||||
EditFolderPopup.showPopup(Canvas);
|
||||
}
|
||||
else if(%assetType $= "TerrainAsset")
|
||||
{
|
||||
EditTerrainAssetPopup.showPopup(Canvas);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditAssetPopup.showPopup(Canvas);
|
||||
}
|
||||
|
||||
if(%assetType $= "Folder")
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,6 +4,10 @@ function AssetBrowser::setupCreateNewTerrainAsset(%this)
|
|||
NewAssetPropertiesInspector.addField("resolution", "Terrain Texture Resolution", "list", "Is this script used on the server?", "1024", "256,512,1024,2048,4096", %this.newAssetSettings);
|
||||
NewAssetPropertiesInspector.addField("genWithNoise", "Generate Terrain With Noise", "bool", "Is this script used on the server?", "0", "2", %this.newAssetSettings);
|
||||
NewAssetPropertiesInspector.endGroup();
|
||||
|
||||
NewAssetPropertiesInspector.startGroup("Terrain - Import");
|
||||
NewAssetPropertiesInspector.addField("importDetails", "Import Heightmap", "button", "Import an existing heightmap", "", "Canvas.pushDialog( TerrainImportGui );", %this.newAssetSettings);
|
||||
NewAssetPropertiesInspector.endGroup();
|
||||
}
|
||||
|
||||
function AssetBrowser::createTerrainAsset(%this)
|
||||
|
|
@ -38,11 +42,48 @@ function AssetBrowser::createTerrainAsset(%this)
|
|||
|
||||
AssetBrowser.refresh();
|
||||
|
||||
//
|
||||
$createdTerrainBlock = TerrainBlock::createNew( %assetName, %this.newAssetSettings.resolution, "", %this.newAssetSettings.genWithNoise );
|
||||
|
||||
$createdTerrainBlock.terrainAsset = %moduleName @ ":" @ %assetName;
|
||||
$createdTerrainBlock.terrainFile = "";
|
||||
MECreateUndoAction::submit($createdTerrainBlock);
|
||||
|
||||
$createdTerrainBlock.terrainAsset = %moduleName @ ":" @ %assetName;
|
||||
$createdTerrainBlock.terrainFile = "";
|
||||
|
||||
//If we're importing, deal with that now, otherwise just create the new terrain
|
||||
if(AssetBrowser.newAssetSettings.importingTerrain)
|
||||
{
|
||||
// This will update an existing terrain with the name %terrainName,
|
||||
// or create a new one if %terrainName isn't a TerrainBlock
|
||||
$createdTerrainBlock = TerrainBlock::import( $createdTerrainBlock,
|
||||
AssetBrowser.newAssetSettings.heightMapPng,
|
||||
AssetBrowser.newAssetSettings.metersPerPixel,
|
||||
AssetBrowser.newAssetSettings.heightScale,
|
||||
AssetBrowser.newAssetSettings.opacityNames,
|
||||
AssetBrowser.newAssetSettings.materialNames,
|
||||
AssetBrowser.newAssetSettings.flipYAxis );
|
||||
|
||||
if ( isObject( $createdTerrainBlock ) )
|
||||
{
|
||||
assert( isObject( EWorldEditor ),
|
||||
"ObjectBuilderGui::processNewObject - EWorldEditor is missing!" );
|
||||
|
||||
// Select it in the editor.
|
||||
//EWorldEditor.clearSelection();
|
||||
//EWorldEditor.selectObject($createdTerrainBlock);
|
||||
|
||||
// When we drop the selection don't store undo
|
||||
// state for it... the creation deals with it.
|
||||
//EWorldEditor.dropSelection( true );
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
toolsMessageBox( "Import Terrain",
|
||||
"Terrain import failed! Check console for error messages.",
|
||||
"Ok", "Error" );
|
||||
}
|
||||
}
|
||||
|
||||
return %tamlpath;
|
||||
}
|
||||
|
|
@ -78,6 +119,9 @@ function createTerrainBlock(%assetId)
|
|||
// When we drop the selection don't store undo
|
||||
// state for it... the creation deals with it.
|
||||
EWorldEditor.dropSelection( true );
|
||||
|
||||
ETerrainEditor.isDirty = true;
|
||||
EPainter.updateLayers();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -64,6 +64,27 @@ function AssetBrowser::buildPopupMenus(%this)
|
|||
};
|
||||
}
|
||||
|
||||
if( !isObject( EditTerrainAssetPopup ) )
|
||||
{
|
||||
new PopupMenu( EditTerrainAssetPopup )
|
||||
{
|
||||
superClass = "MenuBuilder";
|
||||
class = "EditorWorldMenu";
|
||||
//isPopup = true;
|
||||
|
||||
item[ 0 ] = "Export Terraform Data" TAB "" TAB "Heightfield::saveBitmap(\"\");";
|
||||
item[ 1 ] = "Rename Asset" TAB "" TAB "AssetBrowser.renameAsset();";
|
||||
item[ 2 ] = "Asset Properties" TAB "" TAB "AssetBrowser.editAssetInfo();";
|
||||
item[ 3 ] = "-";
|
||||
Item[ 4 ] = "Duplicate Asset" TAB "" TAB "AssetBrowser.duplicateAsset();";
|
||||
item[ 5 ] = "-";
|
||||
item[ 6 ] = "Delete Asset" TAB "" TAB "AssetBrowser.deleteAsset();";
|
||||
|
||||
jumpFileName = "";
|
||||
jumpLineNumber = "";
|
||||
};
|
||||
}
|
||||
|
||||
if( !isObject( AddNewComponentAssetPopup ) )
|
||||
{
|
||||
new PopupMenu( AddNewComponentAssetPopup )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue