mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-14 08:04:40 +00:00
Shifts handling of material and terrain material definitions to be written into the asset definition taml file instead of having an extra loose file
Also updates importers to correctly handle this change Adds ability for taml XML serialization to properly assign array'd fields Adds 'inheritFrom' field to simobjects for when objects with parent objects are serialized AssetBase how inherits from SimGroup so it can have objects like material definitions embedded in them for save/load in the taml definition file Updated loading/handling logic in terrain material asset to be more similar to regular material assets
This commit is contained in:
parent
656475deaf
commit
630285def6
20 changed files with 791 additions and 318 deletions
|
|
@ -2444,7 +2444,6 @@ function AssetBrowserFilterTree::onControlDropped( %this, %payload, %position )
|
|||
|
||||
function AssetBrowserFilterTree::onDragDropped( %this )
|
||||
{
|
||||
%asdgadfhg =true;
|
||||
}
|
||||
|
||||
function AssetBrowser::hasLooseFilesInDir(%this)
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ function AssetBrowser::createMaterialAsset(%this)
|
|||
%assetPath = AssetBrowser.dirHandler.currentAddress @ "/";
|
||||
|
||||
%tamlpath = %assetPath @ %assetName @ ".asset.taml";
|
||||
%scriptPath = %assetPath @ %assetName @ "." @ $TorqueScriptFileExtension;
|
||||
|
||||
%asset = new MaterialAsset()
|
||||
{
|
||||
|
|
@ -16,13 +15,13 @@ function AssetBrowser::createMaterialAsset(%this)
|
|||
versionId = 1;
|
||||
materialDefinitionName = %assetName;
|
||||
scriptFile = %assetName @ "." @ $TorqueScriptFileExtension;
|
||||
|
||||
new Material(%assetName) {
|
||||
};
|
||||
};
|
||||
|
||||
TamlWrite(%asset, %tamlpath);
|
||||
|
||||
%mat = new Material(%assetName);
|
||||
%mat.save(%scriptPath);
|
||||
|
||||
%moduleDef = ModuleDatabase.findModule(%moduleName, 1);
|
||||
AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath);
|
||||
|
||||
|
|
@ -42,6 +41,7 @@ function AssetBrowser::editMaterialAsset(%this, %assetDef)
|
|||
|
||||
EditorGui.setEditor(MaterialEditorPlugin);
|
||||
|
||||
MaterialEditorGui.currentMaterialAsset = %assetDef.getAssetId();
|
||||
MaterialEditorGui.currentMaterial = %assetDef.materialDefinitionName;
|
||||
MaterialEditorGui.setActiveMaterial( %assetDef.materialDefinitionName );
|
||||
|
||||
|
|
|
|||
|
|
@ -15,10 +15,37 @@ function AssetBrowser::createTerrainMaterialAsset(%this)
|
|||
{
|
||||
AssetName = %assetName;
|
||||
versionId = 1;
|
||||
scriptFile = %assetName @ "." @ $TorqueScriptFileExtension;
|
||||
materialDefinitionName = %assetName;
|
||||
};
|
||||
|
||||
%matDef = new TerrainMaterial(%assetName)
|
||||
{
|
||||
internalName = %moduleName @ ":" @ %assetName;
|
||||
diffuseMap = "";
|
||||
detailMap = "";
|
||||
detailSize = "10";
|
||||
isManaged = "1";
|
||||
detailBrightness = "1";
|
||||
Enabled = "1";
|
||||
diffuseSize = "200";
|
||||
};
|
||||
|
||||
%fxMatDef = new Material("TerrainFX_" @ %assetName)
|
||||
{
|
||||
mapTo = %assetName;
|
||||
footstepSoundId = 0;
|
||||
terrainMaterials = "1";
|
||||
ShowDust = "1";
|
||||
showFootprints = "1";
|
||||
materialTag0 = "Terrain";
|
||||
effectColor[0] = "0.42 0.42 0 1";
|
||||
effectColor[1] = "0.42 0.42 0 1";
|
||||
impactSoundId = "0";
|
||||
};
|
||||
|
||||
%asset.add(%matDef);
|
||||
%asset.add(%fxMatDef);
|
||||
|
||||
TamlWrite(%asset, %tamlpath);
|
||||
|
||||
%moduleDef = ModuleDatabase.findModule(%moduleName, 1);
|
||||
|
|
@ -28,35 +55,6 @@ function AssetBrowser::createTerrainMaterialAsset(%this)
|
|||
|
||||
AssetBrowser.refresh();
|
||||
|
||||
//AssetBrowserFilterTree.onSelect(%smItem);
|
||||
|
||||
%file = new FileObject();
|
||||
%templateFile = new FileObject();
|
||||
|
||||
%templateFilePath = %this.templateFilesPath @ "terrainMaterial." @ $TorqueScriptFileExtension @ ".template";
|
||||
|
||||
if(%file.openForWrite(%scriptPath) && %templateFile.openForRead(%templateFilePath))
|
||||
{
|
||||
while( !%templateFile.isEOF() )
|
||||
{
|
||||
%line = %templateFile.readline();
|
||||
%line = strreplace( %line, "@", %assetName );
|
||||
|
||||
%file.writeline(%line);
|
||||
//echo(%line);
|
||||
}
|
||||
|
||||
%file.close();
|
||||
%templateFile.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
%file.close();
|
||||
%templateFile.close();
|
||||
|
||||
warnf("CreateNewTerrainMaterialAsset - Something went wrong and we couldn't write thescript file!");
|
||||
}
|
||||
|
||||
//If we've got the terrain mat editor open, go ahead and update it all
|
||||
TerrainMaterialDlg.onWake();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue