mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 16:44:36 +00:00
Cleanup of the editor load function
This commit is contained in:
parent
c729f603b8
commit
d22e7c98e1
1 changed files with 88 additions and 27 deletions
|
|
@ -123,6 +123,17 @@ package Tools
|
||||||
call( %initializeFunction );
|
call( %initializeFunction );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Now, go through and load any tool-group modules
|
||||||
|
ModuleDatabase.setModuleExtension("module");
|
||||||
|
|
||||||
|
//Any common tool modules
|
||||||
|
ModuleDatabase.scanModules( "tools", false );
|
||||||
|
ModuleDatabase.LoadGroup( "Tool" );
|
||||||
|
|
||||||
|
//Do any tools that come in with a gameplay package. These are usually specialized tools
|
||||||
|
//ModuleDatabase.scanModules( "data", false );
|
||||||
|
//ModuleDatabase.LoadGroup( "Tool" );
|
||||||
|
|
||||||
// Popuplate the default SimObject icons that
|
// Popuplate the default SimObject icons that
|
||||||
// are used by the various editors.
|
// are used by the various editors.
|
||||||
EditorIconRegistry::loadFromPath( "tools/classIcons/" );
|
EditorIconRegistry::loadFromPath( "tools/classIcons/" );
|
||||||
|
|
@ -214,6 +225,29 @@ package Tools
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function EditorCreateFakeGameSession(%fileName)
|
||||||
|
{
|
||||||
|
// Create a local game server and connect to it.
|
||||||
|
if(isObject(ServerGroup))
|
||||||
|
ServerGroup.delete();
|
||||||
|
|
||||||
|
new SimGroup(ServerGroup);
|
||||||
|
|
||||||
|
if(isObject(ServerConnection))
|
||||||
|
ServerConnection.delete();
|
||||||
|
|
||||||
|
new GameConnection(ServerConnection);
|
||||||
|
|
||||||
|
// This calls GameConnection::onConnect.
|
||||||
|
ServerConnection.connectLocal();
|
||||||
|
|
||||||
|
$instantGroup = ServerGroup;
|
||||||
|
|
||||||
|
$Game::MissionGroup = "MissionGroup";
|
||||||
|
|
||||||
|
exec(%file);
|
||||||
|
}
|
||||||
|
|
||||||
function fastLoadWorldEdit(%val)
|
function fastLoadWorldEdit(%val)
|
||||||
{
|
{
|
||||||
if(%val)
|
if(%val)
|
||||||
|
|
@ -223,36 +257,63 @@ function fastLoadWorldEdit(%val)
|
||||||
onStart();
|
onStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$Game::running)
|
%timerId = startPrecisionTimer();
|
||||||
|
|
||||||
|
if( GuiEditorIsActive() )
|
||||||
|
toggleGuiEditor(1);
|
||||||
|
|
||||||
|
if( !$missionRunning )
|
||||||
{
|
{
|
||||||
//startGame();
|
// Flag saying, when level is chosen, launch it with the editor open.
|
||||||
activatePackage( "BootEditor" );
|
ChooseLevelDlg.launchInEditor = true;
|
||||||
ChooseLevelDlg.launchInEditor = false;
|
Canvas.pushDialog( ChooseLevelDlg );
|
||||||
StartGame("tools/levels/BlankRoom.mis", "SinglePlayer");
|
|
||||||
|
|
||||||
if(!isObject(Observer))
|
|
||||||
{
|
|
||||||
datablock CameraData(Observer) {};
|
|
||||||
}
|
|
||||||
|
|
||||||
%cam = new Camera()
|
|
||||||
{
|
|
||||||
datablock = Observer;
|
|
||||||
};
|
|
||||||
|
|
||||||
%cam.scopeToClient(LocalClientConnection);
|
|
||||||
|
|
||||||
LocalClientConnection.setCameraObject(%cam);
|
|
||||||
LocalClientConnection.setControlObject(%cam);
|
|
||||||
|
|
||||||
LocalClientConnection.camera = %cam;
|
|
||||||
|
|
||||||
%cam.setPosition("0 0 0");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
toggleEditor(true);
|
pushInstantGroup();
|
||||||
|
|
||||||
|
if ( !isObject( Editor ) )
|
||||||
|
{
|
||||||
|
Editor::create();
|
||||||
|
MissionCleanup.add( Editor );
|
||||||
|
MissionCleanup.add( Editor.getUndoManager() );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( EditorIsActive() )
|
||||||
|
{
|
||||||
|
if (theLevelInfo.type $= "DemoScene")
|
||||||
|
{
|
||||||
|
commandToServer('dropPlayerAtCamera');
|
||||||
|
Editor.close("SceneGui");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Editor.close("PlayGui");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
canvas.pushDialog( EditorLoadingGui );
|
||||||
|
canvas.repaint();
|
||||||
|
|
||||||
|
Editor.open();
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
popInstantGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%elapsed = stopPrecisionTimer( %timerId );
|
||||||
|
warn( "Time spent in toggleEditor() : " @ %elapsed / 1000.0 @ " s" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue