Merge branch 'Preview4_0' of https://github.com/Areloch/Torque3D into alph40_pbrConfig_BREAKINGWip

This commit is contained in:
AzaezelX 2019-11-07 01:39:50 -06:00
commit 062e6f3364
95 changed files with 4237 additions and 2024 deletions

View file

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

View file

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

View file

@ -1885,6 +1885,9 @@ function Editor::open(%this)
Canvas.setContent(EditorGui);
$isFirstPersonVar = true;
EditorGui.syncCameraGui();
if(EditorSettings.value("WorldEditor/Layout/LayoutMode", "Classic") $= "Modern")
togglePanelLayout();
}
function Editor::close(%this, %gui)

View file

@ -164,7 +164,7 @@ function toggleEditor(%make)
//------------------------------------------------------------------------------
// The editor action maps are defined in editor.bind.cs
GlobalActionMap.bind(keyboard, "f11", toggleEditor);
GlobalActionMap.bind(keyboard, "f11", fastLoadWorldEdit);
// The scenario:

View file

@ -60,6 +60,8 @@ EditorSettings.endGroup();
EditorSettings.beginGroup( "Tools" );
EditorSettings.setDefaultValue( "snapGround", "0" );
EditorSettings.setDefaultValue( "TerrainSnapOffsetZ", "0" );
EditorSettings.setDefaultValue( "OffsetZValue", "0.01" );
EditorSettings.setDefaultValue( "snapSoft", "0" );
EditorSettings.setDefaultValue( "snapSoftSize", "2.0" );
EditorSettings.setDefaultValue( "boundingBoxCollision", "0" );
@ -215,6 +217,8 @@ function EditorGui::readWorldEditorSettings(%this)
EditorSettings.beginGroup( "Tools" );
EWorldEditor.stickToGround = EditorSettings.value("snapGround"); //$pref::WorldEditor::snapGround;
EWorldEditor.TerrainSnapOffsetZ = EditorSettings.value("TerrainSnapOffsetZ"); //$pref::WorldEditor::TerrainSnapOffsetZ;
EWorldEditor.OffsetZValue = EditorSettings.value("OffsetZValue"); //$pref::WorldEditor::OffsetZValue;
EWorldEditor.setSoftSnap( EditorSettings.value("snapSoft") ); //$pref::WorldEditor::snapSoft
EWorldEditor.setSoftSnapSize( EditorSettings.value("snapSoftSize") ); //$pref::WorldEditor::snapSoftSize
EWorldEditor.boundingBoxCollision = EditorSettings.value("boundingBoxCollision"); //$pref::WorldEditor::boundingBoxCollision;
@ -310,6 +314,8 @@ function EditorGui::writeWorldEditorSettings(%this)
EditorSettings.beginGroup( "Tools" );
EditorSettings.setValue( "snapGround", EWorldEditor.stickToGround ); //$Pref::WorldEditor::snapGround
EditorSettings.setValue( "TerrainSnapOffsetZ", EWorldEditor.TerrainSnapOffsetZ ); //$pref::WorldEditor::TerrainSnapOffsetZ;
EditorSettings.setValue( "OffsetZValue", EWorldEditor.OffsetZValue ); //$pref::WorldEditor::OffsetZValue;
EditorSettings.setValue( "snapSoft", EWorldEditor.getSoftSnap() ); //$Pref::WorldEditor::snapSoft
EditorSettings.setValue( "snapSoftSize", EWorldEditor.getSoftSnapSize() ); //$Pref::WorldEditor::snapSoftSize
EditorSettings.setValue( "boundingBoxCollision", EWorldEditor.boundingBoxCollision ); //$Pref::WorldEditor::boundingBoxCollision

View file

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

View file

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

View file

@ -20,7 +20,7 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
// Debug Shaders.
new ShaderData( AL_ColorBufferShader )
singleton shaderData( AL_ColorBufferShader )
{
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
DXPixelShaderFile = "./shaders/dbgColorBufferP.hlsl";
@ -59,7 +59,7 @@ function toggleColorBufferViz( %enable )
}
}
new ShaderData( AL_SpecMapShader )
singleton shaderData( AL_SpecMapShader )
{
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
DXPixelShaderFile = "./shaders/dbgSpecMapVisualizeP.hlsl";
@ -94,7 +94,7 @@ function toggleSpecMapViz( %enable )
AL_SpecMapVisualize.disable();
}
new GFXStateBlockData( AL_DepthVisualizeState )
singleton GFXStateBlockData( AL_DepthVisualizeState )
{
zDefined = true;
zEnable = false;
@ -105,7 +105,7 @@ new GFXStateBlockData( AL_DepthVisualizeState )
samplerStates[1] = SamplerClampLinear; // viz color lookup
};
new GFXStateBlockData( AL_DefaultVisualizeState )
singleton GFXStateBlockData( AL_DefaultVisualizeState )
{
blendDefined = true;
blendEnable = true;
@ -121,7 +121,7 @@ new GFXStateBlockData( AL_DefaultVisualizeState )
samplerStates[1] = SamplerClampLinear; // depthviz
};
new ShaderData( AL_DepthVisualizeShader )
singleton shaderData( AL_DepthVisualizeShader )
{
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
DXPixelShaderFile = "./shaders/dbgDepthVisualizeP.hlsl";
@ -157,7 +157,7 @@ function AL_DepthVisualize::onEnabled( %this )
return true;
}
new ShaderData( AL_GlowVisualizeShader )
singleton shaderData( AL_GlowVisualizeShader )
{
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
DXPixelShaderFile = "./shaders/dbgGlowVisualizeP.hlsl";
@ -178,7 +178,7 @@ singleton PostEffect( AL_GlowVisualize )
renderPriority = 9999;
};
new ShaderData( AL_NormalsVisualizeShader )
singleton shaderData( AL_NormalsVisualizeShader )
{
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
DXPixelShaderFile = "./shaders/dbgNormalVisualizeP.hlsl";
@ -214,7 +214,7 @@ function AL_NormalsVisualize::onEnabled( %this )
new ShaderData( AL_LightColorVisualizeShader )
singleton shaderData( AL_LightColorVisualizeShader )
{
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
DXPixelShaderFile = "./shaders/dbgLightColorVisualizeP.hlsl";
@ -249,7 +249,7 @@ function AL_LightColorVisualize::onEnabled( %this )
}
new ShaderData( AL_LightSpecularVisualizeShader )
singleton shaderData( AL_LightSpecularVisualizeShader )
{
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
DXPixelShaderFile = "./shaders/dbgLightSpecularVisualizeP.hlsl";

View file

@ -1,4 +1,4 @@
new GFXStateBlockData( Viz_DefaultVisualizeState )
singleton GFXStateBlockData( Viz_DefaultVisualizeState )
{
/*alphaDefined = true;
alphaTestEnable = true;
@ -39,7 +39,7 @@ new GFXStateBlockData( Viz_DefaultVisualizeState )
samplerStates[4] = SamplerClampLinear; // depthviz
};
new ShaderData( Viz_TexelDensity )
singleton shaderData( Viz_TexelDensity )
{
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
DXPixelShaderFile = "./shaders/Viz_TexelDensityP.hlsl";
@ -79,7 +79,7 @@ function toggleTexelDensityViz( %enable )
//
//
new ShaderData( Viz_SurfaceProperties )
singleton shaderData( Viz_SurfaceProperties )
{
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
DXPixelShaderFile = "./shaders/Viz_SurfacePropertiesP.hlsl";
@ -203,7 +203,7 @@ function Viz_SurfacePropertiesPFX::onEnabled( %this )
//
//
//
new ShaderData( Viz_ColorBlindness )
singleton shaderData( Viz_ColorBlindness )
{
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
DXPixelShaderFile = "./shaders/Viz_ColorblindnessP.hlsl";
@ -307,7 +307,7 @@ function Viz_ColorBlindnessPFX::onEnabled( %this )
//
//Material Complexity Viz
new ShaderData( Viz_MaterialComplexity )
singleton shaderData( Viz_MaterialComplexity )
{
DXVertexShaderFile = "./shaders/Viz_materialComplexityV.hlsl";
DXPixelShaderFile = "./shaders/Viz_materialComplexityP.hlsl";

View file

@ -20,7 +20,7 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
new ShaderData( AL_ShadowVisualizeShader )
singleton shaderData( AL_ShadowVisualizeShader )
{
DXVertexShaderFile = $Core::CommonShaderPath @ "/guiMaterialV.hlsl";
DXPixelShaderFile = "./shaders/dbgShadowVisualizeP.hlsl";