Makes the graphics menu in the stock UI mostly functional again

Adds sanity check to editing of gameasset script action in asset browser
Updates module template file
Updates visualizers
Fixes checking of popup menu items
Adds stub for TerrainMaterialAsset
This commit is contained in:
Areloch 2019-08-29 00:22:33 -05:00
parent 07b8619bf3
commit d720eb8ccd
163 changed files with 10289 additions and 711 deletions

View file

@ -21,7 +21,8 @@ function AssetBrowser::editGameObjectAssetScript(%this, %assetDef)
{
%scriptFile = %assetDef.scriptFile;
EditorOpenFileInTorsion(makeFullPath(%scriptFile), 0);
if(%scriptFile !$= "")
EditorOpenFileInTorsion(makeFullPath(%scriptFile), 0);
}
function AssetBrowser::applyInstanceToGameObject(%this, %assetDef)

View file

@ -12,12 +12,12 @@ function @@::initServer(%this)
}
//This is called when the server is created for an actual game/map to be played
function @@::onCreateServer(%this)
function @@::onCreateGameServer(%this)
{
}
//This is called when the server is shut down due to the game/map being exited
function @@::onDestroyServer(%this)
function @@::onDestroyGameServer(%this)
{
}
@ -27,11 +27,11 @@ function @@::initClient(%this)
}
//This is called when a client connects to a server
function @@::onCreateClient(%this)
function @@::onCreateClientConnection(%this)
{
}
//This is called when a client disconnects from a server
function @@::onDestroyClient(%this)
function @@::onDestroyClientConnection(%this)
{
}

View file

@ -147,6 +147,11 @@ function SettingsInspector::changeEditorSetting(%this, %varName, %value)
{
%varName = strreplace(%varName, "-", "/");
if(isFile(%value) || IsDirectory(%value))
{
%value = makeFullPath(%value);
}
echo("Set " @ %varName @ " to be " @ %value);
if(ESettingsWindow.mode $= "Editor")

View file

@ -68,6 +68,7 @@ function initializeWorldEditor()
exec("./scripts/visibility/visibilityLayer.ed.cs");
exec("./scripts/visibility/lightViz.cs");
exec("./scripts/visibility/shadowViz.cs");
exec("./scripts/visibility/probeViz.cs");
exec("./scripts/visibility/miscViz.cs");
// Load Custom Editors

View file

@ -579,7 +579,9 @@ function EditorGui::onSleep( %this )
// Remove the editor's ActionMaps.
EditorMap.pop();
MoveMap.pop();
if(isObject(moveMap))
MoveMap.pop();
// Notify the editor plugins that the editor will be closing.

View file

@ -361,3 +361,68 @@ function toggleBackbufferViz( %enable )
}
}
//
//
//
function setLightingMode(%mode)
{
resetLightingMode();
switch$ ( %mode )
{
case "Unlit":
$Shadows::disable = true;
$Light::renderReflectionProbes = false;
$Light::disableLights = true;
EVisibilityLightingModesOptions.checkItem(1, true);
case "NoShadows":
$Shadows::disable = true;
EVisibilityLightingModesOptions.checkItem(2, true);
case "DetailLighting":
//$Viz_ColorblindnessModeVar = "0";
EVisibilityLightingModesOptions.checkItem(3, true);
case "LightingOnly":
$Light::renderReflectionProbes = false;
EVisibilityLightingModesOptions.checkItem(4, true);
case "ReflectionsOnly":
$Light::disableLights = true;
EVisibilityLightingModesOptions.checkItem(5, true);
}
}
function resetLightingMode()
{
for(%i=0; %i < 6; %i++)
{
EVisibilityLightingModesOptions.checkItem(%i, false);
}
$Light::renderReflectionProbes = true;
$Light::disableLights = false;
$Shadows::disable = false;
EVisibilityLightingModesOptions.checkItem(0, true);
}
function togglePSSMDebugViz()
{
disableVisualizers();
$AL::PSSMDebugRender = !$AL::PSSMDebugRender;
}
function disablePSSMDebugViz()
{
$AL::PSSMDebugRender = false;
$Light::renderReflectionProbes = true;
}
//
//
function toggleLightFrustumViz()
{
$Light::renderLightFrustums = !$Light::renderLightFrustums;
}
function disableLightFrustumViz()
{
$Light::renderLightFrustums = false;
}

View file

@ -90,8 +90,9 @@ new ShaderData( Viz_SurfaceProperties )
samplerNames[0] = "deferredTex";
samplerNames[1] = "colorBufferTex";
samplerNames[2] = "matinfoTex";
samplerNames[3] = "$backBuffer";
samplerNames[4] = "glowBuffer";
samplerNames[3] = "ssaoMaskTex";
samplerNames[4] = "$backBuffer";
samplerNames[5] = "glowBuffer";
pixVersion = 2.0;
};
@ -103,8 +104,9 @@ singleton PostEffect( Viz_SurfacePropertiesPFX )
texture[0] = "#deferred";
texture[1] = "#color";
texture[2] = "#matinfo";
texture[3] = "$backBuffer";
texture[4] = "#glowbuffer";
texture[3] = "#ssaoMask";
texture[4] = "$backBuffer";
texture[5] = "#glowbuffer";
target = "$backBuffer";
renderPriority = 9999;
@ -141,10 +143,12 @@ function toggleSurfacePropertiesViz( %mode )
$Viz_SurfacePropertiesModeVar = "10";
case "Fresnel":
$Viz_SurfacePropertiesModeVar = "11";
case "Backbuffer":
case "SSAO":
$Viz_SurfacePropertiesModeVar = "12";
case "Glow":
case "Backbuffer":
$Viz_SurfacePropertiesModeVar = "13";
case "Glow":
$Viz_SurfacePropertiesModeVar = "14";
default:
$Viz_SurfacePropertiesModeVar = "-1";
}
@ -163,7 +167,7 @@ function toggleSurfacePropertiesViz( %mode )
}
}
for(%i=0; %i < 14; %i++)
for(%i=0; %i < 15; %i++)
{
if(%i == $Viz_SurfacePropertiesModeVar)
EVisibilityBufferVizOptions.checkItem(%i, true);

View file

@ -1,5 +1,7 @@
function toggleProbeVis(%mode)
function toggleProbeViz(%mode)
{
setLightingMode("ReflectionsOnly");
$Probes::showAttenuation = 0;
$Probes::showSpecularCubemaps = 0;
$Probes::showDiffuseCubemaps = 0;
@ -16,4 +18,10 @@ function toggleProbeVis(%mode)
case "Diffuse":
$Probes::showDiffuseCubemaps = 1;
}
}
function disableProbeViz()
{
setLightingMode("Lit");
toggleProbeViz(-1);
}

View file

@ -28,8 +28,9 @@
TORQUE_UNIFORM_SAMPLER2D(deferredBuffer, 0);
TORQUE_UNIFORM_SAMPLER2D(colorBuffer, 1);
TORQUE_UNIFORM_SAMPLER2D(matInfoBuffer, 2);
TORQUE_UNIFORM_SAMPLER2D(backbufferTex, 3);
TORQUE_UNIFORM_SAMPLER2D(glowBuffer, 4);
TORQUE_UNIFORM_SAMPLER2D(ssaoMaskTex, 3);
TORQUE_UNIFORM_SAMPLER2D(backbufferTex, 4);
TORQUE_UNIFORM_SAMPLER2D(glowBuffer, 5);
uniform float mode;
uniform float3 eyePosWorld;
@ -73,8 +74,10 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
else if(mode == 11)
return float4(surface.F.rgb,1);
else if(mode == 12)
float4(TORQUE_TEX2D( backbufferTex, IN.uv0 ).rgb, 1.0);
float4(TORQUE_TEX2D( ssaoMaskTex, IN.uv0 ).rgb, 1.0);
else if(mode == 13)
float4(TORQUE_TEX2D( backbufferTex, IN.uv0 ).rgb, 1.0);
else if(mode == 14)
float4(TORQUE_TEX2D( glowBuffer, IN.uv0 ).rgb, 1.0);
return float4(0,0,0,1);

View file

@ -0,0 +1,44 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "../../../../core/rendering/shaders/postFX/postFx.hlsl"
#include "../../../../core/rendering/shaders/torque.hlsl"
uniform float4 rtParams0;
uniform float4 rtParams1;
uniform float4 rtParams2;
uniform float4 rtParams3;
PFXVertToPix main( PFXVert IN )
{
PFXVertToPix OUT;
OUT.hpos = float4(IN.pos,1.0);
OUT.uv0 = viewportCoordToRenderTarget( IN.uv, rtParams0 );
OUT.uv1 = viewportCoordToRenderTarget( IN.uv, rtParams1 );
OUT.uv2 = viewportCoordToRenderTarget( IN.uv, rtParams2 );
OUT.uv3 = viewportCoordToRenderTarget( IN.uv, rtParams3 );
OUT.wsEyeRay = IN.wsEyeRay;
return OUT;
}

View file

@ -91,27 +91,22 @@ function setupEditorVisibilityMenu()
item[ 7 ] = "Show Sound Spaces" TAB "" TAB "$SFXSpace::isRenderable = !$SFXSpace::isRenderable;";
};
EVisibility.addOption( "Debug Render: Player Collision", "$Player::renderCollision", "" );
EVisibility.addOption( "Debug Render: Terrain", "TerrainBlock::debugRender", "" );
EVisibility.addOption( "Debug Render: Decals", "$Decals::debugRender", "" );
EVisibility.addOption( "Debug Render: Light Frustums", "$Light::renderLightFrustums", "" );
EVisibility.addOption( "Debug Render: Bounding Boxes", "$Scene::renderBoundingBoxes", "" );
EVisibility.addOption( "Debug Render: Physics World", "$PhysicsWorld::render", "togglePhysicsDebugViz" );
%debugRenderpopup = new PopupMenu(EVisibilityDebugRenderOptions)
{
superClass = "MenuBuilder";
class = "EditorWorldMenu";
item[ 0 ] = "Show Player Collision" TAB "" TAB "";
item[ 1 ] = "Show Terrain Debug" TAB "" TAB "";
item[ 2 ] = "Show Decals Debug" TAB "" TAB "";
item[ 3 ] = "Show Bounding Boxes" TAB "" TAB "";
item[ 4 ] = "Show Physics World" TAB "" TAB "";
item[ 0 ] = "Show Player Collision" TAB "" TAB "$Player::renderCollision != $Player::renderCollision;";
item[ 1 ] = "Show Terrain Debug" TAB "" TAB "$TerrainBlock::debugRender != $TerrainBlock::debugRender;";
item[ 2 ] = "Show Decals Debug" TAB "" TAB "$Decals::debugRender != $Decals::debugRender;";
item[ 3 ] = "Show Bounding Boxes" TAB "" TAB "$Scene::renderBoundingBoxes != $Scene::renderBoundingBoxes;";
item[ 4 ] = "Show Physics World" TAB "" TAB "$PhysicsWorld::render != $PhysicsWorld::render;";
item[ 5 ] = "Show Player Collision" TAB "" TAB "";
item[ 6 ] = "Show Texel Density" TAB "" TAB "toggleTexelDensityViz();";
};
%probespopup.enableItem(6, false);
//
//Lighting stuff
%lightingModepopup = new PopupMenu(EVisibilityLightingModesOptions)
@ -119,21 +114,23 @@ function setupEditorVisibilityMenu()
superClass = "MenuBuilder";
class = "EditorWorldMenu";
item[ 0 ] = "Lit" TAB "" TAB "";
item[ 1 ] = "Unlit" TAB "" TAB "";
item[ 2 ] = "No Shadows" TAB "" TAB "$Shadows::disable = !$Shadows::disable;";
item[ 3 ] = "Detail Lighting" TAB "" TAB "";
item[ 4 ] = "Lighting Only" TAB "" TAB "";
item[ 5 ] = "Reflections Only" TAB "" TAB "";
item[ 0 ] = "Lit" TAB "" TAB "setLightingMode(\"Lit\");";
item[ 1 ] = "Unlit" TAB "" TAB "setLightingMode(\"Unlit\");";
item[ 2 ] = "No Shadows" TAB "" TAB "setLightingMode(\"NoShadows\");";
item[ 3 ] = "Detail Lighting" TAB "" TAB "setLightingMode(\"DetailLighting\");";
item[ 4 ] = "Lighting Only" TAB "" TAB "setLightingMode(\"LightingOnly\");";
item[ 5 ] = "Reflections Only" TAB "" TAB "setLightingMode(\"ReflectionsOnly\");";
};
EVisibilityLightingModesOptions.checkItem(0, true);
%lightspopup = new PopupMenu(EVisibilityLightsOptions)
{
superClass = "MenuBuilder";
class = "EditorWorldMenu";
item[ 0 ] = "Show Light Frustums" TAB "" TAB "$Light::renderLightFrustums = !$Light::renderLightFrustums;";
item[ 1 ] = "Show Shadowmap Cascades" TAB "" TAB "$AL::PSSMDebugRender = !$AL::PSSMDebugRender;";
item[ 0 ] = "Show Light Frustums" TAB "" TAB "toggleLightFrustumViz();";
item[ 1 ] = "Show Shadowmap Cascades" TAB "" TAB "togglePSSMDebugViz();";
item[ 2 ] = "Show Specular Light" TAB "" TAB "";
item[ 3 ] = "Show Diffuse Light" TAB "" TAB "";
};
@ -145,22 +142,14 @@ function setupEditorVisibilityMenu()
superClass = "MenuBuilder";
class = "EditorWorldMenu";
item[ 0 ] = "Show Probe Attenuation" TAB "" TAB "toggleProbeVis(\"Attenuation\");";
item[ 1 ] = "Show Probe Contribution" TAB "" TAB "toggleProbeVis(\"Contribution\");";
item[ 2 ] = "Show Probe Specular Reflections" TAB "" TAB "toggleProbeVis(\"Specular\");";
item[ 3 ] = "Show Probe Diffuse Reflections" TAB "" TAB "toggleProbeVis(\"Diffuse\");";
item[ 0 ] = "Show Probe Attenuation" TAB "" TAB "toggleProbeViz(\"Attenuation\");";
item[ 1 ] = "Show Probe Contribution" TAB "" TAB "toggleProbeViz(\"Contribution\");";
item[ 2 ] = "Show Probe Specular Reflections Only" TAB "" TAB "toggleProbeViz(\"Specular\");";
item[ 3 ] = "Show Probe Diffuse Reflections Only" TAB "" TAB "toggleProbeViz(\"Diffuse\");";
item[ 4 ] = "Enable Live Updates on Selected Probe" TAB "" TAB "";
};
%lightingpopup = new PopupMenu(EVisibilityLightingOptions)
{
superClass = "MenuBuilder";
class = "EditorWorldMenu";
item[ 0 ] = "Lighting Modes" TAB EVisibilityLightingModesOptions;
item[ 1 ] = "Lights" TAB EVisibilityLightsOptions;
item[ 2 ] = "Probes" TAB EVisibilityProbesOptions;
};
%probespopup.enableItem(4, false);
//
//Buffer Viz
@ -185,8 +174,10 @@ function setupEditorVisibilityMenu()
item[ 11 ] = "Fresnel" TAB "" TAB "toggleSurfacePropertiesViz(\"Fresnel\");";
item[ 12 ] = "Backbuffer" TAB "" TAB "toggleSurfacePropertiesViz(\"Backbuffer\");";
item[ 13 ] = "Glow" TAB "" TAB "toggleSurfacePropertiesViz(\"Glow\");";
item[ 12 ] = "Ambient Occlusion" TAB "" TAB "toggleSurfacePropertiesViz(\"SSAO\");";
item[ 13 ] = "Backbuffer" TAB "" TAB "toggleSurfacePropertiesViz(\"Backbuffer\");";
item[ 14 ] = "Glow" TAB "" TAB "toggleSurfacePropertiesViz(\"Glow\");";
};
//
@ -232,10 +223,12 @@ function setupEditorVisibilityMenu()
item[ 7 ] = "Disable Zone Culling" TAB "" TAB "$Scene::disableZoneCulling = !$Scene::disableZoneCulling;";
item[ 8 ] = "Disable Terrain Culling" TAB "" TAB "$Scene::disableTerrainOcclusion = !$Scene::disableTerrainOcclusion;";
item[ 9 ] = "-" TAB "" TAB "";
item[ 10 ] = "Lighting" TAB EVisibilityLightingOptions;
item[ 11 ] = "Buffer Visualization" TAB EVisibilityBufferVizOptions;
item[ 12 ] = "-" TAB "" TAB "";
item[ 13 ] = "Class Visibility" TAB EVisibilityClassVizOptions;
item[ 10 ] = "Lighting Modes" TAB EVisibilityLightingModesOptions;
item[ 11 ] = "Lights" TAB EVisibilityLightsOptions;
item[ 12 ] = "Probes" TAB EVisibilityProbesOptions;
item[ 13 ] = "Buffer Visualization" TAB EVisibilityBufferVizOptions;
item[ 14 ] = "-" TAB "" TAB "";
item[ 15 ] = "Class Visibility" TAB EVisibilityClassVizOptions;
};
}
@ -418,3 +411,16 @@ function togglePhysicsDebugViz( %enable )
physicsDebugDraw(%enable);
}
}
function disableVisualizers()
{
//Set lighting mode to lit
resetLightingMode();
disableSurfacePropertiesViz();
disableColorblindnessViz();
disablePSSMDebugViz();
disableLightingOnlyViz();
disableReflectionsOnlyViz();
disableProbeViz();
}