Merge branch 'GarageGames/master' into ueberengine-dev

Conflicts:
	Engine/source/windowManager/sdl/sdlWindowMgr.cpp
	Tools/CMake/torque3d.cmake

3.10 final update
This commit is contained in:
Duion 2017-03-23 20:36:21 +01:00
commit aff033dd0d
1003 changed files with 53039 additions and 82707 deletions

View file

@ -106,7 +106,7 @@
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
command = "GuiEdit();";
command = "toggleGuiEditor(1);";
tooltipProfile = "GuiToolTipProfile";
tooltip = "The GUI Editor is accessible in-game by pressing F10";
hovertime = "1000";

Binary file not shown.

Before

Width:  |  Height:  |  Size: 331 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View file

@ -62,6 +62,7 @@ singleton PostEffect( FogPostFx )
renderPriority = 5;
targetFormat = getBestHDRFormat();
isEnabled = true;
};

View file

@ -22,7 +22,7 @@
/// Blends between the scene and the tone mapped scene.
$HDRPostFX::enableToneMapping = 1.0;
$HDRPostFX::enableToneMapping = 0.5;
/// The tone mapping middle grey or exposure value used
/// to adjust the overall "balance" of the image.
@ -318,7 +318,7 @@ function HDRPostFX::onDisabled( %this )
GammaPostFX.enable();
// Restore the non-HDR offscreen surface format.
%format = "GFXFormatR8G8B8A8";
%format = getBestHDRFormat();
AL_FormatToken.format = %format;
setReflectFormat( %format );
@ -333,8 +333,8 @@ function HDRPostFX::onDisabled( %this )
singleton PostEffect( HDRPostFX )
{
isEnabled = false;
allowReflectPass = true;
allowReflectPass = false;
// Resolve the HDR before we render any editor stuff
// and before we resolve the scene to the backbuffer.
renderTime = "PFXBeforeBin";
@ -359,7 +359,7 @@ singleton PostEffect( HDRPostFX )
new PostEffect()
{
allowReflectPass = true;
allowReflectPass = false;
shader = HDR_DownScale4x4Shader;
stateBlock = HDR_DownSampleStateBlock;
texture[0] = "$inTex";
@ -370,7 +370,7 @@ singleton PostEffect( HDRPostFX )
new PostEffect()
{
allowReflectPass = true;
allowReflectPass = false;
internalName = "bloomH";
shader = HDR_BloomGaussBlurHShader;
@ -382,7 +382,7 @@ singleton PostEffect( HDRPostFX )
new PostEffect()
{
allowReflectPass = true;
allowReflectPass = false;
internalName = "bloomV";
shader = HDR_BloomGaussBlurVShader;
@ -397,7 +397,7 @@ singleton PostEffect( HDRPostFX )
// Now calculate the adapted luminance.
new PostEffect()
{
allowReflectPass = true;
allowReflectPass = false;
internalName = "adaptLum";
shader = HDR_SampleLumShader;
@ -409,7 +409,7 @@ singleton PostEffect( HDRPostFX )
new PostEffect()
{
allowReflectPass = true;
allowReflectPass = false;
shader = HDR_DownSampleLumShader;
stateBlock = HDR_DownSampleStateBlock;
texture[0] = "$inTex";
@ -420,7 +420,7 @@ singleton PostEffect( HDRPostFX )
new PostEffect()
{
allowReflectPass = true;
allowReflectPass = false;
shader = HDR_DownSampleLumShader;
stateBlock = HDR_DownSampleStateBlock;
texture[0] = "$inTex";
@ -431,7 +431,7 @@ singleton PostEffect( HDRPostFX )
new PostEffect()
{
allowReflectPass = true;
allowReflectPass = false;
shader = HDR_DownSampleLumShader;
stateBlock = HDR_DownSampleStateBlock;
texture[0] = "$inTex";
@ -445,8 +445,8 @@ singleton PostEffect( HDRPostFX )
// one... PostEffect takes care to manage that.
new PostEffect()
{
allowReflectPass = true;
internalName = "finalLum";
allowReflectPass = false;
internalName = "finalLum";
shader = HDR_CalcAdaptedLumShader;
stateBlock = HDR_DownSampleStateBlock;
texture[0] = "$inTex";
@ -462,7 +462,7 @@ singleton PostEffect( HDRPostFX )
// version of the scene.
new PostEffect()
{
allowReflectPass = true;
allowReflectPass = false;
internalName = "combinePass";
shader = HDR_CombineShader;
@ -471,7 +471,6 @@ singleton PostEffect( HDRPostFX )
texture[1] = "#adaptedLum";
texture[2] = "#bloomFinal";
texture[3] = $HDRPostFX::colorCorrectionRamp;
texture[4] = "#prepass";
target = "$backBuffer";
};
};

View file

@ -97,7 +97,6 @@ function startDemoRecord()
ChatHud.AddLine( "\c4Recording to file [\c2" @ $DemoFileName @ "\cr].");
ServerConnection.prepDemoRecord();
ServerConnection.startRecording($DemoFileName);
// make sure start worked

View file

@ -33,7 +33,7 @@ function initRenderManager()
{
enabled = "false";
format = "GFXFormatR16G16B16A16F";
format = getBestHDRFormat();
depthFormat = "GFXFormatD24S8";
aaLevel = 0; // -1 = match backbuffer
@ -59,7 +59,7 @@ function initRenderManager()
DiffuseRenderPassManager.addManager( new RenderMeshMgr(MeshBin) { bintype = "Mesh"; renderOrder = 0.5; processAddOrder = 0.5; basicOnly = true; } );
DiffuseRenderPassManager.addManager( new RenderImposterMgr(ImposterBin) { renderOrder = 0.56; processAddOrder = 0.56; } );
DiffuseRenderPassManager.addManager( new RenderObjectMgr(ObjectBin) { bintype = "Object"; renderOrder = 0.6; processAddOrder = 0.6; } );
DiffuseRenderPassManager.addManager( new RenderObjectMgr(ShadowBin) { bintype = "Shadow"; renderOrder = 0.7; processAddOrder = 0.7; } );
DiffuseRenderPassManager.addManager( new RenderMeshMgr(DecalRoadBin) { bintype = "DecalRoad"; renderOrder = 0.8; processAddOrder = 0.8; } );
DiffuseRenderPassManager.addManager( new RenderMeshMgr(DecalBin) { bintype = "Decal"; renderOrder = 0.81; processAddOrder = 0.81; } );

View file

@ -55,6 +55,9 @@ function formatSessionNumber(%number)
// Records a movie file from the Canvas content using the specified fps.
// Possible encoder values are "PNG" and "THEORA" (default).
//---------------------------------------------------------------------------------------------
$RecordingMovie = false;
function recordMovie(%movieName, %fps, %encoder)
{
// If the canvas doesn't exist yet, setup a flag so it'll
@ -65,12 +68,24 @@ function recordMovie(%movieName, %fps, %encoder)
if (%encoder $= "")
%encoder = "THEORA";
%resolution = Canvas.getVideoMode();
// Start the movie recording
ChatHud.AddLine( "\c4Recording movie file to [\c2" @ %movieName @ "\cr].ogv.");
echo("Recording movie to: " @ %movieName);
startVideoCapture(Canvas, %movieName, %encoder, %fps);
$RecordingMovie = true;
}
function stopMovie()
{
// Stop the current recording
ChatHud.AddLine( "\c4Recording movie file finished.");
echo("Stopped movie recording");
stopVideoCapture();
$RecordingMovie = false;
}
/// This is bound in initializeCommon() to take

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -28,6 +28,8 @@ $defaultGame = "scripts";
// Set profile directory
$Pref::Video::ProfilePath = "core/profile";
$Core::windowIcon = "core/torque.png";
$Core::splashWindowImage = "art/gui/splash.png";
function createCanvas(%windowTitle)
{

View file

@ -409,6 +409,49 @@ function stopRecordingDemo( %val )
moveMap.bind( keyboard, F3, startRecordingDemo );
moveMap.bind( keyboard, F4, stopRecordingDemo );
//------------------------------------------------------------------------------
// Theora Video Capture (Records a movie file)
//------------------------------------------------------------------------------
function toggleMovieRecording(%val)
{
if (!%val)
return;
%movieEncodingType = "THEORA"; // Valid encoder values are "PNG" and "THEORA" (default).
%movieFPS = 30; // video capture frame rate.
if (!$RecordingMovie)
{
// locate a non-existent filename to use
for(%i = 0; %i < 1000; %i++)
{
%num = %i;
if(%num < 10)
%num = "0" @ %num;
if(%num < 100)
%num = "0" @ %num;
%filePath = "movies/movie" @ %num;
if(!isfile(%filePath))
break;
}
if(%i == 1000)
return;
// Start the movie recording
recordMovie(%filePath, %movieFPS, %movieEncodingType);
}
else
{
// Stop the current recording
stopMovie();
}
}
// Key binding works at any time and not just while in a game.
GlobalActionMap.bind(keyboard, "alt m", toggleMovieRecording);
//------------------------------------------------------------------------------
// Helper Functions

View file

@ -138,13 +138,13 @@ mat3x3 quatToMat( vec4 quat )
///
vec2 parallaxOffset( sampler2D texMap, vec2 texCoord, vec3 negViewTS, float depthScale )
{
float depth = texture( texMap, texCoord ).a;
vec2 offset = negViewTS.xy * vec2( depth * depthScale );
float depth = texture( texMap, texCoord ).a/(PARALLAX_REFINE_STEPS*2);
vec2 offset = negViewTS.xy * vec2( depth * depthScale )/vec2(PARALLAX_REFINE_STEPS*2);
for ( int i=0; i < PARALLAX_REFINE_STEPS; i++ )
{
depth = ( depth + texture( texMap, texCoord + offset ).a ) * 0.5;
offset = negViewTS.xy * vec2( depth * depthScale );
depth = ( depth + texture( texMap, texCoord + offset ).a )/(PARALLAX_REFINE_STEPS*2);
offset = negViewTS.xy * vec2( depth * depthScale )/vec2(PARALLAX_REFINE_STEPS*2);
}
return offset;
@ -153,13 +153,13 @@ vec2 parallaxOffset( sampler2D texMap, vec2 texCoord, vec3 negViewTS, float dept
/// Same as parallaxOffset but for dxtnm where depth is stored in the red channel instead of the alpha
vec2 parallaxOffsetDxtnm(sampler2D texMap, vec2 texCoord, vec3 negViewTS, float depthScale)
{
float depth = texture(texMap, texCoord).r;
vec2 offset = negViewTS.xy * vec2(depth * depthScale);
float depth = texture(texMap, texCoord).r/(PARALLAX_REFINE_STEPS*2);
vec2 offset = negViewTS.xy * vec2(depth * depthScale)/vec2(PARALLAX_REFINE_STEPS*2);
for (int i = 0; i < PARALLAX_REFINE_STEPS; i++)
{
depth = (depth + texture(texMap, texCoord + offset).r) * 0.5;
offset = negViewTS.xy * vec2(depth * depthScale);
depth = (depth + texture(texMap, texCoord + offset).r)/(PARALLAX_REFINE_STEPS*2);
offset = negViewTS.xy * vec2(depth * depthScale)/vec2(PARALLAX_REFINE_STEPS*2);
}
return offset;

View file

@ -41,7 +41,7 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
color.b = TORQUE_TEX1D( colorCorrectionTex, color.b ).b;
// Apply gamma correction
color.rgb = pow( abs(color.rgb), OneOverGamma );
color.rgb = pow( saturate(color.rgb), OneOverGamma );
// Apply contrast
color.rgb = ((color.rgb - 0.5f) * Contrast) + 0.5f;

View file

@ -45,7 +45,7 @@ void main()
color.b = texture( colorCorrectionTex, color.b ).b;
// Apply gamma correction
color.rgb = pow( abs(color.rgb), vec3(OneOverGamma) );
color.rgb = pow( clamp(color.rgb, vec3(0.0),vec3(1.0)), vec3(OneOverGamma) );
// Apply contrast
color.rgb = ((color.rgb - 0.5f) * Contrast) + 0.5f;

View file

@ -28,7 +28,6 @@ TORQUE_UNIFORM_SAMPLER2D(sceneTex, 0);
TORQUE_UNIFORM_SAMPLER2D(luminanceTex, 1);
TORQUE_UNIFORM_SAMPLER2D(bloomTex, 2);
TORQUE_UNIFORM_SAMPLER1D(colorCorrectionTex, 3);
TORQUE_UNIFORM_SAMPLER2D(prepassTex, 4);
uniform float2 texSize0;
uniform float2 texSize2;
@ -40,7 +39,6 @@ uniform float g_fEnableBlueShift;
uniform float3 g_fBlueShiftColor;
uniform float g_fBloomScale;
uniform float g_fOneOverGamma;
uniform float Brightness;
uniform float Contrast;
@ -71,6 +69,9 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
bloom.rgb = lerp( bloom.rgb, rodColor, coef );
}
// Add the bloom effect.
sample += g_fBloomScale * bloom;
// Map the high range of color values into a range appropriate for
// display, taking into account the user's adaptation level,
// white point, and selected value for for middle gray.
@ -82,19 +83,13 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
sample.rgb = lerp( sample.rgb, sample.rgb * toneScalar, g_fEnableToneMapping );
}
// Add the bloom effect.
float depth = TORQUE_PREPASS_UNCONDITION( prepassTex, IN.uv0 ).w;
if (depth>0.9999)
sample += g_fBloomScale * bloom;
// Apply the color correction.
sample.r = TORQUE_TEX1D( colorCorrectionTex, sample.r ).r;
sample.g = TORQUE_TEX1D( colorCorrectionTex, sample.g ).g;
sample.b = TORQUE_TEX1D( colorCorrectionTex, sample.b ).b;
// Apply gamma correction
sample.rgb = pow( abs(sample.rgb), g_fOneOverGamma );
sample.rgb = pow( saturate(sample.rgb), g_fOneOverGamma );
// Apply contrast
sample.rgb = ((sample.rgb - 0.5f) * Contrast) + 0.5f;

View file

@ -29,7 +29,6 @@ uniform sampler2D sceneTex;
uniform sampler2D luminanceTex;
uniform sampler2D bloomTex;
uniform sampler1D colorCorrectionTex;
uniform sampler2D prepassTex;
uniform vec2 texSize0;
uniform vec2 texSize2;
@ -49,7 +48,6 @@ uniform float Contrast;
out vec4 OUT_col;
void main()
{
vec4 _sample = hdrDecode( texture( sceneTex, IN_uv0 ) );
@ -76,6 +74,9 @@ void main()
bloom.rgb = mix( bloom.rgb, rodColor, coef );
}
// Add the bloom effect.
_sample += g_fBloomScale * bloom;
// Map the high range of color values into a range appropriate for
// display, taking into account the user's adaptation level,
// white point, and selected value for for middle gray.
@ -87,18 +88,13 @@ void main()
_sample.rgb = mix( _sample.rgb, _sample.rgb * toneScalar, g_fEnableToneMapping );
}
// Add the bloom effect.
float depth = prepassUncondition( prepassTex, IN_uv0 ).w;
if (depth>0.9999)
_sample += g_fBloomScale * bloom;
// Apply the color correction.
_sample.r = texture( colorCorrectionTex, _sample.r ).r;
_sample.g = texture( colorCorrectionTex, _sample.g ).g;
_sample.b = texture( colorCorrectionTex, _sample.b ).b;
// Apply gamma correction
_sample.rgb = pow( abs(_sample.rgb), vec3(g_fOneOverGamma) );
_sample.rgb = pow( _sample.rgb, vec3(g_fOneOverGamma) );
// Apply contrast
_sample.rgb = ((_sample.rgb - 0.5f) * Contrast) + 0.5f;

View file

@ -140,13 +140,13 @@ float3x3 quatToMat( float4 quat )
///
float2 parallaxOffset(TORQUE_SAMPLER2D(texMap), float2 texCoord, float3 negViewTS, float depthScale)
{
float depth = TORQUE_TEX2D(texMap, texCoord).a;
float2 offset = negViewTS.xy * (depth * depthScale);
float depth = TORQUE_TEX2D(texMap, texCoord).a/(PARALLAX_REFINE_STEPS*2);
float2 offset = negViewTS.xy * (depth * depthScale)/(PARALLAX_REFINE_STEPS);
for (int i = 0; i < PARALLAX_REFINE_STEPS; i++)
{
depth = (depth + TORQUE_TEX2D(texMap, texCoord + offset).a) * 0.5;
offset = negViewTS.xy * (depth * depthScale);
depth = (depth + TORQUE_TEX2D(texMap, texCoord + offset).a)/(PARALLAX_REFINE_STEPS*2);
offset = negViewTS.xy * (depth * depthScale)/(PARALLAX_REFINE_STEPS);
}
return offset;
@ -155,13 +155,13 @@ float2 parallaxOffset(TORQUE_SAMPLER2D(texMap), float2 texCoord, float3 negViewT
/// Same as parallaxOffset but for dxtnm where depth is stored in the red channel instead of the alpha
float2 parallaxOffsetDxtnm(TORQUE_SAMPLER2D(texMap), float2 texCoord, float3 negViewTS, float depthScale)
{
float depth = TORQUE_TEX2D(texMap, texCoord).r;
float2 offset = negViewTS.xy * (depth * depthScale);
float depth = TORQUE_TEX2D(texMap, texCoord).r/(PARALLAX_REFINE_STEPS*2);
float2 offset = negViewTS.xy * (depth * depthScale)/(PARALLAX_REFINE_STEPS*2);
for (int i = 0; i < PARALLAX_REFINE_STEPS; i++)
{
depth = (depth + TORQUE_TEX2D(texMap, texCoord + offset).r) * 0.5;
offset = negViewTS.xy * (depth * depthScale);
depth = (depth + TORQUE_TEX2D(texMap, texCoord + offset).r)/(PARALLAX_REFINE_STEPS*2);
offset = negViewTS.xy * (depth * depthScale)/(PARALLAX_REFINE_STEPS*2);
}
return offset;

View file

@ -105,7 +105,7 @@ function EditorInspectorBase::onAdd( %this )
superClass = "MenuBuilder";
isPopup = true;
item[ 0 ] = "Edit Profile" TAB "" TAB "if( !$InGuiEditor ) toggleGuiEditor( true ); GuiEditor.editProfile( %this.inspectorField.getData() );";
item[ 0 ] = "Edit Profile" TAB "" TAB "if( !GuiEditorIsActive() ) toggleGuiEditor( true ); GuiEditor.editProfile( %this.inspectorField.getData() );";
item[ 1 ] = "Jump to Definition in Torsion" TAB "" TAB "EditorOpenDeclarationInTorsion( %this.inspectorField.getData() );";
item[ 2 ] = "Inspect Object" TAB "" TAB "inspectObject( %this.inspectorField.getData() );";
item[ 3 ] = "-";

View file

@ -252,7 +252,7 @@
objectNamesOnly = "1";
useInspectorTooltips = "0";
tooltipOnWidthOnly = "0";
compareToObjectID = "1";
compareToObjectID = "0";
canRenameObjects = "1";
renameInternal = "0";
isContainer = "1";

View file

@ -718,6 +718,22 @@
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiCheckBoxCtrl() {
text = "use sRGB";
groupNum = "-1";
buttonType = "ToggleButton";
useMouseEvents = "0";
position = "360 105";
extent = "66 16";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiCheckBoxProfile";
visible = "1";
active = "1";
variable = "$displayAsSRGB";
command = "useSRGBctrl($displayAsSRGB);";
};
};
};
//--- OBJECT WRITE END ---
@ -727,6 +743,15 @@ $ColorPickerCancelCallback = "";
$ColorPickerUpdateCallback = "";
$ColorCallbackType = 1; // ColorI
function useSRGBctrl(%colorScale)
{
ColorPickerDlg.useSRGB = %colorScale;
ColorRangeSelect.useSRGB = %colorScale;
ColorBlendSelect.useSRGB = %colorScale;
myColor.useSRGB = %colorScale;
oldColor.useSRGB = %colorScale;
}
// This function pushes the color picker dialog and returns to a callback the selected value
function GetColorI( %currentColor, %callback, %root, %updateCallback, %cancelCallback )
{

View file

@ -86,7 +86,7 @@
minExtent = "8 8";
canSave = "1";
visible = "1";
command = "GuiEditor.switchToWorldEditor();";
command = "toggleEditor(1);";
tooltipProfile = "ToolsGuiToolTipProfile";
ToolTip = "World Editor";
hovertime = "1000";

View file

@ -75,11 +75,26 @@ function toggleGuiEditor( %make )
if( EditorIsActive() && !GuiEditor.toggleIntoEditorGui )
toggleEditor( true );
GuiEdit();
if( !isObject( GuiEditCanvas ) )
new GuiControl( GuiEditCanvas, EditorGuiGroup );
// Cancel the scheduled event to prevent
// the level from cycling after it's duration
// has elapsed.
if( GuiEditorIsActive() )
{
GuiEditor.close();
}
else
{
GuiEditor.open();
// Cancel the scheduled event to prevent
// the level from cycling after it's duration
// has elapsed.
cancel($Game::Schedule);
}
// Cancel the scheduled event to prevent
// the level from cycling after it's duration
// has elapsed.
cancel($Game::Schedule);
}
}
@ -98,6 +113,26 @@ package GuiEditor_BlockDialogs
//---------------------------------------------------------------------------------------------
function GuiEditor::open(%this)
{
GuiEditCanvas.onCreateMenu();
GuiEditContent(Canvas.getContent());
}
function GuiEditor::close(%this)
{
// prevent the mission editor from opening while the GuiEditor is open.
if(Canvas.getContent() != GuiEditorGui.getId())
return;
GuiGroup.add(GuiEditorGui);
Canvas.setContent(GuiEditor.lastContent);
GuiEditCanvas.onDestroyMenu();
}
function GuiEditor::openForEditing( %this, %content )
{
Canvas.setContent( GuiEditorGui );

View file

@ -67,7 +67,7 @@
MinExtent = "8 8";
canSave = "1";
Visible = "1";
Command = "toggleEditor( true ); GuiEdit(); $GuiEditorBtnPressed = true;";
Command = "toggleGuiEditor(true); $GuiEditorBtnPressed = true;";
tooltipprofile = "ToolsGuiToolTipProfile";
ToolTip = "Open the GuiEditor";
hovertime = "1000";

View file

@ -35,8 +35,6 @@ function EditorGui::init(%this)
$NextOperationId = 1;
$HeightfieldDirtyRow = -1;
%this.buildMenus();
if( !isObject( %this-->ToolsPaletteWindow ) )
{
// Load Creator/Inspector GUI
@ -1914,6 +1912,8 @@ function Editor::open(%this)
if(Canvas.getContent() == GuiEditorGui.getId())
return;
EditorGui.buildMenus();
if( !EditorGui.isInitialized )
EditorGui.init();
@ -1929,6 +1929,21 @@ function Editor::close(%this, %gui)
if(isObject(MessageHud))
MessageHud.close();
EditorGui.writeCameraSettings();
EditorGui.onDestroyMenu();
}
function EditorGui::onDestroyMenu(%this)
{
if( !isObject( %this.menuBar ) )
return;
// Destroy menus
while( %this.menuBar.getCount() != 0 )
%this.menuBar.getObject( 0 ).delete();
%this.menuBar.removeFromCanvas();
%this.menuBar.delete();
}
$RelightCallback = "";

View file

@ -99,18 +99,12 @@ function Editor::checkActiveLoadDone()
//------------------------------------------------------------------------------
function toggleEditor(%make)
{
if (Canvas.isFullscreen())
{
MessageBoxOK("Windowed Mode Required", "Please switch to windowed mode to access the Mission Editor.");
return;
}
if (%make)
{
{
%timerId = startPrecisionTimer();
if( $InGuiEditor )
GuiEdit();
if( GuiEditorIsActive() )
toggleGuiEditor(1);
if( !$missionRunning )
{
@ -141,29 +135,21 @@ function toggleEditor(%make)
Editor.close("PlayGui");
}
}
else
else
{
if ( !$GuiEditorBtnPressed )
{
canvas.pushDialog( EditorLoadingGui );
canvas.repaint();
}
else
{
$GuiEditorBtnPressed = false;
}
canvas.pushDialog( EditorLoadingGui );
canvas.repaint();
Editor.open();
// Cancel the scheduled event to prevent
// the level from cycling after it's duration
// has elapsed.
// Cancel the scheduled event to prevent
// the level from cycling after it's duration
// has elapsed.
cancel($Game::Schedule);
if (theLevelInfo.type $= "DemoScene")
commandToServer('dropCameraAtPlayer', true);
canvas.popDialog(EditorLoadingGui);
}

View file

@ -42,47 +42,59 @@ function EditorGui::buildMenus(%this)
}
// Sub menus (temporary, until MenuBuilder gets updated)
// The speed increments located here are overwritten in EditorCameraSpeedMenu::setupDefaultState.
// The new min/max for the editor camera speed range can be set in each level's levelInfo object.
%this.cameraSpeedMenu = new PopupMenu(EditorCameraSpeedOptions)
// The speed increments located here are overwritten in EditorCameraSpeedMenu::setupDefaultState.
// The new min/max for the editor camera speed range can be set in each level's levelInfo object.
if(!isObject(EditorCameraSpeedOptions))
{
superClass = "MenuBuilder";
class = "EditorCameraSpeedMenu";
item[0] = "Slowest" TAB %cmdCtrl @ "-Shift 1" TAB "5";
item[1] = "Slow" TAB %cmdCtrl @ "-Shift 2" TAB "35";
item[2] = "Slower" TAB %cmdCtrl @ "-Shift 3" TAB "70";
item[3] = "Normal" TAB %cmdCtrl @ "-Shift 4" TAB "100";
item[4] = "Faster" TAB %cmdCtrl @ "-Shift 5" TAB "130";
item[5] = "Fast" TAB %cmdCtrl @ "-Shift 6" TAB "165";
item[6] = "Fastest" TAB %cmdCtrl @ "-Shift 7" TAB "200";
};
%this.freeCameraTypeMenu = new PopupMenu(EditorFreeCameraTypeOptions)
%this.cameraSpeedMenu = new PopupMenu(EditorCameraSpeedOptions)
{
superClass = "MenuBuilder";
class = "EditorCameraSpeedMenu";
item[0] = "Slowest" TAB %cmdCtrl @ "-Shift 1" TAB "5";
item[1] = "Slow" TAB %cmdCtrl @ "-Shift 2" TAB "35";
item[2] = "Slower" TAB %cmdCtrl @ "-Shift 3" TAB "70";
item[3] = "Normal" TAB %cmdCtrl @ "-Shift 4" TAB "100";
item[4] = "Faster" TAB %cmdCtrl @ "-Shift 5" TAB "130";
item[5] = "Fast" TAB %cmdCtrl @ "-Shift 6" TAB "165";
item[6] = "Fastest" TAB %cmdCtrl @ "-Shift 7" TAB "200";
};
}
if(!isObject(EditorFreeCameraTypeOptions))
{
superClass = "MenuBuilder";
class = "EditorFreeCameraTypeMenu";
item[0] = "Standard" TAB "Ctrl 1" TAB "EditorGuiStatusBar.setCamera(\"Standard Camera\");";
item[1] = "Orbit Camera" TAB "Ctrl 2" TAB "EditorGuiStatusBar.setCamera(\"Orbit Camera\");";
Item[2] = "-";
item[3] = "Smoothed" TAB "" TAB "EditorGuiStatusBar.setCamera(\"Smooth Camera\");";
item[4] = "Smoothed Rotate" TAB "" TAB "EditorGuiStatusBar.setCamera(\"Smooth Rot Camera\");";
};
%this.playerCameraTypeMenu = new PopupMenu(EditorPlayerCameraTypeOptions)
%this.freeCameraTypeMenu = new PopupMenu(EditorFreeCameraTypeOptions)
{
superClass = "MenuBuilder";
class = "EditorFreeCameraTypeMenu";
item[0] = "Standard" TAB "Ctrl 1" TAB "EditorGuiStatusBar.setCamera(\"Standard Camera\");";
item[1] = "Orbit Camera" TAB "Ctrl 2" TAB "EditorGuiStatusBar.setCamera(\"Orbit Camera\");";
Item[2] = "-";
item[3] = "Smoothed" TAB "" TAB "EditorGuiStatusBar.setCamera(\"Smooth Camera\");";
item[4] = "Smoothed Rotate" TAB "" TAB "EditorGuiStatusBar.setCamera(\"Smooth Rot Camera\");";
};
}
if(!isObject(EditorPlayerCameraTypeOptions))
{
superClass = "MenuBuilder";
class = "EditorPlayerCameraTypeMenu";
Item[0] = "First Person" TAB "" TAB "EditorGuiStatusBar.setCamera(\"1st Person Camera\");";
Item[1] = "Third Person" TAB "" TAB "EditorGuiStatusBar.setCamera(\"3rd Person Camera\");";
};
%this.cameraBookmarksMenu = new PopupMenu(EditorCameraBookmarks)
%this.playerCameraTypeMenu = new PopupMenu(EditorPlayerCameraTypeOptions)
{
superClass = "MenuBuilder";
class = "EditorPlayerCameraTypeMenu";
Item[0] = "First Person" TAB "" TAB "EditorGuiStatusBar.setCamera(\"1st Person Camera\");";
Item[1] = "Third Person" TAB "" TAB "EditorGuiStatusBar.setCamera(\"3rd Person Camera\");";
};
}
if(!isObject(EditorCameraBookmarks))
{
superClass = "MenuBuilder";
class = "EditorCameraBookmarksMenu";
//item[0] = "None";
};
%this.cameraBookmarksMenu = new PopupMenu(EditorCameraBookmarks)
{
superClass = "MenuBuilder";
class = "EditorCameraBookmarksMenu";
//item[0] = "None";
};
}
%this.viewTypeMenu = new PopupMenu()
{
superClass = "MenuBuilder";
@ -98,7 +110,7 @@ function EditorGui::buildMenus(%this)
};
// Menu bar
%this.menuBar = new MenuBar()
%this.menuBar = new MenuBar(WorldEditorMenubar)
{
dynamicItemInsertPos = 3;
};
@ -263,7 +275,8 @@ function EditorGui::buildMenus(%this)
item[0] = "Network Graph" TAB "n" TAB "toggleNetGraph();";
item[1] = "Profiler" TAB "ctrl F2" TAB "showMetrics(true);";
item[2] = "Bake Selected to Mesh" TAB "" TAB "bakeSelectedToMesh();";
item[2] = "Torque SimView" TAB "" TAB "tree();";
item[3] = "Make Selected a Mesh" TAB "" TAB "makeSelectedAMesh();";
};
%this.menuBar.insert(%toolsMenu, %this.menuBar.getCount());

View file

@ -61,4 +61,7 @@ exec("./player.cs");
exec("./aiPlayer.cs");
// Load the vehicle datablocks
exec("./vehicles/cheetahCar.cs");
exec("./vehicles/cheetahCar.cs");
// Physics objects
exec("./physics.cs");

View file

@ -83,6 +83,8 @@ datablock LightningData(DefaultStorm)
thunderSounds[1] = ThunderCrash2Sound;
thunderSounds[2] = ThunderCrash3Sound;
thunderSounds[3] = ThunderCrash4Sound;
strikeTextures[0] = "art/environment/lightning";
};
datablock ReflectorDesc( DefaultCubeDesc )

View file

@ -0,0 +1,71 @@
//-----------------------------------------------------------------------------
// 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.
//-----------------------------------------------------------------------------
datablock PhysicsShapeData( PhysicsCube )
{
category = "Physics";
shapeName = "art/shapes/cube/cube.dae";
emap = true;
//physics properties
mass = "0.5";
friction = "0.4";
staticFriction = "0.5";
restitution = "0.3";
linearDamping = "0.1";
angularDamping = "0.2";
linearSleepThreshold = "1.0";
angularSleepThreshold = "1.0";
buoyancyDensity = "0.9";
waterDampingScale = "10";
//damage - dynamic fields
radiusDamage = 0;
damageRadius = 0;
areaImpulse = 0;
invulnerable = true;
};
datablock PhysicsShapeData( PhysicsBoulder )
{
category = "Physics";
shapeName = "art/shapes/rocks/boulder.dts";
emap = true;
//physics properties
mass = "20";
friction = "0.2";
staticFriction = "0.3";
restitution = "0.8";
linearDamping = "0.1";
angularDamping = "0.2";
linearSleepThreshold = "1.0";
angularSleepThreshold = "1.0";
buoyancyDensity = "0.9";
waterDampingScale = "10";
//damage - dynamic fields
radiusDamage = 0;
damageRadius = 0;
areaImpulse = 0;
invulnerable = false;
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View file

@ -126,7 +126,7 @@
profile = "GuiMenuButtonProfile";
visible = "1";
active = "1";
command = "GuiEdit();";
command = "toggleGuiEditor(1);";
tooltipProfile = "GuiToolTipProfile";
tooltip = "The GUI Editor is accessible in-game by pressing F10";
hovertime = "1000";

Binary file not shown.

Before

Width:  |  Height:  |  Size: 331 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View file

@ -22,7 +22,7 @@
/// Blends between the scene and the tone mapped scene.
$HDRPostFX::enableToneMapping = 1.0;
$HDRPostFX::enableToneMapping = 0.5;
/// The tone mapping middle grey or exposure value used
/// to adjust the overall "balance" of the image.
@ -333,8 +333,8 @@ function HDRPostFX::onDisabled( %this )
singleton PostEffect( HDRPostFX )
{
isEnabled = false;
allowReflectPass = true;
allowReflectPass = false;
// Resolve the HDR before we render any editor stuff
// and before we resolve the scene to the backbuffer.
renderTime = "PFXBeforeBin";
@ -359,7 +359,7 @@ singleton PostEffect( HDRPostFX )
new PostEffect()
{
allowReflectPass = true;
allowReflectPass = false;
shader = HDR_DownScale4x4Shader;
stateBlock = HDR_DownSampleStateBlock;
texture[0] = "$inTex";
@ -370,7 +370,7 @@ singleton PostEffect( HDRPostFX )
new PostEffect()
{
allowReflectPass = true;
allowReflectPass = false;
internalName = "bloomH";
shader = HDR_BloomGaussBlurHShader;
@ -382,7 +382,7 @@ singleton PostEffect( HDRPostFX )
new PostEffect()
{
allowReflectPass = true;
allowReflectPass = false;
internalName = "bloomV";
shader = HDR_BloomGaussBlurVShader;
@ -397,7 +397,7 @@ singleton PostEffect( HDRPostFX )
// Now calculate the adapted luminance.
new PostEffect()
{
allowReflectPass = true;
allowReflectPass = false;
internalName = "adaptLum";
shader = HDR_SampleLumShader;
@ -409,7 +409,7 @@ singleton PostEffect( HDRPostFX )
new PostEffect()
{
allowReflectPass = true;
allowReflectPass = false;
shader = HDR_DownSampleLumShader;
stateBlock = HDR_DownSampleStateBlock;
texture[0] = "$inTex";
@ -420,7 +420,7 @@ singleton PostEffect( HDRPostFX )
new PostEffect()
{
allowReflectPass = true;
allowReflectPass = false;
shader = HDR_DownSampleLumShader;
stateBlock = HDR_DownSampleStateBlock;
texture[0] = "$inTex";
@ -431,7 +431,7 @@ singleton PostEffect( HDRPostFX )
new PostEffect()
{
allowReflectPass = true;
allowReflectPass = false;
shader = HDR_DownSampleLumShader;
stateBlock = HDR_DownSampleStateBlock;
texture[0] = "$inTex";
@ -445,8 +445,8 @@ singleton PostEffect( HDRPostFX )
// one... PostEffect takes care to manage that.
new PostEffect()
{
allowReflectPass = true;
internalName = "finalLum";
allowReflectPass = false;
internalName = "finalLum";
shader = HDR_CalcAdaptedLumShader;
stateBlock = HDR_DownSampleStateBlock;
texture[0] = "$inTex";
@ -462,7 +462,7 @@ singleton PostEffect( HDRPostFX )
// version of the scene.
new PostEffect()
{
allowReflectPass = true;
allowReflectPass = false;
internalName = "combinePass";
shader = HDR_CombineShader;
@ -471,7 +471,6 @@ singleton PostEffect( HDRPostFX )
texture[1] = "#adaptedLum";
texture[2] = "#bloomFinal";
texture[3] = $HDRPostFX::colorCorrectionRamp;
texture[4] = "#prepass";
target = "$backBuffer";
};
};

View file

@ -97,7 +97,6 @@ function startDemoRecord()
ChatHud.AddLine( "\c4Recording to file [\c2" @ $DemoFileName @ "\cr].");
ServerConnection.prepDemoRecord();
ServerConnection.startRecording($DemoFileName);
// make sure start worked

View file

@ -55,6 +55,9 @@ function formatSessionNumber(%number)
// Records a movie file from the Canvas content using the specified fps.
// Possible encoder values are "PNG" and "THEORA" (default).
//---------------------------------------------------------------------------------------------
$RecordingMovie = false;
function recordMovie(%movieName, %fps, %encoder)
{
// If the canvas doesn't exist yet, setup a flag so it'll
@ -65,12 +68,24 @@ function recordMovie(%movieName, %fps, %encoder)
if (%encoder $= "")
%encoder = "THEORA";
%resolution = Canvas.getVideoMode();
// Start the movie recording
ChatHud.AddLine( "\c4Recording movie file to [\c2" @ %movieName @ "\cr].ogv.");
echo("Recording movie to: " @ %movieName);
startVideoCapture(Canvas, %movieName, %encoder, %fps);
$RecordingMovie = true;
}
function stopMovie()
{
// Stop the current recording
ChatHud.AddLine( "\c4Recording movie file finished.");
echo("Stopped movie recording");
stopVideoCapture();
$RecordingMovie = false;
}
/// This is bound in initializeCommon() to take

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -28,6 +28,8 @@ $defaultGame = "scripts";
// Set profile directory
$Pref::Video::ProfilePath = "core/profile";
$Core::windowIcon = "core/torque.png";
$Core::splashWindowImage = "art/gui/splash.png";
function createCanvas(%windowTitle)
{

View file

@ -583,6 +583,49 @@ function stopRecordingDemo( %val )
moveMap.bind( keyboard, F3, startRecordingDemo );
moveMap.bind( keyboard, F4, stopRecordingDemo );
//------------------------------------------------------------------------------
// Theora Video Capture (Records a movie file)
//------------------------------------------------------------------------------
function toggleMovieRecording(%val)
{
if (!%val)
return;
%movieEncodingType = "THEORA"; // Valid encoder values are "PNG" and "THEORA" (default).
%movieFPS = 30; // video capture frame rate.
if (!$RecordingMovie)
{
// locate a non-existent filename to use
for(%i = 0; %i < 1000; %i++)
{
%num = %i;
if(%num < 10)
%num = "0" @ %num;
if(%num < 100)
%num = "0" @ %num;
%filePath = "movies/movie" @ %num;
if(!isfile(%filePath))
break;
}
if(%i == 1000)
return;
// Start the movie recording
recordMovie(%filePath, %movieFPS, %movieEncodingType);
}
else
{
// Stop the current recording
stopMovie();
}
}
// Key binding works at any time and not just while in a game.
GlobalActionMap.bind(keyboard, "alt m", toggleMovieRecording);
//------------------------------------------------------------------------------
// Helper Functions

View file

@ -41,7 +41,7 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
color.b = TORQUE_TEX1D( colorCorrectionTex, color.b ).b;
// Apply gamma correction
color.rgb = pow( abs(color.rgb), OneOverGamma );
color.rgb = pow( saturate(color.rgb), OneOverGamma );
// Apply contrast
color.rgb = ((color.rgb - 0.5f) * Contrast) + 0.5f;

View file

@ -45,7 +45,7 @@ void main()
color.b = texture( colorCorrectionTex, color.b ).b;
// Apply gamma correction
color.rgb = pow( abs(color.rgb), vec3(OneOverGamma) );
color.rgb = pow( clamp(color.rgb, vec3(0.0),vec3(1.0)), vec3(OneOverGamma) );
// Apply contrast
color.rgb = ((color.rgb - 0.5f) * Contrast) + 0.5f;

View file

@ -28,7 +28,6 @@ TORQUE_UNIFORM_SAMPLER2D(sceneTex, 0);
TORQUE_UNIFORM_SAMPLER2D(luminanceTex, 1);
TORQUE_UNIFORM_SAMPLER2D(bloomTex, 2);
TORQUE_UNIFORM_SAMPLER1D(colorCorrectionTex, 3);
TORQUE_UNIFORM_SAMPLER2D(prepassTex, 4);
uniform float2 texSize0;
uniform float2 texSize2;
@ -40,7 +39,6 @@ uniform float g_fEnableBlueShift;
uniform float3 g_fBlueShiftColor;
uniform float g_fBloomScale;
uniform float g_fOneOverGamma;
uniform float Brightness;
uniform float Contrast;
@ -71,6 +69,9 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
bloom.rgb = lerp( bloom.rgb, rodColor, coef );
}
// Add the bloom effect.
sample += g_fBloomScale * bloom;
// Map the high range of color values into a range appropriate for
// display, taking into account the user's adaptation level,
// white point, and selected value for for middle gray.
@ -82,19 +83,13 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
sample.rgb = lerp( sample.rgb, sample.rgb * toneScalar, g_fEnableToneMapping );
}
// Add the bloom effect.
float depth = TORQUE_PREPASS_UNCONDITION( prepassTex, IN.uv0 ).w;
if (depth>0.9999)
sample += g_fBloomScale * bloom;
// Apply the color correction.
sample.r = TORQUE_TEX1D( colorCorrectionTex, sample.r ).r;
sample.g = TORQUE_TEX1D( colorCorrectionTex, sample.g ).g;
sample.b = TORQUE_TEX1D( colorCorrectionTex, sample.b ).b;
// Apply gamma correction
sample.rgb = pow( abs(sample.rgb), g_fOneOverGamma );
sample.rgb = pow( saturate(sample.rgb), g_fOneOverGamma );
// Apply contrast
sample.rgb = ((sample.rgb - 0.5f) * Contrast) + 0.5f;

View file

@ -29,7 +29,6 @@ uniform sampler2D sceneTex;
uniform sampler2D luminanceTex;
uniform sampler2D bloomTex;
uniform sampler1D colorCorrectionTex;
uniform sampler2D prepassTex;
uniform vec2 texSize0;
uniform vec2 texSize2;
@ -49,7 +48,6 @@ uniform float Contrast;
out vec4 OUT_col;
void main()
{
vec4 _sample = hdrDecode( texture( sceneTex, IN_uv0 ) );
@ -76,6 +74,9 @@ void main()
bloom.rgb = mix( bloom.rgb, rodColor, coef );
}
// Add the bloom effect.
_sample += g_fBloomScale * bloom;
// Map the high range of color values into a range appropriate for
// display, taking into account the user's adaptation level,
// white point, and selected value for for middle gray.
@ -87,18 +88,13 @@ void main()
_sample.rgb = mix( _sample.rgb, _sample.rgb * toneScalar, g_fEnableToneMapping );
}
// Add the bloom effect.
float depth = prepassUncondition( prepassTex, IN_uv0 ).w;
if (depth>0.9999)
_sample += g_fBloomScale * bloom;
// Apply the color correction.
_sample.r = texture( colorCorrectionTex, _sample.r ).r;
_sample.g = texture( colorCorrectionTex, _sample.g ).g;
_sample.b = texture( colorCorrectionTex, _sample.b ).b;
// Apply gamma correction
_sample.rgb = pow( abs(_sample.rgb), vec3(g_fOneOverGamma) );
_sample.rgb = pow( _sample.rgb, vec3(g_fOneOverGamma) );
// Apply contrast
_sample.rgb = ((_sample.rgb - 0.5f) * Contrast) + 0.5f;

View file

@ -105,7 +105,7 @@ function EditorInspectorBase::onAdd( %this )
superClass = "MenuBuilder";
isPopup = true;
item[ 0 ] = "Edit Profile" TAB "" TAB "if( !$InGuiEditor ) toggleGuiEditor( true ); GuiEditor.editProfile( %this.inspectorField.getData() );";
item[ 0 ] = "Edit Profile" TAB "" TAB "if( !GuiEditorIsActive() ) toggleGuiEditor( true ); GuiEditor.editProfile( %this.inspectorField.getData() );";
item[ 1 ] = "Jump to Definition in Torsion" TAB "" TAB "EditorOpenDeclarationInTorsion( %this.inspectorField.getData() );";
item[ 2 ] = "Inspect Object" TAB "" TAB "inspectObject( %this.inspectorField.getData() );";
item[ 3 ] = "-";

View file

@ -252,7 +252,7 @@
objectNamesOnly = "1";
useInspectorTooltips = "0";
tooltipOnWidthOnly = "0";
compareToObjectID = "1";
compareToObjectID = "0";
canRenameObjects = "1";
renameInternal = "0";
isContainer = "1";

View file

@ -718,6 +718,22 @@
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiCheckBoxCtrl() {
text = "use sRGB";
groupNum = "-1";
buttonType = "ToggleButton";
useMouseEvents = "0";
position = "360 105";
extent = "66 16";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiCheckBoxProfile";
visible = "1";
active = "1";
variable = "$displayAsSRGB";
command = "useSRGBctrl($displayAsSRGB);";
};
};
};
//--- OBJECT WRITE END ---
@ -727,6 +743,15 @@ $ColorPickerCancelCallback = "";
$ColorPickerUpdateCallback = "";
$ColorCallbackType = 1; // ColorI
function useSRGBctrl(%colorScale)
{
ColorPickerDlg.useSRGB = %colorScale;
ColorRangeSelect.useSRGB = %colorScale;
ColorBlendSelect.useSRGB = %colorScale;
myColor.useSRGB = %colorScale;
oldColor.useSRGB = %colorScale;
}
// This function pushes the color picker dialog and returns to a callback the selected value
function GetColorI( %currentColor, %callback, %root, %updateCallback, %cancelCallback )
{

View file

@ -86,7 +86,7 @@
minExtent = "8 8";
canSave = "1";
visible = "1";
command = "GuiEditor.switchToWorldEditor();";
command = "toggleEditor(1);";
tooltipProfile = "ToolsGuiToolTipProfile";
ToolTip = "World Editor";
hovertime = "1000";

View file

@ -75,11 +75,26 @@ function toggleGuiEditor( %make )
if( EditorIsActive() && !GuiEditor.toggleIntoEditorGui )
toggleEditor( true );
GuiEdit();
if( !isObject( GuiEditCanvas ) )
new GuiControl( GuiEditCanvas, EditorGuiGroup );
// Cancel the scheduled event to prevent
// the level from cycling after it's duration
// has elapsed.
if( GuiEditorIsActive() )
{
GuiEditor.close();
}
else
{
GuiEditor.open();
// Cancel the scheduled event to prevent
// the level from cycling after it's duration
// has elapsed.
cancel($Game::Schedule);
}
// Cancel the scheduled event to prevent
// the level from cycling after it's duration
// has elapsed.
cancel($Game::Schedule);
}
}
@ -98,6 +113,26 @@ package GuiEditor_BlockDialogs
//---------------------------------------------------------------------------------------------
function GuiEditor::open(%this)
{
GuiEditCanvas.onCreateMenu();
GuiEditContent(Canvas.getContent());
}
function GuiEditor::close(%this)
{
// prevent the mission editor from opening while the GuiEditor is open.
if(Canvas.getContent() != GuiEditorGui.getId())
return;
GuiGroup.add(GuiEditorGui);
Canvas.setContent(GuiEditor.lastContent);
GuiEditCanvas.onDestroyMenu();
}
function GuiEditor::openForEditing( %this, %content )
{
Canvas.setContent( GuiEditorGui );

View file

@ -67,7 +67,7 @@
MinExtent = "8 8";
canSave = "1";
Visible = "1";
Command = "toggleEditor( true ); GuiEdit(); $GuiEditorBtnPressed = true;";
Command = "toggleGuiEditor(true); $GuiEditorBtnPressed = true;";
tooltipprofile = "ToolsGuiToolTipProfile";
ToolTip = "Open the GuiEditor";
hovertime = "1000";

View file

@ -35,8 +35,6 @@ function EditorGui::init(%this)
$NextOperationId = 1;
$HeightfieldDirtyRow = -1;
%this.buildMenus();
if( !isObject( %this-->ToolsPaletteWindow ) )
{
// Load Creator/Inspector GUI
@ -1914,6 +1912,8 @@ function Editor::open(%this)
if(Canvas.getContent() == GuiEditorGui.getId())
return;
EditorGui.buildMenus();
if( !EditorGui.isInitialized )
EditorGui.init();
@ -1929,6 +1929,21 @@ function Editor::close(%this, %gui)
if(isObject(MessageHud))
MessageHud.close();
EditorGui.writeCameraSettings();
EditorGui.onDestroyMenu();
}
function EditorGui::onDestroyMenu(%this)
{
if( !isObject( %this.menuBar ) )
return;
// Destroy menus
while( %this.menuBar.getCount() != 0 )
%this.menuBar.getObject( 0 ).delete();
%this.menuBar.removeFromCanvas();
%this.menuBar.delete();
}
$RelightCallback = "";

View file

@ -99,18 +99,12 @@ function Editor::checkActiveLoadDone()
//------------------------------------------------------------------------------
function toggleEditor(%make)
{
if (Canvas.isFullscreen())
{
MessageBoxOK("Windowed Mode Required", "Please switch to windowed mode to access the Mission Editor.");
return;
}
if (%make)
{
{
%timerId = startPrecisionTimer();
if( $InGuiEditor )
GuiEdit();
if( GuiEditorIsActive() )
toggleGuiEditor(1);
if( !$missionRunning )
{
@ -141,29 +135,21 @@ function toggleEditor(%make)
Editor.close("PlayGui");
}
}
else
else
{
if ( !$GuiEditorBtnPressed )
{
canvas.pushDialog( EditorLoadingGui );
canvas.repaint();
}
else
{
$GuiEditorBtnPressed = false;
}
canvas.pushDialog( EditorLoadingGui );
canvas.repaint();
Editor.open();
// Cancel the scheduled event to prevent
// the level from cycling after it's duration
// has elapsed.
// Cancel the scheduled event to prevent
// the level from cycling after it's duration
// has elapsed.
cancel($Game::Schedule);
if (theLevelInfo.type $= "DemoScene")
commandToServer('dropCameraAtPlayer', true);
canvas.popDialog(EditorLoadingGui);
}

View file

@ -42,47 +42,59 @@ function EditorGui::buildMenus(%this)
}
// Sub menus (temporary, until MenuBuilder gets updated)
// The speed increments located here are overwritten in EditorCameraSpeedMenu::setupDefaultState.
// The new min/max for the editor camera speed range can be set in each level's levelInfo object.
%this.cameraSpeedMenu = new PopupMenu(EditorCameraSpeedOptions)
// The speed increments located here are overwritten in EditorCameraSpeedMenu::setupDefaultState.
// The new min/max for the editor camera speed range can be set in each level's levelInfo object.
if(!isObject(EditorCameraSpeedOptions))
{
superClass = "MenuBuilder";
class = "EditorCameraSpeedMenu";
item[0] = "Slowest" TAB %cmdCtrl @ "-Shift 1" TAB "5";
item[1] = "Slow" TAB %cmdCtrl @ "-Shift 2" TAB "35";
item[2] = "Slower" TAB %cmdCtrl @ "-Shift 3" TAB "70";
item[3] = "Normal" TAB %cmdCtrl @ "-Shift 4" TAB "100";
item[4] = "Faster" TAB %cmdCtrl @ "-Shift 5" TAB "130";
item[5] = "Fast" TAB %cmdCtrl @ "-Shift 6" TAB "165";
item[6] = "Fastest" TAB %cmdCtrl @ "-Shift 7" TAB "200";
};
%this.freeCameraTypeMenu = new PopupMenu(EditorFreeCameraTypeOptions)
%this.cameraSpeedMenu = new PopupMenu(EditorCameraSpeedOptions)
{
superClass = "MenuBuilder";
class = "EditorCameraSpeedMenu";
item[0] = "Slowest" TAB %cmdCtrl @ "-Shift 1" TAB "5";
item[1] = "Slow" TAB %cmdCtrl @ "-Shift 2" TAB "35";
item[2] = "Slower" TAB %cmdCtrl @ "-Shift 3" TAB "70";
item[3] = "Normal" TAB %cmdCtrl @ "-Shift 4" TAB "100";
item[4] = "Faster" TAB %cmdCtrl @ "-Shift 5" TAB "130";
item[5] = "Fast" TAB %cmdCtrl @ "-Shift 6" TAB "165";
item[6] = "Fastest" TAB %cmdCtrl @ "-Shift 7" TAB "200";
};
}
if(!isObject(EditorFreeCameraTypeOptions))
{
superClass = "MenuBuilder";
class = "EditorFreeCameraTypeMenu";
item[0] = "Standard" TAB "Ctrl 1" TAB "EditorGuiStatusBar.setCamera(\"Standard Camera\");";
item[1] = "Orbit Camera" TAB "Ctrl 2" TAB "EditorGuiStatusBar.setCamera(\"Orbit Camera\");";
Item[2] = "-";
item[3] = "Smoothed" TAB "" TAB "EditorGuiStatusBar.setCamera(\"Smooth Camera\");";
item[4] = "Smoothed Rotate" TAB "" TAB "EditorGuiStatusBar.setCamera(\"Smooth Rot Camera\");";
};
%this.playerCameraTypeMenu = new PopupMenu(EditorPlayerCameraTypeOptions)
%this.freeCameraTypeMenu = new PopupMenu(EditorFreeCameraTypeOptions)
{
superClass = "MenuBuilder";
class = "EditorFreeCameraTypeMenu";
item[0] = "Standard" TAB "Ctrl 1" TAB "EditorGuiStatusBar.setCamera(\"Standard Camera\");";
item[1] = "Orbit Camera" TAB "Ctrl 2" TAB "EditorGuiStatusBar.setCamera(\"Orbit Camera\");";
Item[2] = "-";
item[3] = "Smoothed" TAB "" TAB "EditorGuiStatusBar.setCamera(\"Smooth Camera\");";
item[4] = "Smoothed Rotate" TAB "" TAB "EditorGuiStatusBar.setCamera(\"Smooth Rot Camera\");";
};
}
if(!isObject(EditorPlayerCameraTypeOptions))
{
superClass = "MenuBuilder";
class = "EditorPlayerCameraTypeMenu";
Item[0] = "First Person" TAB "" TAB "EditorGuiStatusBar.setCamera(\"1st Person Camera\");";
Item[1] = "Third Person" TAB "" TAB "EditorGuiStatusBar.setCamera(\"3rd Person Camera\");";
};
%this.cameraBookmarksMenu = new PopupMenu(EditorCameraBookmarks)
%this.playerCameraTypeMenu = new PopupMenu(EditorPlayerCameraTypeOptions)
{
superClass = "MenuBuilder";
class = "EditorPlayerCameraTypeMenu";
Item[0] = "First Person" TAB "" TAB "EditorGuiStatusBar.setCamera(\"1st Person Camera\");";
Item[1] = "Third Person" TAB "" TAB "EditorGuiStatusBar.setCamera(\"3rd Person Camera\");";
};
}
if(!isObject(EditorCameraBookmarks))
{
superClass = "MenuBuilder";
class = "EditorCameraBookmarksMenu";
//item[0] = "None";
};
%this.cameraBookmarksMenu = new PopupMenu(EditorCameraBookmarks)
{
superClass = "MenuBuilder";
class = "EditorCameraBookmarksMenu";
//item[0] = "None";
};
}
%this.viewTypeMenu = new PopupMenu()
{
superClass = "MenuBuilder";
@ -98,7 +110,7 @@ function EditorGui::buildMenus(%this)
};
// Menu bar
%this.menuBar = new MenuBar()
%this.menuBar = new MenuBar(WorldEditorMenubar)
{
dynamicItemInsertPos = 3;
};
@ -263,7 +275,8 @@ function EditorGui::buildMenus(%this)
item[0] = "Network Graph" TAB "n" TAB "toggleNetGraph();";
item[1] = "Profiler" TAB "ctrl F2" TAB "showMetrics(true);";
item[2] = "Make Selected a Mesh" TAB "" TAB "makeSelectedAMesh();";
item[2] = "Torque SimView" TAB "" TAB "tree();";
item[3] = "Make Selected a Mesh" TAB "" TAB "makeSelectedAMesh();";
};
%this.menuBar.insert(%toolsMenu, %this.menuBar.getCount());