WIP of updating terrain editor to work with assets

Fix minor UI issues for asset browser
included folder 'asset type' script
This commit is contained in:
Areloch 2019-11-06 00:23:07 -06:00
parent a85bc7bae0
commit 22249bf4d4
25 changed files with 2203 additions and 1256 deletions

View file

@ -314,7 +314,7 @@
minExtent = "8 2";
horizSizing = "left";
vertSizing = "bottom";
profile = "ToolsGuiDefaultProfile";
profile = "ToolsGuiSolidDefaultProfile";
visible = "1";
active = "1";
command = "AssetBrowser.showVisibiltyOptions();";
@ -343,7 +343,7 @@
minExtent = "64 64";
horizSizing = "relative";
vertSizing = "height";
profile = "ToolsGuiDefaultProfile";
profile = "ToolsGuiSolidDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
@ -365,7 +365,7 @@
minExtent = "0 0";
horizSizing = "right";
vertSizing = "bottom";
profile = "ToolsGuiDefaultProfile";
profile = "ToolsGuiSolidDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
@ -462,7 +462,7 @@
minExtent = "8 2";
horizSizing = "width";
vertSizing = "height";
profile = "ToolsGuiDefaultProfile";
profile = "ToolsGuiSolidDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
@ -495,7 +495,7 @@
profile = "GuiEditorScrollProfile";
visible = "1";
active = "1";
tooltipProfile = "ToolsGuiDefaultProfile";
tooltipProfile = "ToolsGuiSolidDefaultProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
@ -554,7 +554,7 @@
minExtent = "16 16";
horizSizing = "right";
vertSizing = "bottom";
profile = "ToolsGuiDefaultProfile";
profile = "ToolsGuiSolidDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
@ -629,7 +629,7 @@
minExtent = "8 2";
horizSizing = "left";
vertSizing = "bottom";
profile = "ToolsGuiDefaultProfile";
profile = "ToolsGuiSolidDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
@ -654,7 +654,7 @@
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "ToolsGuiDefaultProfile";
profile = "ToolsGuiSolidDefaultProfile";
visible = "1";
active = "1";
command = "AssetBrowser.toggleFolderCollapseButton();";
@ -680,7 +680,7 @@
minExtent = "8 2";
horizSizing = "left";
vertSizing = "bottom";
profile = "ToolsGuiDefaultProfile";
profile = "ToolsGuiSolidDefaultProfile";
visible = "1";
active = "1";
command = "AssetBrowser.showFilterOptions();";
@ -704,7 +704,7 @@
minExtent = "8 2";
horizSizing = "width";
vertSizing = "height";
profile = "ToolsGuiDefaultProfile";
profile = "ToolsGuiSolidDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
@ -737,7 +737,7 @@
profile = "GuiEditorScrollProfile";
visible = "1";
active = "1";
tooltipProfile = "ToolsGuiDefaultProfile";
tooltipProfile = "ToolsGuiSolidDefaultProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
@ -825,7 +825,7 @@
minExtent = "8 2";
horizSizing = "width";
vertSizing = "height";
profile = "ToolsGuiDefaultProfile";
profile = "ToolsGuiSolidDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";

View file

@ -52,7 +52,7 @@ function initializeAssetBrowser()
AssetFilterTypeList.add("ShapeAnimations");
AssetFilterTypeList.add("Sounds");
AssetFilterTypeList.add("StateMachines");
AssetFilterTypeList.add("Terrains");
AssetFilterTypeList.add("Terrain");
AssetFilterTypeList.add("TerrainMaterials");
}
@ -94,6 +94,8 @@ function initializeAssetBrowser()
exec("./scripts/assetTypes/stateMachine.cs");
exec("./scripts/assetTypes/cubemap.cs");
exec("./scripts/assetTypes/folder.cs");
exec("./scripts/assetTypes/terrain.cs");
exec("./scripts/assetTypes/terrainMaterial.cs");
exec("./scripts/fieldTypes/fieldTypes.cs");
exec("./scripts/fieldTypes/listField.cs");

View file

@ -1124,28 +1124,9 @@ function AssetBrowserFilterTree::onRightMouseDown(%this, %itemId)
}
else
{
//get the parent, and thus our module
%moduleId = %this.getParentItem(%itemId);
//set the module value for creation info
AssetBrowser.selectedModule = %this.getItemText(%moduleId);
if(%this.getItemText(%itemId) $= "ComponentAsset")
{
AddNewComponentAssetPopup.showPopup(Canvas);
//Canvas.popDialog(AssetBrowser_newComponentAsset);
//AssetBrowser_newComponentAsset-->AssetBrowserModuleList.setText(AssetBrowser.selectedModule);
}
else if(%this.getItemText(%itemId) $= "ScriptAsset")
{
EditAssetCategoryPopup.showPopup(Canvas);
}
EditFolderPopup.showPopup(Canvas);
}
}
else if( %this.getSelectedItemsCount() > 0 && %itemId == 1)
{
AddNewModulePopup.showPopup(Canvas);
}
}
//
@ -1254,6 +1235,9 @@ function AssetBrowser::rebuildAssetArray(%this)
%assetType = AssetDatabase.getAssetType(%assetId);
}
if(AssetBrowser.assetTypeFilter !$= "" && AssetBrowser.assetTypeFilter !$= %assetType)
continue;
/*if(%this.getItemText(%itemId) $= %assetType || (%assetType $= "" && %this.getItemText(%itemId) $= "Misc")
|| %moduleItemId == 1)
{*/

View file

@ -0,0 +1,95 @@
function AssetBrowser::buildFolderPreview(%this, %assetDef, %previewData)
{
%previewData.assetName = %assetDef.assetName;
%previewData.assetPath = %assetDef.dirPath;
//%previewData.previewImage = "tools/assetBrowser/art/folderIcon";
%previewData.previewImage = "tools/gui/images/folder";
//%previewData.assetFriendlyName = %assetDef.assetName;
%previewData.assetDesc = %assetDef.description;
%previewData.tooltip = %assetDef.dirPath;
%previewData.doubleClickCommand = "AssetBrowser.navigateTo(\""@ %assetDef.dirPath @ "/" @ %assetDef.assetName @"\")";//browseTo %assetDef.dirPath / %assetDef.assetName
}
function AssetBrowser::renameFolder(%this, %folderPath, %newFolderName)
{
%fullPath = makeFullPath(%folderPath);
%newFullPath = makeFullPath(%folderPath);
%fullPath = strreplace(%fullPath, "//", "/");
%count = getTokenCount(%fullPath, "/");
%basePath = getTokens(%fullPath, "/", 0, %count-2);
%oldName = getToken(%fullPath, "/", %count-1);
//We need to ensure that no files are 'active' while we try and clean up behind ourselves with the delete action
//so, we nix any assets active for the module, do the delete action on the old folder, and then re-acquire our assets.
//This will have the added benefit of updating paths for asset items
%module = AssetBrowser.getModuleFromAddress(AssetBrowser.currentAddress);
%moduleId = %module.ModuleId;
AssetDatabase.removeDeclaredAssets(%moduleId);
%copiedSuccess = pathCopy(%fullPath, %basePath @ "/" @ %newFolderName);
%this.deleteFolder(%fullPath);
AssetDatabase.addModuleDeclaredAssets(%moduleId);
}
function AssetBrowser::deleteFolder(%this, %folderPath)
{
doDeleteFolder(%folderPath);
%this.loadFilters();
}
function doDeleteFolder(%folderPath)
{
%fullPath = makeFullPath(%folderPath);
//First, wipe out any files inside the folder first
%file = findFirstFileMultiExpr( %fullPath @ "/*.*", true);
while( %file !$= "" )
{
%success = fileDelete( %file );
if(!%success)
{
error("doDeleteFolder - unable to delete file " @ %file);
return;
}
%file = findNextFileMultiExpr( %fullPath @ "/*.*" );
}
//next, walk through and delete any subfolders that may be remaining
while(fileDelete(%fullPath) == 0)
{
//We couldn't delete the folder, so get a directory list and recurse through it, deleteing them as we go
%paths = getDirectoryList(%fullPath);
for(%i=0; %i < getFieldCount(%paths); %i++)
{
%childPath = getField(%paths, %i);
doDeleteFolder(%fullPath @ "/" @ %childPath);
}
}
}
function AssetBrowser::moveFolder(%this, %folderPath, %newFolderPath)
{
%fullPath = makeFullPath(%folderPath);
%newFullPath = makeFullPath(%newFolderPath);
%fullPath = strreplace(%fullPath, "//", "/");
%newFullPath = strreplace(%newFullPath, "//", "/");
%count = getTokenCount(%fullPath, "/");
%basePath = getTokens(%fullPath, "/", 0, %count-2);
%oldName = getToken(%fullPath, "/", %count-1);
%copiedSuccess = pathCopy(%fullPath, %newFullPath @ "/" @ %newFolderName);
%this.deleteFolder(%fullPath);
}

View file

@ -1,5 +1,38 @@
function AssetBrowser::createTerrainAsset(%this)
{
%moduleName = AssetBrowser.newAssetSettings.moduleName;
%modulePath = "data/" @ %moduleName;
%assetName = AssetBrowser.newAssetSettings.assetName;
%assetType = AssetBrowser.newAssetSettings.assetType;
%assetPath = AssetBrowser.currentAddress @ "/";
%tamlpath = %assetPath @ %assetName @ ".asset.taml";
%terPath = %assetPath @ %assetName @ ".ter";
%asset = new TerrainAsset()
{
AssetName = %assetName;
versionId = 1;
terrainFile = %assetName @ ".ter";
};
TamlWrite(%asset, %tamlpath);
%moduleDef = ModuleDatabase.findModule(%moduleName, 1);
AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath);
AssetBrowser.loadFilters();
AssetBrowserFilterTree.onSelect(%smItem);
//Save out a basic terrain block here
%terrBlock = new TerrainBlock() { terrainFile = %terPath; };
%terrBlock.save(%terPath);
%terrBlock.delete();
return %tamlpath;
}
function AssetBrowser::editTerrainAsset(%this, %assetDef)
@ -50,4 +83,45 @@ function GuiInspectorTypeTerrainAssetPtr::onClick( %this, %fieldName )
function GuiInspectorTypeTerrainAssetPtr::onControlDropped( %this, %payload, %position )
{
}
//AssetDatabase.acquireAsset("pbr:NewTerrain");
function TerrainAsset::saveAsset(%this)
{
%matDepIdx = 0;
while(%this.getFieldValue("terrainMaterialAsset", %matDepIdx) !$= "")
{
%this.setFieldValue("terrainMaterialAsset", "", %matDepIdx);
}
%filePath = AssetDatabase.getAssetFilePath(%this.getAssetId());
%mats = ETerrainEditor.getMaterials();
%assetQuery = new AssetQuery();
AssetDatabase.findAssetType(%assetQuery, "TerrainMaterialAsset");
%count = %assetQuery.getCount();
%matDepIdx = 0;
for( %i = 0; %i < getRecordCount( %mats ); %i++ )
{
%matInternalName = getRecord( %mats, %i );
for(%m=0; %m < %count; %m++)
{
%assetId = %assetQuery.getAsset(%m);
%terrMatAssetDef = AssetDatabase.acquireAsset(%assetId);
if(%terrMatAssetDef.materialDefinitionName $= %matInternalName)
{
%this.setFieldValue("terrainMaterialAsset", "@Asset=" @ %assetId, %matDepIdx);
%matDepIdx++;
}
}
}
%assetQuery.delete();
TAMLWrite(%this, %filePath);
}

View file

@ -1,9 +1,70 @@
function AssetBrowser::createTerrainMaterialAsset(%this)
{
%moduleName = AssetBrowser.newAssetSettings.moduleName;
%modulePath = "data/" @ %moduleName;
%assetName = AssetBrowser.newAssetSettings.assetName;
%assetType = AssetBrowser.newAssetSettings.assetType;
%assetPath = AssetBrowser.currentAddress @ "/";
%tamlpath = %assetPath @ %assetName @ ".asset.taml";
%scriptPath = %assetPath @ %assetName @ ".cs";
%asset = new TerrainMaterialAsset()
{
AssetName = %assetName;
versionId = 1;
scriptFile = %assetName @ ".cs";
materialDefinitionName = %assetName;
};
TamlWrite(%asset, %tamlpath);
%moduleDef = ModuleDatabase.findModule(%moduleName, 1);
AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath);
AssetBrowser.loadFilters();
AssetBrowserFilterTree.onSelect(%smItem);
%file = new FileObject();
%templateFile = new FileObject();
%templateFilePath = %this.templateFilesPath @ "terrainMaterial.cs.template";
if(%file.openForWrite(%scriptPath) && %templateFile.openForRead(%templateFilePath))
{
while( !%templateFile.isEOF() )
{
%line = %templateFile.readline();
%line = strreplace( %line, "@", %assetName );
%file.writeline(%line);
//echo(%line);
}
%file.close();
%templateFile.close();
}
else
{
%file.close();
%templateFile.close();
warnf("CreateNewTerrainMaterialAsset - Something went wrong and we couldn't write thescript file!");
}
//If we've got the terrain mat editor open, go ahead and update it all
TerrainMaterialDlg.onWake();
return %tamlpath;
}
function AssetBrowser::editTerrainMaterialAsset(%this, %assetDef)
{
TerrainMaterialDlg.show(0, 0, 0);
TerrainMaterialDlg.setActiveMaterial(%assetDef.assetName);
}
function AssetBrowser::duplicateTerrainMaterialAsset(%this, %assetDef, %targetModule)

View file

@ -14,7 +14,8 @@ function AssetBrowser::buildPopupMenus(%this)
AddNewModulePopup.enableItem(1, false);
}
if( !isObject( EditAssetPopup ) )
{
new PopupMenu( EditAssetPopup )
@ -64,22 +65,6 @@ function AssetBrowser::buildPopupMenus(%this)
};
}
if( !isObject( EditFolderPopup ) )
{
new PopupMenu( EditFolderPopup )
{
superClass = "MenuBuilder";
class = "EditorWorldMenu";
//isPopup = true;
item[ 0 ] = "Rename Folder" TAB "" TAB "AssetBrowser.renameAsset();";
item[ 1 ] = "-";
Item[ 2 ] = "Duplicate Folder" TAB "" TAB "AssetBrowser.duplicateAsset();";
item[ 3 ] = "-";
item[ 4 ] = "Delete Folder" TAB "" TAB "AssetBrowser.deleteAsset();";
};
}
if( !isObject( AddNewComponentAssetPopup ) )
{
new PopupMenu( AddNewComponentAssetPopup )
@ -121,20 +106,23 @@ function AssetBrowser::buildPopupMenus(%this)
//isPopup = true;
item[ 0 ] = "Create Material" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"MaterialAsset\", AssetBrowser.selectedModule);";//"createNewMaterialAsset(\"NewMaterial\", AssetBrowser.selectedModule);";
item[ 1 ] = "Create Image" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"ImageAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewImageAsset(\"NewImage\", AssetBrowser.selectedModule);";
item[ 2 ] = "-";
item[ 3 ] = "Create Shape" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"Shape\", AssetBrowser.selectedModule);";
item[ 4 ] = "Create Shape Animation" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"ShapeAnimationAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewShapeAnimationAsset(\"NewShapeAnimation\", AssetBrowser.selectedModule);";
item[ 5 ] = "-";
item[ 6 ] = "Create GUI" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"GUIAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewGUIAsset(\"NewGUI\", AssetBrowser.selectedModule);";
item[ 7 ] = "-";
item[ 8 ] = "Create Post Effect" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"PostEffectAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewPostEffectAsset(\"NewPostEffect\", AssetBrowser.selectedModule);";
item[ 9 ] = "-";
item[ 10 ] = "Create Sound" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"SoundAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewSoundAsset(\"NewSound\", AssetBrowser.selectedModule);";
item[ 11 ] = "-";
item[ 12 ] = "Create Particle Effect" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"ParticleEffectAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewParticleEffectAsset(\"NewParticleEffect\", AssetBrowser.selectedModule);";
item[ 13 ] = "-";
item[ 14 ] = "Create Cubemap" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"CubemapAsset\", AssetBrowser.selectedModule);";
item[ 1 ] = "Create Terrain Material" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"TerrainMaterialAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewImageAsset(\"NewImage\", AssetBrowser.selectedModule);";
item[ 2 ] = "Create Image" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"ImageAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewImageAsset(\"NewImage\", AssetBrowser.selectedModule);";
item[ 3 ] = "-";
item[ 4 ] = "Create Terrain Data" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"TerrainAsset\", AssetBrowser.selectedModule);";
item[ 5 ] = "-";
item[ 6 ] = "Create Shape" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"Shape\", AssetBrowser.selectedModule);";
item[ 7 ] = "Create Shape Animation" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"ShapeAnimationAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewShapeAnimationAsset(\"NewShapeAnimation\", AssetBrowser.selectedModule);";
item[ 8 ] = "-";
item[ 9 ] = "Create GUI" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"GUIAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewGUIAsset(\"NewGUI\", AssetBrowser.selectedModule);";
item[ 10 ] = "-";
item[ 11 ] = "Create Post Effect" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"PostEffectAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewPostEffectAsset(\"NewPostEffect\", AssetBrowser.selectedModule);";
item[ 12 ] = "-";
item[ 13 ] = "Create Sound" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"SoundAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewSoundAsset(\"NewSound\", AssetBrowser.selectedModule);";
item[ 14 ] = "-";
item[ 15 ] = "Create Particle Effect" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"ParticleEffectAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewParticleEffectAsset(\"NewParticleEffect\", AssetBrowser.selectedModule);";
item[ 16 ] = "-";
item[ 17 ] = "Create Cubemap" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"CubemapAsset\", AssetBrowser.selectedModule);";
};
}
@ -199,10 +187,27 @@ function AssetBrowser::buildPopupMenus(%this)
}
//Some assets are not yet ready/implemented, so disable their creation here
AddNewArtAssetPopup.enableItem(3, false); //shape
AddNewArtAssetPopup.enableItem(4, false); //shape animation
AddNewArtAssetPopup.enableItem(10, false); //sound asset
AddNewArtAssetPopup.enableItem(12, false); //particle effect
AddNewArtAssetPopup.enableItem(6, false); //shape
AddNewArtAssetPopup.enableItem(7, false); //shape animation
AddNewArtAssetPopup.enableItem(13, false); //sound asset
AddNewArtAssetPopup.enableItem(15, false); //particle effect
if( !isObject( EditFolderPopup ) )
{
new PopupMenu( EditFolderPopup )
{
superClass = "MenuBuilder";
class = "EditorWorldMenu";
//isPopup = true;
Item[ 0 ] = "Create in Folder" TAB AddNewAssetPopup;
item[ 1 ] = "-";
item[ 2 ] = "Rename Folder" TAB "" TAB "AssetBrowser.renameAsset();";
Item[ 3 ] = "Duplicate Folder" TAB "" TAB "AssetBrowser.duplicateAsset();";
item[ 4 ] = "-";
item[ 5 ] = "Delete Folder" TAB "" TAB "AssetBrowser.deleteAsset();";
};
}
if( !isObject( EditAssetCategoryPopup ) )
{

View file

@ -0,0 +1,24 @@
singleton Material(TerrainFX_@)
{
mapTo = "@";
footstepSoundId = 0;
terrainMaterials = "1";
ShowDust = "1";
showFootprints = "1";
materialTag0 = "Terrain";
effectColor[0] = "0.42 0.42 0 1";
effectColor[1] = "0.42 0.42 0 1";
impactSoundId = "0";
};
new TerrainMaterial(@)
{
internalName = "@";
diffuseMap = "";
detailMap = "";
detailSize = "10";
isManaged = "1";
detailBrightness = "1";
Enabled = "1";
diffuseSize = "200";
};

View file

@ -20,7 +20,7 @@
minExtent = "8 2";
horizSizing = "center";
vertSizing = "center";
profile = "ToolsGuiDefaultProfile";
profile = "ToolsGuiSolidDefaultProfile";
visible = "1";
active = "1";
tooltipProfile = "ToolsGuiToolTipProfile";

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -37,7 +37,7 @@ new GuiControlProfile (ToolsGuiDefaultProfile)
mouseOverSelected = false;
// fill color
opaque = true;
opaque = false;
fillColor = EditorSettings.value("Theme/tabsColor");
fillColorHL = EditorSettings.value("Theme/tabsGLColor");
fillColorSEL = EditorSettings.value("Theme/tabsSELColor");
@ -79,7 +79,7 @@ new GuiControlProfile (ToolsGuiDefaultProfile)
};
if( !isObject( ToolsGuiSolidDefaultProfile ) )
new GuiControlProfile (ToolsGuiSolidDefaultProfile)
new GuiControlProfile (ToolsGuiSolidDefaultProfile : ToolsGuiDefaultProfile)
{
opaque = true;
border = true;
@ -1123,6 +1123,8 @@ singleton GuiControlProfile( ToolsMenubarProfile : ToolsGuiDefaultProfile )
bitmap = "./menubar";
category = "Editor";
opaque = true;
fillColor = EditorSettings.value("Theme/headerColor");
fontColor = EditorSettings.value("Theme/headerTextColor");
fontColorHL = EditorSettings.value("Theme/fieldTextHLColor");

View file

@ -2,212 +2,202 @@
<EditorSettings>
<Group name="MeshRoadEditor">
<Setting name="HoverSplineColor">255 0 0 255</Setting>
<Setting name="SelectedSplineColor">0 255 0 255</Setting>
<Setting name="sideMaterialName">DefaultRoadMaterialOther</Setting>
<Setting name="DefaultWidth">10</Setting>
<Setting name="topMaterialName">DefaultRoadMaterialTop</Setting>
<Setting name="DefaultNormal">0 0 1</Setting>
<Setting name="sideMaterialName">DefaultRoadMaterialOther</Setting>
<Setting name="SelectedSplineColor">0 255 0 255</Setting>
</Group>
<Group name="TerrainEditor">
<Setting name="currentAction">lowerHeight</Setting>
<Group name="ActionValues">
<Setting name="softSelectRadius">50</Setting>
<Setting name="softSelectDefaultFilter">1.000000 0.833333 0.666667 0.500000 0.333333 0.166667 0.000000</Setting>
<Setting name="setHeightVal">100</Setting>
<Setting name="scaleVal">1</Setting>
<Setting name="softSelectFilter">1.000000 0.833333 0.666667 0.500000 0.333333 0.166667 0.000000</Setting>
<Setting name="SlopeMaxAngle">90</Setting>
<Setting name="SlopeMinAngle">0</Setting>
<Setting name="smoothFactor">0.1</Setting>
<Setting name="noiseFactor">1</Setting>
<Setting name="adjustHeightVal">10</Setting>
</Group>
<Group name="Brush">
<Setting name="brushSize">40 40</Setting>
<Setting name="maxBrushSize">40 40</Setting>
<Setting name="brushSoftness">1</Setting>
<Setting name="brushPressure">1</Setting>
<Setting name="brushType">ellipse</Setting>
</Group>
</Group>
<Group name="Theme">
<Setting name="tooltipDividerColor">72 70 68 255</Setting>
<Setting name="tabsSELColor">59 58 57 255</Setting>
<Setting name="fieldTextSELColor">255 255 255 255</Setting>
<Setting name="tooltipBGColor">43 43 43 255</Setting>
<Setting name="dividerDarkColor">17 16 15 255</Setting>
<Setting name="tabsColor">37 36 35 255</Setting>
<Setting name="windowBackgroundColor">32 31 30 255</Setting>
<Setting name="headerColor">50 49 48 255</Setting>
<Setting name="tooltipTextColor">255 255 255 255</Setting>
<Setting name="headerTextColor">236 234 232 255</Setting>
<Setting name="fieldTextHLColor">234 232 230 255</Setting>
<Setting name="fieldTextColor">178 175 172 255</Setting>
<Setting name="fieldTextSELColor">255 255 255 255</Setting>
<Setting name="fieldBGHLColor">72 70 68 255</Setting>
<Setting name="dividerMidColor">50 49 48 255</Setting>
<Setting name="fieldBGSELColor">100 98 96 255</Setting>
<Setting name="tooltipBGColor">43 43 43 255</Setting>
<Setting name="windowBackgroundColor">32 31 30 255</Setting>
<Setting name="fieldBGColor">59 58 57 255</Setting>
<Setting name="dividerLightColor">96 94 92 255</Setting>
<Setting name="fieldTextHLColor">234 232 230 255</Setting>
<Setting name="fieldTextNAColor">77 77 77 255</Setting>
<Setting name="fieldBGSELColor">100 98 96 255</Setting>
<Setting name="tabsColor">37 36 35 255</Setting>
<Setting name="tabsHLColor">50 49 48 255</Setting>
</Group>
<Group name="ShapeEditor">
<Setting name="showNodes">1</Setting>
<Setting name="renderMounts">1</Setting>
<Setting name="backgroundColor">0 0 0 100</Setting>
<Setting name="highlightMaterial">1</Setting>
<Setting name="RenderCollision">0</Setting>
<Setting name="SunDiffuseColor">255 255 255 255</Setting>
<Setting name="SunAngleZ">135</Setting>
<Setting name="SunAmbientColor">180 180 180 255</Setting>
<Setting name="AdvancedWndVisible">1</Setting>
<Setting name="ShowGrid">1</Setting>
<Setting name="showObjBox">1</Setting>
<Setting name="gridDimension">40 40</Setting>
<Setting name="showBounds">0</Setting>
<Setting name="SunAngleX">45</Setting>
<Setting name="gridSize">0.1</Setting>
<Setting name="headerColor">50 49 48 255</Setting>
<Setting name="fieldTextNAColor">77 77 77 255</Setting>
<Setting name="tooltipTextColor">255 255 255 255</Setting>
<Setting name="headerTextColor">236 234 232 255</Setting>
<Setting name="tooltipDividerColor">72 70 68 255</Setting>
<Setting name="tabsSELColor">59 58 57 255</Setting>
<Setting name="dividerLightColor">96 94 92 255</Setting>
</Group>
<Group name="GuiEditor">
<Setting name="lastPath">tools/gui</Setting>
<Setting name="lastPath">tools/worldEditor/gui</Setting>
<Setting name="previewResolution">1024 768</Setting>
<Group name="EngineDevelopment">
<Setting name="toggleIntoEditor">0</Setting>
<Setting name="showEditorProfiles">0</Setting>
<Setting name="showEditorGuis">0</Setting>
<Group name="Library">
<Setting name="viewType">Categorized</Setting>
</Group>
<Group name="Snapping">
<Setting name="snapToCanvas">1</Setting>
<Setting name="snapToCenters">1</Setting>
<Setting name="sensitivity">2</Setting>
<Setting name="snap2Grid">0</Setting>
<Setting name="snap2GridSize">8</Setting>
<Setting name="snapToControls">1</Setting>
<Setting name="snapToEdges">1</Setting>
<Setting name="snapToGuides">1</Setting>
</Group>
<Group name="Rendering">
<Setting name="drawGuides">1</Setting>
<Setting name="drawBorderLines">1</Setting>
</Group>
<Group name="Help">
<Setting name="documentationURL">http://www.garagegames.com/products/torque-3d/documentation/user</Setting>
<Setting name="documentationReference">../../../Documentation/Torque 3D - Script Manual.chm</Setting>
<Setting name="documentationLocal">../../../Documentation/Official Documentation.html</Setting>
</Group>
<Group name="Selection">
<Setting name="fullBox">0</Setting>
</Group>
<Group name="Snapping">
<Setting name="snapToControls">1</Setting>
<Setting name="sensitivity">2</Setting>
<Setting name="snapToGuides">1</Setting>
<Setting name="snap2GridSize">8</Setting>
<Setting name="snapToCenters">1</Setting>
<Setting name="snapToEdges">1</Setting>
<Setting name="snap2Grid">0</Setting>
<Setting name="snapToCanvas">1</Setting>
</Group>
<Group name="Help">
<Setting name="documentationURL">http://www.garagegames.com/products/torque-3d/documentation/user</Setting>
<Setting name="documentationLocal">../../../Documentation/Official Documentation.html</Setting>
<Setting name="documentationReference">../../../Documentation/Torque 3D - Script Manual.chm</Setting>
</Group>
<Group name="Rendering">
<Setting name="drawBorderLines">1</Setting>
<Setting name="drawGuides">1</Setting>
</Group>
<Group name="Library">
<Setting name="viewType">Categorized</Setting>
<Group name="EngineDevelopment">
<Setting name="showEditorProfiles">0</Setting>
<Setting name="toggleIntoEditor">0</Setting>
<Setting name="showEditorGuis">0</Setting>
</Group>
</Group>
<Group name="AxisGizmo">
<Setting name="mouseRotateScalar">0.8</Setting>
<Setting name="mouseScaleScalar">0.8</Setting>
<Setting name="renderWhenUsed">0</Setting>
<Setting name="rotationSnap">15</Setting>
<Setting name="snapRotations">0</Setting>
<Setting name="renderInfoText">1</Setting>
<Setting name="axisGizmoMaxScreenLen">100</Setting>
<Group name="Grid">
<Setting name="renderPlane">0</Setting>
<Setting name="snapToGrid">1</Setting>
<Setting name="renderPlaneHashes">0</Setting>
<Setting name="gridSize">1 1 1</Setting>
<Setting name="gridColor">255 255 255 20</Setting>
<Setting name="planeDim">500</Setting>
</Group>
<Group name="ShapeEditor">
<Setting name="SunAngleZ">135</Setting>
<Setting name="gridDimension">40 40</Setting>
<Setting name="gridSize">0.1</Setting>
<Setting name="showObjBox">1</Setting>
<Setting name="AdvancedWndVisible">1</Setting>
<Setting name="showNodes">1</Setting>
<Setting name="ShowGrid">1</Setting>
<Setting name="SunDiffuseColor">255 255 255 255</Setting>
<Setting name="SunAngleX">45</Setting>
<Setting name="highlightMaterial">1</Setting>
<Setting name="backgroundColor">0 0 0 100</Setting>
<Setting name="renderMounts">1</Setting>
<Setting name="RenderCollision">0</Setting>
<Setting name="showBounds">0</Setting>
<Setting name="SunAmbientColor">180 180 180 255</Setting>
</Group>
<Group name="WorldEditor">
<Setting name="torsionPath">AssetWork_Debug.exe</Setting>
<Setting name="undoLimit">40</Setting>
<Setting name="dropType">screenCenter</Setting>
<Setting name="displayType">6</Setting>
<Setting name="forceLoadDAE">0</Setting>
<Setting name="torsionPath">AssetWork_Debug.exe</Setting>
<Setting name="orthoFOV">50</Setting>
<Setting name="undoLimit">40</Setting>
<Setting name="EditorLayoutMode">Modern</Setting>
<Setting name="dropType">screenCenter</Setting>
<Setting name="orthoShowGrid">1</Setting>
<Setting name="currentEditor">WorldEditorInspectorPlugin</Setting>
<Group name="Grid">
<Setting name="gridMinorColor">51 51 51 100</Setting>
<Setting name="gridColor">102 102 102 100</Setting>
<Setting name="gridSize">1</Setting>
<Setting name="gridOriginColor">255 255 255 100</Setting>
<Setting name="gridSnap">1</Setting>
</Group>
<Group name="Render">
<Setting name="renderSelectionBox">1</Setting>
<Setting name="showMousePopupInfo">1</Setting>
<Setting name="renderObjHandle">1</Setting>
<Setting name="renderPopupBackground">1</Setting>
<Setting name="renderObjText">1</Setting>
</Group>
<Group name="ObjectIcons">
<Setting name="fadeIconsStartDist">8</Setting>
<Setting name="fadeIconsStartAlpha">255</Setting>
<Setting name="fadeIconsEndDist">20</Setting>
<Setting name="fadeIconsEndAlpha">0</Setting>
<Setting name="fadeIcons">1</Setting>
</Group>
<Group name="Color">
<Setting name="selectionBoxColor">255 255 0 255</Setting>
<Setting name="dragRectColor">255 255 0 255</Setting>
<Setting name="objMouseOverSelectColor">0 0 255 255</Setting>
<Setting name="objSelectColor">255 0 0 255</Setting>
<Setting name="objectTextColor">255 255 255 255</Setting>
<Setting name="popupBackgroundColor">100 100 100 255</Setting>
<Setting name="objMouseOverColor">0 255 0 255</Setting>
</Group>
<Group name="Theme">
<Setting name="windowTitleFontHLColor">255 255 255 255</Setting>
<Setting name="windowTitleFontColor">215 215 215 255</Setting>
<Setting name="windowTitleBGHLColor">48 48 48 255</Setting>
<Setting name="windowTitleBGNAColor">180 180 180 255</Setting>
<Setting name="windowTitleBGColor">50 50 50 255</Setting>
</Group>
<Group name="Tools">
<Setting name="snapGround">0</Setting>
<Setting name="snapSoftSize">2</Setting>
<Setting name="boundingBoxCollision">0</Setting>
<Setting name="dropAtScreenCenterScalar">1</Setting>
<Setting name="dropAtScreenCenterMax">100</Setting>
<Setting name="snapSoft">0</Setting>
<Setting name="objectsUseBoxCenter">1</Setting>
<Setting name="displayType">6</Setting>
<Setting name="currentEditor">TerrainPainterPlugin</Setting>
<Group name="Images">
<Setting name="selectHandle">tools/worldEditor/images/SelectHandle</Setting>
<Setting name="lockedHandle">tools/worldEditor/images/LockedHandle</Setting>
<Setting name="defaultHandle">tools/worldEditor/images/DefaultHandle</Setting>
</Group>
<Group name="Docs">
<Setting name="documentationURL">http://www.garagegames.com/products/torque-3d/documentation/user</Setting>
<Setting name="forumURL">http://www.garagegames.com/products/torque-3d/forums</Setting>
<Setting name="documentationReference">../../../Documentation/Torque 3D - Script Manual.chm</Setting>
<Setting name="documentationLocal">../../../Documentation/Official Documentation.html</Setting>
<Setting name="documentationReference">../../../Documentation/Torque 3D - Script Manual.chm</Setting>
</Group>
<Group name="Images">
<Setting name="defaultHandle">tools/worldEditor/images/DefaultHandle</Setting>
<Setting name="lockedHandle">tools/worldEditor/images/LockedHandle</Setting>
<Setting name="selectHandle">tools/worldEditor/images/SelectHandle</Setting>
<Group name="Theme">
<Setting name="windowTitleFontColor">215 215 215 255</Setting>
<Setting name="windowTitleFontHLColor">255 255 255 255</Setting>
<Setting name="windowTitleBGColor">50 50 50 255</Setting>
<Setting name="windowTitleBGHLColor">48 48 48 255</Setting>
<Setting name="windowTitleBGNAColor">180 180 180 255</Setting>
</Group>
<Group name="Grid">
<Setting name="gridColor">102 102 102 100</Setting>
<Setting name="gridOriginColor">255 255 255 100</Setting>
<Setting name="gridMinorColor">51 51 51 100</Setting>
<Setting name="gridSize">1</Setting>
<Setting name="gridSnap">1</Setting>
</Group>
<Group name="ObjectIcons">
<Setting name="fadeIcons">1</Setting>
<Setting name="fadeIconsStartDist">8</Setting>
<Setting name="fadeIconsEndDist">20</Setting>
<Setting name="fadeIconsEndAlpha">0</Setting>
<Setting name="fadeIconsStartAlpha">255</Setting>
</Group>
<Group name="Tools">
<Setting name="dropAtScreenCenterScalar">1</Setting>
<Setting name="TerrainSnapOffsetZ">0</Setting>
<Setting name="OffsetZValue">0.01</Setting>
<Setting name="objectsUseBoxCenter">1</Setting>
<Setting name="boundingBoxCollision">0</Setting>
<Setting name="dropAtScreenCenterMax">100</Setting>
<Setting name="snapGround">0</Setting>
<Setting name="snapSoft">0</Setting>
<Setting name="snapSoftSize">2</Setting>
</Group>
<Group name="Render">
<Setting name="renderObjText">1</Setting>
<Setting name="renderPopupBackground">1</Setting>
<Setting name="showMousePopupInfo">1</Setting>
<Setting name="renderSelectionBox">1</Setting>
<Setting name="renderObjHandle">1</Setting>
</Group>
<Group name="Color">
<Setting name="objMouseOverSelectColor">0 0 255 255</Setting>
<Setting name="objSelectColor">255 0 0 255</Setting>
<Setting name="objMouseOverColor">0 255 0 255</Setting>
<Setting name="dragRectColor">255 255 0 255</Setting>
<Setting name="objectTextColor">255 255 255 255</Setting>
<Setting name="selectionBoxColor">255 255 0 255</Setting>
<Setting name="popupBackgroundColor">100 100 100 255</Setting>
</Group>
<Group name="Layout">
<Setting name="LayoutMode">Classic</Setting>
</Group>
</Group>
<Group name="AssetCreation">
<Setting name="ScriptAssetSubdirectoryFormat">&lt;AssetType&gt;/&lt;SpecialAssetTag&gt;/</Setting>
<Setting name="AutoImport">1</Setting>
<Setting name="TerrainMatAssetSubdirectoryFormat">&lt;AssetType&gt;/</Setting>
<Setting name="GUIAssetSubdirectoryFormat">&lt;AssetType&gt;/OtherFolder/</Setting>
<Setting name="StatemachineAssetSubdirectoryFormat">&lt;AssetType&gt;/</Setting>
<Setting name="CubemapAssetSubdirectoryFormat">&lt;AssetType&gt;/</Setting>
<Setting name="LevelAssetSubdirectoryFormat">&lt;AssetType&gt;/&lt;AssetName&gt;/</Setting>
<Setting name="AssetImporDefaultConfig">TestConfig</Setting>
<Setting name="CubemapAssetSubdirectoryFormat">&lt;AssetType&gt;/</Setting>
<Setting name="TerrainAssetSubdirectoryFormat">&lt;AssetType&gt;/</Setting>
<Setting name="PostFXAssetSubdirectoryFormat">&lt;AssetType&gt;/</Setting>
<Setting name="CppAssetSubdirectoryFormat">&lt;AssetType&gt;/&lt;SpecialAssetTag&gt;/</Setting>
<Setting name="StatemachineAssetSubdirectoryFormat">&lt;AssetType&gt;/</Setting>
<Setting name="TerrainMatAssetSubdirectoryFormat">&lt;AssetType&gt;/</Setting>
<Setting name="ScriptAssetSubdirectoryFormat">&lt;AssetType&gt;/&lt;SpecialAssetTag&gt;/</Setting>
<Setting name="AutoImport">1</Setting>
<Setting name="TerrainAssetSubdirectoryFormat">&lt;AssetType&gt;/</Setting>
<Setting name="GUIAssetSubdirectoryFormat">&lt;AssetType&gt;/OtherFolder/</Setting>
</Group>
<Group name="TerrainEditor">
<Setting name="currentAction">lowerHeight</Setting>
<Group name="ActionValues">
<Setting name="softSelectDefaultFilter">1.000000 0.833333 0.666667 0.500000 0.333333 0.166667 0.000000</Setting>
<Setting name="noiseFactor">1</Setting>
<Setting name="SlopeMaxAngle">90</Setting>
<Setting name="softSelectRadius">50</Setting>
<Setting name="SlopeMinAngle">0</Setting>
<Setting name="softSelectFilter">1.000000 0.833333 0.666667 0.500000 0.333333 0.166667 0.000000</Setting>
<Setting name="smoothFactor">0.1</Setting>
<Setting name="adjustHeightVal">10</Setting>
<Setting name="setHeightVal">100</Setting>
<Setting name="scaleVal">1</Setting>
<Group name="LevelInformation">
<Setting name="levelsDirectory">data/FPSGameplay/levels</Setting>
<Group name="levels">
<Group name="BlankRoom.mis">
<Setting name="cameraSpeed">25</Setting>
</Group>
<Group name="PbrMatTest.mis">
<Setting name="cameraSpeed">5</Setting>
</Group>
</Group>
<Group name="Brush">
<Setting name="brushPressure">1</Setting>
<Setting name="brushType">ellipse</Setting>
<Setting name="maxBrushSize">40 40</Setting>
<Setting name="brushSize">40 40</Setting>
<Setting name="brushSoftness">1</Setting>
</Group>
</Group>
<Group name="RoadEditor">
<Setting name="SelectedSplineColor">0 255 0 255</Setting>
<Setting name="HoverNodeColor">255 255 255 255</Setting>
<Setting name="materialName">DefaultDecalRoadMaterial</Setting>
<Setting name="DefaultWidth">10</Setting>
</Group>
<Group name="Assets">
<Setting name="AssetImporDefaultConfig">TestConfig</Setting>
@ -217,32 +207,44 @@
</Group>
</Group>
<Group name="NavEditor">
<Setting name="spawnDatablock">DefaultPlayerData</Setting>
<Setting name="backgroundBuild">1</Setting>
<Setting name="spawnDatablock">DefaultPlayerData</Setting>
<Setting name="SpawnClass">AIPlayer</Setting>
</Group>
<Group name="RiverEditor">
<Setting name="DefaultNormal">0 0 1</Setting>
<Setting name="HoverSplineColor">255 0 0 255</Setting>
<Setting name="DefaultWidth">10</Setting>
<Setting name="DefaultNormal">0 0 1</Setting>
<Setting name="SelectedSplineColor">0 255 0 255</Setting>
<Setting name="HoverNodeColor">255 255 255 255</Setting>
<Setting name="DefaultDepth">5</Setting>
<Setting name="HoverNodeColor">255 255 255 255</Setting>
<Setting name="SelectedSplineColor">0 255 0 255</Setting>
</Group>
<Group name="LevelInformation">
<Setting name="levelsDirectory">data/FPSGameplay/levels</Setting>
<Group name="levels">
<Group name="PbrMatTest.mis">
<Setting name="cameraSpeed">5</Setting>
</Group>
<Group name="BlankRoom.mis">
<Setting name="cameraSpeed">25</Setting>
</Group>
<Group name="AxisGizmo">
<Setting name="rotationSnap">15</Setting>
<Setting name="mouseRotateScalar">0.8</Setting>
<Setting name="snapRotations">0</Setting>
<Setting name="mouseScaleScalar">0.8</Setting>
<Setting name="renderInfoText">1</Setting>
<Setting name="renderWhenUsed">0</Setting>
<Setting name="axisGizmoMaxScreenLen">100</Setting>
<Group name="Grid">
<Setting name="gridSize">1 1 1</Setting>
<Setting name="planeDim">500</Setting>
<Setting name="gridColor">255 255 255 20</Setting>
<Setting name="renderPlane">0</Setting>
<Setting name="snapToGrid">1</Setting>
<Setting name="renderPlaneHashes">0</Setting>
</Group>
</Group>
<Group name="AssetBrowser">
<Setting name="previewSize">Small</Setting>
</Group>
<Group name="RoadEditor">
<Setting name="materialName">DefaultDecalRoadMaterial</Setting>
<Setting name="DefaultWidth">10</Setting>
<Setting name="SelectedSplineColor">0 255 0 255</Setting>
<Setting name="HoverNodeColor">255 255 255 255</Setting>
</Group>
<Group name="ConvexEditor">
<Setting name="materialName">Grid_512_Orange</Setting>
</Group>

View file

@ -299,6 +299,20 @@
function CreateNewTerrainGui::onWake( %this )
{
%this-->theName.setText( "" );
//Run through and grab any TerrainMaterialAssets
%assetQuery = new AssetQuery();
AssetDatabase.findAssetType(%assetQuery, "TerrainMaterialAsset");
%count = %assetQuery.getCount();
for(%i=0; %i < %count; %i++)
{
%assetId = %assetQuery.getAsset(%i);
AssetDatabase.acquireAsset(%assetId);
}
%assetQuery.delete();
%matList = %this-->theMaterialList;
%matList.clear();
@ -313,8 +327,8 @@ function CreateNewTerrainGui::onWake( %this )
%rezList.add( "512", 512 );
%rezList.add( "1024", 1024 );
%rezList.add( "2048", 2048 );
//%rezList.add( "4096", 4096 );
%rezList.setSelected( 256 );
%rezList.add( "4096", 4096 );
%rezList.setSelected( 512 );
%this-->flatRadio.setStateOn( true );
}

View file

@ -227,6 +227,77 @@ function ObjectBuilderGui::gotFileName(%this, %name)
//%this.controls[%this.currentControl].setValue(%name);
}
//------------------------------------------------------------------------------
function ObjectBuilderGui::createTerrainAssetType(%this, %index)
{
if(%index >= %this.numFields || %this.field[%index, name] $= "")
{
error("ObjectBuilderGui::createTerrainAssetType: invalid field");
return;
}
//
if(%this.field[%index, text] $= "")
%name = %this.field[%index, name];
else
%name = %this.field[%index, text];
//
%this.textControls[%this.numControls] = new GuiTextCtrl() {
profile = "ToolsGuiTextRightProfile";
text = %name;
extent = %this.fieldNameExtent;
position = %this.curXPos @ " " @ %this.curYPos;
modal = "1";
};
//
%this.controls[%this.numControls] = new GuiButtonCtrl() {
HorizSizing = "width";
profile = "ToolsGuiButtonProfile";
extent = %this.fileButtonExtent;
position = %this.curXPos + %this.columnOffset @ " " @ %this.curYPos;
modal = "1";
command = %this @ ".getTerrainAsset(" @ %index @ ");";
};
%val = %this.field[%index, value];
%this.controls[%this.numControls].setValue(fileBase(%val) @ fileExt(%val));
%this.numControls++;
%this.curYPos += %this.defaultFieldStep;
}
function ObjectBuilderGui::getTerrainAsset(%this, %index)
{
if(%index >= %this.numFields || %this.field[%index, name] $= "")
{
error("ObjectBuilderGui::getTerrainAsset: invalid field");
return;
}
%val = %this.field[%index, ext];
//%path = filePath(%val);
//%ext = fileExt(%val);
%this.currentControl = %index;
AssetBrowser.showDialog("TerrainAsset", %this @ ".gotTerrainAsset", "", "", "");
//getLoadFilename( %val @ "|" @ %val, %this @ ".gotFileName", %this.lastPath );
}
function ObjectBuilderGui::gotTerrainAsset(%this, %name)
{
%index = %this.currentControl;
%this.field[%index, value] = %name;
%this.controls[%this.currentControl].setText(fileBase(%name) @ fileExt(%name));
%this.lastPath = %name;
// This doesn't work for button controls as getValue returns their state!
//%this.controls[%this.currentControl].setValue(%name);
}
//------------------------------------------------------------------------------
function ObjectBuilderGui::createMaterialNameType(%this, %index)
@ -489,6 +560,9 @@ function ObjectBuilderGui::process(%this)
case "TypeFile":
%this.createFileType(%i);
case "TypeTerrainAsset":
%this.createTerrainAssetType(%i);
case "TypeMaterialName":
%this.createMaterialNameType(%i);
@ -830,6 +904,7 @@ function ObjectBuilderGui::buildTerrainBlock(%this)
%this.createCallback = "ETerrainEditor.attachTerrain();";
%this.addField("terrainFile", "TypeFile", "Terrain file", "", "*.ter");
%this.addField("terrainAsset", "TypeTerrainAsset", "Terrain Asset", "", "");
%this.addField("squareSize", "TypeInt", "Square size", "8");
%this.process();

View file

@ -83,6 +83,20 @@ function TerrainMaterialDlg::onWake( %this )
if( !isObject( TerrainMaterialDlgDeleteGroup ) )
new SimGroup( TerrainMaterialDlgDeleteGroup );
//Run through and grab any TerrainMaterialAssets
%assetQuery = new AssetQuery();
AssetDatabase.findAssetType(%assetQuery, "TerrainMaterialAsset");
%count = %assetQuery.getCount();
for(%i=0; %i < %count; %i++)
{
%assetId = %assetQuery.getAsset(%i);
AssetDatabase.acquireAsset(%assetId);
}
%assetQuery.delete();
// Snapshot the materials.
%this.snapshotMaterials();
@ -292,12 +306,33 @@ function TerrainMaterialDlg::changeNormal( %this )
%ctrl.setBitmap( %file );
}
//-----------------------------------------------------------------------------
function TerrainMaterialDlg::changePBRConfig( %this )
{
%ctrl = %this-->pbrConfigTexCtrl;
%file = %ctrl.bitmap;
if( getSubStr( %file, 0 , 6 ) $= "tools/" )
%file = "";
%file = TerrainMaterialDlg._selectTextureFileDialog( %file );
if( %file $= "" )
{
if( %ctrl.bitmap !$= "" )
%file = %ctrl.bitmap;
else
%file = "tools/materialEditor/gui/unknownImage";
}
%file = makeRelativePath( %file, getMainDotCsDir() );
%ctrl.setBitmap( %file );
}
//-----------------------------------------------------------------------------
function TerrainMaterialDlg::newMat( %this )
{
// Create a unique material name.
%matName = getUniqueInternalName( "newMaterial", TerrainMaterialSet, true );
/*%matName = getUniqueInternalName( "newMaterial", TerrainMaterialSet, true );
// Create the new material.
%newMat = new TerrainMaterial()
@ -308,12 +343,16 @@ function TerrainMaterialDlg::newMat( %this )
%newMat.setFileName( "art/terrains/materials.cs" );
// Mark it as dirty and to be saved in the default location.
ETerrainMaterialPersistMan.setDirty( %newMat, "art/terrains/materials.cs" );
%matLibTree = %this-->matLibTree;
%matLibTree.buildVisibleTree( true );
%item = %matLibTree.findItemByObjectId( %newMat );
%matLibTree.selectItem( %item );
ETerrainMaterialPersistMan.setDirty( %newMat, "art/terrains/materials.cs" );*/
%scene = getRootScene();
%path = filePath(%scene.getFilename());
%module = AssetBrowser.getModuleFromAddress(%path);
AssetBrowser.selectedModule = %module.moduleID;
AssetBrowser.currentAddress = "data/" @ %module.moduleID;
AssetBrowser.setupCreateNewAsset("TerrainMaterialAsset", AssetBrowser.selectedModule);
}
//-----------------------------------------------------------------------------
@ -380,6 +419,11 @@ function TerrainMaterialDlg::setActiveMaterial( %this, %mat )
}else{
%this-->baseTexCtrl.setBitmap( %mat.diffuseMap );
}
if (%mat.pbrConfigMap $= ""){
%this-->pbrConfigTexCtrl.setBitmap( "tools/materialEditor/gui/unknownImage" );
}else{
%this-->pbrConfigTexCtrl.setBitmap( %mat.pbrConfigMap );
}
if (%mat.detailMap $= ""){
%this-->detailTexCtrl.setBitmap( "tools/materialEditor/gui/unknownImage" );
}else{
@ -438,6 +482,11 @@ function TerrainMaterialDlg::saveDirtyMaterial( %this, %mat )
}else{
%newNormal = %this-->normTexCtrl.bitmap;
}
if (%this-->pbrConfigTexCtrl.bitmap $= "tools/materialEditor/gui/unknownImage"){
%newPBRConfig = "";
}else{
%newPBRConfig = %this-->pbrConfigTexCtrl.bitmap;
}
if (%this-->detailTexCtrl.bitmap $= "tools/materialEditor/gui/unknownImage"){
%newDetail = "";
}else{
@ -466,6 +515,7 @@ function TerrainMaterialDlg::saveDirtyMaterial( %this, %mat )
%mat.diffuseMap $= %newDiffuse &&
%mat.normalMap $= %newNormal &&
%mat.detailMap $= %newDetail &&
%mat.pbrConfigMap $= %newPBRConfig &&
%mat.macroMap $= %newMacro &&
%mat.detailSize == %detailSize &&
%mat.diffuseSize == %diffuseSize &&
@ -497,7 +547,8 @@ function TerrainMaterialDlg::saveDirtyMaterial( %this, %mat )
}
%mat.diffuseMap = %newDiffuse;
%mat.normalMap = %newNormal;
%mat.normalMap = %newNormal;
%mat.pbrConfigMap = %newPBRConfig;
%mat.detailMap = %newDetail;
%mat.macroMap = %newMacro;
%mat.detailSize = %detailSize;
@ -543,6 +594,7 @@ function TerrainMaterialDlg::snapshotMaterials( %this )
internalName = %mat.internalName;
diffuseMap = %mat.diffuseMap;
normalMap = %mat.normalMap;
pbrConfigMap = %mat.pbrConfigMap;
detailMap = %mat.detailMap;
macroMap = %mat.macroMap;
detailSize = %mat.detailSize;
@ -577,6 +629,7 @@ function TerrainMaterialDlg::restoreMaterials( %this )
%mat.setInternalName( %obj.internalName );
%mat.diffuseMap = %obj.diffuseMap;
%mat.normalMap = %obj.normalMap;
%mat.pbrConfigMap = %obj.pbrConfigMap;
%mat.detailMap = %obj.detailMap;
%mat.macroMap = %obj.macroMap;
%mat.detailSize = %obj.detailSize;

View file

@ -280,7 +280,17 @@ function EditorSaveMission()
initContainerTypeSearch($TypeMasks::TerrainObjectType);
while ((%terrainObject = containerSearchNext()) != 0)
%terrainObject.save(%terrainObject.terrainFile);
{
if(%terrainObject.terrainAsset !$= "")
{
//we utilize a terrain asset, so we'll update our dependencies while we're at it
%terrainObject.saveAsset();
}
else
{
%terrainObject.save(%terrainObject.terrainFile);
}
}
}
ETerrainPersistMan.saveDirty();