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

@ -40,6 +40,8 @@
#include "assets/assetPtr.h"
#endif
#include "T3D/assets/TerrainMaterialAsset.h"
//-----------------------------------------------------------------------------
IMPLEMENT_CONOBJECT(TerrainAsset);
@ -89,7 +91,7 @@ ConsoleSetType(TypeTerrainAssetPtr)
TerrainAsset::TerrainAsset()
{
mTerrainFile = StringTable->EmptyString();
mTerrainFilePath = StringTable->EmptyString();
}
//-----------------------------------------------------------------------------
@ -106,8 +108,22 @@ void TerrainAsset::initPersistFields()
Parent::initPersistFields();
//addField("shaderGraph", TypeRealString, Offset(mShaderGraphFile, TerrainAsset), "");
addProtectedField("terrainFile", TypeAssetLooseFilePath, Offset(mTerrainFile, TerrainAsset),
&setTerrainFile, &getTerrainFile, "Path to the file containing the terrain data.");
addProtectedField("terrainFile", TypeAssetLooseFilePath, Offset(mTerrainFilePath, TerrainAsset),
&setTerrainFilePath, &getTerrainFilePath, "Path to the file containing the terrain data.");
}
void TerrainAsset::setDataField(StringTableEntry slotName, const char* array, const char* value)
{
Parent::setDataField(slotName, array, value);
//Now, if it's a material slot of some fashion, set it up
StringTableEntry matSlotName = StringTable->insert("terrainMaterialAsset");
if (String(slotName).startsWith(matSlotName))
{
StringTableEntry matId = StringTable->insert(value);
mTerrMaterialAssetIds.push_back(matId);
}
}
void TerrainAsset::initializeAsset()
@ -115,22 +131,20 @@ void TerrainAsset::initializeAsset()
// Call parent.
Parent::initializeAsset();
if (!Platform::isFullPath(mTerrainFile))
mTerrainFile = getOwned() ? expandAssetFilePath(mTerrainFile) : mTerrainFile;
if (!Platform::isFullPath(mTerrainFilePath))
mTerrainFilePath = getOwned() ? expandAssetFilePath(mTerrainFilePath) : mTerrainFilePath;
//if (Platform::isFile(mTerrainFile))
// Con::executeFile(mScriptFile, false, false);
loadTerrain();
}
void TerrainAsset::onAssetRefresh()
{
mTerrainFile = expandAssetFilePath(mTerrainFile);
mTerrainFilePath = expandAssetFilePath(mTerrainFilePath);
//if (Platform::isFile(mScriptFile))
// Con::executeFile(mScriptFile, false, false);
loadTerrain();
}
void TerrainAsset::setTerrainFile(const char* pScriptFile)
void TerrainAsset::setTerrainFilePath(const char* pScriptFile)
{
// Sanity!
AssertFatal(pScriptFile != NULL, "Cannot use a NULL script file.");
@ -139,12 +153,52 @@ void TerrainAsset::setTerrainFile(const char* pScriptFile)
pScriptFile = StringTable->insert(pScriptFile);
// Update.
mTerrainFile = getOwned() ? expandAssetFilePath(pScriptFile) : pScriptFile;
mTerrainFilePath = getOwned() ? expandAssetFilePath(pScriptFile) : pScriptFile;
// Refresh the asset.
refreshAsset();
}
bool TerrainAsset::loadTerrain()
{
mTerrMaterialAssets.clear();
mTerrMaterialAssetIds.clear();
//First, load any material, animation, etc assets we may be referencing in our asset
// Find any asset dependencies.
AssetManager::typeAssetDependsOnHash::Iterator assetDependenciesItr = mpOwningAssetManager->getDependedOnAssets()->find(mpAssetDefinition->mAssetId);
// Does the asset have any dependencies?
if (assetDependenciesItr != mpOwningAssetManager->getDependedOnAssets()->end())
{
// Iterate all dependencies.
while (assetDependenciesItr != mpOwningAssetManager->getDependedOnAssets()->end() && assetDependenciesItr->key == mpAssetDefinition->mAssetId)
{
StringTableEntry assetType = mpOwningAssetManager->getAssetType(assetDependenciesItr->value);
if (assetType == StringTable->insert("TerrainMaterialAsset"))
{
mTerrMaterialAssetIds.push_front(assetDependenciesItr->value);
//Force the asset to become initialized if it hasn't been already
AssetPtr<TerrainMaterialAsset> matAsset = assetDependenciesItr->value;
mTerrMaterialAssets.push_front(matAsset);
}
// Next dependency.
assetDependenciesItr++;
}
}
mTerrainFile = ResourceManager::get().load(mTerrainFilePath);
if (mTerrainFile)
return true;
return false;
}
//------------------------------------------------------------------------------
void TerrainAsset::copyTo(SimObject* object)
@ -190,7 +244,7 @@ GuiControl* GuiInspectorTypeTerrainAssetPtr::constructEditControl()
TerrainAsset* matAsset = AssetDatabase.acquireAsset< TerrainAsset>(matAssetId);
TerrainMaterial* materialDef = nullptr;
//TerrainMaterial* materialDef = nullptr;
char bitmapName[512] = "tools/worldEditor/images/toolbar/shape-editor";
@ -268,23 +322,3 @@ bool GuiInspectorTypeTerrainAssetPtr::updateRects()
return resized;
}
void GuiInspectorTypeTerrainAssetPtr::setMaterialAsset(String assetId)
{
mTargetObject->setDataField(mCaption, "", assetId);
//force a refresh
SimObject* obj = mInspector->getInspectObject();
mInspector->inspectObject(obj);
}
DefineEngineMethod(GuiInspectorTypeTerrainAssetPtr, setMaterialAsset, void, (String assetId), (""),
"Gets a particular shape animation asset for this shape.\n"
"@param animation asset index.\n"
"@return Shape Animation Asset.\n")
{
if (assetId == String::EmptyString)
return;
return object->setMaterialAsset(assetId);
}

View file

@ -19,6 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#pragma once
#ifndef TERRAINASSET_H
#define TERRAINASSET_H
@ -46,14 +47,23 @@
#include "gui/editor/guiInspectorTypes.h"
#endif
#include "terrain/terrData.h"
//#include "terrain/terrData.h"
#include "assets/assetPtr.h"
#include "terrain/terrFile.h"
class TerrainMaterialAsset;
//-----------------------------------------------------------------------------
class TerrainAsset : public AssetBase
{
typedef AssetBase Parent;
StringTableEntry mTerrainFile;
StringTableEntry mTerrainFilePath;
Resource<TerrainFile> mTerrainFile;
//Material assets we're dependent on and use
Vector<StringTableEntry> mTerrMaterialAssetIds;
Vector<AssetPtr<TerrainMaterialAsset>> mTerrMaterialAssets;
public:
TerrainAsset();
@ -63,8 +73,14 @@ public:
static void initPersistFields();
virtual void copyTo(SimObject* object);
void setTerrainFile(const char* pTerrainFile);
inline StringTableEntry getTerrainFile(void) const { return mTerrainFile; };
virtual void setDataField(StringTableEntry slotName, const char* array, const char* value);
void setTerrainFilePath(const char* pTerrainFile);
inline StringTableEntry getTerrainFilePath(void) const { return mTerrainFilePath; };
inline Resource<TerrainFile> getTerrainResource(void) const { return mTerrainFile; };
bool loadTerrain();
/// Declare Console Object.
DECLARE_CONOBJECT(TerrainAsset);
@ -73,8 +89,8 @@ protected:
virtual void initializeAsset();
virtual void onAssetRefresh(void);
static bool setTerrainFile(void *obj, const char *index, const char *data) { static_cast<TerrainAsset*>(obj)->setTerrainFile(data); return false; }
static const char* getTerrainFile(void* obj, const char* data) { return static_cast<TerrainAsset*>(obj)->getTerrainFile(); }
static bool setTerrainFilePath(void *obj, const char *index, const char *data) { static_cast<TerrainAsset*>(obj)->setTerrainFilePath(data); return false; }
static const char* getTerrainFilePath(void* obj, const char* data) { return static_cast<TerrainAsset*>(obj)->getTerrainFilePath(); }
};
DefineConsoleType(TypeTerrainAssetPtr, TerrainAsset)
@ -96,7 +112,6 @@ public:
virtual GuiControl* constructEditControl();
virtual bool updateRects();
void setMaterialAsset(String assetId);
};
#endif // _ASSET_BASE_H_

View file

@ -19,6 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#pragma once
#ifndef TERRAINMATERIALASSET_H
#define TERRAINMATERIALASSET_H

View file

@ -184,7 +184,7 @@ Material::Material()
dMemset(mCellLayout, 0, sizeof(mCellLayout));
dMemset(mCellSize, 0, sizeof(mCellSize));
dMemset(mNormalMapAtlas, 0, sizeof(mNormalMapAtlas));
dMemset(mUseAnisotropic, 0, sizeof(mUseAnisotropic));
dMemset(mUseAnisotropic, 1, sizeof(mUseAnisotropic));
// Deferred Shading : Metalness
dMemset(mUseMetalness, 0, sizeof(mUseMetalness));

View file

@ -53,7 +53,7 @@
#include "T3D/physics/physicsCollision.h"
#include "console/engineAPI.h"
#include "console/engineAPI.h"
#include "T3D/assets/TerrainMaterialAsset.h"
using namespace Torque;
IMPLEMENT_CO_NETOBJECT_V1(TerrainBlock);
@ -207,6 +207,9 @@ TerrainBlock::TerrainBlock()
mNetFlags.set(Ghostable | ScopeAlways);
mIgnoreZodiacs = false;
zode_primBuffer = 0;
mTerrainAsset = StringTable->EmptyString();
mTerrainAssetId = StringTable->EmptyString();
}
@ -352,17 +355,121 @@ void TerrainBlock::setFile(const Resource<TerrainFile>& terr)
mTerrFileName = terr.getPath();
}
bool TerrainBlock::setTerrainAsset(const StringTableEntry terrainAssetId)
{
mTerrainAssetId = terrainAssetId;
mTerrainAsset = mTerrainAssetId;
if (mTerrainAsset.isNull())
{
Con::errorf("[TerrainBlock] Failed to load terrain asset.");
return false;
}
Resource<TerrainFile> file = mTerrainAsset->getTerrainResource();
if (!file)
return false;
mFile = file;
return true;
}
bool TerrainBlock::save(const char *filename)
{
return mFile->save(filename);
}
bool TerrainBlock::saveAsset()
{
if (!mTerrainAsset.isNull() && mTerrainAsset->isAssetValid())
{
//first, clear out our old dependency references
/*SimFieldDictionary* fieldDictionary = mTerrainAsset->getFieldDictionary();
for (SimFieldDictionaryIterator itr(fieldDictionary); *itr; ++itr)
{
SimFieldDictionary::Entry* entry = *itr;
if (String(entry->slotName).startsWith("terrainMaterailAsset"))
{
//got one, so clear it's value
setDataField(entry->slotName, NULL, "");
}
}
AssetQuery* pAssetQuery = new AssetQuery();
AssetDatabase.findAssetType(pAssetQuery, "TerrainMaterialAsset");
TerrainBlock* clientTerr = static_cast<TerrainBlock*>(getClientObject());
U32 terrMatIdx = 0;
for (U32 i = 0; i < pAssetQuery->mAssetList.size(); i++)
{
//Acquire it so we can check it for matches
AssetPtr<TerrainMaterialAsset> terrMatAsset = pAssetQuery->mAssetList[i];
for (U32 m = 0; m < clientTerr->mFile->mMaterials.size(); m++)
{
StringTableEntry intMatName = clientTerr->mFile->mMaterials[m]->getInternalName();
StringTableEntry assetMatDefName = terrMatAsset->getMaterialDefinitionName();
if (assetMatDefName == intMatName)
{
//we have a match!
char depSlotName[30];
dSprintf(depSlotName, sizeof(depSlotName), "terrainMaterialAsset%d", terrMatIdx);
char depValue[255];
dSprintf(depValue, sizeof(depValue), "@Asset=%s", terrMatAsset.getAssetId());
setDataField(depSlotName, NULL, depValue);
terrMatIdx++;
}
}
terrMatAsset.clear();
}
pAssetQuery->destroySelf();
// Set the format mode.
Taml taml;
// Yes, so set it.
taml.setFormatMode(Taml::getFormatModeEnum("xml"));
// Turn-off auto-formatting.
taml.setAutoFormat(false);
// Read object.
bool success = taml.write(mTerrainAsset, AssetDatabase.getAssetFilePath(mTerrainAsset.getAssetId()));
if (!success)
return false;*/
return mFile->save(mTerrainAsset->getTerrainFilePath());
}
return false;
}
bool TerrainBlock::_setTerrainFile( void *obj, const char *index, const char *data )
{
static_cast<TerrainBlock*>( obj )->setFile( FileName( data ) );
return false;
}
bool TerrainBlock::_setTerrainAsset(void* obj, const char* index, const char* data)
{
TerrainBlock* terr = static_cast<TerrainBlock*>(obj);// ->setFile(FileName(data));
terr->setTerrainAsset(StringTable->insert(data));
terr->setMaskBits(FileMask | HeightMapChangeMask);
return false;
}
void TerrainBlock::_updateBounds()
{
if ( !mFile )
@ -901,31 +1008,50 @@ bool TerrainBlock::onAdd()
if(!Parent::onAdd())
return false;
if ( mTerrFileName.isEmpty() )
Resource<TerrainFile> terr;
if (!mTerrainAsset.isNull())
{
mTerrFileName = Con::getVariable( "$Client::MissionFile" );
String terrainDirectory( Con::getVariable( "$pref::Directories::Terrain" ) );
if ( terrainDirectory.isEmpty() )
terr = mTerrainAsset->getTerrainResource();
if (terr == NULL)
{
terrainDirectory = "art/terrains/";
if (isClientObject())
NetConnection::setLastError("Unable to load terrain asset: %s", mTerrainAsset.getAssetId());
return false;
}
mTerrFileName.replace("tools/levels/", terrainDirectory);
mTerrFileName.replace("levels/", terrainDirectory);
Vector<String> materials;
materials.push_back( "warning_material" );
TerrainFile::create( &mTerrFileName, 256, materials );
mFile = terr;
}
Resource<TerrainFile> terr = ResourceManager::get().load( mTerrFileName );
if(terr == NULL)
else
{
if(isClientObject())
NetConnection::setLastError("You are missing a file needed to play this mission: %s", mTerrFileName.c_str());
return false;
}
if (mTerrFileName.isEmpty())
{
mTerrFileName = Con::getVariable("$Client::MissionFile");
String terrainDirectory(Con::getVariable("$pref::Directories::Terrain"));
if (terrainDirectory.isEmpty())
{
terrainDirectory = "art/terrains/";
}
mTerrFileName.replace("tools/levels/", terrainDirectory);
mTerrFileName.replace("levels/", terrainDirectory);
setFile( terr );
Vector<String> materials;
materials.push_back("warning_material");
TerrainFile::create(&mTerrFileName, 256, materials);
}
terr = ResourceManager::get().load(mTerrFileName);
if (terr == NULL)
{
if (isClientObject())
NetConnection::setLastError("You are missing a file needed to play this mission: %s", mTerrFileName.c_str());
return false;
}
setFile(terr);
}
if ( terr->mNeedsResaving )
{
@ -1130,6 +1256,10 @@ void TerrainBlock::initPersistFields()
&TerrainBlock::_setTerrainFile, &defaultProtectedGetFn,
"The source terrain data file." );
addProtectedField("terrainAsset", TypeTerrainAssetPtr, Offset(mTerrainAsset, TerrainBlock),
&TerrainBlock::_setTerrainAsset, &defaultProtectedGetFn,
"The source terrain data asset.");
endGroup( "Media" );
addGroup( "Misc" );
@ -1190,6 +1320,7 @@ U32 TerrainBlock::packUpdate(NetConnection* con, U32 mask, BitStream *stream)
if ( stream->writeFlag( mask & FileMask ) )
{
stream->write( mTerrFileName );
stream->writeString( mTerrainAssetId );
stream->write( mCRC );
}
@ -1230,12 +1361,25 @@ void TerrainBlock::unpackUpdate(NetConnection* con, BitStream *stream)
{
FileName terrFile;
stream->read( &terrFile );
char buffer[256];
stream->readString(buffer);
StringTableEntry terrainAsset = StringTable->insert(buffer);
stream->read( &mCRC );
if ( isProperlyAdded() )
setFile( terrFile );
if (terrainAsset != StringTable->EmptyString())
{
if (isProperlyAdded())
setTerrainAsset(StringTable->insert(terrFile.c_str()));
else
mTerrainAssetId = StringTable->insert(terrFile.c_str());
}
else
mTerrFileName = terrFile;
{
if (isProperlyAdded())
setFile(terrFile);
else
mTerrFileName = terrFile;
}
}
if ( stream->readFlag() ) // SizeMask
@ -1310,6 +1454,16 @@ DefineEngineMethod( TerrainBlock, save, bool, ( const char* fileName),,
return static_cast<TerrainBlock*>(object)->save(filename);
}
DefineEngineMethod(TerrainBlock, saveAsset, bool, (), ,
"@brief Saves the terrain block's terrain file to the specified file name.\n\n"
"@param fileName Name and path of file to save terrain data to.\n\n"
"@return True if file save was successful, false otherwise")
{
return static_cast<TerrainBlock*>(object)->saveAsset();
}
//ConsoleMethod(TerrainBlock, save, bool, 3, 3, "(string fileName) - saves the terrain block's terrain file to the specified file name.")
//{
// char filename[256];

View file

@ -50,7 +50,12 @@
#include "gfx/gfxPrimitiveBuffer.h"
#endif
#ifndef _ASSET_PTR_H_
#include "assets/assetPtr.h"
#endif
#ifndef TERRAINASSET_H
#include "T3D/assets/TerrainAsset.h"
#endif
class GBitmap;
class TerrainBlock;
@ -120,6 +125,9 @@ protected:
///
FileName mTerrFileName;
AssetPtr<TerrainAsset> mTerrainAsset;
StringTableEntry mTerrainAssetId;
/// The maximum detail distance found in the material list.
F32 mMaxDetailDistance;
@ -241,6 +249,7 @@ protected:
// Protected fields
static bool _setTerrainFile( void *obj, const char *index, const char *data );
static bool _setTerrainAsset(void* obj, const char* index, const char* data);
static bool _setSquareSize( void *obj, const char *index, const char *data );
static bool _setBaseTexSize(void *obj, const char *index, const char *data);
static bool _setBaseTexFormat(void *obj, const char *index, const char *data);
@ -418,7 +427,10 @@ public:
void setFile(const Resource<TerrainFile>& file);
bool setTerrainAsset(const StringTableEntry terrainAssetId);
bool save(const char* filename);
bool saveAsset();
F32 getSquareSize() const { return mSquareSize; }

View file

@ -97,7 +97,7 @@ void TerrainMaterial::initPersistFields()
addField( "parallaxScale", TypeF32, Offset( mParallaxScale, TerrainMaterial ), "Used to scale the height from the normal map to give some self "
"occlusion effect (aka parallax) to the terrain material" );
addField("compositeMap", TypeStringFilename, Offset(mCompositeMap, TerrainMaterial), "Composite map for the material");
addField("pbrConfigMap", TypeStringFilename, Offset(mCompositeMap, TerrainMaterial), "Composite map for the material");
Parent::initPersistFields();
// Gotta call this at least once or it won't get created!

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();