From 81aa43a4bd5f1a8807796248ff07787fab7b3751 Mon Sep 17 00:00:00 2001 From: JeffR Date: Tue, 29 Mar 2022 01:40:07 -0500 Subject: [PATCH 1/4] Fixed formatting to match the standard for TerrainMaterialAsset inspector fields Added utility functions to TerrainMaterialAsset for getting the material and fx material definitions Fixed logical flaw with the initialization code that could cause the materialDefinition to be nulled in terrainmaterialassets Fixed layer handling in GroundCover to properly work with TerrainMaterialAssets Added logic to properly exit out of the onAdd in the event no internal name is assigned or if there is a collision. This prevents duplicates from appearing in the terr mat editor when creating a new material Fixed issue where going from a creator item in the AB to selecting a particular asset type would break the filtering because select mode removed collections and creator items, changing all the item ids and breaking references. Added sanity check to prevent attempting to acquire non-assets in the AB, such as creator entries, which would cause console spam Added optional field to provide an override new asset name to the New Asset window Added logic so in the event no FX Material is found when importing a terrain material, it will create a stub entry so it always has one defined Added logic to handle situations where a terrain has a reference to an assetId, but the asset does not exist for whatever reason. Will prompt to create the missing asset, then continue on with the regular saving/editing process as normal Fixed issue where the terrain material editor would try and reference the preview images being used in the display on the editor instead of the proper assetId itself --- .../T3D/assets/TerrainMaterialAsset.cpp | 146 +++++++----------- .../source/T3D/assets/TerrainMaterialAsset.h | 13 +- Engine/source/T3D/fx/groundCover.cpp | 4 +- Engine/source/T3D/fx/groundCover.h | 2 +- Engine/source/terrain/terrMaterial.cpp | 14 +- .../assetBrowser/scripts/assetBrowser.tscript | 35 ++--- .../assetBrowser/scripts/newAsset.tscript | 8 +- .../pre40/T3Dpre4ProjectImporter.tscript | 9 ++ .../interfaces/terrainMaterialDlg.ed.tscript | 45 ++++-- 9 files changed, 142 insertions(+), 134 deletions(-) diff --git a/Engine/source/T3D/assets/TerrainMaterialAsset.cpp b/Engine/source/T3D/assets/TerrainMaterialAsset.cpp index 3ef54d856..043ce6812 100644 --- a/Engine/source/T3D/assets/TerrainMaterialAsset.cpp +++ b/Engine/source/T3D/assets/TerrainMaterialAsset.cpp @@ -177,11 +177,6 @@ void TerrainMaterialAsset::initializeAsset() return; } - if (mMatDefinitionName == StringTable->insert("DetailBlue")) - { - bool asdfsd = true; - } - if (size() != 0 && mScriptPath == StringTable->EmptyString()) { mLoadedState = EmbeddedDefinition; @@ -267,18 +262,20 @@ void TerrainMaterialAsset::loadMaterial() { for (U32 i = 0; i < size(); i++) { - mMaterialDefinition = dynamic_cast(getObject(i)); - if (mMaterialDefinition) + TerrainMaterial* terrMat = dynamic_cast(getObject(i)); + if (terrMat) { + mMaterialDefinition = terrMat; mLoadedState = Ok; mMaterialDefinition->setInternalName(getAssetId()); continue; } //Otherwise, check if it's our FX material - mFXMaterialDefinition = dynamic_cast(getObject(i)); - if (mFXMaterialDefinition) + Material* fxMat = dynamic_cast(getObject(i)); + if (fxMat) { + mFXMaterialDefinition = fxMat; //mMaterialDefinition->setInternalName(getAssetId()); mFXMaterialDefinition->reload(); continue; @@ -286,6 +283,9 @@ void TerrainMaterialAsset::loadMaterial() } } + + if(mLoadedState == Ok) + return; } else if ((mLoadedState == ScriptLoaded || mLoadedState == DefinitionAlreadyExists) && mMatDefinitionName != StringTable->EmptyString()) { @@ -460,6 +460,28 @@ DefineEngineMethod(TerrainMaterialAsset, getScriptPath, const char*, (), , { return object->getScriptPath(); } + +DefineEngineMethod(TerrainMaterialAsset, getMaterialDefinition, S32, (), , + "Queries the Asset Database to see if any asset exists that is associated with the provided material name.\n" + "@return The AssetId of the associated asset, if any.") +{ + SimObjectPtr mat = object->getMaterialDefinition(); + if (mat.isValid()) + return mat->getId(); + else + return 0; +} + +DefineEngineMethod(TerrainMaterialAsset, getFXMaterialDefinition, S32, (), , + "Queries the Asset Database to see if any asset exists that is associated with the provided material name.\n" + "@return The AssetId of the associated asset, if any.") +{ + SimObjectPtr mat = object->getFXMaterialDefinition(); + if (mat.isValid()) + return mat->getId(); + else + return 0; +} #endif //----------------------------------------------------------------------------- // GuiInspectorTypeAssetId @@ -483,68 +505,36 @@ void GuiInspectorTypeTerrainMaterialAssetPtr::consoleInit() GuiControl* GuiInspectorTypeTerrainMaterialAssetPtr::constructEditControl() { // Create base filename edit controls - mUseHeightOverride = true; - mHeightOverride = 100; - - mMatEdContainer = new GuiControl(); - mMatEdContainer->registerObject(); - - addObject(mMatEdContainer); - - // Create "Open in ShapeEditor" button - mMatPreviewButton = new GuiBitmapButtonCtrl(); - - const char* matAssetId = getData(); - - TerrainMaterialAsset* matAsset = AssetDatabase.acquireAsset< TerrainMaterialAsset>(matAssetId); - - TerrainMaterial* materialDef = nullptr; - - char bitmapName[512] = "ToolsModule:material_editor_n_image"; - - /*if (!Sim::findObject(matAsset->getMaterialDefinitionName(), materialDef)) - { - Con::errorf("GuiInspectorTypeTerrainMaterialAssetPtr::constructEditControl() - unable to find material in asset"); - } - else - { - mMatPreviewButton->setBitmap(materialDef->mDiffuseMapFilename[0]); - }*/ - - mMatPreviewButton->setPosition(0, 0); - mMatPreviewButton->setExtent(100,100); + GuiControl* retCtrl = Parent::constructEditControl(); + if (retCtrl == NULL) + return retCtrl; // Change filespec char szBuffer[512]; - dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"TerrainMaterialAsset\", \"AssetBrowser.changeAsset\", %d, %s);", + dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"TerrainMaterialAsset\", \"AssetBrowser.changeAsset\", %s, %s);", mInspector->getIdString(), mCaption); - mMatPreviewButton->setField("Command", szBuffer); + mBrowseButton->setField("Command", szBuffer); - mMatPreviewButton->setDataField(StringTable->insert("Profile"), NULL, "GuiButtonProfile"); - mMatPreviewButton->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile"); - mMatPreviewButton->setDataField(StringTable->insert("hovertime"), NULL, "1000"); + setDataField(StringTable->insert("targetObject"), NULL, mInspector->getInspectObject()->getIdString()); - StringBuilder strbld; - strbld.append(matAsset->getMaterialDefinitionName()); - strbld.append("\n"); - strbld.append("Open this asset in the Material Editor"); + // Create "Open in Editor" button + mEditButton = new GuiBitmapButtonCtrl(); - mMatPreviewButton->setDataField(StringTable->insert("tooltip"), NULL, strbld.data()); + dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.editAsset(%d.getText());", retCtrl->getId()); + mEditButton->setField("Command", szBuffer); - _registerEditControl(mMatPreviewButton); - //mMatPreviewButton->registerObject(); - mMatEdContainer->addObject(mMatPreviewButton); + char bitmapName[512] = "ToolsModule:material_editor_n_image"; + mEditButton->setBitmap(StringTable->insert(bitmapName)); - mMatAssetIdTxt = new GuiTextEditCtrl(); - mMatAssetIdTxt->registerObject(); - mMatAssetIdTxt->setActive(false); + mEditButton->setDataField(StringTable->insert("Profile"), NULL, "GuiButtonProfile"); + mEditButton->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile"); + mEditButton->setDataField(StringTable->insert("hovertime"), NULL, "1000"); + mEditButton->setDataField(StringTable->insert("tooltip"), NULL, "Open this asset in the Terrain Material Editor"); - mMatAssetIdTxt->setText(matAssetId); + mEditButton->registerObject(); + addObject(mEditButton); - mMatAssetIdTxt->setBounds(100, 0, 150, 18); - mMatEdContainer->addObject(mMatAssetIdTxt); - - return mMatEdContainer; + return retCtrl; } bool GuiInspectorTypeTerrainMaterialAssetPtr::updateRects() @@ -558,45 +548,21 @@ bool GuiInspectorTypeTerrainMaterialAssetPtr::updateRects() mEditCtrlRect.set(fieldExtent.x - dividerPos + dividerMargin, 1, dividerPos - dividerMargin - 34, fieldExtent.y); bool resized = mEdit->resize(mEditCtrlRect.point, mEditCtrlRect.extent); - - if (mMatEdContainer != nullptr) + if (mBrowseButton != NULL) { - mMatPreviewButton->resize(mEditCtrlRect.point, mEditCtrlRect.extent); + mBrowseRect.set(fieldExtent.x - 32, 2, 14, fieldExtent.y - 4); + resized |= mBrowseButton->resize(mBrowseRect.point, mBrowseRect.extent); } - if (mMatPreviewButton != nullptr) + if (mEditButton != NULL) { - mMatPreviewButton->resize(Point2I::Zero, Point2I(100, 100)); - } - - if (mMatAssetIdTxt != nullptr) - { - mMatAssetIdTxt->resize(Point2I(100, 0), Point2I(mEditCtrlRect.extent.x - 100, 18)); + RectI shapeEdRect(fieldExtent.x - 16, 2, 14, fieldExtent.y - 4); + resized |= mEditButton->resize(shapeEdRect.point, shapeEdRect.extent); } return resized; } -void GuiInspectorTypeTerrainMaterialAssetPtr::setMaterialAsset(String assetId) -{ - mTargetObject->setDataField(mCaption, "", assetId); - - //force a refresh - SimObject* obj = mInspector->getInspectObject(); - mInspector->inspectObject(obj); -} - -DefineEngineMethod(GuiInspectorTypeTerrainMaterialAssetPtr, 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); -} - IMPLEMENT_CONOBJECT(GuiInspectorTypeTerrainMaterialAssetId); ConsoleDocClass(GuiInspectorTypeTerrainMaterialAssetId, diff --git a/Engine/source/T3D/assets/TerrainMaterialAsset.h b/Engine/source/T3D/assets/TerrainMaterialAsset.h index dfa3c3ef1..86b6bc718 100644 --- a/Engine/source/T3D/assets/TerrainMaterialAsset.h +++ b/Engine/source/T3D/assets/TerrainMaterialAsset.h @@ -94,6 +94,8 @@ public: StringTableEntry getMaterialDefinitionName() { return mMatDefinitionName; } SimObjectPtr getMaterialDefinition() { return mMaterialDefinition; } + SimObjectPtr getFXMaterialDefinition() { return mFXMaterialDefinition; } + void setScriptFile(const char* pScriptFile); inline StringTableEntry getScriptFile(void) const { return mScriptFile; }; @@ -127,26 +129,23 @@ protected: }; DefineConsoleType(TypeTerrainMaterialAssetPtr, TerrainMaterialAsset) -DefineConsoleType(TypeMaterialAssetId, String) +DefineConsoleType(TypeTerrainMaterialAssetId, String) //----------------------------------------------------------------------------- // TypeAssetId GuiInspectorField Class //----------------------------------------------------------------------------- -class GuiInspectorTypeTerrainMaterialAssetPtr : public GuiInspectorField +class GuiInspectorTypeTerrainMaterialAssetPtr : public GuiInspectorTypeFileName { - typedef GuiInspectorField Parent; + typedef GuiInspectorTypeFileName Parent; public: - GuiControl* mMatEdContainer; - GuiBitmapButtonCtrl *mMatPreviewButton; - GuiTextEditCtrl *mMatAssetIdTxt; + GuiBitmapButtonCtrl* mEditButton; DECLARE_CONOBJECT(GuiInspectorTypeTerrainMaterialAssetPtr); static void consoleInit(); virtual GuiControl* constructEditControl(); virtual bool updateRects(); - void setMaterialAsset(String assetId); }; class GuiInspectorTypeTerrainMaterialAssetId : public GuiInspectorTypeTerrainMaterialAssetPtr { diff --git a/Engine/source/T3D/fx/groundCover.cpp b/Engine/source/T3D/fx/groundCover.cpp index a9c975eec..e6d354d76 100644 --- a/Engine/source/T3D/fx/groundCover.cpp +++ b/Engine/source/T3D/fx/groundCover.cpp @@ -50,6 +50,7 @@ #include "renderInstance/renderDeferredMgr.h" #include "console/engineAPI.h" #include "T3D/assets/MaterialAsset.h" +#include "T3D/assets/TerrainMaterialAsset.h" /// This is used for rendering ground cover billboards. GFXImplementVertexFormat( GCVertex ) @@ -564,7 +565,7 @@ void GroundCover::initPersistFields() addField("shapeFilename", TypeFilename, Offset(mShapeName, GroundCover), MAX_COVERTYPES, "The cover shape filename. [Optional]", AbstractClassRep::FIELD_HideInInspectors); INITPERSISTFIELD_SHAPEASSET_ARRAY(Shape, MAX_COVERTYPES, GroundCover, "The cover shape. [Optional]"); - addField( "layer", TypeTerrainMaterialName, Offset( mLayer, GroundCover ), MAX_COVERTYPES, "Terrain material name to limit coverage to, or blank to not limit." ); + addField( "layer", TypeTerrainMaterialAssetId, Offset( mLayer, GroundCover ), MAX_COVERTYPES, "Terrain material assetId to limit coverage to, or blank to not limit." ); addField( "invertLayer", TypeBool, Offset( mInvertLayer, GroundCover ), MAX_COVERTYPES, "Indicates that the terrain material index given in 'layer' is an exclusion mask." ); @@ -1178,6 +1179,7 @@ GroundCoverCell* GroundCover::_generateCell( const Point2I& index, const bool typeIsShape = mShapeInstances[ type ] != NULL; const Box3F typeShapeBounds = typeIsShape ? mShapeInstances[ type ]->getShape()->mBounds : Box3F(); const F32 typeWindScale = mWindScale[type]; + StringTableEntry typeLayer = mLayer[type]; const bool typeInvertLayer = mInvertLayer[type]; diff --git a/Engine/source/T3D/fx/groundCover.h b/Engine/source/T3D/fx/groundCover.h index aba467810..906a96a7e 100644 --- a/Engine/source/T3D/fx/groundCover.h +++ b/Engine/source/T3D/fx/groundCover.h @@ -312,7 +312,7 @@ protected: /// The maximum world space elevation for placement. F32 mMaxElevation[MAX_COVERTYPES]; - /// Terrain material name to limit coverage to, or + /// Terrain material assetId to limit coverage to, or /// left empty to cover entire terrain. StringTableEntry mLayer[MAX_COVERTYPES]; diff --git a/Engine/source/terrain/terrMaterial.cpp b/Engine/source/terrain/terrMaterial.cpp index 289c9a16f..b25cf02b9 100644 --- a/Engine/source/terrain/terrMaterial.cpp +++ b/Engine/source/terrain/terrMaterial.cpp @@ -137,13 +137,19 @@ bool TerrainMaterial::onAdd() SimSet *set = Sim::getTerrainMaterialSet(); // Make sure we have an internal name set. - if ( !mInternalName || !mInternalName[0] ) - Con::warnf( "TerrainMaterial::onAdd() - No internal name set!" ); + if (!mInternalName || !mInternalName[0]) + { + Con::warnf("TerrainMaterial::onAdd() - No internal name set!"); + return false; + } else { SimObject *object = set->findObjectByInternalName( mInternalName ); - if ( object ) - Con::warnf( "TerrainMaterial::onAdd() - Internal name collision; '%s' already exists!", mInternalName ); + if (object) + { + Con::warnf("TerrainMaterial::onAdd() - Internal name collision; '%s' already exists!", mInternalName); + return false; + } } set->addObject( this ); diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript index cf331ac74..fc3e3576c 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript @@ -639,9 +639,18 @@ function AssetBrowser::loadDirectories( %this ) %dataItem = AssetBrowser-->filterTree.insertItem(AssetBrowser-->filterTree.modulesIdx, "data"); AssetBrowser-->filterTree.tagsIdx = AssetBrowser-->filterTree.insertItem(1, "Tags"); - if(!%this.selectMode) AssetBrowser-->filterTree.creatorIdx = AssetBrowser-->filterTree.insertItem(1, "Creator"); + AssetBrowser-->filterTree.clearSelection(); + + if(%this.selectMode) + { + AssetBrowser-->filterTree.addSelection(AssetBrowser-->filterTree.collectionsIdx); + AssetBrowser-->filterTree.addSelection(AssetBrowser-->filterTree.creatorIdx); + + AssetBrowser-->filterTree.hideSelection(); + } + %this.dirHandler.loadFolders("data", %dataItem); %this.loadCollectionSets(); @@ -750,20 +759,6 @@ function AssetBrowser::loadDirectories( %this ) function AssetBrowser::updateSelection( %this, %asset, %moduleName ) { - /*%isAssetBorder = 0; - eval("%isAssetBorder = isObject(AssetBrowser-->"@%asset@"Border);"); - if( %isAssetBorder ) - { - eval( "AssetBrowser-->"@%asset@"Border.setStateOn(1);"); - } - - %isAssetBorderPrevious = 0; - eval("%isAssetBorderPrevious = isObject(AssetBrowser-->"@%this.prevSelectedMaterialHL@"Border);"); - if( %isAssetBorderPrevious ) - { - eval( "AssetBrowser-->"@%this.prevSelectedMaterialHL@"Border.setStateOn(0);"); - }*/ - //If we had an existing selected assetDef, clear the reference if(isObject(AssetBrowser.selectedAssetDef)) AssetDatabase.releaseAsset(AssetBrowser.selectedAssetDef.getAssetId()); @@ -775,11 +770,13 @@ function AssetBrowser::updateSelection( %this, %asset, %moduleName ) if(strstr(%moduleName, "/") != -1) return; - //Otherwise, it's an asset so we'll select the definition while we're at it + //Check if this is an actual assetId, or if it's just a programmatic reference + //like what we use for the creator entries + if(AssetDatabase.isDeclaredAsset(AssetBrowser.selectedAsset)) + { + //Looks good, it's an asset so we'll select the definition while we're at it AssetBrowser.selectedAssetDef = AssetDatabase.acquireAsset(AssetBrowser.selectedAsset); - //AssetBrowser.selectedPreviewImagePath = %previewImagePath; - - //%this.prevSelectedMaterialHL = %asset; + } } function AssetBrowser::loadCollectionSets(%this) diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/newAsset.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/newAsset.tscript index f2ea27660..c402456cd 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/newAsset.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/newAsset.tscript @@ -85,7 +85,7 @@ function NewAssetModuleBtn::onClick(%this) AssetBrowser_addModuleWindow.selectWindow(); } -function AssetBrowser::setupCreateNewAsset(%this, %assetType, %moduleName, %callback) +function AssetBrowser::setupCreateNewAsset(%this, %assetType, %moduleName, %callback, %nameOverride) { Canvas.pushDialog(AssetBrowser_newAsset); @@ -106,8 +106,12 @@ function AssetBrowser::setupCreateNewAsset(%this, %assetType, %moduleName, %call %this.newAssetSettings.assetType = %assetType; %this.newAssetSettings.moduleName = %moduleName; + %newAssetName = "New" @ %shortAssetTypeName; + if(%nameOverride !$= "") + %newAssetName = %nameOverride; + NewAssetPropertiesInspector.startGroup("General"); - NewAssetPropertiesInspector.addField("assetName", "New Asset Name", "String", "Name of the new asset", "New" @ %shortAssetTypeName, "", %this.newAssetSettings); + NewAssetPropertiesInspector.addField("assetName", "New Asset Name", "String", "Name of the new asset", %newAssetName, "", %this.newAssetSettings); //NewAssetPropertiesInspector.addField("AssetType", "New Asset Type", "List", "Type of the new asset", %assetType, "Component,Image,Material,Shape,Sound,State Machine", %newAssetSettings); //NewAssetPropertiesInspector.addField("friendlyName", "Friendly Name", "String", "Human-readable name of new asset", "", "", %this.newAssetSettings); diff --git a/Templates/BaseGame/game/tools/projectImporter/importers/pre40/T3Dpre4ProjectImporter.tscript b/Templates/BaseGame/game/tools/projectImporter/importers/pre40/T3Dpre4ProjectImporter.tscript index 00f890cf1..7c50130b2 100644 --- a/Templates/BaseGame/game/tools/projectImporter/importers/pre40/T3Dpre4ProjectImporter.tscript +++ b/Templates/BaseGame/game/tools/projectImporter/importers/pre40/T3Dpre4ProjectImporter.tscript @@ -1244,6 +1244,15 @@ function T3Dpre4ProjectImporter::processTerrainMaterialObject(%this, %fileObject %fileObject.FXMaterial.processed = true; %fileObject.FXMaterial.skip = true; } + else + { + //if after all that we still have no FXMaterial, just create a new one + %fxMat = new Material("TerrainFX_" @ %objectName) + { + mapTo = %objectName; + }; + %asset.add(%fxMat); + } %success = false; if(TamlWrite(%asset, %tamlpath)) diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/interfaces/terrainMaterialDlg.ed.tscript b/Templates/BaseGame/game/tools/worldEditor/scripts/interfaces/terrainMaterialDlg.ed.tscript index fd1063618..1446d6d7d 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/interfaces/terrainMaterialDlg.ed.tscript +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/interfaces/terrainMaterialDlg.ed.tscript @@ -474,11 +474,36 @@ function TerrainMaterialDlg::setActiveMaterial( %this, %mat ) function TerrainMaterialDlg::saveDirtyMaterial( %this, %mat ) { + //If we happen to have been handed an assetId, process it + if(AssetDatabase.isDeclaredAsset(%mat)) + { + %assetDef = AssetDatabase.acquireAsset(%mat); + %mat = %assetDef.getMaterialDefinition(); + } + // Skip over obviously bad cases. if ( !isObject( %mat ) || !%mat.isMemberOfClass( TerrainMaterial ) ) return; + //Lets validate it wasn't a generated stub. if so, we need to add an intermediate + //step to create the asset + %assetDef = AssetDatabase.acquireAsset(%mat.internalName); + if(%assetDef $= "") + { + %moduleSplit = strpos(%mat.internalName, ":"); + %moduleName = getSubStr(%mat.internalName, 0, %moduleSplit); + %assetName = getSubStr(%mat.internalName, %moduleSplit+1, -1); + if(ModuleDatabase.findModule(%moduleName) !$= "") + { + AssetBrowser.selectedModule = %moduleName; + } + + //we need to create an actual asset here + AssetBrowser.setupCreateNewAsset("TerrainMaterialAsset", AssetBrowser.selectedModule, "TerrainMaterialDlg.saveDirtyMaterial", %assetName); + return; + } + // Read out properties from the dialog. %newName = %this-->matNameCtrl.getText(); @@ -487,28 +512,28 @@ function TerrainMaterialDlg::saveDirtyMaterial( %this, %mat ) //--- - %newDiffuse = %this-->texDiffuseMap.getBitmap(); - if(%newDiffuse $= $TerrainMaterialEditor::emptyMaterialImage || %newDiffuse $= %blankBitmap) + %newDiffuse = %this-->diffuseMapAssetId.text; + if(%newDiffuse $= "None") %newDiffuse = ""; //--- - %newNormal = %this-->texNormalMap.getBitmap(); - if(%newNormal $= $TerrainMaterialEditor::emptyMaterialImage || %newNormal $= %blankBitmap) + %newNormal = %this-->normalMapAssetId.text; + if(%newNormal $= "None") %newNormal = ""; //--- - %newormConfig = %this-->texORMConfigMap.getBitmap(); - if(%newormConfig $= $TerrainMaterialEditor::emptyMaterialImage || %newormConfig $= %blankBitmap) + %newormConfig = %this-->ORMMapAssetId.text; + if(%newormConfig $= "None") %newormConfig = ""; //--- - %newDetail = %this-->texDetailMap.getBitmap(); - if(%newDetail $= $TerrainMaterialEditor::emptyMaterialImage || %newDetail $= %blankBitmap) + %newDetail = %this-->detailMapAssetId.text; + if(%newDetail $= "None") %newDetail = ""; //--- - %newMacro = %this-->texMacroMap.getBitmap(); - if(%newMacro $= $TerrainMaterialEditor::emptyMaterialImage || %newMacro $= %blankBitmap) + %newMacro = %this-->macroMapAssetId.text; + if(%newMacro $= "None") %newMacro = ""; %detailSize = %this-->detSizeCtrl.getText(); From 85bb4cbff3943387c4368c7bcaa9adc47a55c0f5 Mon Sep 17 00:00:00 2001 From: JeffR Date: Wed, 30 Mar 2022 01:38:15 -0500 Subject: [PATCH 2/4] Adds cleanup of material and terrain material objects when creating a new asset of the respective type to avoid collisions when we immediately properly init the asset on creation Reorganizes the terrainMaterialDlg to use a split container for better usability, fixed some minor layout issues, and added in FX material fields to be able to edit those directly via the terrain mat editor Updated the terrainMaterialDlg save logic to better sequence the steps for saving to allow stable in-place creation of asset for stub materials due to missing references Updated the terrainMaterialDlg save logic to properly save out all the material effects stuff like footstep flags, effect colors, or sounds. --- .../scripts/assetTypes/material.tscript | 3 + .../assetTypes/terrainMaterial.tscript | 4 + .../gui/guiTerrainMaterialDlg.ed.gui | 1470 +++-------------- .../interfaces/terrainMaterialDlg.ed.tscript | 251 ++- 4 files changed, 442 insertions(+), 1286 deletions(-) diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/material.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/material.tscript index fb6b8a4ad..27a3dc58d 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/material.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/material.tscript @@ -21,6 +21,9 @@ function AssetBrowser::createMaterialAsset(%this) TamlWrite(%asset, %tamlpath); + //cleanup before proper init'ing + %assetName.delete(); + %moduleDef = ModuleDatabase.findModule(%moduleName, 1); AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath); diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/terrainMaterial.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/terrainMaterial.tscript index 8fc9e21f9..c9c9ba83d 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/terrainMaterial.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/terrainMaterial.tscript @@ -48,6 +48,10 @@ function AssetBrowser::createTerrainMaterialAsset(%this) TamlWrite(%asset, %tamlpath); + //cleanup before proper init'ing + %matDef.delete(); + %fxMatDef.delete(); + %moduleDef = ModuleDatabase.findModule(%moduleName, 1); AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath); diff --git a/Templates/BaseGame/game/tools/worldEditor/gui/guiTerrainMaterialDlg.ed.gui b/Templates/BaseGame/game/tools/worldEditor/gui/guiTerrainMaterialDlg.ed.gui index 4eef5308f..014771aed 100644 --- a/Templates/BaseGame/game/tools/worldEditor/gui/guiTerrainMaterialDlg.ed.gui +++ b/Templates/BaseGame/game/tools/worldEditor/gui/guiTerrainMaterialDlg.ed.gui @@ -1,1922 +1,894 @@ //--- OBJECT WRITE BEGIN --- $guiContent = new GuiControl(TerrainMaterialDlg,EditorGuiGroup) { - position = "0 0"; extent = "1024 768"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "ToolsGuiDefaultNonModalProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; isContainer = "1"; - canSave = "1"; canSaveDynamicFields = "1"; new GuiWindowCtrl() { text = "Terrain Materials Editor"; - resizeWidth = "1"; - resizeHeight = "1"; - canMove = "1"; - canClose = "1"; canMinimize = "0"; canMaximize = "0"; - canCollapse = "0"; closeCommand = "TerrainMaterialDlg.dialogCancel();"; edgeSnap = "0"; docking = "None"; margin = "4 4 4 4"; - padding = "0 0 0 0"; anchorTop = "0"; - anchorBottom = "0"; anchorLeft = "0"; - anchorRight = "0"; - position = "315 118"; - extent = "394 532"; + position = "222 59"; + extent = "457 639"; minExtent = "358 452"; horizSizing = "center"; vertSizing = "center"; profile = "ToolsGuiWindowProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; + + new GuiSplitContainer() { + splitPoint = "182 100"; + position = "3 27"; + extent = "450 579"; + horizSizing = "width"; + profile = "ToolsGuiDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + + new GuiPanel() { + docking = "Client"; + extent = "180 579"; + profile = "ToolsGuiDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + internalName = "Panel1"; new GuiContainer() { - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "6 25"; - extent = "189 64"; - minExtent = "8 2"; + position = "6 -2"; + extent = "179 18"; horizSizing = "width"; - vertSizing = "bottom"; profile = "inspectorStyleRolloutDarkProfile"; - visible = "1"; - active = "1"; tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; new GuiTextCtrl() { text = "Terrain Materials"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; position = "5 0"; extent = "91 18"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "ToolsGuiDefaultProfile"; - visible = "1"; - active = "1"; tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiBitmapButtonCtrl() { - bitmapAsset = "ToolsModule:new_n_image"; - bitmapMode = "Stretched"; - autoFitExtents = "0"; - useModifiers = "0"; - useStates = "1"; - masked = "0"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "160 2"; + BitmapAsset = "ToolsModule:new_n_image"; + position = "150 3"; extent = "15 15"; - minExtent = "8 2"; horizSizing = "left"; vertSizing = "top"; profile = "ToolsGuiButtonProfile"; - visible = "1"; - active = "1"; command = "TerrainMaterialDlg.newMat();"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiBitmapButtonCtrl() { - bitmapAsset = "ToolsModule:delete_n_image"; - bitmapMode = "Stretched"; - autoFitExtents = "0"; - useModifiers = "0"; - useStates = "1"; - masked = "0"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "173 2"; + BitmapAsset = "ToolsModule:delete_n_image"; + position = "163 3"; extent = "15 15"; - minExtent = "8 2"; horizSizing = "left"; vertSizing = "top"; profile = "ToolsGuiButtonProfile"; - visible = "1"; - active = "1"; command = "TerrainMaterialDlg.deleteMat();"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; }; + new GuiControl() { + position = "6 26"; + extent = "177 545"; + horizSizing = "width"; + vertSizing = "height"; + profile = "ToolsGuiDefaultProfile"; + tooltipProfile = "ToolsGuiToolTipProfile"; + isContainer = "1"; + + new GuiScrollCtrl() { + hScrollBar = "dynamic"; + vScrollBar = "dynamic"; + extent = "174 549"; + horizSizing = "width"; + vertSizing = "height"; + profile = "ToolsGuiScrollProfile"; + tooltipProfile = "ToolsGuiToolTipProfile"; + + new GuiTreeViewCtrl() { + itemHeight = "21"; + mouseDragging = "0"; + multipleSelections = "0"; + deleteObjectAllowed = "0"; + dragToItemAllowed = "0"; + showRoot = "0"; + showObjectIds = "0"; + showClassNames = "0"; + showObjectNames = "0"; + position = "1 1"; + extent = "224 42"; + profile = "ToolsGuiTreeViewProfile"; + tooltipProfile = "ToolsGuiToolTipProfile"; + internalName = "matLibTree"; + class = "TerrainMaterialTreeCtrl"; + }; + }; + }; + }; + new GuiPanel() { + docking = "Client"; + position = "184 0"; + extent = "266 579"; + profile = "ToolsGuiDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + internalName = "panel2"; + new GuiContainer() { - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "202 26"; - extent = "185 463"; - minExtent = "8 2"; - horizSizing = "left"; + position = "-7 0"; + extent = "274 577"; + horizSizing = "width"; vertSizing = "height"; profile = "inspectorStyleRolloutProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; internalName = "matSettingsParent"; - canSave = "1"; - canSaveDynamicFields = "0"; new GuiBitmapCtrl() { - bitmap = "ToolsModule:separator_v_image"; - color = "White"; - wrap = "0"; + BitmapAsset = "ToolsModule:separator_v_image"; position = "1 0"; - extent = "183 2"; - minExtent = "8 2"; + extent = "271 2"; horizSizing = "width"; - vertSizing = "bottom"; profile = "ToolsGuiDefaultProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiTextCtrl() { text = "Name"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; position = "8 22"; extent = "44 17"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "ToolsGuiTextProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiDefaultProfile"; - hovertime = "1000"; isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiTextEditCtrl() { - historySize = "0"; - tabComplete = "0"; - sinkAllKeyEvents = "0"; - password = "0"; - passwordMask = "*"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; position = "39 21"; - extent = "143 18"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; + extent = "227 18"; profile = "ToolsGuiTextEditProfile"; - visible = "1"; - active = "1"; altCommand = "TerrainMaterialDlg.setMaterialName( $ThisControl.getText() );"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; isContainer = "0"; internalName = "matNameCtrl"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiTextCtrl() { text = "Material Properties"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; position = "8 0"; extent = "117 16"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "ToolsGuiInspectorTitleTextProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiContainer(DiffuseMapContainer) { - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; position = "6 43"; - extent = "185 75"; - minExtent = "8 2"; + extent = "261 75"; horizSizing = "width"; - vertSizing = "bottom"; profile = "ToolsGuiDefaultProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; new GuiCheckBoxCtrl() { text = " Use Side Projection"; - groupNum = "-1"; - buttonType = "ToggleButton"; - useMouseEvents = "0"; position = "55 54"; extent = "119 16"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "ToolsGuiCheckBoxProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; internalName = "sideProjectionCtrl"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiBitmapCtrl() { - bitmapAsset = "ToolsModule:unknownImage_image"; - color = "255 255 255 255"; - wrap = "0"; + BitmapAsset = "ToolsModule:unknownImage_image"; position = "1 1"; extent = "47 47"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "ToolsGuiDefaultProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; internalName = "texDiffuseMap"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiBitmapButtonCtrl() { - bitmapAsset = "ToolsModule:cubemapBtnBorder_n_image"; - bitmapMode = "Stretched"; - autoFitExtents = "0"; - useModifiers = "0"; - useStates = "1"; - masked = "0"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; + BitmapAsset = "ToolsModule:cubemapBtnBorder_n_image"; position = "1 1"; extent = "48 48"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "ToolsGuiDefaultProfile"; - visible = "1"; - active = "1"; command = "TerrainMaterialDlg.updateTextureMap(\"DiffuseMap\");"; tooltipProfile = "ToolsGuiDefaultProfile"; tooltip = "Change the Active Diffuse Map for this layer"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiTextCtrl() { text = "Diffuse"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; position = "56 -3"; extent = "39 18"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "EditorTextProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiTextCtrl() { text = "None"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; position = "56 16"; - extent = "116 17"; - minExtent = "8 2"; + extent = "205 17"; horizSizing = "width"; - vertSizing = "bottom"; profile = "ToolsGuiTextProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; isContainer = "0"; internalName = "diffuseMapAssetId"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiButtonCtrl() { text = "Edit"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "116 0"; + position = "204 0"; extent = "40 16"; - minExtent = "8 2"; horizSizing = "left"; - vertSizing = "bottom"; profile = "ToolsGuiButtonProfile"; - visible = "1"; - active = "1"; command = "TerrainMaterialDlg.updateTextureMap(\"DiffuseMap\");"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiBitmapButtonCtrl() { - bitmapAsset = "ToolsModule:delete_n_image"; - bitmapMode = "Stretched"; - autoFitExtents = "0"; - useModifiers = "0"; - useStates = "1"; - masked = "0"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "159 0"; + BitmapAsset = "ToolsModule:delete_n_image"; + position = "247 0"; extent = "16 16"; - minExtent = "8 2"; horizSizing = "left"; - vertSizing = "bottom"; profile = "ToolsGuiDefaultProfile"; - visible = "1"; - active = "1"; command = "TerrainMaterialDlg.clearTextureMap(\"DiffuseMap\");"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiTextCtrl() { text = "Size"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; anchorTop = "0"; - anchorBottom = "0"; anchorLeft = "0"; - anchorRight = "0"; position = "132 35"; extent = "39 16"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "ToolsGuiTextProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiTextEditCtrl() { - historySize = "0"; - tabComplete = "0"; - sinkAllKeyEvents = "0"; - password = "0"; - passwordMask = "*"; text = "200"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; anchorTop = "0"; - anchorBottom = "0"; anchorLeft = "0"; - anchorRight = "0"; position = "94 34"; extent = "34 18"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "ToolsGuiTextEditProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; isContainer = "0"; internalName = "baseSizeCtrl"; - canSave = "1"; - canSaveDynamicFields = "0"; }; }; new GuiBitmapCtrl() { - bitmapAsset = "ToolsModule:separator_v_image"; - color = "255 255 255 255"; - wrap = "0"; + BitmapAsset = "ToolsModule:separator_v_image"; position = "6 116"; - extent = "175 2"; - minExtent = "8 2"; + extent = "266 2"; horizSizing = "width"; - vertSizing = "bottom"; profile = "ToolsGuiDefaultProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiContainer(DetailMapContainer) { - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; position = "6 122"; - extent = "185 100"; - minExtent = "8 2"; + extent = "261 75"; horizSizing = "width"; - vertSizing = "bottom"; profile = "ToolsGuiDefaultProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; new GuiBitmapCtrl() { - bitmapAsset = "ToolsModule:unknownImage_image"; - color = "255 255 255 255"; - wrap = "0"; + BitmapAsset = "ToolsModule:unknownImage_image"; position = "1 1"; extent = "47 47"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "ToolsGuiDefaultProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; internalName = "texDetailMap"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiBitmapButtonCtrl() { - bitmapAsset = "ToolsModule:cubemapBtnBorder_n_image"; - bitmapMode = "Stretched"; - autoFitExtents = "0"; - useModifiers = "0"; - useStates = "1"; - masked = "0"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; + BitmapAsset = "ToolsModule:cubemapBtnBorder_n_image"; position = "1 1"; extent = "48 48"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "ToolsGuiDefaultProfile"; - visible = "1"; - active = "1"; command = "TerrainMaterialDlg.updateTextureMap(\"DetailMap\");"; tooltipProfile = "ToolsGuiDefaultProfile"; tooltip = "Change the active Detail Map for this layer."; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiTextCtrl() { text = "Detail"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; position = "56 -3"; extent = "30 18"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "EditorTextProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiTextCtrl() { text = "None"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; position = "56 16"; - extent = "116 17"; - minExtent = "8 2"; + extent = "205 17"; horizSizing = "width"; - vertSizing = "bottom"; profile = "ToolsGuiTextProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; isContainer = "0"; internalName = "detailMapAssetId"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiButtonCtrl() { text = "Edit"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "116 0"; + position = "204 0"; extent = "40 16"; - minExtent = "8 2"; horizSizing = "left"; - vertSizing = "bottom"; profile = "ToolsGuiButtonProfile"; - visible = "1"; - active = "1"; command = "TerrainMaterialDlg.updateTextureMap(\"DetailMap\");"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiBitmapButtonCtrl() { - bitmapAsset = "ToolsModule:delete_n_image"; - bitmapMode = "Stretched"; - autoFitExtents = "0"; - useModifiers = "0"; - useStates = "1"; - masked = "0"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "159 0"; + BitmapAsset = "ToolsModule:delete_n_image"; + position = "247 0"; extent = "16 16"; - minExtent = "8 2"; horizSizing = "left"; - vertSizing = "bottom"; profile = "ToolsGuiDefaultProfile"; - visible = "1"; - active = "1"; command = "TerrainMaterialDlg.clearTextureMap(\"DetailMap\");"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiTextCtrl() { text = "Size"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; anchorTop = "0"; - anchorBottom = "0"; anchorLeft = "0"; - anchorRight = "0"; position = "132 33"; extent = "39 16"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "ToolsGuiTextProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiTextEditCtrl() { - historySize = "0"; - tabComplete = "0"; - sinkAllKeyEvents = "0"; - password = "0"; - passwordMask = "*"; text = "2"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; anchorTop = "0"; - anchorBottom = "0"; anchorLeft = "0"; - anchorRight = "0"; position = "94 32"; extent = "34 18"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "ToolsGuiTextEditProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; isContainer = "0"; internalName = "detSizeCtrl"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiTextCtrl() { text = "Strength"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; anchorTop = "0"; - anchorBottom = "0"; anchorLeft = "0"; - anchorRight = "0"; position = "39 54"; extent = "46 16"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "ToolsGuiTextProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiTextEditCtrl() { - historySize = "0"; - tabComplete = "0"; - sinkAllKeyEvents = "0"; - password = "0"; - passwordMask = "*"; text = "1"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; anchorTop = "0"; - anchorBottom = "0"; anchorLeft = "0"; - anchorRight = "0"; position = "1 53"; extent = "34 18"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "ToolsGuiTextEditProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; isContainer = "0"; internalName = "detStrengthCtrl"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiTextCtrl() { text = "Distance"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; anchorTop = "0"; - anchorBottom = "0"; anchorLeft = "0"; - anchorRight = "0"; position = "132 54"; extent = "45 16"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "ToolsGuiTextProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiTextEditCtrl() { - historySize = "0"; - tabComplete = "0"; - sinkAllKeyEvents = "0"; - password = "0"; - passwordMask = "*"; text = "50"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; anchorTop = "0"; - anchorBottom = "0"; anchorLeft = "0"; - anchorRight = "0"; position = "94 53"; extent = "34 18"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "ToolsGuiTextEditProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; isContainer = "0"; internalName = "detDistanceCtrl"; - canSave = "1"; - canSaveDynamicFields = "0"; }; }; new GuiBitmapCtrl() { - bitmapAsset = "ToolsModule:separator_v_image"; - color = "255 255 255 255"; - wrap = "0"; + BitmapAsset = "ToolsModule:separator_v_image"; position = "6 198"; - extent = "175 2"; - minExtent = "8 2"; + extent = "266 2"; horizSizing = "width"; - vertSizing = "bottom"; profile = "ToolsGuiDefaultProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiContainer(NormalMapContainer) { - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; position = "6 205"; - extent = "185 100"; - minExtent = "8 2"; + extent = "261 100"; horizSizing = "width"; - vertSizing = "bottom"; profile = "ToolsGuiDefaultProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; new GuiBitmapCtrl() { - bitmapAsset = "ToolsModule:unknownImage_image"; - color = "255 255 255 255"; - wrap = "0"; + BitmapAsset = "ToolsModule:unknownImage_image"; position = "1 1"; extent = "47 47"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "ToolsGuiDefaultProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; internalName = "texNormalMap"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiTextCtrl() { text = "Normal"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; position = "56 -3"; extent = "39 18"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "EditorTextProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiBitmapButtonCtrl() { - bitmapAsset = "ToolsModule:cubemapBtnBorder_n_image"; - bitmapMode = "Stretched"; - autoFitExtents = "0"; - useModifiers = "0"; - useStates = "1"; - masked = "0"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; + BitmapAsset = "ToolsModule:cubemapBtnBorder_n_image"; position = "1 1"; extent = "48 48"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "ToolsGuiDefaultProfile"; - visible = "1"; - active = "1"; command = "TerrainMaterialDlg.updateTextureMap(\"NormalMap\");"; tooltipProfile = "ToolsGuiDefaultProfile"; tooltip = "Change the active Normal Map for this layer."; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiTextCtrl() { text = "None"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; position = "56 15"; - extent = "116 17"; - minExtent = "8 2"; + extent = "205 17"; horizSizing = "width"; - vertSizing = "bottom"; profile = "ToolsGuiTextProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; isContainer = "0"; internalName = "normalMapAssetId"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiButtonCtrl() { text = "Edit"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "116 0"; + position = "204 0"; extent = "40 16"; - minExtent = "8 2"; horizSizing = "left"; - vertSizing = "bottom"; profile = "ToolsGuiButtonProfile"; - visible = "1"; - active = "1"; command = "TerrainMaterialDlg.updateTextureMap(\"NormalMap\");"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiBitmapButtonCtrl() { - bitmapAsset = "ToolsModule:delete_n_image"; - bitmapMode = "Stretched"; - autoFitExtents = "0"; - useModifiers = "0"; - useStates = "1"; - masked = "0"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "159 0"; + BitmapAsset = "ToolsModule:delete_n_image"; + position = "247 0"; extent = "16 16"; - minExtent = "8 2"; horizSizing = "left"; - vertSizing = "bottom"; profile = "ToolsGuiDefaultProfile"; - visible = "1"; - active = "1"; command = "TerrainMaterialDlg.clearTextureMap(\"NormalMap\");"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiTextCtrl() { text = "Parallax Scale"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; position = "92 34"; extent = "77 16"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "ToolsGuiTextProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiTextEditCtrl() { - historySize = "0"; - tabComplete = "0"; - sinkAllKeyEvents = "0"; - password = "0"; - passwordMask = "*"; text = "0"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; anchorTop = "0"; - anchorBottom = "0"; anchorLeft = "0"; - anchorRight = "0"; position = "55 33"; extent = "34 18"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "ToolsGuiTextEditProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; isContainer = "0"; internalName = "parallaxScaleCtrl"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiSliderCtrl(TerrainMaterialDlgBlendHeightBaseSlider) { range = "-0.5 0.5"; ticks = "0"; - snap = "0"; value = "0"; - useFillBar = "0"; - fillBarColor = "255 255 255 255"; - renderTicks = "1"; position = "39 61"; extent = "70 14"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "ToolsGuiSliderProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; internalName = "blendHeightBaseSliderCtrl"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiTextCtrl() { text = "Blend Height"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; position = "115 61"; - extent = "58 15"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; + extent = "68 15"; profile = "ToolsGuiTextProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiTextEditCtrl(TerrainMaterialDlgBlendHeightBaseTextEdit) { - historySize = "0"; - tabComplete = "0"; - sinkAllKeyEvents = "0"; - password = "0"; - passwordMask = "*"; text = "0"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; anchorTop = "0"; - anchorBottom = "0"; anchorLeft = "0"; - anchorRight = "0"; position = "1 59"; extent = "35 18"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "ToolsGuiTextEditProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; isContainer = "0"; internalName = "blendHeightBaseTextEditCtrl"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiSliderCtrl(TerrainMaterialDlgBlendHeightContrastSlider) { range = "0 5"; ticks = "0"; - snap = "0"; value = "1"; - useFillBar = "0"; - fillBarColor = "255 255 255 255"; - renderTicks = "1"; position = "39 81"; extent = "70 14"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "ToolsGuiSliderProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; internalName = "blendHeightContrastSliderCtrl"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiTextCtrl() { text = "Blend Contrast"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; position = "115 81"; - extent = "58 15"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; + extent = "76 15"; profile = "ToolsGuiTextProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiTextEditCtrl(TerrainMaterialDlgBlendHeightContrastTextEdit) { - historySize = "0"; - tabComplete = "0"; - sinkAllKeyEvents = "0"; - password = "0"; - passwordMask = "*"; text = "1"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; anchorTop = "0"; - anchorBottom = "0"; anchorLeft = "0"; - anchorRight = "0"; position = "1 79"; extent = "35 18"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "ToolsGuiTextEditProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; isContainer = "0"; internalName = "blendHeightContrastTextEditCtrl"; - canSave = "1"; - canSaveDynamicFields = "0"; }; }; new GuiBitmapCtrl() { - bitmapAsset = "ToolsModule:separator_v_image"; - color = "255 255 255 255"; - wrap = "0"; + BitmapAsset = "ToolsModule:separator_v_image"; position = "6 307"; - extent = "175 2"; - minExtent = "8 2"; + extent = "266 2"; horizSizing = "width"; - vertSizing = "bottom"; profile = "ToolsGuiDefaultProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiContainer(ORMMapContainer) { - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; position = "6 314"; - extent = "185 64"; - minExtent = "8 2"; + extent = "261 64"; horizSizing = "width"; - vertSizing = "bottom"; profile = "ToolsGuiDefaultProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; new GuiBitmapCtrl() { - bitmapAsset = "ToolsModule:unknownImage_image"; - color = "255 255 255 255"; - wrap = "0"; + BitmapAsset = "ToolsModule:unknownImage_image"; position = "1 1"; extent = "47 47"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "ToolsGuiDefaultProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; internalName = "texORMConfigMap"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiTextCtrl() { text = "ORM Config"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; position = "56 -3"; extent = "64 18"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "EditorTextProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiBitmapButtonCtrl() { - bitmapAsset = "ToolsModule:cubemapBtnBorder_n_image"; - bitmapMode = "Stretched"; - autoFitExtents = "0"; - useModifiers = "0"; - useStates = "1"; - masked = "0"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; + BitmapAsset = "ToolsModule:cubemapBtnBorder_n_image"; position = "1 1"; extent = "48 48"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "ToolsGuiDefaultProfile"; - visible = "1"; - active = "1"; command = "TerrainMaterialDlg.updateTextureMap(\"ORMConfigMap\");"; tooltipProfile = "ToolsGuiDefaultProfile"; tooltip = "Change the active ORM Config Map for this layer."; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiTextCtrl() { text = "None"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; position = "56 15"; - extent = "116 17"; - minExtent = "8 2"; + extent = "205 17"; horizSizing = "width"; - vertSizing = "bottom"; profile = "ToolsGuiTextProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; isContainer = "0"; internalName = "ORMMapAssetId"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiButtonCtrl() { text = "Edit"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "116 0"; + position = "205 0"; extent = "40 16"; - minExtent = "8 2"; horizSizing = "left"; - vertSizing = "bottom"; profile = "ToolsGuiButtonProfile"; - visible = "1"; - active = "1"; command = "TerrainMaterialDlg.updateTextureMap(\"OrmConfigMap\");"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiBitmapButtonCtrl() { - bitmapAsset = "ToolsModule:delete_n_image"; - bitmapMode = "Stretched"; - autoFitExtents = "0"; - useModifiers = "0"; - useStates = "1"; - masked = "0"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "159 0"; + BitmapAsset = "ToolsModule:delete_n_image"; + position = "248 0"; extent = "16 16"; - minExtent = "8 2"; horizSizing = "left"; - vertSizing = "bottom"; profile = "ToolsGuiDefaultProfile"; - visible = "1"; - active = "1"; command = "TerrainMaterialDlg.clearTextureMap(\"ORMConfigMap\");"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiCheckBoxCtrl() { text = " Is sRGB"; - groupNum = "-1"; - buttonType = "ToggleButton"; - useMouseEvents = "0"; position = "55 32"; extent = "119 16"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "ToolsGuiCheckBoxProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - internalName = "isSRGB"; - canSave = "1"; - canSaveDynamicFields = "0"; + internalName = "IsSRGB"; }; new GuiCheckBoxCtrl() { text = " Invert Roughness"; - groupNum = "-1"; - buttonType = "ToggleButton"; - useMouseEvents = "0"; position = "55 48"; extent = "119 16"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "ToolsGuiCheckBoxProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - internalName = "invertRoughness"; - canSave = "1"; - canSaveDynamicFields = "0"; + internalName = "InvertRoughness"; }; }; new GuiBitmapCtrl() { - bitmapAsset = "ToolsModule:separator_v_image"; - color = "255 255 255 255"; - wrap = "0"; + BitmapAsset = "ToolsModule:separator_v_image"; position = "6 381"; - extent = "175 2"; - minExtent = "8 2"; + extent = "266 2"; horizSizing = "width"; - vertSizing = "bottom"; profile = "ToolsGuiDefaultProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiContainer(MacroMapContainer) { - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; position = "6 388"; - extent = "185 72"; - minExtent = "8 2"; + extent = "261 72"; horizSizing = "width"; - vertSizing = "bottom"; profile = "ToolsGuiDefaultProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; new GuiBitmapCtrl() { - bitmapAsset = "ToolsModule:unknownImage_image"; - color = "255 255 255 255"; - wrap = "0"; + BitmapAsset = "ToolsModule:unknownImage_image"; position = "1 1"; extent = "47 47"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "ToolsGuiDefaultProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; internalName = "texMacroMap"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiBitmapButtonCtrl() { - bitmapAsset = "ToolsModule:cubemapBtnBorder_n_image"; - bitmapMode = "Stretched"; - autoFitExtents = "0"; - useModifiers = "0"; - useStates = "1"; - masked = "0"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; + BitmapAsset = "ToolsModule:cubemapBtnBorder_n_image"; position = "1 1"; extent = "48 48"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "ToolsGuiDefaultProfile"; - visible = "1"; - active = "1"; command = "TerrainMaterialDlg.updateTextureMap(\"MacroMap\");"; tooltipProfile = "ToolsGuiDefaultProfile"; tooltip = "Change the active Macro Map for this layer."; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiTextCtrl() { text = "Macro"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; position = "56 -3"; extent = "34 18"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "EditorTextProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiTextCtrl() { text = "None"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; position = "56 17"; - extent = "116 17"; - minExtent = "8 2"; + extent = "192 17"; horizSizing = "width"; - vertSizing = "bottom"; profile = "ToolsGuiTextProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; isContainer = "0"; internalName = "macroMapAssetId"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiButtonCtrl() { text = "Edit"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "116 0"; + position = "204 0"; extent = "40 16"; - minExtent = "8 2"; horizSizing = "left"; - vertSizing = "bottom"; profile = "ToolsGuiButtonProfile"; - visible = "1"; - active = "1"; command = "TerrainMaterialDlg.updateTextureMap(\"MacroMap\");"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiBitmapButtonCtrl() { - bitmapAsset = "ToolsModule:delete_n_image"; - bitmapMode = "Stretched"; - autoFitExtents = "0"; - useModifiers = "0"; - useStates = "1"; - masked = "0"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "159 0"; + BitmapAsset = "ToolsModule:delete_n_image"; + position = "247 0"; extent = "16 16"; - minExtent = "8 2"; horizSizing = "left"; - vertSizing = "bottom"; profile = "ToolsGuiDefaultProfile"; - visible = "1"; - active = "1"; command = "TerrainMaterialDlg.clearTextureMap(\"MacroMap\");"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiTextCtrl() { text = "Size"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; anchorTop = "0"; - anchorBottom = "0"; anchorLeft = "0"; - anchorRight = "0"; position = "132 33"; extent = "39 16"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "ToolsGuiTextProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiTextEditCtrl() { - historySize = "0"; - tabComplete = "0"; - sinkAllKeyEvents = "0"; - password = "0"; - passwordMask = "*"; text = "200"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; anchorTop = "0"; - anchorBottom = "0"; anchorLeft = "0"; - anchorRight = "0"; position = "94 32"; extent = "34 18"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "ToolsGuiTextEditProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; isContainer = "0"; internalName = "macroSizeCtrl"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiTextCtrl() { text = "Strength"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; anchorTop = "0"; - anchorBottom = "0"; anchorLeft = "0"; - anchorRight = "0"; position = "39 54"; extent = "46 16"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "ToolsGuiTextProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiTextEditCtrl() { - historySize = "0"; - tabComplete = "0"; - sinkAllKeyEvents = "0"; - password = "0"; - passwordMask = "*"; text = "0.7"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; anchorTop = "0"; - anchorBottom = "0"; anchorLeft = "0"; - anchorRight = "0"; position = "1 53"; extent = "34 18"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "ToolsGuiTextEditProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; isContainer = "0"; internalName = "macroStrengthCtrl"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiTextCtrl() { text = "Distance"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; anchorTop = "0"; - anchorBottom = "0"; anchorLeft = "0"; - anchorRight = "0"; position = "132 54"; extent = "45 16"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "ToolsGuiTextProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiTextEditCtrl() { - historySize = "0"; - tabComplete = "0"; - sinkAllKeyEvents = "0"; - password = "0"; - passwordMask = "*"; text = "500"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; anchorTop = "0"; - anchorBottom = "0"; anchorLeft = "0"; - anchorRight = "0"; position = "94 53"; extent = "34 18"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "ToolsGuiTextEditProfile"; - visible = "1"; - active = "1"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; isContainer = "0"; internalName = "macroDistanceCtrl"; - canSave = "1"; - canSaveDynamicFields = "0"; }; }; + new GuiContainer(TerrainEffectsContainer) { + position = "6 460"; + extent = "265 97"; + horizSizing = "width"; + profile = "ToolsGuiDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + + new GuiBitmapCtrl() { + BitmapAsset = "ToolsModule:separator_v_image"; + position = "2 2"; + extent = "276 2"; + horizSizing = "width"; + profile = "GuiDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiTextCtrl() { + text = "Effect Colors[0:1]"; + position = "1 22"; + extent = "86 15"; + profile = "ToolsGuiDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; }; - new GuiControl() { - position = "6 42"; - extent = "189 473"; - minExtent = "8 2"; + new GuiSwatchButtonCtrl() { + position = "89 22"; + extent = "16 16"; + tooltipProfile = "ToolsGuiToolTipProfile"; + command = "getColorF($ThisControl.color, \"TerrainMaterialDlg.updateEffectColor0\");"; + internalName = "effectColor0Swatch"; + }; + new GuiSwatchButtonCtrl() { + position = "109 22"; + extent = "16 16"; + tooltipProfile = "ToolsGuiToolTipProfile"; + command = "getColorF($ThisControl.color, \"TerrainMaterialDlg.updateEffectColor1\");"; + internalName = "effectColor1Swatch"; + }; + new GuiCheckBoxCtrl() { + text = "Show Footprints"; + position = "1 40"; + extent = "93 16"; + profile = "ToolsGuiCheckBoxProfile"; + tooltipProfile = "ToolsGuiDefaultProfile"; + tooltip = "Enables Player footprints on surfaces that use this Material."; + internalName = "showFootprintsCheckbox"; + }; + new GuiCheckBoxCtrl() { + text = "Show Dust"; + position = "110 40"; + extent = "68 16"; + profile = "ToolsGuiCheckBoxProfile"; + tooltipProfile = "ToolsGuiDefaultProfile"; + tooltip = "Enables dust particles on surfaces that use this Material."; + internalName = "showDustCheckbox"; + }; + new GuiTextCtrl() { + text = "Footstep sound"; + position = "1 59"; + extent = "77 15"; + profile = "ToolsGuiDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiPopUpMenuCtrl() { + text = "None"; + position = "80 58"; + extent = "184 18"; horizSizing = "width"; - vertSizing = "height"; + profile = "ToolsGuiPopUpMenuProfile"; + tooltipProfile = "ToolsGuiToolTipProfile"; + tooltip = "Determines the footstep sound to use when the Player walks on this Material."; + isContainer = "0"; + internalName = "footstepSoundPopup"; + }; + new GuiTextCtrl() { + text = "Impact sound"; + position = "1 79"; + extent = "64 15"; profile = "ToolsGuiDefaultProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; - - new GuiScrollCtrl() { - willFirstRespond = "1"; - hScrollBar = "dynamic"; - vScrollBar = "dynamic"; - lockHorizScroll = "0"; - lockVertScroll = "0"; - constantThumbHeight = "0"; - childMargin = "0 0"; - mouseWheelScrollSpeed = "-1"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "0 0"; - extent = "189 454"; - minExtent = "8 2"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiPopUpMenuCtrl() { + text = "None"; + position = "80 78"; + extent = "184 18"; horizSizing = "width"; - vertSizing = "height"; - profile = "ToolsGuiScrollProfile"; - visible = "1"; - active = "1"; + profile = "ToolsGuiPopUpMenuProfile"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; - - new GuiTreeViewCtrl() { - tabSize = "16"; - textOffset = "2"; - fullRowSelect = "0"; - itemHeight = "21"; - destroyTreeOnSleep = "1"; - mouseDragging = "0"; - multipleSelections = "0"; - deleteObjectAllowed = "0"; - dragToItemAllowed = "0"; - clearAllOnSingleSelection = "1"; - showRoot = "0"; - useInspectorTooltips = "0"; - tooltipOnWidthOnly = "0"; - showObjectIds = "0"; - showClassNames = "0"; - showObjectNames = "0"; - showInternalNames = "1"; - showClassNameForUnnamedObjects = "0"; - compareToObjectID = "1"; - canRenameObjects = "1"; - renameInternal = "0"; - position = "1 1"; - extent = "136 147"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "ToolsGuiTreeViewProfile"; - visible = "1"; - active = "1"; + tooltip = "Determines the impact sound to use when an object collides with this Material."; + isContainer = "0"; + internalName = "impactSoundPopup"; + }; + new GuiTextCtrl() { + text = "Effects"; + position = "2 4"; + extent = "38 18"; + profile = "EditorTextProfile"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - internalName = "matLibTree"; - class = "TerrainMaterialTreeCtrl"; - canSave = "1"; - canSaveDynamicFields = "0"; + isContainer = "0"; + }; + }; }; }; }; new GuiButtonCtrl() { text = "Apply&Select"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "202 494"; + position = "269 612"; extent = "98 22"; - minExtent = "8 2"; horizSizing = "left"; vertSizing = "top"; profile = "ToolsGuiButtonProfile"; - visible = "1"; - active = "1"; command = "TerrainMaterialDlg.dialogApply();"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiButtonCtrl() { text = "Cancel"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "307 494"; + position = "374 612"; extent = "80 22"; - minExtent = "8 2"; horizSizing = "left"; vertSizing = "top"; profile = "ToolsGuiButtonProfile"; - visible = "1"; - active = "1"; command = "TerrainMaterialDlg.dialogCancel();"; tooltipProfile = "ToolsGuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiBitmapCtrl() { - bitmapAsset = "ToolsModule:inactive_overlay_image"; - color = "255 255 255 255"; - wrap = "0"; - position = "199 23"; - extent = "190 367"; - minExtent = "8 2"; + BitmapAsset = "ToolsModule:inactive_overlay_image"; + position = "277 23"; + extent = "190 474"; horizSizing = "left"; vertSizing = "height"; profile = "ToolsGuiDefaultProfile"; visible = "0"; - active = "1"; tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; isContainer = "1"; internalName = "inactiveOverlay"; hidden = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; new GuiTextCtrl() { text = "Inactive"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "0 151"; + position = "0 205"; extent = "190 64"; - minExtent = "8 2"; horizSizing = "width"; vertSizing = "center"; profile = "ToolsGuiTextCenterProfile"; - visible = "1"; - active = "1"; tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; internalName = "inactiveOverlayDlg"; - canSave = "1"; - canSaveDynamicFields = "0"; }; }; }; diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/interfaces/terrainMaterialDlg.ed.tscript b/Templates/BaseGame/game/tools/worldEditor/scripts/interfaces/terrainMaterialDlg.ed.tscript index 1446d6d7d..745ee906a 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/interfaces/terrainMaterialDlg.ed.tscript +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/interfaces/terrainMaterialDlg.ed.tscript @@ -109,6 +109,31 @@ function TerrainMaterialDlg::onWake( %this ) %item = %matLibTree.getFirstRootItem(); %matLibTree.expandItem( %item ); + //Sounds + %this-->footstepSoundPopup.clear(); + %this-->impactSoundPopup.clear(); + + %sounds = "" TAB "" TAB "" TAB "" TAB ""; // Default sounds + + %assetQuery = new AssetQuery(); + AssetDatabase.findAssetType(%assetQuery, "SoundAsset"); + + %count = %assetQuery.getCount(); + // Get custom sound assets + for(%i=0; %i < %count; %i++) + { + %assetId = %assetQuery.getAsset(%i); + %sounds = %sounds TAB %assetId; + } + + %count = getFieldCount(%sounds); + for (%i = 0; %i < %count; %i++) + { + %name = getField(%sounds, %i); + %this-->footstepSoundPopup.add(%name); + %this-->impactSoundPopup.add(%name); + } + %this.activateMaterialCtrls( true ); } @@ -150,18 +175,8 @@ function TerrainMaterialDlg::dialogApply( %this ) %mat.delete(); } - // Make sure we save any changes to the current selection. - %this.saveDirtyMaterial( %this.activeMat ); - - // Delete the snapshot. - TerrainMaterialDlgSnapshot.delete(); - // Remove ourselves from the canvas. - Canvas.popDialog( TerrainMaterialDlg ); - - call( %this.onApplyCallback, %this.activeMat, %this.matIndex ); - - TerrainMaterialDlg.matDirty = false; + %this.prepSaveDirtyMaterial(); } //----------------------------------------------------------------------------- @@ -171,7 +186,7 @@ function TerrainMaterialDlg::dialogCancel( %this ) if(TerrainMaterialDlg.matDirty) { toolsMessageBoxYesNo("Save Dirty Material?", "The current material has been modified. Do you wish save your changes?", - "TerrainMaterialDlg.saveDirtyMaterial(" @ %this-->matLibTree.getSelectedItem() @ ");TerrainMaterialDlg.closeDialog();", "TerrainMaterialDlg.closeDialog();"); + "TerrainMaterialDlg.prepSaveDirtyMaterial("@%this-->matLibTree.getSelectedItem()@");TerrainMaterialDlg.closeDialog();", "TerrainMaterialDlg.closeDialog();"); } else { @@ -380,13 +395,13 @@ function TerrainMaterialTreeCtrl::onSelect( %this, %item ) if(TerrainMaterialDlg.matDirty) { toolsMessageBoxYesNo("Save Dirty Material?", "The current material has been modified. Do you wish save your changes?", - "TerrainMaterialDlg.saveDirtyMaterial(" @ TerrainMaterialDlg.previousMat @ ");TerrainMaterialDlg.setActiveMaterial(" @ %item @ ");", + "TerrainMaterialDlg.prepSaveDirtyMaterial(" @ TerrainMaterialDlg.previousMat @ ");TerrainMaterialDlg.setActiveMaterial(" @ %item @ ");", "TerrainMaterialDlg.setActiveMaterial(" @ %item @ ");"); } else { - TerrainMaterialDlg.setActiveMaterial( %item ); -} + TerrainMaterialDlg.setActiveMaterial( %item ); + } } //----------------------------------------------------------------------------- @@ -461,6 +476,32 @@ function TerrainMaterialDlg::setActiveMaterial( %this, %mat ) %this-->isSRGB.setValue( %mat.isSRGB ); %this-->invertRoughness.setValue( %mat.invertRoughness ); + //FX material stuffs + if(AssetDatabase.isDeclaredAsset(%mat.internalName)) + { + %asset = AssetDatabase.acquireAsset(%mat.internalName); + %fxMat = %asset.getFXMaterialDefinition(); + if(isObject(%fxMat)) + { + %this-->effectColor0Swatch.color = %fxMat.effectColor[0]; + %this-->effectColor1Swatch.color = %fxMat.effectColor[1]; + + %this-->showFootprintsCheckbox.setValue(%fxMat.showFootprints); + %this-->showDustCheckbox.setValue(%fxMat.showDust); + %this.updateSoundPopup("Footstep", %fxMat.footstepSoundId, %fxMat.customFootstepSound); + %this.updateSoundPopup("Impact", %fxMat.impactSoundId, %fxMat.customImpactSound); + } + else + { + %this-->effectColor0Swatch.color = "1 1 1 1"; + %this-->effectColor1Swatch.color = "1 1 1 1"; + %this-->showFootprintsCheckbox.setValue(0); + %this-->showFootprintsCheckbox.setValue(0); + %this.updateSoundPopup("Footstep", 0, ""); + %this.updateSoundPopup("Impact", 0, ""); + } + } + %this.activateMaterialCtrls( true ); } else @@ -470,40 +511,133 @@ function TerrainMaterialDlg::setActiveMaterial( %this, %mat ) } } -//----------------------------------------------------------------------------- - -function TerrainMaterialDlg::saveDirtyMaterial( %this, %mat ) +function TerrainMaterialDlg::updateSoundPopup(%this, %type, %defaultId, %customName) { - //If we happen to have been handed an assetId, process it - if(AssetDatabase.isDeclaredAsset(%mat)) + %ctrl = TerrainMaterialDlg.findObjectByInternalName( %type @ "SoundPopup", true ); + + switch (%defaultId) { - %assetDef = AssetDatabase.acquireAsset(%mat); - %mat = %assetDef.getMaterialDefinition(); + case 0: %name = ""; + case 1: %name = ""; + case 2: %name = ""; + case 3: %name = ""; + default: + if (%customName $= "") + %name = ""; + else + %name = %customName; + } + + %r = %ctrl.findText(%name); + if (%r != -1) + %ctrl.setSelected(%r, false); + else + %ctrl.setText(%name); +} + +function TerrainMaterialDlg::getBehaviorSound(%this, %type, %sound) +{ + %defaultId = -1; + %customName = ""; + + switch$ (%sound) + { + case "": %defaultId = 0; + case "": %defaultId = 1; + case "": %defaultId = 2; + case "": %defaultId = 3; + default: %customName = %sound; } - // Skip over obviously bad cases. - if ( !isObject( %mat ) || - !%mat.isMemberOfClass( TerrainMaterial ) ) - return; - - //Lets validate it wasn't a generated stub. if so, we need to add an intermediate - //step to create the asset - %assetDef = AssetDatabase.acquireAsset(%mat.internalName); - if(%assetDef $= "") + return %defaultId TAB %customName; +} + +function TerrainMaterialDlg::updateEffectColor0(%this, %color) +{ + %this-->effectColor0Swatch.color = %color; +} + +function TerrainMaterialDlg::updateEffectColor1(%this, %color) +{ + %this-->effectColor1Swatch.color = %color; +} +//----------------------------------------------------------------------------- +function TerrainMaterialDlg::prepSaveDirtyMaterial(%this, %material) +{ + if(%material $= "") + %material = %this.activeMat; + + if(!isObject(%material)) { - %moduleSplit = strpos(%mat.internalName, ":"); - %moduleName = getSubStr(%mat.internalName, 0, %moduleSplit); - %assetName = getSubStr(%mat.internalName, %moduleSplit+1, -1); + error("TerrainMaterialDlg::prepSaveDirtyMaterial() - active material is not a valid object"); + return; + } + if(!AssetDatabase.isDeclaredAsset(%material.internalName)) + { + //No valid asset, so we probably generated it as a stub due to a leftover + //reference. Let's generate a new asset + %assetId = %material.internalName; + + %moduleSplit = strpos(%material.internalName, ":"); + %moduleName = getSubStr(%material.internalName, 0, %moduleSplit); + %assetName = getSubStr(%material.internalName, %moduleSplit+1, -1); if(ModuleDatabase.findModule(%moduleName) !$= "") { AssetBrowser.selectedModule = %moduleName; } - //we need to create an actual asset here + //Clear the stub + TerrainMaterialSet.remove(%material); + %material.delete(); + + %oldMat = TerrainMaterialSet.findObjectByInternalName( %assetId ); + AssetBrowser.setupCreateNewAsset("TerrainMaterialAsset", AssetBrowser.selectedModule, "TerrainMaterialDlg.saveDirtyMaterial", %assetName); + } + else + { + %assetDef = AssetDatabase.acquireAsset(%material.internalName); + + //If we somehow don't have an FX material, make one + %fxMat = %assetDef.getFXMaterialDefinition(); + if(!isObject(%fxMat)) + { + %fxMat = new Material("TerrainFX_" @ %assetDef.assetName){ + mapTo = %assetDef.assetName; + }; + + %assetDef.add(%fxMat); + } + + // Make sure we save any changes to the current selection. + %this.saveDirtyMaterial( %material.internalName ); + } +} + +function TerrainMaterialDlg::saveDirtyMaterial( %this, %materialAssetId ) +{ + %assetDef = ""; + %mat = ""; + + //If we happen to have been handed an assetId, process it + if(AssetDatabase.isDeclaredAsset(%materialAssetId)) + { + %assetDef = AssetDatabase.acquireAsset(%materialAssetId); + %mat = %assetDef.getMaterialDefinition(); + } + else + { + error("TerrainMaterialDlg::saveDirtyMaterial() - attempting to save invalid assetId: " @ %materialAssetId); return; } + // Skip over obviously bad cases. + if ( !isObject( %mat ) || + !%mat.isMemberOfClass( TerrainMaterial ) ) + return; + + %this.activeMat = %mat; + // Read out properties from the dialog. %newName = %this-->matNameCtrl.getText(); @@ -552,6 +686,17 @@ function TerrainMaterialDlg::saveDirtyMaterial( %this, %mat ) %isSRGB = %this-->isSRGB.getValue(); %invertRoughness = %this-->invertRoughness.getValue(); + //Effects + %effectColor0 = %this-->effectColor0Swatch.color; + %effectColor1 = %this-->effectColor1Swatch.color; + %showFootsteps = %this-->showFootprintsCheckbox.getValue(); + %showDust = %this-->showDustCheckbox.getValue(); + + %footstepSound = %this.getBehaviorSound("Footstep", %this-->footstepSoundPopup.getText()); + %impactSound = %this.getBehaviorSound("Impact", %this-->impactSoundPopup.getText()); + + %fxMat = %assetDef.getFXMaterialDefinition(); + // If no properties of this materials have changed, // return. @@ -573,7 +718,15 @@ function TerrainMaterialDlg::saveDirtyMaterial( %this, %mat ) %mat.blendHeightBase == %blendHeightBase && %mat.blendHeightContrast == %blendHeightContrast && %mat.isSRGB == %isSRGB && - %mat.invertRoughness == %invertRoughness && false) + %mat.invertRoughness == %invertRoughness && + %fxMat.effectColor[0] == %effectColor0 && + %fxMat.effectColor[1] == %effectColor1 && + %fxMat.showFootprints == %showFootsteps && + %fxMat.showDust == %showDust && + %fxMat.footstepSoundId == getField(%footstepSound, 0) && + %fxMat.customFootstepSound == getField(%footstepSound, 1) && + %fxMat.impactSoundId == getField(%impactSound, 0) && + %fxMat.customImpactSound == getField(%impactSound, 1) && false) return; // Make sure the material name is unique. @@ -614,11 +767,35 @@ function TerrainMaterialDlg::saveDirtyMaterial( %this, %mat ) %mat.isSRGB = %isSRGB; %mat.invertRoughness = %invertRoughness; + //effects + %fxMat.effectColor[0] = %effectColor0; + %fxMat.effectColor[1] = %effectColor1; + %fxMat.showFootprints = %showFootsteps; + %fxMat.showDust = %showDust; + %fxMat.footstepSoundId = getField(%footstepSound, 0); + %fxMat.customFootstepSound = getField(%footstepSound, 1); + %fxMat.impactSoundId = getField(%impactSound, 0); + %fxMat.customImpactSound = getField(%impactSound, 1); + //Save the material asset - %assetDef = AssetDatabase.acquireAsset(%mat.internalName); %assetDef.saveAsset(); + %this.schedule(32, "cleanupDirtyMaterial"); } +function TerrainMaterialDlg::cleanupDirtyMaterial(%this) +{ + // Delete the snapshot. + TerrainMaterialDlgSnapshot.delete(); + + // Remove ourselves from the canvas. + Canvas.popDialog( TerrainMaterialDlg ); + + call( %this.onApplyCallback, %this.activeMat, %this.matIndex ); + + TerrainMaterialDlg.matDirty = false; + + //%this.setActiveMaterial(%this.activeMat); +} //----------------------------------------------------------------------------- function TerrainMaterialDlg::snapshotMaterials( %this ) From c2857efe281b89c32a554d1e21fc9f5a8ccfc602 Mon Sep 17 00:00:00 2001 From: JeffR Date: Thu, 31 Mar 2022 00:40:24 -0500 Subject: [PATCH 3/4] Adds logic to up-convert non-embedded terrain materials and materials to have embedded definitions --- .../scripts/materialEditor.ed.tscript | 19 ++++++++++++++++- .../interfaces/terrainMaterialDlg.ed.tscript | 21 ++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/Templates/BaseGame/game/tools/materialEditor/scripts/materialEditor.ed.tscript b/Templates/BaseGame/game/tools/materialEditor/scripts/materialEditor.ed.tscript index de003fdc8..cf2afc7b3 100644 --- a/Templates/BaseGame/game/tools/materialEditor/scripts/materialEditor.ed.tscript +++ b/Templates/BaseGame/game/tools/materialEditor/scripts/materialEditor.ed.tscript @@ -1963,7 +1963,24 @@ function MaterialEditorGui::save( %this ) MaterialEditorGui.copyMaterials( materialEd_previewMaterial, notDirtyMaterial ); %assetDef = AssetDatabase.acquireAsset(MaterialEditorGui.currentMaterialAsset); - %assetDef.saveAsset(); //write it out + %didEmbed = false; + %matScriptFile = %assetDef.getScriptPath(); + if(%matScriptFile !$= "") + { + //lets up-convert to embedded + %assetDef.add(%assetDef.materialDefinitionName); + %assetDef.scriptFile = ""; + %didEmbed = true; + } + + //write it out + if(%assetDef.saveAsset()) + { + if(%didEmbed) + { + fileDelete(%matScriptFile); //cleanup the old definition file + } + } } else { diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/interfaces/terrainMaterialDlg.ed.tscript b/Templates/BaseGame/game/tools/worldEditor/scripts/interfaces/terrainMaterialDlg.ed.tscript index 745ee906a..e5fd3d27a 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/interfaces/terrainMaterialDlg.ed.tscript +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/interfaces/terrainMaterialDlg.ed.tscript @@ -778,7 +778,26 @@ function TerrainMaterialDlg::saveDirtyMaterial( %this, %materialAssetId ) %fxMat.customImpactSound = getField(%impactSound, 1); //Save the material asset - %assetDef.saveAsset(); + %didEmbed = false; + %matScriptFile = %assetDef.getScriptPath(); + if(%matScriptFile !$= "") + { + //lets up-convert to embedded + %assetDef.add(%mat); + %assetDef.add(%fxMat); + %assetDef.scriptFile = ""; + %didEmbed = true; + } + + //write it out + if(%assetDef.saveAsset()) + { + if(%didEmbed) + { + fileDelete(%matScriptFile); //cleanup the old definition file + } + } + %this.schedule(32, "cleanupDirtyMaterial"); } From bae6a3f514cecf2f2e425b920fb2e409e9d83e02 Mon Sep 17 00:00:00 2001 From: JeffR Date: Thu, 31 Mar 2022 18:58:06 -0500 Subject: [PATCH 4/4] Fixes assignment of the mapTo field for terrain FX materials to point to the assetId rather than just the assetName, fixing the material mapping lookups Fixes project import to comply to above change Makes Material default mEffectColor to white instead of whatever default value it comes up with due to memset --- Engine/source/materials/materialDefinition.cpp | 3 +++ .../assetBrowser/scripts/assetTypes/terrainMaterial.tscript | 2 +- .../importers/pre40/T3Dpre4ProjectImporter.tscript | 6 +++--- .../scripts/interfaces/terrainMaterialDlg.ed.tscript | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Engine/source/materials/materialDefinition.cpp b/Engine/source/materials/materialDefinition.cpp index 7b3d2c7de..4204dfe63 100644 --- a/Engine/source/materials/materialDefinition.cpp +++ b/Engine/source/materials/materialDefinition.cpp @@ -229,6 +229,9 @@ Material::Material() dMemset(mEffectColor, 0, sizeof(mEffectColor)); + mEffectColor[0] = LinearColorF::WHITE; + mEffectColor[1] = LinearColorF::WHITE; + mFootstepSoundId = -1; mImpactSoundId = -1; mImpactFXIndex = -1; INIT_ASSET(CustomFootstepSound); diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/terrainMaterial.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/terrainMaterial.tscript index c9c9ba83d..8df0a1fa3 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/terrainMaterial.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/terrainMaterial.tscript @@ -32,7 +32,7 @@ function AssetBrowser::createTerrainMaterialAsset(%this) %fxMatDef = new Material("TerrainFX_" @ %assetName) { - mapTo = %assetName; + mapTo = %moduleName @ ":" @ %assetName; footstepSoundId = 0; terrainMaterials = "1"; ShowDust = "1"; diff --git a/Templates/BaseGame/game/tools/projectImporter/importers/pre40/T3Dpre4ProjectImporter.tscript b/Templates/BaseGame/game/tools/projectImporter/importers/pre40/T3Dpre4ProjectImporter.tscript index 7c50130b2..798d2be01 100644 --- a/Templates/BaseGame/game/tools/projectImporter/importers/pre40/T3Dpre4ProjectImporter.tscript +++ b/Templates/BaseGame/game/tools/projectImporter/importers/pre40/T3Dpre4ProjectImporter.tscript @@ -1203,7 +1203,7 @@ function T3Dpre4ProjectImporter::processTerrainMaterialObject(%this, %fileObject { %fxMatObj = getField(%fxMatList, %i); %fxMatObjMapTo = findObjectField(%fxMatObj, "mapTo"); - if(%fxMatObjMapTo $= %objectName) + if(%fxMatObjMapTo $= %objectName || %fxMatObjMapTo $= %assetName) { %fileObject.FXMaterial = %fxMatObj; break; @@ -1215,7 +1215,7 @@ function T3Dpre4ProjectImporter::processTerrainMaterialObject(%this, %fileObject if(%fileObject.FXMaterial !$= "") { //Ensure our mapto is up to date for any name sanitize/tweaks - setObjectField(%fileObject.FXMaterial, "mapTo", %objectName); + setObjectField(%fileObject.FXMaterial, "mapTo", %moduleName @ ":" @ %assetName); //we associated to an FX material, so process that now %objectDefinition = ""; @@ -1249,7 +1249,7 @@ function T3Dpre4ProjectImporter::processTerrainMaterialObject(%this, %fileObject //if after all that we still have no FXMaterial, just create a new one %fxMat = new Material("TerrainFX_" @ %objectName) { - mapTo = %objectName; + mapTo = %moduleName @ ":" @ %assetName; }; %asset.add(%fxMat); } diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/interfaces/terrainMaterialDlg.ed.tscript b/Templates/BaseGame/game/tools/worldEditor/scripts/interfaces/terrainMaterialDlg.ed.tscript index e5fd3d27a..1eb7af85d 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/interfaces/terrainMaterialDlg.ed.tscript +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/interfaces/terrainMaterialDlg.ed.tscript @@ -603,7 +603,7 @@ function TerrainMaterialDlg::prepSaveDirtyMaterial(%this, %material) if(!isObject(%fxMat)) { %fxMat = new Material("TerrainFX_" @ %assetDef.assetName){ - mapTo = %assetDef.assetName; + mapTo = %material.internalName; }; %assetDef.add(%fxMat);