|
@@ -33,191 +33,200 @@ $Tools::loadFirst = "editorClasses base worldEditor";
|
|
|
//---------------------------------------------------------------------------------------------
|
|
|
$Tools::materialEditorList = "";
|
|
|
|
|
|
-//---------------------------------------------------------------------------------------------
|
|
|
-// Tools Package.
|
|
|
-//---------------------------------------------------------------------------------------------
|
|
|
-package Tools
|
|
|
+if(!$Tools::loaded)
|
|
|
+{
|
|
|
+ new Settings(EditorSettings) { file = "tools/settings.xml"; };
|
|
|
+ EditorSettings.read();
|
|
|
+
|
|
|
+ exec( "tools/gui/profiles.ed.cs" );
|
|
|
+ exec("tools/gui/EditorLoadingGui.gui");
|
|
|
+}
|
|
|
+
|
|
|
+function EditorIsActive()
|
|
|
+{
|
|
|
+ return ( isObject(EditorGui) && Canvas.getContent() == EditorGui.getId() );
|
|
|
+}
|
|
|
+
|
|
|
+function GuiEditorIsActive()
|
|
|
+{
|
|
|
+ return ( isObject(GuiEditorGui) && Canvas.getContent() == GuiEditorGui.getId() );
|
|
|
+}
|
|
|
+
|
|
|
+function loadKeybindings()
|
|
|
{
|
|
|
- function loadKeybindings()
|
|
|
+ Parent::loadKeybindings();
|
|
|
+}
|
|
|
+
|
|
|
+// Start-up.
|
|
|
+function onStart()
|
|
|
+{
|
|
|
+ //First, we want to ensure we don't inadvertently clean up our editor objects by leaving them in the MissionCleanup group, so lets change that real fast
|
|
|
+ $instantGroup = "";
|
|
|
+ pushInstantGroup();
|
|
|
+
|
|
|
+ echo( " % - Initializing Tools" );
|
|
|
+
|
|
|
+ // Default file path when saving from the editor (such as prefabs)
|
|
|
+ if ($Pref::WorldEditor::LastPath $= "")
|
|
|
{
|
|
|
- Parent::loadKeybindings();
|
|
|
+ $Pref::WorldEditor::LastPath = getMainDotCsDir();
|
|
|
}
|
|
|
|
|
|
- // Start-up.
|
|
|
- function onStart()
|
|
|
+ // Common GUI stuff.
|
|
|
+ exec( "./gui/cursors.ed.cs" );
|
|
|
+ exec( "./gui/messageBoxes/messageBox.ed.cs" );
|
|
|
+ exec( "./editorClasses/gui/panels/navPanelProfiles.ed.cs" );
|
|
|
+
|
|
|
+ // Make sure we get editor profiles before any GUI's
|
|
|
+ // BUG: these dialogs are needed earlier in the init sequence, and should be moved to
|
|
|
+ // common, along with the guiProfiles they depend on.
|
|
|
+ exec( "./gui/guiDialogs.ed.cs" );
|
|
|
+
|
|
|
+ //%toggle = $Scripts::ignoreDSOs;
|
|
|
+ //$Scripts::ignoreDSOs = true;
|
|
|
+
|
|
|
+ $ignoredDatablockSet = new SimSet();
|
|
|
+
|
|
|
+ // fill the list of editors
|
|
|
+ $editors[count] = getWordCount( $Tools::loadFirst );
|
|
|
+ for ( %i = 0; %i < $editors[count]; %i++ )
|
|
|
{
|
|
|
- //First, we want to ensure we don't inadvertently clean up our editor objects by leaving them in the MissionCleanup group, so lets change that real fast
|
|
|
- $instantGroup = "";
|
|
|
- pushInstantGroup();
|
|
|
-
|
|
|
- echo( " % - Initializing Tools" );
|
|
|
-
|
|
|
- // Default file path when saving from the editor (such as prefabs)
|
|
|
- if ($Pref::WorldEditor::LastPath $= "")
|
|
|
- {
|
|
|
- $Pref::WorldEditor::LastPath = getMainDotCsDir();
|
|
|
- }
|
|
|
-
|
|
|
- // Common GUI stuff.
|
|
|
- exec( "./gui/cursors.ed.cs" );
|
|
|
- exec( "./gui/profiles.ed.cs" );
|
|
|
- exec( "./gui/messageBoxes/messageBox.ed.cs" );
|
|
|
- exec( "./editorClasses/gui/panels/navPanelProfiles.ed.cs" );
|
|
|
-
|
|
|
- // Make sure we get editor profiles before any GUI's
|
|
|
- // BUG: these dialogs are needed earlier in the init sequence, and should be moved to
|
|
|
- // common, along with the guiProfiles they depend on.
|
|
|
- exec( "./gui/guiDialogs.ed.cs" );
|
|
|
-
|
|
|
- //%toggle = $Scripts::ignoreDSOs;
|
|
|
- //$Scripts::ignoreDSOs = true;
|
|
|
-
|
|
|
- $ignoredDatablockSet = new SimSet();
|
|
|
+ $editors[%i] = getWord( $Tools::loadFirst, %i );
|
|
|
+ }
|
|
|
|
|
|
- // fill the list of editors
|
|
|
- $editors[count] = getWordCount( $Tools::loadFirst );
|
|
|
- for ( %i = 0; %i < $editors[count]; %i++ )
|
|
|
- {
|
|
|
- $editors[%i] = getWord( $Tools::loadFirst, %i );
|
|
|
- }
|
|
|
-
|
|
|
- %pattern = $Tools::resourcePath @ "/*/main.cs";
|
|
|
+ %pattern = $Tools::resourcePath @ "/*/main.cs";
|
|
|
+ %folder = findFirstFile( %pattern );
|
|
|
+ if ( %folder $= "")
|
|
|
+ {
|
|
|
+ // if we have absolutely no matches for main.cs, we look for main.cs.dso
|
|
|
+ %pattern = $Tools::resourcePath @ "/*/main.cs.dso";
|
|
|
%folder = findFirstFile( %pattern );
|
|
|
- if ( %folder $= "")
|
|
|
- {
|
|
|
- // if we have absolutely no matches for main.cs, we look for main.cs.dso
|
|
|
- %pattern = $Tools::resourcePath @ "/*/main.cs.dso";
|
|
|
- %folder = findFirstFile( %pattern );
|
|
|
- }
|
|
|
- while ( %folder !$= "" )
|
|
|
+ }
|
|
|
+ while ( %folder !$= "" )
|
|
|
+ {
|
|
|
+ if( filePath( %folder ) !$= "tools" ) // Skip the actual 'tools' folder...we want the children
|
|
|
{
|
|
|
- if( filePath( %folder ) !$= "tools" ) // Skip the actual 'tools' folder...we want the children
|
|
|
+ %folder = filePath( %folder );
|
|
|
+ %editor = fileName( %folder );
|
|
|
+ if ( IsDirectory( %folder ) )
|
|
|
{
|
|
|
- %folder = filePath( %folder );
|
|
|
- %editor = fileName( %folder );
|
|
|
- if ( IsDirectory( %folder ) )
|
|
|
+ // Yes, this sucks and should be done better
|
|
|
+ if ( strstr( $Tools::loadFirst, %editor ) == -1 )
|
|
|
{
|
|
|
- // Yes, this sucks and should be done better
|
|
|
- if ( strstr( $Tools::loadFirst, %editor ) == -1 )
|
|
|
- {
|
|
|
- $editors[$editors[count]] = %editor;
|
|
|
- $editors[count]++;
|
|
|
- }
|
|
|
+ $editors[$editors[count]] = %editor;
|
|
|
+ $editors[count]++;
|
|
|
}
|
|
|
}
|
|
|
- %folder = findNextFile( %pattern );
|
|
|
}
|
|
|
-
|
|
|
- // initialize every editor
|
|
|
- new SimSet( EditorPluginSet );
|
|
|
- %count = $editors[count];
|
|
|
- for ( %i = 0; %i < %count; %i++ )
|
|
|
- {
|
|
|
- exec( "./" @ $editors[%i] @ "/main.cs" );
|
|
|
-
|
|
|
- %initializeFunction = "initialize" @ $editors[%i];
|
|
|
- if( isFunction( %initializeFunction ) )
|
|
|
- call( %initializeFunction );
|
|
|
- }
|
|
|
-
|
|
|
- // Popuplate the default SimObject icons that
|
|
|
- // are used by the various editors.
|
|
|
- EditorIconRegistry::loadFromPath( "tools/classIcons/" );
|
|
|
-
|
|
|
- // Load up the tools resources. All the editors are initialized at this point, so
|
|
|
- // resources can override, redefine, or add functionality.
|
|
|
- Tools::LoadResources( $Tools::resourcePath );
|
|
|
-
|
|
|
- //Now, go through and load any tool-group modules
|
|
|
- ModuleDatabase.setModuleExtension("module");
|
|
|
-
|
|
|
- //Any common tool modules
|
|
|
- ModuleDatabase.scanModules( "tools", false );
|
|
|
- ModuleDatabase.LoadGroup( "Tools" );
|
|
|
-
|
|
|
- //Now that we're done loading, we can set the instant group back
|
|
|
- popInstantGroup();
|
|
|
- $instantGroup = MissionCleanup;
|
|
|
- pushInstantGroup();
|
|
|
-
|
|
|
- $Tools::loaded = true;
|
|
|
+ %folder = findNextFile( %pattern );
|
|
|
}
|
|
|
-
|
|
|
- function startToolTime(%tool)
|
|
|
+
|
|
|
+ // initialize every editor
|
|
|
+ new SimSet( EditorPluginSet );
|
|
|
+ %count = $editors[count];
|
|
|
+ for ( %i = 0; %i < %count; %i++ )
|
|
|
{
|
|
|
- if($toolDataToolCount $= "")
|
|
|
- $toolDataToolCount = 0;
|
|
|
-
|
|
|
- if($toolDataToolEntry[%tool] !$= "true")
|
|
|
- {
|
|
|
- $toolDataToolEntry[%tool] = "true";
|
|
|
- $toolDataToolList[$toolDataToolCount] = %tool;
|
|
|
- $toolDataToolCount++;
|
|
|
- $toolDataClickCount[%tool] = 0;
|
|
|
- }
|
|
|
+ exec( "./" @ $editors[%i] @ "/main.cs" );
|
|
|
|
|
|
- $toolDataStartTime[%tool] = getSimTime();
|
|
|
- $toolDataClickCount[%tool]++;
|
|
|
+ %initializeFunction = "initialize" @ $editors[%i];
|
|
|
+ if( isFunction( %initializeFunction ) )
|
|
|
+ call( %initializeFunction );
|
|
|
}
|
|
|
|
|
|
- function endToolTime(%tool)
|
|
|
+ // Popuplate the default SimObject icons that
|
|
|
+ // are used by the various editors.
|
|
|
+ EditorIconRegistry::loadFromPath( "tools/classIcons/" );
|
|
|
+
|
|
|
+ // Load up the tools resources. All the editors are initialized at this point, so
|
|
|
+ // resources can override, redefine, or add functionality.
|
|
|
+ Tools::LoadResources( $Tools::resourcePath );
|
|
|
+
|
|
|
+ //Now, go through and load any tool-group modules
|
|
|
+ ModuleDatabase.setModuleExtension("module");
|
|
|
+
|
|
|
+ //Any common tool modules
|
|
|
+ ModuleDatabase.scanModules( "tools", false );
|
|
|
+ ModuleDatabase.LoadGroup( "Tools" );
|
|
|
+
|
|
|
+ //Now that we're done loading, we can set the instant group back
|
|
|
+ popInstantGroup();
|
|
|
+ $instantGroup = MissionCleanup;
|
|
|
+ pushInstantGroup();
|
|
|
+
|
|
|
+ $Tools::loaded = true;
|
|
|
+}
|
|
|
+
|
|
|
+function startToolTime(%tool)
|
|
|
+{
|
|
|
+ if($toolDataToolCount $= "")
|
|
|
+ $toolDataToolCount = 0;
|
|
|
+
|
|
|
+ if($toolDataToolEntry[%tool] !$= "true")
|
|
|
{
|
|
|
- %startTime = 0;
|
|
|
-
|
|
|
- if($toolDataStartTime[%tool] !$= "")
|
|
|
- %startTime = $toolDataStartTime[%tool];
|
|
|
-
|
|
|
- if($toolDataTotalTime[%tool] $= "")
|
|
|
- $toolDataTotalTime[%tool] = 0;
|
|
|
-
|
|
|
- $toolDataTotalTime[%tool] += getSimTime() - %startTime;
|
|
|
+ $toolDataToolEntry[%tool] = "true";
|
|
|
+ $toolDataToolList[$toolDataToolCount] = %tool;
|
|
|
+ $toolDataToolCount++;
|
|
|
+ $toolDataClickCount[%tool] = 0;
|
|
|
}
|
|
|
|
|
|
- function dumpToolData()
|
|
|
+ $toolDataStartTime[%tool] = getSimTime();
|
|
|
+ $toolDataClickCount[%tool]++;
|
|
|
+}
|
|
|
+
|
|
|
+function endToolTime(%tool)
|
|
|
+{
|
|
|
+ %startTime = 0;
|
|
|
+
|
|
|
+ if($toolDataStartTime[%tool] !$= "")
|
|
|
+ %startTime = $toolDataStartTime[%tool];
|
|
|
+
|
|
|
+ if($toolDataTotalTime[%tool] $= "")
|
|
|
+ $toolDataTotalTime[%tool] = 0;
|
|
|
+
|
|
|
+ $toolDataTotalTime[%tool] += getSimTime() - %startTime;
|
|
|
+}
|
|
|
+
|
|
|
+function dumpToolData()
|
|
|
+{
|
|
|
+ %count = $toolDataToolCount;
|
|
|
+ for(%i=0; %i<%count; %i++)
|
|
|
{
|
|
|
- %count = $toolDataToolCount;
|
|
|
- for(%i=0; %i<%count; %i++)
|
|
|
- {
|
|
|
- %tool = $toolDataToolList[%i];
|
|
|
- %totalTime = $toolDataTotalTime[%tool];
|
|
|
- if(%totalTime $= "")
|
|
|
- %totalTime = 0;
|
|
|
- %clickCount = $toolDataClickCount[%tool];
|
|
|
- echo("---");
|
|
|
- echo("Tool: " @ %tool);
|
|
|
- echo("Time (seconds): " @ %totalTime / 1000);
|
|
|
- echo("Activated: " @ %clickCount);
|
|
|
- echo("---");
|
|
|
- }
|
|
|
+ %tool = $toolDataToolList[%i];
|
|
|
+ %totalTime = $toolDataTotalTime[%tool];
|
|
|
+ if(%totalTime $= "")
|
|
|
+ %totalTime = 0;
|
|
|
+ %clickCount = $toolDataClickCount[%tool];
|
|
|
+ echo("---");
|
|
|
+ echo("Tool: " @ %tool);
|
|
|
+ echo("Time (seconds): " @ %totalTime / 1000);
|
|
|
+ echo("Activated: " @ %clickCount);
|
|
|
+ echo("---");
|
|
|
}
|
|
|
+}
|
|
|
+
|
|
|
+// Shutdown.
|
|
|
+function onExit()
|
|
|
+{
|
|
|
+ if( EditorGui.isInitialized )
|
|
|
+ EditorGui.shutdown();
|
|
|
|
|
|
- // Shutdown.
|
|
|
- function onExit()
|
|
|
+ // Free all the icon images in the registry.
|
|
|
+ EditorIconRegistry::clear();
|
|
|
+
|
|
|
+ // Save any Layouts we might be using
|
|
|
+ //GuiFormManager::SaveLayout(LevelBuilder, Default, User);
|
|
|
+
|
|
|
+ %count = $editors[count];
|
|
|
+ for (%i = 0; %i < %count; %i++)
|
|
|
{
|
|
|
- if( EditorGui.isInitialized )
|
|
|
- EditorGui.shutdown();
|
|
|
-
|
|
|
- // Free all the icon images in the registry.
|
|
|
- EditorIconRegistry::clear();
|
|
|
-
|
|
|
- // Save any Layouts we might be using
|
|
|
- //GuiFormManager::SaveLayout(LevelBuilder, Default, User);
|
|
|
-
|
|
|
- %count = $editors[count];
|
|
|
- for (%i = 0; %i < %count; %i++)
|
|
|
- {
|
|
|
- %destroyFunction = "destroy" @ $editors[%i];
|
|
|
- if( isFunction( %destroyFunction ) )
|
|
|
- call( %destroyFunction );
|
|
|
- }
|
|
|
-
|
|
|
- // Call Parent.
|
|
|
- Parent::onExit();
|
|
|
-
|
|
|
- // write out our settings xml file
|
|
|
- EditorSettings.write();
|
|
|
+ %destroyFunction = "destroy" @ $editors[%i];
|
|
|
+ if( isFunction( %destroyFunction ) )
|
|
|
+ call( %destroyFunction );
|
|
|
}
|
|
|
-};
|
|
|
+
|
|
|
+ // write out our settings xml file
|
|
|
+ EditorSettings.write();
|
|
|
+}
|
|
|
|
|
|
function EditorCreateFakeGameSession(%fileName)
|
|
|
{
|
|
@@ -248,7 +257,12 @@ function fastLoadWorldEdit(%val)
|
|
|
{
|
|
|
if(!$Tools::loaded)
|
|
|
{
|
|
|
+ canvas.pushDialog( EditorLoadingGui );
|
|
|
+ canvas.repaint();
|
|
|
+
|
|
|
onStart();
|
|
|
+
|
|
|
+ canvas.popDialog(EditorLoadingGui);
|
|
|
}
|
|
|
|
|
|
%timerId = startPrecisionTimer();
|
|
@@ -290,7 +304,7 @@ function fastLoadWorldEdit(%val)
|
|
|
{
|
|
|
canvas.pushDialog( EditorLoadingGui );
|
|
|
canvas.repaint();
|
|
|
-
|
|
|
+
|
|
|
Editor.open();
|
|
|
|
|
|
// Cancel the scheduled event to prevent
|
|
@@ -318,7 +332,12 @@ function fastLoadGUIEdit(%val)
|
|
|
{
|
|
|
if(!$Tools::loaded)
|
|
|
{
|
|
|
+ canvas.pushDialog( EditorLoadingGui );
|
|
|
+ canvas.repaint();
|
|
|
+
|
|
|
onStart();
|
|
|
+
|
|
|
+ canvas.popDialog(EditorLoadingGui);
|
|
|
}
|
|
|
|
|
|
toggleGuiEditor(true);
|
|
@@ -339,21 +358,7 @@ function Tools::LoadResources( %path )
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-//-----------------------------------------------------------------------------
|
|
|
-// Activate Package.
|
|
|
-//-----------------------------------------------------------------------------
|
|
|
-activatePackage(Tools);
|
|
|
-
|
|
|
//This lets us fast-load the editor from the menu
|
|
|
GlobalActionMap.bind(keyboard, "F11", fastLoadWorldEdit);
|
|
|
GlobalActionMap.bind(keyboard, "F10", fastLoadGUIEdit);
|
|
|
|
|
|
-function EditorIsActive()
|
|
|
-{
|
|
|
- return ( isObject(EditorGui) && Canvas.getContent() == EditorGui.getId() );
|
|
|
-}
|
|
|
-
|
|
|
-function GuiEditorIsActive()
|
|
|
-{
|
|
|
- return ( isObject(GuiEditorGui) && Canvas.getContent() == GuiEditorGui.getId() );
|
|
|
-}
|