mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
Adds logic to up-convert non-embedded terrain materials and materials to have embedded definitions
This commit is contained in:
parent
85bb4cbff3
commit
c2857efe28
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue