|
@@ -20,2813 +20,412 @@
|
|
|
// IN THE SOFTWARE.
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
-function EditorGui::init(%this)
|
|
|
+function EditorGui::buildMenus(%this)
|
|
|
{
|
|
|
- EWorldEditor.isDirty = false;
|
|
|
- ETerrainEditor.isDirty = false;
|
|
|
- ETerrainEditor.isMissionDirty = false;
|
|
|
-
|
|
|
- if( %this.isInitialized )
|
|
|
+ if(isObject(%this.menuBar))
|
|
|
return;
|
|
|
-
|
|
|
- %this.readWorldEditorSettings();
|
|
|
-
|
|
|
- $SelectedOperation = -1;
|
|
|
- $NextOperationId = 1;
|
|
|
- $HeightfieldDirtyRow = -1;
|
|
|
-
|
|
|
- if( !isObject( %this-->ToolsPaletteWindow ) )
|
|
|
- {
|
|
|
- // Load Creator/Inspector GUI
|
|
|
- exec("~/worldEditor/gui/ToolsPaletteGroups/init.cs");
|
|
|
- exec("~/worldEditor/gui/ToolsPaletteWindow.ed.gui");
|
|
|
-
|
|
|
- if( isObject( EWToolsPaletteWindow ) )
|
|
|
- {
|
|
|
- %this.add( EWToolsPaletteWindow );
|
|
|
- EWToolsPaletteWindow.init();
|
|
|
- EWToolsPaletteWindow.setVisible( false );
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- if( !isObject( %this-->TreeWindow ) )
|
|
|
- {
|
|
|
- // Load Creator/Inspector GUI
|
|
|
- exec("~/worldEditor/gui/WorldEditorTreeWindow.ed.gui");
|
|
|
- if( isObject( EWTreeWindow ) )
|
|
|
- {
|
|
|
- %this.add( EWTreeWindow );
|
|
|
- EWTreeWindow-->EditorTree.selectPage( 0 );
|
|
|
- EWTreeWindow.setVisible( false );
|
|
|
- }
|
|
|
+ //set up %cmdctrl variable so that it matches OS standards
|
|
|
+ if( $platform $= "macos" )
|
|
|
+ {
|
|
|
+ %cmdCtrl = "Cmd";
|
|
|
+ %menuCmdCtrl = "Cmd";
|
|
|
+ %quitShortcut = "Cmd Q";
|
|
|
+ %redoShortcut = "Cmd-Shift Z";
|
|
|
}
|
|
|
-
|
|
|
- if( !isObject( %this-->InspectorWindow ) )
|
|
|
- {
|
|
|
- // Load Creator/Inspector GUI
|
|
|
- exec("~/worldEditor/gui/WorldEditorInspectorWindow.ed.gui");
|
|
|
- //EWInspectorWindow.resize(getWord(EWInspectorWindow.Position, 0), getWord(EWInspectorWindow.Position, 1), getWord(EWInspectorWindow.extent, 0), getWord(EWInspectorWindow.extent, 1));
|
|
|
- if( isObject( EWInspectorWindow ) )
|
|
|
- {
|
|
|
- %this.add( EWInspectorWindow );
|
|
|
- EWInspectorWindow.setVisible( false );
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if( !isObject( %this-->WorldEditorToolbar ) )
|
|
|
+ else
|
|
|
{
|
|
|
- // Load Creator/Inspector GUI
|
|
|
- exec("~/worldEditor/gui/WorldEditorToolbar.ed.gui");
|
|
|
- if( isObject( EWorldEditorToolbar ) )
|
|
|
- {
|
|
|
- %this.add( EWorldEditorToolbar );
|
|
|
- EWorldEditorToolbar.setVisible( false );
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if ( !isObject( %this-->TerrainEditToolbar ) )
|
|
|
+ %cmdCtrl = "Ctrl";
|
|
|
+ %menuCmdCtrl = "Alt";
|
|
|
+ %quitShortcut = "Alt F4";
|
|
|
+ %redoShortcut = "Ctrl Y";
|
|
|
+ }
|
|
|
+
|
|
|
+ // 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.
|
|
|
+ if(!isObject(EditorCameraSpeedOptions))
|
|
|
{
|
|
|
- // Load Terrain Edit GUI
|
|
|
- exec("~/worldEditor/gui/TerrainEditToolbar.ed.gui");
|
|
|
- if( isObject( EWTerrainEditToolbar ) )
|
|
|
+ %this.cameraSpeedMenu = new PopupMenu(EditorCameraSpeedOptions)
|
|
|
{
|
|
|
- %this.add( EWTerrainEditToolbar );
|
|
|
- EWTerrainEditToolbar.setVisible( false );
|
|
|
- }
|
|
|
+ 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( %this-->TerrainPainter ) )
|
|
|
+ if(!isObject(EditorFreeCameraTypeOptions))
|
|
|
{
|
|
|
- // Load Terrain Painter GUI
|
|
|
- exec("~/worldEditor/gui/TerrainPainterWindow.ed.gui");
|
|
|
- if( isObject( %guiContent ) ){
|
|
|
- %this.add( %guiContent->TerrainPainter );
|
|
|
- %this.add( %guiContent->TerrainPainterPreview );
|
|
|
- }
|
|
|
+ %this.freeCameraTypeMenu = new PopupMenu(EditorFreeCameraTypeOptions)
|
|
|
+ {
|
|
|
+ superClass = "MenuBuilder";
|
|
|
+ class = "EditorFreeCameraTypeMenu";
|
|
|
|
|
|
- exec("~/worldEditor/gui/guiTerrainMaterialDlg.ed.gui");
|
|
|
- exec("~/worldEditor/gui/TerrainBrushSoftnessCurveDlg.ed.gui");
|
|
|
+ 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( %this-->TerrainPainterToolbar) )
|
|
|
+ if(!isObject(EditorPlayerCameraTypeOptions))
|
|
|
{
|
|
|
- // Load Terrain Edit GUI
|
|
|
- exec("~/worldEditor/gui/TerrainPainterToolbar.ed.gui");
|
|
|
- if( isObject( EWTerrainPainterToolbar ) )
|
|
|
+ %this.playerCameraTypeMenu = new PopupMenu(EditorPlayerCameraTypeOptions)
|
|
|
{
|
|
|
- %this.add( EWTerrainPainterToolbar );
|
|
|
- EWTerrainPainterToolbar.setVisible( false );
|
|
|
- }
|
|
|
+ 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( %this-->ToolsToolbar ) )
|
|
|
+ if(!isObject(EditorCameraBookmarks))
|
|
|
{
|
|
|
- // Load Creator/Inspector GUI
|
|
|
- exec("~/worldEditor/gui/ToolsToolbar.ed.gui");
|
|
|
- if( isObject( EWToolsToolbar ) )
|
|
|
+ %this.cameraBookmarksMenu = new PopupMenu(EditorCameraBookmarks)
|
|
|
{
|
|
|
- %this.add( EWToolsToolbar );
|
|
|
- EWToolsToolbar.setVisible( true );
|
|
|
+ superClass = "MenuBuilder";
|
|
|
+ class = "EditorCameraBookmarksMenu";
|
|
|
|
|
|
- }
|
|
|
+ //item[0] = "None";
|
|
|
+ };
|
|
|
}
|
|
|
-
|
|
|
- // Visibility Layer Window
|
|
|
- if( !isObject( %this-->VisibilityLayerWindow ) )
|
|
|
+ %this.viewTypeMenu = new PopupMenu()
|
|
|
{
|
|
|
- %this.add( EVisibility );
|
|
|
- EVisibility.setVisible(false);
|
|
|
- EVisibilityTabBook.selectPage(0);
|
|
|
- }
|
|
|
+ superClass = "MenuBuilder";
|
|
|
|
|
|
- // Editor Settings Window
|
|
|
- if( !isObject( %this-->EditorSettingsWindow ) )
|
|
|
- {
|
|
|
- exec("~/worldEditor/gui/EditorSettingsWindow.ed.gui");
|
|
|
- exec("~/worldEditor/scripts/editorSettingsWindow.ed.cs");
|
|
|
- %this.add( ESettingsWindow );
|
|
|
- ESettingsWindow.setVisible(false);
|
|
|
+ item[ 0 ] = "Top" TAB "Alt 2" TAB "EditorGuiStatusBar.setCamera(\"Top View\");";
|
|
|
+ item[ 1 ] = "Bottom" TAB "Alt 5" TAB "EditorGuiStatusBar.setCamera(\"Bottom View\");";
|
|
|
+ item[ 2 ] = "Front" TAB "Alt 3" TAB "EditorGuiStatusBar.setCamera(\"Front View\");";
|
|
|
+ item[ 3 ] = "Back" TAB "Alt 6" TAB "EditorGuiStatusBar.setCamera(\"Back View\");";
|
|
|
+ item[ 4 ] = "Left" TAB "Alt 4" TAB "EditorGuiStatusBar.setCamera(\"Left View\");";
|
|
|
+ item[ 5 ] = "Right" TAB "Alt 7" TAB "EditorGuiStatusBar.setCamera(\"Right View\");";
|
|
|
+ item[ 6 ] = "Perspective" TAB "Alt 1" TAB "EditorGuiStatusBar.setCamera(\"Standard Camera\");";
|
|
|
+ item[ 7 ] = "Isometric" TAB "Alt 8" TAB "EditorGuiStatusBar.setCamera(\"Isometric View\");";
|
|
|
+ };
|
|
|
|
|
|
- // Start the standard settings tabs pages
|
|
|
- exec( "~/worldEditor/gui/GeneralSettingsTab.ed.gui" );
|
|
|
- ESettingsWindow.addTabPage( EGeneralSettingsPage );
|
|
|
- exec("~/worldEditor/gui/ObjectEditorSettingsTab.ed.gui");
|
|
|
- ESettingsWindow.addTabPage( EObjectEditorSettingsPage );
|
|
|
- exec("~/worldEditor/gui/AxisGizmoSettingsTab.ed.gui");
|
|
|
- ESettingsWindow.addTabPage( EAxisGizmoSettingsPage );
|
|
|
- exec("~/worldEditor/gui/TerrainEditorSettingsTab.ed.gui");
|
|
|
- ESettingsWindow.addTabPage( ETerrainEditorSettingsPage );
|
|
|
- exec("~/worldEditor/gui/CameraSettingsTab.ed.gui");
|
|
|
- ESettingsWindow.addTabPage( ECameraSettingsPage );
|
|
|
- }
|
|
|
-
|
|
|
- // Object Snap Options Window
|
|
|
- if( !isObject( %this-->SnapOptionsWindow ) )
|
|
|
- {
|
|
|
- exec("~/worldEditor/gui/ObjectSnapOptionsWindow.ed.gui");
|
|
|
- exec("~/worldEditor/scripts/objectSnapOptions.ed.cs");
|
|
|
- %this.add( ESnapOptions );
|
|
|
- ESnapOptions.setVisible(false);
|
|
|
- ESnapOptionsTabBook.selectPage(0);
|
|
|
- }
|
|
|
-
|
|
|
- // Transform Selection Window
|
|
|
- if( !isObject( %this-->TransformSelectionWindow ) )
|
|
|
- {
|
|
|
- exec("~/worldEditor/gui/TransformSelectionWindow.ed.gui");
|
|
|
- exec("~/worldEditor/scripts/transformSelection.ed.cs");
|
|
|
- %this.add( ETransformSelection );
|
|
|
- ETransformSelection.setVisible(false);
|
|
|
- }
|
|
|
-
|
|
|
- // Manage Bookmarks Window
|
|
|
- if( !isObject( %this-->ManageBookmarksWindow ) )
|
|
|
- {
|
|
|
- %this.add( EManageBookmarks );
|
|
|
- EManageBookmarks.setVisible(false);
|
|
|
- }
|
|
|
-
|
|
|
- // Manage SFXParameters Window
|
|
|
- if( !isObject( %this-->ManageSFXParametersWindow ) )
|
|
|
+ // Menu bar
|
|
|
+ %this.menuBar = new GuiMenuBar(WorldEditorMenubar)
|
|
|
{
|
|
|
- %this.add( EManageSFXParameters );
|
|
|
- EManageSFXParameters.setVisible( false );
|
|
|
- }
|
|
|
+ dynamicItemInsertPos = 3;
|
|
|
+ extent = "1024 20";
|
|
|
+ minExtent = "320 20";
|
|
|
+ horizSizing = "width";
|
|
|
+ profile = "GuiMenuBarProfile";
|
|
|
+ };
|
|
|
|
|
|
- // Select Objects Window
|
|
|
- if( !isObject( %this->SelectObjectsWindow ) )
|
|
|
+ // File Menu
|
|
|
+ %fileMenu = new PopupMenu()
|
|
|
{
|
|
|
- %this.add( ESelectObjectsWindow );
|
|
|
- ESelectObjectsWindow.setVisible( false );
|
|
|
- }
|
|
|
+ superClass = "MenuBuilder";
|
|
|
+ class = "EditorFileMenu";
|
|
|
|
|
|
- EWorldEditor.init();
|
|
|
- ETerrainEditor.init();
|
|
|
+ barTitle = "File";
|
|
|
+ };
|
|
|
+
|
|
|
|
|
|
- //Creator.init();
|
|
|
- EWCreatorWindow.init();
|
|
|
- ObjectBuilderGui.init();
|
|
|
+ %fileMenu.appendItem("New Level" TAB "" TAB "schedule( 1, 0, \"EditorNewLevel\" );");
|
|
|
+ %fileMenu.appendItem("Open Level..." TAB %cmdCtrl SPC "O" TAB "schedule( 1, 0, \"EditorOpenMission\" );");
|
|
|
+ %fileMenu.appendItem("Save Level" TAB %cmdCtrl SPC "S" TAB "EditorSaveMissionMenu();");
|
|
|
+ %fileMenu.appendItem("Save Level As..." TAB "" TAB "EditorSaveMissionAs();");
|
|
|
+ %fileMenu.appendItem("-");
|
|
|
|
|
|
- %this.setMenuDefaultState();
|
|
|
-
|
|
|
- EWorldEditorToggleCamera.setBitmap("tools/worldEditor/images/toolbar/player");
|
|
|
-
|
|
|
- /*
|
|
|
- EWorldEditorCameraSpeed.clear();
|
|
|
- EWorldEditorCameraSpeed.add("Slowest - Camera 1",0);
|
|
|
- EWorldEditorCameraSpeed.add("Slow - Camera 2",1);
|
|
|
- EWorldEditorCameraSpeed.add("Slower - Camera 3",2);
|
|
|
- EWorldEditorCameraSpeed.add("Normal - Camera 4",3);
|
|
|
- EWorldEditorCameraSpeed.add("Faster - Camera 5",4);
|
|
|
- EWorldEditorCameraSpeed.add("Fast - Camera 6",5);
|
|
|
- EWorldEditorCameraSpeed.add("Fastest - Camera 7",6);
|
|
|
- EWorldEditorCameraSpeed.setSelected(3);
|
|
|
- */
|
|
|
-
|
|
|
- EWorldEditorAlignPopup.clear();
|
|
|
- EWorldEditorAlignPopup.add("World",0);
|
|
|
- EWorldEditorAlignPopup.add("Object",1);
|
|
|
- EWorldEditorAlignPopup.setSelected(0);
|
|
|
-
|
|
|
-
|
|
|
- // sync camera gui
|
|
|
- EditorGui.syncCameraGui();
|
|
|
-
|
|
|
- // this will brind CameraTypesDropdown to front so that it goes over the menubar
|
|
|
- EditorGui.pushToBack(CameraTypesDropdown);
|
|
|
- EditorGui.pushToBack(VisibilityDropdown);
|
|
|
-
|
|
|
- // dropdowns out so that they display correctly in editor gui
|
|
|
- objectTransformDropdown.parentGroup = editorGui;
|
|
|
- objectCenterDropdown.parentGroup = editorGui;
|
|
|
- objectSnapDropdown.parentGroup = editorGui;
|
|
|
-
|
|
|
- // make sure to show the default world editor guis
|
|
|
- EditorGui.bringToFront( EWorldEditor );
|
|
|
- EWorldEditor.setVisible( false );
|
|
|
-
|
|
|
- // Call the startup callback on the editor plugins.
|
|
|
- for ( %i = 0; %i < EditorPluginSet.getCount(); %i++ )
|
|
|
+ if( $platform $= "windows" )
|
|
|
{
|
|
|
- %obj = EditorPluginSet.getObject( %i );
|
|
|
- %obj.onWorldEditorStartup();
|
|
|
+ %fileMenu.appendItem( "Open Project in Torsion" TAB "" TAB "EditorOpenTorsionProject();" );
|
|
|
+ %fileMenu.appendItem( "Open Level File in Torsion" TAB "" TAB "EditorOpenFileInTorsion();" );
|
|
|
+ %fileMenu.appendItem( "-" );
|
|
|
}
|
|
|
-
|
|
|
- // With everything loaded, start up the settings window
|
|
|
- ESettingsWindow.startup();
|
|
|
-
|
|
|
- // Start up initial editor plugin.
|
|
|
|
|
|
- %initialEditor = %this.currentEditor; // Read from prefs.
|
|
|
- %this.currentEditor = "";
|
|
|
-
|
|
|
- if( %initialEditor $= "" )
|
|
|
- %initialEditor = "WorldEditorInspectorPlugin";
|
|
|
- %this.setEditor( %initialEditor, true, true );
|
|
|
+ %fileMenu.appendItem("Create Blank Terrain" TAB "" TAB "Canvas.pushDialog( CreateNewTerrainGui );");
|
|
|
+ %fileMenu.appendItem("Import Terrain Heightmap" TAB "" TAB "Canvas.pushDialog( TerrainImportGui );");
|
|
|
|
|
|
- // Done.
|
|
|
+ %fileMenu.appendItem("Export Terrain Heightmap" TAB "" TAB "Canvas.pushDialog( TerrainExportGui );");
|
|
|
+ %fileMenu.appendItem("-");
|
|
|
+ %fileMenu.appendItem("Export To COLLADA..." TAB "" TAB "EditorExportToCollada();");
|
|
|
+ //item[5] = "Import Terraform Data..." TAB "" TAB "Heightfield::import();";
|
|
|
+ //item[6] = "Import Texture Data..." TAB "" TAB "Texture::import();";
|
|
|
+ //item[7] = "-";
|
|
|
+ //item[8] = "Export Terraform Data..." TAB "" TAB "Heightfield::saveBitmap(\"\");";
|
|
|
|
|
|
- %this.isInitialized = true;
|
|
|
-}
|
|
|
-
|
|
|
-//------------------------------------------------------------------------------
|
|
|
-// Editor Gui's interactions with Camera Settings
|
|
|
-
|
|
|
-function EditorGui::setupDefaultCameraSettings( %this )
|
|
|
-{
|
|
|
- EditorSettings.beginGroup( "LevelInformation/levels/" @ %this.levelName );
|
|
|
+ %fileMenu.appendItem( "-" );
|
|
|
+ %fileMenu.appendItem( "Add FMOD Designer Audio..." TAB "" TAB "AddFMODProjectDlg.show();" );
|
|
|
|
|
|
- EditorSettings.setDefaultValue( "cameraSpeedMin", "5" );
|
|
|
- EditorSettings.setDefaultValue( "cameraSpeedMax", "200" );
|
|
|
-
|
|
|
- EditorSettings.endGroup();
|
|
|
-}
|
|
|
-
|
|
|
-function EditorGui::readCameraSettings( %this, %levelName )
|
|
|
-{
|
|
|
- if( %levelName !$= %this.levelName )
|
|
|
- return;
|
|
|
+ %fileMenu.appendItem("-");
|
|
|
+ %fileMenu.appendItem("Play Level" TAB "F11" TAB "Editor.close(\"PlayGui\");");
|
|
|
|
|
|
- EditorCameraSpeedOptions.setupGuiControls();
|
|
|
-}
|
|
|
-
|
|
|
-function EditorGui::writeCameraSettings( %this )
|
|
|
-{
|
|
|
- EditorSettings.beginGroup( "LevelInformation/levels/" @ %this.levelName );
|
|
|
-
|
|
|
- EditorSettings.setValue( "cameraSpeed", $Camera::movementSpeed );
|
|
|
-
|
|
|
- EditorSettings.endGroup();
|
|
|
-}
|
|
|
-
|
|
|
-//------------------------------------------------------------------------------
|
|
|
-
|
|
|
-function EditorGui::shutdown( %this )
|
|
|
-{
|
|
|
- // Store settings.
|
|
|
- %this.writeWorldEditorSettings();
|
|
|
-
|
|
|
- // Deactivate current editor.
|
|
|
- %this.setEditor( "" );
|
|
|
-
|
|
|
- // Call the shutdown callback on the editor plugins.
|
|
|
- foreach( %plugin in EditorPluginSet )
|
|
|
- %plugin.onWorldEditorShutdown();
|
|
|
-}
|
|
|
+ %fileMenu.appendItem("Exit Level" TAB "" TAB "EditorExitMission();");
|
|
|
+ %fileMenu.appendItem("Quit" TAB %quitShortcut TAB "EditorQuitGame();");
|
|
|
|
|
|
-/// This is used to add an editor to the Editors menu which
|
|
|
-/// will take over the default world editor window.
|
|
|
-function EditorGui::addToEditorsMenu( %this, %displayName, %accel, %newPlugin )
|
|
|
-{
|
|
|
- %windowMenu = %this.findMenu( "Editors" );
|
|
|
- %count = %windowMenu.getItemCount();
|
|
|
-
|
|
|
-
|
|
|
- %alreadyExists = false;
|
|
|
- for ( %i = 0; %i < %count; %i++ )
|
|
|
- {
|
|
|
- %existingPlugins = getField(%windowMenu.Item[%i], 2);
|
|
|
-
|
|
|
- if(%newPlugin $= %existingPlugins)
|
|
|
- %alreadyExists = true;
|
|
|
- }
|
|
|
+ %this.menuBar.insert(%fileMenu);
|
|
|
|
|
|
- if( %accel $= "" && %count < 9 )
|
|
|
- %accel = "F" @ %count + 1;
|
|
|
- else
|
|
|
- %accel = "";
|
|
|
+ // Edit Menu
|
|
|
+ %editMenu = new PopupMenu()
|
|
|
+ {
|
|
|
+ superClass = "MenuBuilder";
|
|
|
+ class = "EditorEditMenu";
|
|
|
+ internalName = "EditMenu";
|
|
|
+
|
|
|
+ barTitle = "Edit";
|
|
|
|
|
|
- if(!%alreadyExists)
|
|
|
- %windowMenu.addItem( %count, %displayName TAB %accel TAB %newPlugin );
|
|
|
+ item[0] = "Undo" TAB %cmdCtrl SPC "Z" TAB "Editor.getUndoManager().undo();";
|
|
|
+ item[1] = "Redo" TAB %redoShortcut TAB "Editor.getUndoManager().redo();";
|
|
|
+ item[2] = "-";
|
|
|
+ item[3] = "Cut" TAB %cmdCtrl SPC "X" TAB "EditorMenuEditCut();";
|
|
|
+ item[4] = "Copy" TAB %cmdCtrl SPC "C" TAB "EditorMenuEditCopy();";
|
|
|
+ item[5] = "Paste" TAB %cmdCtrl SPC "V" TAB "EditorMenuEditPaste();";
|
|
|
+ item[6] = "Delete" TAB "Delete" TAB "EditorMenuEditDelete();";
|
|
|
+ item[7] = "-";
|
|
|
+ item[8] = "Deselect" TAB "X" TAB "EditorMenuEditDeselect();";
|
|
|
+ Item[9] = "Select..." TAB "" TAB "EditorGui.toggleObjectSelectionsWindow();";
|
|
|
+ item[10] = "-";
|
|
|
+ item[11] = "Audio Parameters..." TAB "" TAB "EditorGui.toggleSFXParametersWindow();";
|
|
|
+ item[12] = "Editor Settings..." TAB "" TAB "ESettingsWindow.ToggleVisibility();";
|
|
|
+ item[13] = "Snap Options..." TAB "" TAB "ESnapOptions.ToggleVisibility();";
|
|
|
+ item[14] = "-";
|
|
|
+ item[15] = "Game Options..." TAB "" TAB "Canvas.pushDialog(optionsDlg);";
|
|
|
+ item[16] = "PostEffect Manager" TAB "" TAB "Canvas.pushDialog(PostFXManager);";
|
|
|
+ };
|
|
|
+ %this.menuBar.insert(%editMenu);
|
|
|
|
|
|
- return %accel;
|
|
|
-}
|
|
|
+ // View Menu
|
|
|
+ %viewMenu = new PopupMenu()
|
|
|
+ {
|
|
|
+ superClass = "MenuBuilder";
|
|
|
+ class = "EditorViewMenu";
|
|
|
+ internalName = "viewMenu";
|
|
|
|
|
|
-function EditorGui::addToToolsToolbar( %this, %pluginName, %internalName, %bitmap, %tooltip )
|
|
|
-{
|
|
|
- %count = ToolsToolbarArray.getCount();
|
|
|
-
|
|
|
- %alreadyExists = false;
|
|
|
- for ( %i = 0; %i < %count; %i++ )
|
|
|
- {
|
|
|
- %existingInternalName = ToolsToolbarArray.getObject(%i).getFieldValue("internalName");
|
|
|
-
|
|
|
- if(%internalName $= %existingInternalName)
|
|
|
- {
|
|
|
- %alreadyExists = true;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
+ barTitle = "View";
|
|
|
+
|
|
|
+ item[ 0 ] = "Visibility Layers" TAB "Alt V" TAB "VisibilityDropdownToggle();";
|
|
|
+ item[ 1 ] = "Show Grid in Ortho Views" TAB %cmdCtrl @ "-Shift-Alt G" TAB "EditorGui.toggleOrthoGrid();";
|
|
|
+ };
|
|
|
+ %this.menuBar.insert(%viewMenu);
|
|
|
|
|
|
- if(!%alreadyExists)
|
|
|
+ // Camera Menu
|
|
|
+ %cameraMenu = new PopupMenu()
|
|
|
{
|
|
|
- %button = new GuiBitmapButtonCtrl() {
|
|
|
- canSaveDynamicFields = "0";
|
|
|
- internalName = %internalName;
|
|
|
- Enabled = "1";
|
|
|
- isContainer = "0";
|
|
|
- Profile = "ToolsGuiButtonProfile";
|
|
|
- HorizSizing = "right";
|
|
|
- VertSizing = "bottom";
|
|
|
- position = "180 0";
|
|
|
- Extent = "25 19";
|
|
|
- MinExtent = "8 2";
|
|
|
- canSave = "1";
|
|
|
- Visible = "1";
|
|
|
- Command = "EditorGui.setEditor(" @ %pluginName @ ");";
|
|
|
- tooltipprofile = "ToolsGuiToolTipProfile";
|
|
|
- ToolTip = %tooltip;
|
|
|
- hovertime = "750";
|
|
|
- bitmap = %bitmap;
|
|
|
- buttonType = "RadioButton";
|
|
|
- groupNum = "0";
|
|
|
- useMouseEvents = "0";
|
|
|
- };
|
|
|
- ToolsToolbarArray.add(%button);
|
|
|
- EWToolsToolbar.setExtent((25 + 8) * (%count + 1) + 12 SPC "33");
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-//-----------------------------------------------------------------------------
|
|
|
-
|
|
|
-function EditorGui::setDisplayType( %this, %type )
|
|
|
-{
|
|
|
- %gui = %this.currentEditor.editorGui;
|
|
|
- if( !isObject( %gui ) )
|
|
|
- return;
|
|
|
-
|
|
|
- %this.viewTypeMenu.checkRadioItem( 0, 7, %type );
|
|
|
-
|
|
|
- // Store the current camera rotation so we can restore it correctly when
|
|
|
- // switching back to perspective view
|
|
|
- if ( %gui.getDisplayType() == $EditTSCtrl::DisplayTypePerspective )
|
|
|
- %this.lastPerspectiveCamRotation = LocalClientConnection.camera.getRotation();
|
|
|
-
|
|
|
- %gui.setDisplayType( %type );
|
|
|
-
|
|
|
- if ( %gui.getDisplayType() == $EditTSCtrl::DisplayTypePerspective )
|
|
|
- LocalClientConnection.camera.setRotation( %this.lastPerspectiveCamRotation );
|
|
|
-
|
|
|
- %this.currentDisplayType = %type;
|
|
|
-}
|
|
|
-
|
|
|
-//-----------------------------------------------------------------------------
|
|
|
+ superClass = "MenuBuilder";
|
|
|
+ class = "EditorCameraMenu";
|
|
|
|
|
|
-function EditorGui::setEditor( %this, %newEditor, %dontActivate )
|
|
|
-{
|
|
|
- if ( isObject( %this.currentEditor ) )
|
|
|
+ barTitle = "Camera";
|
|
|
+
|
|
|
+ item[0] = "World Camera" TAB %this.freeCameraTypeMenu;
|
|
|
+ item[1] = "Player Camera" TAB %this.playerCameraTypeMenu;
|
|
|
+ item[2] = "-";
|
|
|
+ Item[3] = "Toggle Camera" TAB %menuCmdCtrl SPC "C" TAB "commandToServer('ToggleCamera');";
|
|
|
+ item[4] = "Place Camera at Selection" TAB "Ctrl Q" TAB "EWorldEditor.dropCameraToSelection();";
|
|
|
+ item[5] = "Place Camera at Player" TAB "Alt Q" TAB "commandToServer('dropCameraAtPlayer');";
|
|
|
+ item[6] = "Place Player at Camera" TAB "Alt W" TAB "commandToServer('DropPlayerAtCamera');";
|
|
|
+ item[7] = "-";
|
|
|
+ item[8] = "Fit View to Selection" TAB "F" TAB "commandToServer('EditorCameraAutoFit', EWorldEditor.getSelectionRadius()+1);";
|
|
|
+ item[9] = "Fit View To Selection and Orbit" TAB "Alt F" TAB "EditorGuiStatusBar.setCamera(\"Orbit Camera\"); commandToServer('EditorCameraAutoFit', EWorldEditor.getSelectionRadius()+1);";
|
|
|
+ item[10] = "-";
|
|
|
+ item[11] = "Speed" TAB %this.cameraSpeedMenu;
|
|
|
+ item[12] = "View" TAB %this.viewTypeMenu;
|
|
|
+ item[13] = "-";
|
|
|
+ Item[14] = "Add Bookmark..." TAB "Ctrl B" TAB "EditorGui.addCameraBookmarkByGui();";
|
|
|
+ Item[15] = "Manage Bookmarks..." TAB "Ctrl-Shift B" TAB "EditorGui.toggleCameraBookmarkWindow();";
|
|
|
+ item[16] = "Jump to Bookmark" TAB %this.cameraBookmarksMenu;
|
|
|
+ };
|
|
|
+ %this.menuBar.insert(%cameraMenu);
|
|
|
+
|
|
|
+ // Editors Menu
|
|
|
+ %editorsMenu = new PopupMenu()
|
|
|
{
|
|
|
- if( isObject( %newEditor ) && %this.currentEditor.getId() == %newEditor.getId() )
|
|
|
- return;
|
|
|
+ superClass = "MenuBuilder";
|
|
|
+ class = "EditorToolsMenu";
|
|
|
|
|
|
- if( %this.currentEditor.isActivated )
|
|
|
- %this.currentEditor.onDeactivated();
|
|
|
+ barTitle = "Editors";
|
|
|
|
|
|
- if( isObject( %this.currentEditor.editorGui ) )
|
|
|
- %this.currentOrthoFOV = %this.currentEditor.editorGui.getOrthoFOV();
|
|
|
- }
|
|
|
-
|
|
|
- if( !isObject( %newEditor ) )
|
|
|
- {
|
|
|
- %this.currentEditor = "";
|
|
|
- return;
|
|
|
- }
|
|
|
+ //item[0] = "Object Editor" TAB "F1" TAB WorldEditorInspectorPlugin;
|
|
|
+ //item[1] = "Material Editor" TAB "F2" TAB MaterialEditorPlugin;
|
|
|
+ //item[2] = "-";
|
|
|
+ //item[3] = "Terrain Editor" TAB "F3" TAB TerrainEditorPlugin;
|
|
|
+ //item[4] = "Terrain Painter" TAB "F4" TAB TerrainPainterPlugin;
|
|
|
+ //item[5] = "-";
|
|
|
+ };
|
|
|
+ %this.menuBar.insert(%editorsMenu);
|
|
|
|
|
|
- // If we have a special set editor function, run that instead
|
|
|
- if( %newEditor.isMethod( "setEditorFunction" ) )
|
|
|
+ // Lighting Menu
|
|
|
+ %lightingMenu = new PopupMenu()
|
|
|
{
|
|
|
- if( %newEditor.setEditorFunction() )
|
|
|
- {
|
|
|
- %this.syncEditor( %newEditor );
|
|
|
- %this.currentEditor = %newEditor;
|
|
|
+ superClass = "MenuBuilder";
|
|
|
+ class = "EditorLightingMenu";
|
|
|
+
|
|
|
+ barTitle = "Lighting";
|
|
|
|
|
|
- if (!%dontActivate)
|
|
|
- %this.currentEditor.onActivated();
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- // if were falling back and were the same editor, why are we going to just shove ourself
|
|
|
- // into the editor position again? opt for a fallback
|
|
|
- if( !isObject( %this.currentEditor ) )
|
|
|
- %this.currentEditor = "WorldEditorInspectorPlugin";
|
|
|
- else if( %this.currentEditor.getId() == %newEditor.getId() )
|
|
|
- %this.currentEditor = "WorldEditorInspectorPlugin";
|
|
|
-
|
|
|
- %this.syncEditor( %this.currentEditor, true );
|
|
|
+ item[0] = "Full Relight" TAB "Alt L" TAB "Editor.lightScene(\"\", forceAlways);";
|
|
|
+ item[1] = "Toggle ShadowViz" TAB "" TAB "toggleShadowViz();";
|
|
|
+ item[2] = "-";
|
|
|
|
|
|
- if( !%dontActivate )
|
|
|
- %this.currentEditor.onActivated();
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- %this.syncEditor( %newEditor );
|
|
|
- %this.currentEditor = %newEditor;
|
|
|
-
|
|
|
- if( !%dontActivate )
|
|
|
- %this.currentEditor.onActivated();
|
|
|
- }
|
|
|
-
|
|
|
- // Sync display type.
|
|
|
+ // NOTE: The light managers will be inserted as the
|
|
|
+ // last menu items in EditorLightingMenu::onAdd().
|
|
|
+ };
|
|
|
+ %this.menuBar.insert(%lightingMenu);
|
|
|
|
|
|
- %gui = %this.currentEditor.editorGui;
|
|
|
- if( isObject( %gui ) )
|
|
|
+ // Tools Menu
|
|
|
+ %toolsMenu = new PopupMenu()
|
|
|
{
|
|
|
- %gui.setDisplayType( %this.currentDisplayType );
|
|
|
- %gui.setOrthoFOV( %this.currentOrthoFOV );
|
|
|
- EditorGui.syncCameraGui();
|
|
|
- }
|
|
|
-}
|
|
|
+ superClass = "MenuBuilder";
|
|
|
+ class = "EditorUtilitiesMenu";
|
|
|
|
|
|
-function EditorGui::syncEditor( %this, %newEditor, %newEditorFailed )
|
|
|
-{
|
|
|
- // Sync with menu bar
|
|
|
- %menu = %this.findMenu( "Editors" );
|
|
|
- %count = %menu.getItemCount();
|
|
|
- for ( %i = 0; %i < %count; %i++ )
|
|
|
- {
|
|
|
- %pluginObj = getField( %menu.item[%i], 2 );
|
|
|
- if ( %pluginObj $= %newEditor )
|
|
|
- {
|
|
|
- %menu.checkRadioItem( 0, %count, %i );
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // In order to hook up a palette, the word Palette must be able to be
|
|
|
- // switched out in order to read correctly, if not, no palette will be used
|
|
|
- %paletteName = strreplace(%newEditor, "Plugin", "Palette");
|
|
|
-
|
|
|
- // Sync with ToolsToolbar
|
|
|
- for ( %i = 0; %i < ToolsToolbarArray.getCount(); %i++ )
|
|
|
- {
|
|
|
- %toolbarButton = ToolsToolbarArray.getObject(%i).internalName;
|
|
|
- if( %paletteName $= %toolbarButton )
|
|
|
- {
|
|
|
- ToolsToolbarArray.getObject(%i).setStateOn(1);
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // Handles quit game and gui editor changes in wierd scenarios
|
|
|
- if( %newEditorFailed && EWToolsToolbar.isDynamic )
|
|
|
- {
|
|
|
- if( EWToolsToolbar.isClosed )
|
|
|
- EWToolsToolbar.reset();
|
|
|
- EWToolsToolbar.toggleSize();
|
|
|
- }
|
|
|
-
|
|
|
- // Toggle the editor specific palette; we define special cases here
|
|
|
- switch$ ( %paletteName )
|
|
|
- {
|
|
|
- case "MaterialEditorPalette":
|
|
|
- %paletteName = "WorldEditorInspectorPalette";
|
|
|
- case "DatablockEditorPalette":
|
|
|
- %paletteName = "WorldEditorInspectorPalette";
|
|
|
- case "ParticleEditorPalette":
|
|
|
- %paletteName = "WorldEditorInspectorPalette";
|
|
|
- }
|
|
|
+ barTitle = "Tools";
|
|
|
+
|
|
|
+ item[0] = "Network Graph" TAB "n" TAB "toggleNetGraph();";
|
|
|
+ item[1] = "Profiler" TAB "ctrl F2" TAB "showMetrics(true);";
|
|
|
+ item[2] = "Torque SimView" TAB "" TAB "tree();";
|
|
|
+ item[3] = "Make Selected a Mesh" TAB "" TAB "makeSelectedAMesh();";
|
|
|
+ };
|
|
|
+ %this.menuBar.insert(%toolsMenu);
|
|
|
|
|
|
- %this-->ToolsPaletteWindow.togglePalette(%paletteName);
|
|
|
-}
|
|
|
-
|
|
|
-function EditorGui::onWake( %this )
|
|
|
-{
|
|
|
- EHWorldEditor.setStateOn( 1 );
|
|
|
-
|
|
|
- // Notify the editor plugins that the editor has started.
|
|
|
-
|
|
|
- foreach( %plugin in EditorPluginSet )
|
|
|
- %plugin.onEditorWake();
|
|
|
-
|
|
|
- // Push the ActionMaps in the order that we want to have them
|
|
|
- // before activating an editor plugin, so that if the plugin
|
|
|
- // installs an ActionMap, it will be highest on the stack.
|
|
|
-
|
|
|
- MoveMap.push();
|
|
|
- EditorMap.push();
|
|
|
-
|
|
|
- // Active the current editor plugin.
|
|
|
-
|
|
|
- if( !%this.currentEditor.isActivated )
|
|
|
- %this.currentEditor.onActivated();
|
|
|
-
|
|
|
- %slashPos = 0;
|
|
|
- while( strpos( $Server::MissionFile, "/", %slashPos ) != -1 )
|
|
|
+ // Help Menu
|
|
|
+ %helpMenu = new PopupMenu()
|
|
|
{
|
|
|
- %slashPos = strpos( $Server::MissionFile, "/", %slashPos ) + 1;
|
|
|
- }
|
|
|
- %levelName = getSubStr( $Server::MissionFile , %slashPos , 99 );
|
|
|
-
|
|
|
- if( %levelName !$= %this.levelName )
|
|
|
- %this.onNewLevelLoaded( %levelName );
|
|
|
-}
|
|
|
+ superClass = "MenuBuilder";
|
|
|
+ class = "EditorHelpMenu";
|
|
|
|
|
|
-function EditorGui::onSleep( %this )
|
|
|
-{
|
|
|
- // Deactivate the current editor plugin.
|
|
|
-
|
|
|
- if( %this.currentEditor.isActivated )
|
|
|
- %this.currentEditor.onDeactivated();
|
|
|
-
|
|
|
- // Remove the editor's ActionMaps.
|
|
|
-
|
|
|
- EditorMap.pop();
|
|
|
- MoveMap.pop();
|
|
|
+ barTitle = "Help";
|
|
|
|
|
|
- // Notify the editor plugins that the editor will be closing.
|
|
|
+ item[0] = "Online Documentation..." TAB "Alt F1" TAB "gotoWebPage(EWorldEditor.documentationURL);";
|
|
|
+ item[1] = "Offline User Guide..." TAB "" TAB "gotoWebPage(EWorldEditor.documentationLocal);";
|
|
|
+ item[2] = "Offline Reference Guide..." TAB "" TAB "shellexecute(EWorldEditor.documentationReference);";
|
|
|
+ item[3] = "Torque 3D Forums..." TAB "" TAB "gotoWebPage(EWorldEditor.forumURL);";
|
|
|
+ };
|
|
|
+ %this.menuBar.insert(%helpMenu);
|
|
|
|
|
|
- foreach( %plugin in EditorPluginSet )
|
|
|
- %plugin.onEditorSleep();
|
|
|
-
|
|
|
- if(isObject($Server::CurrentScene))
|
|
|
- $Server::CurrentScene.open();
|
|
|
-}
|
|
|
-
|
|
|
-function EditorGui::onNewLevelLoaded( %this, %levelName )
|
|
|
-{
|
|
|
- %this.levelName = %levelName;
|
|
|
- %this.setupDefaultCameraSettings();
|
|
|
- ECameraSettingsPage.init();
|
|
|
- EditorCameraSpeedOptions.setupDefaultState();
|
|
|
+ // Menus that are added/removed dynamically (temporary)
|
|
|
|
|
|
- new ScriptObject( EditorMissionCleanup )
|
|
|
+ // World Menu
|
|
|
+ if(! isObject(%this.worldMenu))
|
|
|
{
|
|
|
- parentGroup = "MissionCleanup";
|
|
|
- };
|
|
|
-}
|
|
|
+ %this.dropTypeMenu = new PopupMenu()
|
|
|
+ {
|
|
|
+ superClass = "MenuBuilder";
|
|
|
+ class = "EditorDropTypeMenu";
|
|
|
|
|
|
-function EditorMissionCleanup::onRemove( %this )
|
|
|
-{
|
|
|
- EditorGui.levelName = "";
|
|
|
- foreach( %plugin in EditorPluginSet )
|
|
|
- %plugin.onExitMission();
|
|
|
-}
|
|
|
+ // The onSelectItem() callback for this menu re-purposes the command field
|
|
|
+ // as the MenuBuilder version is not used.
|
|
|
+ item[0] = "at Origin" TAB "" TAB "atOrigin";
|
|
|
+ item[1] = "at Camera" TAB "" TAB "atCamera";
|
|
|
+ item[2] = "at Camera w/Rotation" TAB "" TAB "atCameraRot";
|
|
|
+ item[3] = "Below Camera" TAB "" TAB "belowCamera";
|
|
|
+ item[4] = "Screen Center" TAB "" TAB "screenCenter";
|
|
|
+ item[5] = "at Centroid" TAB "" TAB "atCentroid";
|
|
|
+ item[6] = "to Terrain" TAB "" TAB "toTerrain";
|
|
|
+ item[7] = "Below Selection" TAB "" TAB "belowSelection";
|
|
|
+ item[8] = "At Gizmo" TAB "" TAB "atGizmo";
|
|
|
+ };
|
|
|
+
|
|
|
+ %this.alignBoundsMenu = new PopupMenu()
|
|
|
+ {
|
|
|
+ superClass = "MenuBuilder";
|
|
|
+ class = "EditorAlignBoundsMenu";
|
|
|
|
|
|
-//-----------------------------------------------------------------------------
|
|
|
+ // The onSelectItem() callback for this menu re-purposes the command field
|
|
|
+ // as the MenuBuilder version is not used.
|
|
|
+ item[0] = "+X Axis" TAB "" TAB "0";
|
|
|
+ item[1] = "+Y Axis" TAB "" TAB "1";
|
|
|
+ item[2] = "+Z Axis" TAB "" TAB "2";
|
|
|
+ item[3] = "-X Axis" TAB "" TAB "3";
|
|
|
+ item[4] = "-Y Axis" TAB "" TAB "4";
|
|
|
+ item[5] = "-Z Axis" TAB "" TAB "5";
|
|
|
+ };
|
|
|
+
|
|
|
+ %this.alignCenterMenu = new PopupMenu()
|
|
|
+ {
|
|
|
+ superClass = "MenuBuilder";
|
|
|
+ class = "EditorAlignCenterMenu";
|
|
|
|
|
|
-// Called when we have been set as the content and onWake has been called
|
|
|
-function EditorGui::onSetContent(%this, %oldContent)
|
|
|
-{
|
|
|
- %this.attachMenus();
|
|
|
-}
|
|
|
+ // The onSelectItem() callback for this menu re-purposes the command field
|
|
|
+ // as the MenuBuilder version is not used.
|
|
|
+ item[0] = "X Axis" TAB "" TAB "0";
|
|
|
+ item[1] = "Y Axis" TAB "" TAB "1";
|
|
|
+ item[2] = "Z Axis" TAB "" TAB "2";
|
|
|
+ };
|
|
|
+
|
|
|
+ %this.worldMenu = new PopupMenu()
|
|
|
+ {
|
|
|
+ superClass = "MenuBuilder";
|
|
|
+ class = "EditorWorldMenu";
|
|
|
|
|
|
-// Called before onSleep when the canvas content is changed
|
|
|
-function EditorGui::onUnsetContent(%this, %newContent)
|
|
|
-{
|
|
|
- %this.detachMenus();
|
|
|
+ barTitle = "Object";
|
|
|
+
|
|
|
+ item[0] = "Lock Selection" TAB %cmdCtrl @ " L" TAB "EWorldEditor.lockSelection(true); EWorldEditor.syncGui();";
|
|
|
+ item[1] = "Unlock Selection" TAB %cmdCtrl @ "-Shift L" TAB "EWorldEditor.lockSelection(false); EWorldEditor.syncGui();";
|
|
|
+ item[2] = "-";
|
|
|
+ item[3] = "Hide Selection" TAB %cmdCtrl @ " H" TAB "EWorldEditor.hideSelection(true); EWorldEditor.syncGui();";
|
|
|
+ item[4] = "Show Selection" TAB %cmdCtrl @ "-Shift H" TAB "EWorldEditor.hideSelection(false); EWorldEditor.syncGui();";
|
|
|
+ item[5] = "-";
|
|
|
+ item[6] = "Align Bounds" TAB %this.alignBoundsMenu;
|
|
|
+ item[7] = "Align Center" TAB %this.alignCenterMenu;
|
|
|
+ item[8] = "-";
|
|
|
+ item[9] = "Reset Transforms" TAB "Ctrl R" TAB "EWorldEditor.resetTransforms();";
|
|
|
+ item[10] = "Reset Selected Rotation" TAB "" TAB "EWorldEditor.resetSelectedRotation();";
|
|
|
+ item[11] = "Reset Selected Scale" TAB "" TAB "EWorldEditor.resetSelectedScale();";
|
|
|
+ item[12] = "Transform Selection..." TAB "Ctrl T" TAB "ETransformSelection.ToggleVisibility();";
|
|
|
+ item[13] = "-";
|
|
|
+ //item[13] = "Drop Camera to Selection" TAB "Ctrl Q" TAB "EWorldEditor.dropCameraToSelection();";
|
|
|
+ //item[14] = "Add Selection to Instant Group" TAB "" TAB "EWorldEditor.addSelectionToAddGroup();";
|
|
|
+ item[14] = "Drop Selection" TAB "Ctrl D" TAB "EWorldEditor.dropSelection();";
|
|
|
+ //item[15] = "-";
|
|
|
+ item[15] = "Drop Location" TAB %this.dropTypeMenu;
|
|
|
+ Item[16] = "-";
|
|
|
+ Item[17] = "Make Selection Prefab" TAB "" TAB "EditorMakePrefab();";
|
|
|
+ Item[18] = "Explode Selected Prefab" TAB "" TAB "EditorExplodePrefab();";
|
|
|
+ Item[19] = "-";
|
|
|
+ Item[20] = "Mount Selection A to B" TAB "" TAB "EditorMount();";
|
|
|
+ Item[21] = "Unmount Selected Object" TAB "" TAB "EditorUnmount();";
|
|
|
+ };
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
-//------------------------------------------------------------------------------
|
|
|
+//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
-function EditorGui::toggleSFXParametersWindow( %this )
|
|
|
+function EditorGui::attachMenus(%this)
|
|
|
{
|
|
|
- %window = %this-->ManageSFXParametersWindow;
|
|
|
- %window.setVisible( !%window.isVisible() );
|
|
|
+ %this.menuBar.attachToCanvas(Canvas, 0);
|
|
|
}
|
|
|
|
|
|
-//------------------------------------------------------------------------------
|
|
|
-
|
|
|
-function EditorGui::addCameraBookmark( %this, %name )
|
|
|
+function EditorGui::detachMenus(%this)
|
|
|
{
|
|
|
- %obj = new CameraBookmark() {
|
|
|
- datablock = CameraBookmarkMarker;
|
|
|
- internalName = %name;
|
|
|
- };
|
|
|
+ %this.menuBar.removeFromCanvas();
|
|
|
+}
|
|
|
|
|
|
- // Place into correct group
|
|
|
- if( !isObject(CameraBookmarks) )
|
|
|
+function EditorGui::setMenuDefaultState(%this)
|
|
|
+{
|
|
|
+ if(! isObject(%this.menuBar))
|
|
|
+ return 0;
|
|
|
+
|
|
|
+ for(%i = 0;%i < %this.menuBar.getMenuCount();%i++)
|
|
|
{
|
|
|
- %grp = new SimGroup(CameraBookmarks);
|
|
|
- MissionGroup.add(%grp);
|
|
|
+ %menu = %this.menuBar.getMenu(%i);
|
|
|
+ %menu.setupDefaultState();
|
|
|
}
|
|
|
- CameraBookmarks.add( %obj );
|
|
|
-
|
|
|
- %cam = LocalClientConnection.camera.getTransform();
|
|
|
- %obj.setTransform( %cam );
|
|
|
|
|
|
- EWorldEditor.isDirty = true;
|
|
|
- EditorTree.buildVisibleTree(true);
|
|
|
-}
|
|
|
-
|
|
|
-function EditorGui::removeCameraBookmark( %this, %name )
|
|
|
-{
|
|
|
- if( !isObject(CameraBookmarks) )
|
|
|
- return;
|
|
|
-
|
|
|
- %mark = CameraBookmarks.findObjectByInternalName( %name, true );
|
|
|
- if( %mark == 0 )
|
|
|
- return;
|
|
|
-
|
|
|
- MEDeleteUndoAction::submit( %mark );
|
|
|
- EWorldEditor.isDirty = true;
|
|
|
- EditorTree.buildVisibleTree(true);
|
|
|
+ %this.worldMenu.setupDefaultState();
|
|
|
}
|
|
|
|
|
|
-function EditorGui::removeCameraBookmarkIndex( %this, %index )
|
|
|
-{
|
|
|
- if( !isObject(CameraBookmarks) )
|
|
|
- return;
|
|
|
-
|
|
|
- if( %index < 0 || %index >= CameraBookmarks.getCount() )
|
|
|
- return;
|
|
|
-
|
|
|
- %obj = CameraBookmarks.getObject( %index );
|
|
|
- MEDeleteUndoAction::submit( %obj );
|
|
|
- EWorldEditor.isDirty = true;
|
|
|
- EditorTree.buildVisibleTree(true);
|
|
|
-}
|
|
|
+//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
-function EditorGui::jumpToBookmark( %this, %name )
|
|
|
+function EditorGui::findMenu(%this, %name)
|
|
|
{
|
|
|
- if( !isObject(CameraBookmarks) )
|
|
|
- return;
|
|
|
-
|
|
|
- %mark = CameraBookmarks.findObjectByInternalName( %name, true );
|
|
|
- if( %mark == 0 )
|
|
|
- return;
|
|
|
+ if(! isObject(%this.menuBar))
|
|
|
+ return 0;
|
|
|
|
|
|
- LocalClientConnection.camera.setTransform( %mark.getTransform() );
|
|
|
- return;
|
|
|
-}
|
|
|
-
|
|
|
-function EditorGui::jumpToBookmarkIndex( %this, %index )
|
|
|
-{
|
|
|
- if( !isObject(CameraBookmarks) )
|
|
|
- return;
|
|
|
-
|
|
|
- if( %index < 0 || %index >= CameraBookmarks.getCount() )
|
|
|
- return;
|
|
|
-
|
|
|
- %trans = CameraBookmarks.getObject( %index ).getTransform();
|
|
|
- LocalClientConnection.camera.setTransform( %trans );
|
|
|
-}
|
|
|
-
|
|
|
-function EditorGui::addCameraBookmarkByGui( %this )
|
|
|
-{
|
|
|
- // look for a NewCamera name to grab
|
|
|
- for(%i = 0; ; %i++){
|
|
|
- %name = "NewCamera_" @ %i;
|
|
|
- if( !CameraBookmarks.findObjectByInternalName(%name) ){
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- EditorGui.addCameraBookmark( %name );
|
|
|
-}
|
|
|
-
|
|
|
-function EditorGui::toggleCameraBookmarkWindow( %this )
|
|
|
-{
|
|
|
- EManageBookmarks.ToggleVisibility();
|
|
|
-}
|
|
|
-
|
|
|
-function EditorGui::toggleObjectSelectionsWindow( %this )
|
|
|
-{
|
|
|
- ESelectObjectsWindow.toggleVisibility();
|
|
|
-}
|
|
|
-
|
|
|
-function EditorGui::toggleOrthoGrid( %this )
|
|
|
-{
|
|
|
- EWorldEditor.renderOrthoGrid = !EWorldEditor.renderOrthoGrid;
|
|
|
-}
|
|
|
-
|
|
|
-//------------------------------------------------------------------------------
|
|
|
-
|
|
|
-function EditorGui::syncCameraGui( %this )
|
|
|
-{
|
|
|
- if( !EditorIsActive() )
|
|
|
- return;
|
|
|
-
|
|
|
- // Sync projection type
|
|
|
- %displayType = %this.currentEditor.editorGui.getDisplayType();
|
|
|
- %this.viewTypeMenu.checkRadioItem( 0, 7, %displayType );
|
|
|
-
|
|
|
- // Set the camera object's mode and rotation so that it moves correctly
|
|
|
- // based on the current editor mode
|
|
|
- if( %displayType != $EditTSCtrl::DisplayTypePerspective )
|
|
|
+
|
|
|
+ for(%i = 0; %i < %this.menuBar.getMenuCount(); %i++)
|
|
|
{
|
|
|
- switch( %displayType )
|
|
|
- {
|
|
|
- case $EditTSCtrl::DisplayTypeTop: %name = "Top View"; %camRot = "0 0 0";
|
|
|
- case $EditTSCtrl::DisplayTypeBottom: %name = "Bottom View"; %camRot = "3.14159 0 0";
|
|
|
- case $EditTSCtrl::DisplayTypeLeft: %name = "Left View"; %camRot = "-1.571 0 1.571";
|
|
|
- case $EditTSCtrl::DisplayTypeRight: %name = "Right View"; %camRot = "-1.571 0 -1.571";
|
|
|
- case $EditTSCtrl::DisplayTypeFront: %name = "Front View"; %camRot = "-1.571 0 3.14159";
|
|
|
- case $EditTSCtrl::DisplayTypeBack: %name = "Back View"; %camRot = "-1.571 0 0";
|
|
|
- case $EditTSCtrl::DisplayTypeIsometric: %name = "Isometric View"; %camRot = "0 0 0";
|
|
|
- }
|
|
|
-
|
|
|
- LocalClientConnection.camera.controlMode = "Fly";
|
|
|
- LocalClientConnection.camera.setRotation( %camRot );
|
|
|
- EditorGuiStatusBar.setCamera( %name );
|
|
|
- return;
|
|
|
+ %menu = %this.menuBar.getMenu(%i);
|
|
|
+
|
|
|
+ if(%name $= %menu.barTitle)
|
|
|
+ return %menu;
|
|
|
}
|
|
|
-
|
|
|
- // Sync camera settings.
|
|
|
- %flyModeRadioItem = -1;
|
|
|
- if(LocalClientConnection.getControlObject() != LocalClientConnection.player)
|
|
|
- {
|
|
|
- %mode = LocalClientConnection.camera.getMode();
|
|
|
-
|
|
|
- if(%mode $= "Fly" && LocalClientConnection.camera.newtonMode)
|
|
|
- {
|
|
|
- if(LocalClientConnection.camera.newtonRotation == true)
|
|
|
- {
|
|
|
- EditorGui-->NewtonianRotationCamera.setStateOn(true);
|
|
|
- EWorldEditorToggleCamera.setBitmap("tools/gui/images/menubar/smooth-cam-rot");
|
|
|
- %flyModeRadioItem = 4;
|
|
|
- EditorGuiStatusBar.setCamera("Smooth Rot Camera");
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- EditorGui-->NewtonianCamera.setStateOn(true);
|
|
|
- EWorldEditorToggleCamera.setBitmap("tools/gui/images/menubar/smooth-cam");
|
|
|
- %flyModeRadioItem = 3;
|
|
|
- EditorGuiStatusBar.setCamera("Smooth Camera");
|
|
|
- }
|
|
|
- }
|
|
|
- else if(%mode $= "EditOrbit")
|
|
|
- {
|
|
|
- EditorGui-->OrbitCamera.setStateOn(true);
|
|
|
- EWorldEditorToggleCamera.setBitmap("tools/gui/images/menubar/orbit-cam");
|
|
|
- %flyModeRadioItem = 1;
|
|
|
- EditorGuiStatusBar.setCamera("Orbit Camera");
|
|
|
- }
|
|
|
- else // default camera mode
|
|
|
- {
|
|
|
- EditorGui-->StandardCamera.setStateOn(true);
|
|
|
- EWorldEditorToggleCamera.setBitmap("tools/worldEditor/images/toolbar/camera");
|
|
|
- %flyModeRadioItem = 0;
|
|
|
- EditorGuiStatusBar.setCamera("Standard Camera");
|
|
|
- }
|
|
|
-
|
|
|
- //quick way select menu bar options
|
|
|
- %this.findMenu( "Camera" ).checkRadioItem( 0, 1, 0 );
|
|
|
- EditorFreeCameraTypeOptions.checkRadioItem( 0, 4, %flyModeRadioItem);
|
|
|
- EditorPlayerCameraTypeOptions.checkRadioItem( 0, 4, -1);
|
|
|
- }
|
|
|
- else if (!$isFirstPersonVar) // if 3rd person
|
|
|
- {
|
|
|
- EditorGui-->trdPersonCamera.setStateOn(true);
|
|
|
- EWorldEditorToggleCamera.setBitmap("tools/worldEditor/images/toolbar/3rd-person-camera");
|
|
|
- %flyModeRadioItem = 1;
|
|
|
- //quick way select menu bar options
|
|
|
- %this.findMenu( "Camera" ).checkRadioItem( 0, 1, 1 );
|
|
|
- EditorPlayerCameraTypeOptions.checkRadioItem( 0, 2, %flyModeRadioItem);
|
|
|
- EditorGuiStatusBar.setCamera("3rd Person Camera");
|
|
|
- }
|
|
|
- else if ($isFirstPersonVar) // if 1st Person
|
|
|
- {
|
|
|
- EditorGui-->PlayerCamera.setStateOn(true);
|
|
|
- EWorldEditorToggleCamera.setBitmap("tools/worldEditor/images/toolbar/player");
|
|
|
- %flyModeRadioItem = 0;
|
|
|
- //quick way select menu bar options
|
|
|
- %this.findMenu( "Camera" ).checkRadioItem( 0, 1, 1 );
|
|
|
- EditorPlayerCameraTypeOptions.checkRadioItem( 0, 2, %flyModeRadioItem);
|
|
|
- EditorFreeCameraTypeOptions.checkRadioItem( 0, 4, -1);
|
|
|
- EditorGuiStatusBar.setCamera("1st Person Camera");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-/// @name EditorPlugin Methods
|
|
|
-/// @{
|
|
|
-
|
|
|
-//------------------------------------------------------------------------------
|
|
|
-// WorldEditorPlugin
|
|
|
-//------------------------------------------------------------------------------
|
|
|
-
|
|
|
-function WorldEditorPlugin::onActivated( %this )
|
|
|
-{
|
|
|
- EditorGui.bringToFront( EWorldEditor );
|
|
|
- EWorldEditor.setVisible(true);
|
|
|
- EditorGui.menuBar.insert( EditorGui.worldMenu, EditorGui.menuBar.dynamicItemInsertPos );
|
|
|
- EWorldEditor.makeFirstResponder(true);
|
|
|
- EditorTree.open(MissionGroup,true);
|
|
|
- EWCreatorWindow.setNewObjectGroup(MissionGroup);
|
|
|
-
|
|
|
- EWorldEditor.syncGui();
|
|
|
-
|
|
|
- EditorGuiStatusBar.setSelectionObjectsByCount(EWorldEditor.getSelectionSize());
|
|
|
-
|
|
|
- // Should the Transform Selection window open?
|
|
|
- if( EWorldEditor.ETransformSelectionDisplayed )
|
|
|
- {
|
|
|
- ETransformSelection.setVisible(true);
|
|
|
- }
|
|
|
-
|
|
|
- Parent::onActivated(%this);
|
|
|
-}
|
|
|
-
|
|
|
-function WorldEditorPlugin::onDeactivated( %this )
|
|
|
-{
|
|
|
- // Hide the Transform Selection window from other editors
|
|
|
- ETransformSelection.setVisible(false);
|
|
|
-
|
|
|
- EWorldEditor.setVisible( false );
|
|
|
- EditorGui.menuBar.remove( EditorGui.worldMenu );
|
|
|
-
|
|
|
- Parent::onDeactivated(%this);
|
|
|
-}
|
|
|
-
|
|
|
-//------------------------------------------------------------------------------
|
|
|
-// WorldEditorInspectorPlugin
|
|
|
-//------------------------------------------------------------------------------
|
|
|
-
|
|
|
-function WorldEditorInspectorPlugin::onWorldEditorStartup( %this )
|
|
|
-{
|
|
|
- Parent::onWorldEditorStartup( %this );
|
|
|
-
|
|
|
- // Add ourselves to the window menu.
|
|
|
- %accel = EditorGui.addToEditorsMenu( "Object Editor", "", WorldEditorInspectorPlugin );
|
|
|
-
|
|
|
- // Add ourselves to the ToolsToolbar
|
|
|
- %tooltip = "Object Editor (" @ %accel @ ")";
|
|
|
- EditorGui.addToToolsToolbar( "WorldEditorInspectorPlugin", "WorldEditorInspectorPalette", expandFilename("tools/worldEditor/images/toolbar/transform-objects"), %tooltip );
|
|
|
-
|
|
|
- //connect editor windows
|
|
|
- GuiWindowCtrl::attach( EWInspectorWindow, EWTreeWindow);
|
|
|
-
|
|
|
- %map = new ActionMap();
|
|
|
- %map.bindCmd( keyboard, "1", "EWorldEditorNoneModeBtn.performClick();", "" ); // Select
|
|
|
- %map.bindCmd( keyboard, "2", "EWorldEditorMoveModeBtn.performClick();", "" ); // Move
|
|
|
- %map.bindCmd( keyboard, "3", "EWorldEditorRotateModeBtn.performClick();", "" ); // Rotate
|
|
|
- %map.bindCmd( keyboard, "4", "EWorldEditorScaleModeBtn.performClick();", "" ); // Scale
|
|
|
- %map.bindCmd( keyboard, "f", "FitToSelectionBtn.performClick();", "" );// Fit Camera to Selection
|
|
|
- %map.bindCmd( keyboard, "z", "EditorGuiStatusBar.setCamera(\"Standard Camera\");", "" );// Free camera
|
|
|
- %map.bindCmd( keyboard, "n", "ToggleNodeBar->renderHandleBtn.performClick();", "" );// Render Node
|
|
|
- %map.bindCmd( keyboard, "shift n", "ToggleNodeBar->renderTextBtn.performClick();", "" );// Render Node Text
|
|
|
- %map.bindCmd( keyboard, "g", "ESnapOptions-->GridSnapButton.performClick();" ); // Grid Snappping
|
|
|
- %map.bindCmd( keyboard, "t", "SnapToBar->objectSnapDownBtn.performClick();", "" );// Terrain Snapping
|
|
|
- %map.bindCmd( keyboard, "b", "SnapToBar-->objectSnapBtn.performClick();" ); // Soft Snappping
|
|
|
- %map.bindCmd( keyboard, "v", "EWorldEditorToolbar->boundingBoxColBtn.performClick();", "" );// Bounds Selection
|
|
|
- %map.bindCmd( keyboard, "o", "objectCenterDropdown->objectBoxBtn.performClick(); objectCenterDropdown.toggle();", "" );// Object Center
|
|
|
- %map.bindCmd( keyboard, "p", "objectCenterDropdown->objectBoundsBtn.performClick(); objectCenterDropdown.toggle();", "" );// Bounds Center
|
|
|
- %map.bindCmd( keyboard, "k", "objectTransformDropdown->objectTransformBtn.performClick(); objectTransformDropdown.toggle();", "" );// Object Transform
|
|
|
- %map.bindCmd( keyboard, "l", "objectTransformDropdown->worldTransformBtn.performClick(); objectTransformDropdown.toggle();", "" );// World Transform
|
|
|
-
|
|
|
- WorldEditorInspectorPlugin.map = %map;
|
|
|
-}
|
|
|
-
|
|
|
-function WorldEditorInspectorPlugin::onActivated( %this )
|
|
|
-{
|
|
|
- Parent::onActivated( %this );
|
|
|
-
|
|
|
- EditorGui-->InspectorWindow.setVisible( true );
|
|
|
- EditorGui-->TreeWindow.setVisible( true );
|
|
|
- EditorGui-->WorldEditorToolbar.setVisible( true );
|
|
|
- %this.map.push();
|
|
|
-}
|
|
|
-
|
|
|
-function WorldEditorInspectorPlugin::onDeactivated( %this )
|
|
|
-{
|
|
|
- Parent::onDeactivated( %this );
|
|
|
-
|
|
|
- EditorGui-->InspectorWindow.setVisible( false );
|
|
|
- EditorGui-->TreeWindow.setVisible( false );
|
|
|
- EditorGui-->WorldEditorToolbar.setVisible( false );
|
|
|
- %this.map.pop();
|
|
|
-}
|
|
|
-
|
|
|
-function WorldEditorInspectorPlugin::onEditMenuSelect( %this, %editMenu )
|
|
|
-{
|
|
|
- %canCutCopy = EWorldEditor.getSelectionSize() > 0;
|
|
|
- %editMenu.enableItem( 3, %canCutCopy ); // Cut
|
|
|
- %editMenu.enableItem( 4, %canCutCopy ); // Copy
|
|
|
- %editMenu.enableItem( 5, EWorldEditor.canPasteSelection() ); // Paste
|
|
|
-
|
|
|
- %selSize = EWorldEditor.getSelectionSize();
|
|
|
- %lockCount = EWorldEditor.getSelectionLockCount();
|
|
|
- %hideCount = EWorldEditor.getSelectionHiddenCount();
|
|
|
- %editMenu.enableItem( 6, %selSize > 0 && %lockCount != %selSize ); // Delete Selection
|
|
|
-
|
|
|
- %editMenu.enableItem( 8, %canCutCopy ); // Deselect
|
|
|
-}
|
|
|
-
|
|
|
-function WorldEditorInspectorPlugin::handleDelete( %this )
|
|
|
-{
|
|
|
- // The tree handles deletion and notifies the
|
|
|
- // world editor to clear its selection.
|
|
|
- //
|
|
|
- // This is because non-SceneObject elements like
|
|
|
- // SimGroups also need to be destroyed.
|
|
|
- //
|
|
|
- // See EditorTree::onObjectDeleteCompleted().
|
|
|
- %selSize = EWorldEditor.getSelectionSize();
|
|
|
- if( %selSize > 0 )
|
|
|
- EditorTree.deleteSelection();
|
|
|
-}
|
|
|
-
|
|
|
-function WorldEditorInspectorPlugin::handleDeselect()
|
|
|
-{
|
|
|
- EWorldEditor.clearSelection();
|
|
|
-}
|
|
|
-
|
|
|
-function WorldEditorInspectorPlugin::handleCut()
|
|
|
-{
|
|
|
- EWorldEditor.cutSelection();
|
|
|
-}
|
|
|
-
|
|
|
-function WorldEditorInspectorPlugin::handleCopy()
|
|
|
-{
|
|
|
- EWorldEditor.copySelection();
|
|
|
-}
|
|
|
-
|
|
|
-function WorldEditorInspectorPlugin::handlePaste()
|
|
|
-{
|
|
|
- EWorldEditor.pasteSelection();
|
|
|
-}
|
|
|
-
|
|
|
-//------------------------------------------------------------------------------
|
|
|
-// TerrainEditorPlugin
|
|
|
-//------------------------------------------------------------------------------
|
|
|
-
|
|
|
-function TerrainEditorPlugin::onWorldEditorStartup( %this )
|
|
|
-{
|
|
|
- Parent::onWorldEditorStartup( %this );
|
|
|
-
|
|
|
- // Add ourselves to the window menu.
|
|
|
- %accel = EditorGui.addToEditorsMenu( "Terrain Editor", "", TerrainEditorPlugin );
|
|
|
-
|
|
|
- // Add ourselves to the ToolsToolbar
|
|
|
- %tooltip = "Terrain Editor (" @ %accel @ ")";
|
|
|
- EditorGui.addToToolsToolbar( "TerrainEditorPlugin", "TerrainEditorPalette", expandFilename("tools/worldEditor/images/toolbar/sculpt-terrain"), %tooltip );
|
|
|
-
|
|
|
- %map = new ActionMap();
|
|
|
- %map.bindCmd( keyboard, "1", "ToolsPaletteArray->brushAdjustHeight.performClick();", "" ); //Grab Terrain
|
|
|
- %map.bindCmd( keyboard, "2", "ToolsPaletteArray->raiseHeight.performClick();", "" ); // Raise Height
|
|
|
- %map.bindCmd( keyboard, "3", "ToolsPaletteArray->lowerHeight.performClick();", "" ); // Lower Height
|
|
|
- %map.bindCmd( keyboard, "4", "ToolsPaletteArray->smoothHeight.performClick();", "" ); // Average Height
|
|
|
- %map.bindCmd( keyboard, "5", "ToolsPaletteArray->smoothSlope.performClick();", "" ); // Smooth Slope
|
|
|
- %map.bindCmd( keyboard, "6", "ToolsPaletteArray->paintNoise.performClick();", "" ); // Noise
|
|
|
- %map.bindCmd( keyboard, "7", "ToolsPaletteArray->flattenHeight.performClick();", "" ); // Flatten
|
|
|
- %map.bindCmd( keyboard, "8", "ToolsPaletteArray->setHeight.performClick();", "" ); // Set Height
|
|
|
- %map.bindCmd( keyboard, "9", "ToolsPaletteArray->setEmpty.performClick();", "" ); // Clear Terrain
|
|
|
- %map.bindCmd( keyboard, "0", "ToolsPaletteArray->clearEmpty.performClick();", "" ); // Restore Terrain
|
|
|
- %map.bindCmd( keyboard, "v", "EWTerrainEditToolbarBrushType->ellipse.performClick();", "" );// Circle Brush
|
|
|
- %map.bindCmd( keyboard, "b", "EWTerrainEditToolbarBrushType->box.performClick();", "" );// Box Brush
|
|
|
- %map.bindCmd( keyboard, "=", "TerrainEditorPlugin.keyboardModifyBrushSize(1);", "" );// +1 Brush Size
|
|
|
- %map.bindCmd( keyboard, "+", "TerrainEditorPlugin.keyboardModifyBrushSize(1);", "" );// +1 Brush Size
|
|
|
- %map.bindCmd( keyboard, "-", "TerrainEditorPlugin.keyboardModifyBrushSize(-1);", "" );// -1 Brush Size
|
|
|
- %map.bindCmd( keyboard, "[", "TerrainEditorPlugin.keyboardModifyBrushSize(-5);", "" );// -5 Brush Size
|
|
|
- %map.bindCmd( keyboard, "]", "TerrainEditorPlugin.keyboardModifyBrushSize(5);", "" );// +5 Brush Size
|
|
|
- /*%map.bindCmd( keyboard, "]", "TerrainBrushPressureTextEditContainer->textEdit.text += 5", "" );// +5 Pressure
|
|
|
- %map.bindCmd( keyboard, "[", "TerrainBrushPressureTextEditContainer->textEdit.text -= 5", "" );// -5 Pressure
|
|
|
- %map.bindCmd( keyboard, "'", "TerrainBrushSoftnessTextEditContainer->textEdit.text += 5", "" );// +5 Softness
|
|
|
- %map.bindCmd( keyboard, ";", "TerrainBrushSoftnessTextEditContainer->textEdit.text -= 5", "" );// -5 Softness*/
|
|
|
-
|
|
|
- TerrainEditorPlugin.map = %map;
|
|
|
-
|
|
|
- %this.terrainMenu = new PopupMenu()
|
|
|
- {
|
|
|
- superClass = "MenuBuilder";
|
|
|
-
|
|
|
- barTitle = "Terrain";
|
|
|
-
|
|
|
- item[0] = "Smooth Heightmap" TAB "" TAB "ETerrainEditor.onSmoothHeightmap();";
|
|
|
- };
|
|
|
-}
|
|
|
-
|
|
|
-function TerrainEditorPlugin::onActivated( %this )
|
|
|
-{
|
|
|
- Parent::onActivated( %this );
|
|
|
-
|
|
|
- EditorGui.readTerrainEditorSettings();
|
|
|
-
|
|
|
- %action = EditorSettings.value("TerrainEditor/currentAction");
|
|
|
- ETerrainEditor.switchAction( %action );
|
|
|
- ToolsPaletteArray.findObjectByInternalName( %action, true ).setStateOn( true );
|
|
|
-
|
|
|
- EWTerrainEditToolbarBrushType->ellipse.performClick(); // Circle Brush
|
|
|
-
|
|
|
- EditorGui.menuBar.insert( %this.terrainMenu, EditorGui.menuBar.dynamicItemInsertPos );
|
|
|
-
|
|
|
- EditorGui.bringToFront( ETerrainEditor );
|
|
|
- ETerrainEditor.setVisible( true );
|
|
|
- ETerrainEditor.attachTerrain();
|
|
|
- ETerrainEditor.makeFirstResponder( true );
|
|
|
-
|
|
|
- EWTerrainEditToolbar.setVisible( true );
|
|
|
- ETerrainEditor.onBrushChanged();
|
|
|
- ETerrainEditor.setup();
|
|
|
- TerrainEditorPlugin.syncBrushInfo();
|
|
|
-
|
|
|
- EditorGuiStatusBar.setSelection("");
|
|
|
- %this.map.push();
|
|
|
-}
|
|
|
-
|
|
|
-function TerrainEditorPlugin::onDeactivated( %this )
|
|
|
-{
|
|
|
- Parent::onDeactivated( %this );
|
|
|
-
|
|
|
- endToolTime("TerrainEditor");
|
|
|
- EditorGui.writeTerrainEditorSettings();
|
|
|
-
|
|
|
- EWTerrainEditToolbar.setVisible( false );
|
|
|
- ETerrainEditor.setVisible( false );
|
|
|
-
|
|
|
- EditorGui.menuBar.remove( %this.terrainMenu );
|
|
|
-
|
|
|
- %this.map.pop();
|
|
|
-}
|
|
|
-
|
|
|
-function TerrainEditorPlugin::syncBrushInfo( %this )
|
|
|
-{
|
|
|
- // Update gui brush info
|
|
|
- TerrainBrushSizeTextEditContainer-->textEdit.text = getWord(ETerrainEditor.getBrushSize(), 0);
|
|
|
- TerrainBrushPressureTextEditContainer-->textEdit.text = ETerrainEditor.getBrushPressure()*100;
|
|
|
- TerrainBrushSoftnessTextEditContainer-->textEdit.text = ETerrainEditor.getBrushSoftness()*100;
|
|
|
- TerrainSetHeightTextEditContainer-->textEdit.text = ETerrainEditor.setHeightVal;
|
|
|
-
|
|
|
- %brushType = ETerrainEditor.getBrushType();
|
|
|
- eval( "EWTerrainEditToolbar-->" @ %brushType @ ".setStateOn(1);" );
|
|
|
-}
|
|
|
-
|
|
|
-function TerrainEditorPlugin::validateBrushSize( %this )
|
|
|
-{
|
|
|
- %minBrushSize = 1;
|
|
|
- %maxBrushSize = getWord(ETerrainEditor.maxBrushSize, 0);
|
|
|
-
|
|
|
- %val = $ThisControl.getText();
|
|
|
- if(%val < %minBrushSize)
|
|
|
- $ThisControl.setValue(%minBrushSize);
|
|
|
- else if(%val > %maxBrushSize)
|
|
|
- $ThisControl.setValue(%maxBrushSize);
|
|
|
-}
|
|
|
-
|
|
|
-function TerrainEditorPlugin::keyboardModifyBrushSize( %this, %amt)
|
|
|
-{
|
|
|
- %val = TerrainBrushSizeTextEditContainer-->textEdit.getText();
|
|
|
- %val += %amt;
|
|
|
- TerrainBrushSizeTextEditContainer-->textEdit.setValue(%val);
|
|
|
- TerrainBrushSizeTextEditContainer-->textEdit.forceValidateText();
|
|
|
- ETerrainEditor.setBrushSize( TerrainBrushSizeTextEditContainer-->textEdit.getText() );
|
|
|
-}
|
|
|
-
|
|
|
-//------------------------------------------------------------------------------
|
|
|
-// TerrainTextureEditorTool
|
|
|
-//------------------------------------------------------------------------------
|
|
|
-
|
|
|
-function TerrainTextureEditorTool::onActivated( %this )
|
|
|
-{
|
|
|
- EditorGui.bringToFront( ETerrainEditor );
|
|
|
- ETerrainEditor.setVisible( true );
|
|
|
- ETerrainEditor.attachTerrain();
|
|
|
- ETerrainEditor.makeFirstResponder( true );
|
|
|
-
|
|
|
- EditorGui-->TextureEditor.setVisible(true);
|
|
|
-
|
|
|
- EditorGuiStatusBar.setSelection("");
|
|
|
-}
|
|
|
-
|
|
|
-function TerrainTextureEditorTool::onDeactivated( %this )
|
|
|
-{
|
|
|
- EditorGui-->TextureEditor.setVisible(false);
|
|
|
-
|
|
|
- ETerrainEditor.setVisible( false );
|
|
|
-}
|
|
|
-
|
|
|
-//------------------------------------------------------------------------------
|
|
|
-// TerrainPainterPlugin
|
|
|
-//------------------------------------------------------------------------------
|
|
|
-
|
|
|
-function TerrainPainterPlugin::onWorldEditorStartup( %this )
|
|
|
-{
|
|
|
- Parent::onWorldEditorStartup( %this );
|
|
|
-
|
|
|
- // Add ourselves to the window menu.
|
|
|
- %accel = EditorGui.addToEditorsMenu( "Terrain Painter", "", TerrainPainterPlugin );
|
|
|
-
|
|
|
- // Add ourselves to the ToolsToolbar
|
|
|
- %tooltip = "Terrain Painter (" @ %accel @ ")";
|
|
|
- EditorGui.addToToolsToolbar( "TerrainPainterPlugin", "TerrainPainterPalette", expandFilename("tools/worldEditor/images/toolbar/paint-terrain"), %tooltip );
|
|
|
-
|
|
|
- %map = new ActionMap();
|
|
|
- %map.bindCmd( keyboard, "v", "EWTerrainPainterToolbarBrushType->ellipse.performClick();", "" );// Circle Brush
|
|
|
- %map.bindCmd( keyboard, "b", "EWTerrainPainterToolbarBrushType->box.performClick();", "" );// Box Brush
|
|
|
- %map.bindCmd( keyboard, "=", "TerrainPainterPlugin.keyboardModifyBrushSize(1);", "" );// +1 Brush Size
|
|
|
- %map.bindCmd( keyboard, "+", "TerrainPainterPlugin.keyboardModifyBrushSize(1);", "" );// +1 Brush Size
|
|
|
- %map.bindCmd( keyboard, "-", "TerrainPainterPlugin.keyboardModifyBrushSize(-1);", "" );// -1 Brush Size
|
|
|
- %map.bindCmd( keyboard, "[", "TerrainPainterPlugin.keyboardModifyBrushSize(-5);", "" );// -5 Brush Size
|
|
|
- %map.bindCmd( keyboard, "]", "TerrainPainterPlugin.keyboardModifyBrushSize(5);", "" );// +5 Brush Size
|
|
|
- /*%map.bindCmd( keyboard, "]", "PaintBrushSlopeControl->SlopeMinAngle.text += 5", "" );// +5 SlopeMinAngle
|
|
|
- %map.bindCmd( keyboard, "[", "PaintBrushSlopeControl->SlopeMinAngle.text -= 5", "" );// -5 SlopeMinAngle
|
|
|
- %map.bindCmd( keyboard, "'", "PaintBrushSlopeControl->SlopeMaxAngle.text += 5", "" );// +5 SlopeMaxAngle
|
|
|
- %map.bindCmd( keyboard, ";", "PaintBrushSlopeControl->SlopeMaxAngle.text -= 5", "" );// -5 Softness*/
|
|
|
-
|
|
|
- for(%i=1; %i<10; %i++)
|
|
|
- {
|
|
|
- %map.bindCmd( keyboard, %i, "TerrainPainterPlugin.keyboardSetMaterial(" @ (%i-1) @ ");", "" );
|
|
|
- }
|
|
|
- %map.bindCmd( keyboard, 0, "TerrainPainterPlugin.keyboardSetMaterial(10);", "" );
|
|
|
-
|
|
|
- TerrainPainterPlugin.map = %map;
|
|
|
- GuiWindowCtrl::attach( EPainter, EPainterPreview);
|
|
|
-}
|
|
|
-
|
|
|
-function TerrainPainterPlugin::onActivated( %this )
|
|
|
-{
|
|
|
- Parent::onActivated( %this );
|
|
|
-
|
|
|
- EditorGui.readTerrainEditorSettings();
|
|
|
-
|
|
|
- EWTerrainPainterToolbarBrushType->ellipse.performClick();// Circle Brush
|
|
|
- %this.map.push();
|
|
|
-
|
|
|
- EditorGui.bringToFront( ETerrainEditor );
|
|
|
- ETerrainEditor.setVisible( true );
|
|
|
- ETerrainEditor.attachTerrain();
|
|
|
- ETerrainEditor.makeFirstResponder( true );
|
|
|
-
|
|
|
- EditorGui-->TerrainPainter.setVisible(true);
|
|
|
- EditorGui-->TerrainPainterPreview.setVisible(true);
|
|
|
- EWTerrainPainterToolbar.setVisible(true);
|
|
|
- ETerrainEditor.onBrushChanged();
|
|
|
- EPainter.setup();
|
|
|
- TerrainPainterPlugin.syncBrushInfo();
|
|
|
-
|
|
|
- EditorGuiStatusBar.setSelection("");
|
|
|
-}
|
|
|
-
|
|
|
-function TerrainPainterPlugin::onDeactivated( %this )
|
|
|
-{
|
|
|
- Parent::onDeactivated( %this );
|
|
|
-
|
|
|
- EditorGui.writeTerrainEditorSettings();
|
|
|
-
|
|
|
- %this.map.pop();
|
|
|
- EditorGui-->TerrainPainter.setVisible(false);
|
|
|
- EditorGui-->TerrainPainterPreview.setVisible(false);
|
|
|
- EWTerrainPainterToolbar.setVisible(false);
|
|
|
- ETerrainEditor.setVisible( false );
|
|
|
-}
|
|
|
-
|
|
|
-function TerrainPainterPlugin::syncBrushInfo( %this )
|
|
|
-{
|
|
|
- // Update gui brush info
|
|
|
- PaintBrushSizeTextEditContainer-->textEdit.text = getWord(ETerrainEditor.getBrushSize(), 0);
|
|
|
- PaintBrushSlopeControl-->SlopeMinAngle.text = ETerrainEditor.getSlopeLimitMinAngle();
|
|
|
- PaintBrushSlopeControl-->SlopeMaxAngle.text = ETerrainEditor.getSlopeLimitMaxAngle();
|
|
|
- PaintBrushPressureTextEditContainer-->textEdit.text = ETerrainEditor.getBrushPressure()*100;
|
|
|
- %brushType = ETerrainEditor.getBrushType();
|
|
|
- eval( "EWTerrainPainterToolbar-->" @ %brushType @ ".setStateOn(1);" );
|
|
|
-}
|
|
|
-
|
|
|
-function TerrainPainterPlugin::validateBrushSize( %this )
|
|
|
-{
|
|
|
- %minBrushSize = 1;
|
|
|
- %maxBrushSize = getWord(ETerrainEditor.maxBrushSize, 0);
|
|
|
-
|
|
|
- %val = $ThisControl.getText();
|
|
|
- if(%val < %minBrushSize)
|
|
|
- $ThisControl.setValue(%minBrushSize);
|
|
|
- else if(%val > %maxBrushSize)
|
|
|
- $ThisControl.setValue(%maxBrushSize);
|
|
|
-}
|
|
|
-
|
|
|
-function TerrainPainterPlugin::validateSlopeMaxAngle( %this )
|
|
|
-{
|
|
|
- %maxval = ETerrainEditor.getSlopeLimitMaxAngle();
|
|
|
- PaintBrushSlopeControl-->SlopeMaxAngle.setText(%maxval);
|
|
|
-}
|
|
|
-
|
|
|
-function TerrainPainterPlugin::validateSlopeMinAngle( %this )
|
|
|
-{
|
|
|
- %minval = ETerrainEditor.getSlopeLimitMinAngle();
|
|
|
- PaintBrushSlopeControl-->SlopeMinAngle.setText(%minval);
|
|
|
-}
|
|
|
-
|
|
|
-function TerrainPainterPlugin::keyboardModifyBrushSize( %this, %amt)
|
|
|
-{
|
|
|
- %val = PaintBrushSizeTextEditContainer-->textEdit.getText();
|
|
|
- %val += %amt;
|
|
|
- PaintBrushSizeTextEditContainer-->textEdit.setValue(%val);
|
|
|
- PaintBrushSizeTextEditContainer-->textEdit.forceValidateText();
|
|
|
- ETerrainEditor.setBrushSize( PaintBrushSizeTextEditContainer-->textEdit.getText() );
|
|
|
-}
|
|
|
-
|
|
|
-function TerrainPainterPlugin::keyboardSetMaterial( %this, %mat)
|
|
|
-{
|
|
|
- %name = "EPainterMaterialButton" @ %mat;
|
|
|
- %ctrl = EPainter.findObjectByInternalName(%name, true);
|
|
|
- if(%ctrl)
|
|
|
- {
|
|
|
- %ctrl.performClick();
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-/// @} End of EditorPlugin Methods
|
|
|
-
|
|
|
-
|
|
|
-function objectTransformDropdown::toggle()
|
|
|
-{
|
|
|
- if ( objectTransformDropdown.visible )
|
|
|
- {
|
|
|
- EWorldEditorToolbar-->objectTransform.setStateOn(false);
|
|
|
- objectTransformDropdownDecoy.setVisible(false);
|
|
|
- objectTransformDropdownDecoy.setActive(false);
|
|
|
- objectTransformDropdown.setVisible(false);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- EWorldEditorToolbar-->objectTransform.setStateOn(true);
|
|
|
- objectTransformDropdown.setVisible(true);
|
|
|
- objectTransformDropdownDecoy.setActive(true);
|
|
|
- objectTransformDropdownDecoy.setVisible(true);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-function CameraTypesDropdownToggle()
|
|
|
-{
|
|
|
- if ( CameraTypesDropdown.visible )
|
|
|
- {
|
|
|
- EWorldEditorToggleCamera.setStateOn(0);
|
|
|
- CameraTypesDropdownDecoy.setVisible(false);
|
|
|
- CameraTypesDropdownDecoy.setActive(false);
|
|
|
- CameraTypesDropdown.setVisible(false);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- CameraTypesDropdown.setVisible(true);
|
|
|
- CameraTypesDropdownDecoy.setVisible(true);
|
|
|
- CameraTypesDropdownDecoy.setActive(true);
|
|
|
- EWorldEditorToggleCamera.setStateOn(1);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-function VisibilityDropdownToggle()
|
|
|
-{
|
|
|
- if ( EVisibility.visible )
|
|
|
- {
|
|
|
- EVisibility.setVisible(false);
|
|
|
- visibilityToggleBtn.setStateOn(0);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- EVisibility.setVisible(true);
|
|
|
- visibilityToggleBtn.setStateOn(1);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-function CameraTypesDropdownDecoy::onMouseLeave()
|
|
|
-{
|
|
|
- CameraTypesDropdownToggle();
|
|
|
-}
|
|
|
-
|
|
|
-//-----------------------------------------------------------------------------
|
|
|
-
|
|
|
-function EWorldEditor::getGridSnap( %this )
|
|
|
-{
|
|
|
- return %this.gridSnap;
|
|
|
-}
|
|
|
-
|
|
|
-function EWorldEditor::setGridSnap( %this, %value )
|
|
|
-{
|
|
|
- %this.gridSnap = %value;
|
|
|
- GlobalGizmoProfile.snapToGrid = %value;
|
|
|
- %this.syncGui();
|
|
|
-}
|
|
|
-
|
|
|
-function EWorldEditor::getGridSize( %this )
|
|
|
-{
|
|
|
- return %this.gridSize;
|
|
|
-}
|
|
|
-
|
|
|
-function EWorldEditor::setGridSize( %this, %value )
|
|
|
-{
|
|
|
- GlobalGizmoProfile.gridSize = %value SPC %value SPC %value;
|
|
|
- %this.gridSize = %value;
|
|
|
-
|
|
|
- %this.syncGui();
|
|
|
-}
|
|
|
-
|
|
|
-//-----------------------------------------------------------------------------
|
|
|
-
|
|
|
-function EWorldEditor::areAllSelectedObjectsOfType( %this, %className )
|
|
|
-{
|
|
|
- %activeSelection = %this.getActiveSelection();
|
|
|
- if( !isObject( %activeSelection ) )
|
|
|
- return false;
|
|
|
-
|
|
|
- %count = %activeSelection.getCount();
|
|
|
- for( %i = 0; %i < %count; %i ++ )
|
|
|
- {
|
|
|
- %obj = %activeSelection.getObject( %i );
|
|
|
- if( !%obj.isMemberOfClass( %className ) )
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- return true;
|
|
|
-}
|
|
|
-
|
|
|
-//-----------------------------------------------------------------------------
|
|
|
-function EWorldEditorToggleCamera::toggleBitmap(%this)
|
|
|
-{
|
|
|
- %currentImage = %this.bitmap;
|
|
|
-
|
|
|
- if ( %currentImage $= "tools/worldEditor/images/toolbar/player" )
|
|
|
- %image = "tools/worldEditor/images/toolbar/camera";
|
|
|
- else
|
|
|
- %image = "tools/worldEditor/images/toolbar/player";
|
|
|
-
|
|
|
- %this.setBitmap( %image );
|
|
|
-}
|
|
|
-
|
|
|
-function EWorldEditorCameraSpeed::updateMenuBar(%this, %editorBarCtrl)
|
|
|
-{
|
|
|
- // Update Toolbar TextEdit
|
|
|
- if( %editorBarCtrl.getId() == CameraSpeedDropdownCtrlContainer-->slider.getId() )
|
|
|
- {
|
|
|
- %value = %editorBarCtrl.getValue();
|
|
|
- EWorldEditorCameraSpeed.setText( %value );
|
|
|
- $Camera::movementSpeed = %value;
|
|
|
- }
|
|
|
-
|
|
|
- // Update Toolbar Slider
|
|
|
- if( %editorBarCtrl.getId() == EWorldEditorCameraSpeed.getId() )
|
|
|
- {
|
|
|
- %value = %editorBarCtrl.getText();
|
|
|
- if ( %value !$= "" )
|
|
|
- {
|
|
|
- if ( %value <= 0 ) // camera speed must be >= 0
|
|
|
- {
|
|
|
- %value = 1;
|
|
|
- %editorBarCtrl.setText( %value );
|
|
|
- }
|
|
|
- CameraSpeedDropdownCtrlContainer-->slider.setValue( %value );
|
|
|
- $Camera::movementSpeed = %value;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // Update Editor
|
|
|
- EditorCameraSpeedOptions.checkRadioItem(0, 6, -1);
|
|
|
-}
|
|
|
-
|
|
|
-//-----------------------------------------------------------------------------
|
|
|
-
|
|
|
-function EWorldEditorAlignPopup::onSelect(%this, %id, %text)
|
|
|
-{
|
|
|
- if ( GlobalGizmoProfile.mode $= "Scale" && %text $= "World" )
|
|
|
- {
|
|
|
- EWorldEditorAlignPopup.setSelected(1);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- GlobalGizmoProfile.alignment = %text;
|
|
|
-}
|
|
|
-
|
|
|
-//-----------------------------------------------------------------------------
|
|
|
-
|
|
|
-
|
|
|
-//-----------------------------------------------------------------------------
|
|
|
-
|
|
|
-function EWorldEditorNoneModeBtn::onClick(%this)
|
|
|
-{
|
|
|
- GlobalGizmoProfile.mode = "None";
|
|
|
-
|
|
|
- EditorGuiStatusBar.setInfo("Selection arrow.");
|
|
|
-}
|
|
|
-
|
|
|
-function EWorldEditorMoveModeBtn::onClick(%this)
|
|
|
-{
|
|
|
- GlobalGizmoProfile.mode = "Move";
|
|
|
-
|
|
|
- %cmdCtrl = "CTRL";
|
|
|
- if( $platform $= "macos" )
|
|
|
- %cmdCtrl = "CMD";
|
|
|
-
|
|
|
- EditorGuiStatusBar.setInfo( "Move selection. SHIFT while dragging duplicates objects. " @ %cmdCtrl @ " to toggle soft snap. ALT to toggle grid snap." );
|
|
|
-}
|
|
|
-
|
|
|
-function EWorldEditorRotateModeBtn::onClick(%this)
|
|
|
-{
|
|
|
- GlobalGizmoProfile.mode = "Rotate";
|
|
|
-
|
|
|
- EditorGuiStatusBar.setInfo("Rotate selection.");
|
|
|
-}
|
|
|
-
|
|
|
-function EWorldEditorScaleModeBtn::onClick(%this)
|
|
|
-{
|
|
|
- GlobalGizmoProfile.mode = "Scale";
|
|
|
-
|
|
|
- EditorGuiStatusBar.setInfo("Scale selection.");
|
|
|
-}
|
|
|
-
|
|
|
-//-----------------------------------------------------------------------------
|
|
|
-
|
|
|
-function EditorTree::onDeleteSelection( %this )
|
|
|
-{
|
|
|
- %this.undoDeleteList = "";
|
|
|
-}
|
|
|
-
|
|
|
-function EditorTree::onDeleteObject( %this, %object )
|
|
|
-{
|
|
|
- // Don't delete locked objects
|
|
|
- if( %object.locked )
|
|
|
- return true;
|
|
|
-
|
|
|
- if( %object == EWCreatorWindow.objectGroup )
|
|
|
- EWCreatorWindow.setNewObjectGroup( MissionGroup );
|
|
|
-
|
|
|
- // Append it to our list.
|
|
|
- %this.undoDeleteList = %this.undoDeleteList TAB %object;
|
|
|
-
|
|
|
- // We're gonna delete this ourselves in the
|
|
|
- // completion callback.
|
|
|
- return true;
|
|
|
-}
|
|
|
-
|
|
|
-function EditorTree::onObjectDeleteCompleted( %this )
|
|
|
-{
|
|
|
- // This can be called when a deletion is attempted but nothing was
|
|
|
- // actually deleted ( cannot delete the root of the tree ) so only submit
|
|
|
- // the undo if we really deleted something.
|
|
|
- if ( %this.undoDeleteList !$= "" )
|
|
|
- MEDeleteUndoAction::submit( %this.undoDeleteList );
|
|
|
-
|
|
|
- // Let the world editor know to
|
|
|
- // clear its selection.
|
|
|
- EWorldEditor.clearSelection();
|
|
|
- EWorldEditor.isDirty = true;
|
|
|
-}
|
|
|
-
|
|
|
-function EditorTree::onClearSelected(%this)
|
|
|
-{
|
|
|
- WorldEditor.clearSelection();
|
|
|
-}
|
|
|
-
|
|
|
-function EditorTree::onInspect(%this, %obj)
|
|
|
-{
|
|
|
- Inspector.inspect(%obj);
|
|
|
-}
|
|
|
-
|
|
|
-function EditorTree::toggleLock( %this )
|
|
|
-{
|
|
|
- if( EWTreeWindow-->LockSelection.command $= "EWorldEditor.lockSelection(true); EditorTree.toggleLock();" )
|
|
|
- {
|
|
|
- EWTreeWindow-->LockSelection.command = "EWorldEditor.lockSelection(false); EditorTree.toggleLock();";
|
|
|
- EWTreeWindow-->DeleteSelection.command = "";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- EWTreeWindow-->LockSelection.command = "EWorldEditor.lockSelection(true); EditorTree.toggleLock();";
|
|
|
- EWTreeWindow-->DeleteSelection.command = "EditorMenuEditDelete();";
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-function EditorTree::onAddSelection(%this, %obj, %isLastSelection)
|
|
|
-{
|
|
|
- EWorldEditor.selectObject( %obj );
|
|
|
-
|
|
|
- %selSize = EWorldEditor.getSelectionSize();
|
|
|
- %lockCount = EWorldEditor.getSelectionLockCount();
|
|
|
-
|
|
|
- if( %lockCount < %selSize )
|
|
|
- {
|
|
|
- EWTreeWindow-->LockSelection.setStateOn(0);
|
|
|
- EWTreeWindow-->LockSelection.command = "EWorldEditor.lockSelection(true); EditorTree.toggleLock();";
|
|
|
- }
|
|
|
- else if ( %lockCount > 0 )
|
|
|
- {
|
|
|
- EWTreeWindow-->LockSelection.setStateOn(1);
|
|
|
- EWTreeWindow-->LockSelection.command = "EWorldEditor.lockSelection(false); EditorTree.toggleLock();";
|
|
|
- }
|
|
|
-
|
|
|
- if( %selSize > 0 && %lockCount == 0 )
|
|
|
- EWTreeWindow-->DeleteSelection.command = "EditorMenuEditDelete();";
|
|
|
- else
|
|
|
- EWTreeWindow-->DeleteSelection.command = "";
|
|
|
-
|
|
|
- if( %isLastSelection )
|
|
|
- Inspector.addInspect( %obj );
|
|
|
- else
|
|
|
- Inspector.addInspect( %obj, false );
|
|
|
-
|
|
|
-}
|
|
|
-function EditorTree::onRemoveSelection(%this, %obj)
|
|
|
-{
|
|
|
- EWorldEditor.unselectObject(%obj);
|
|
|
- Inspector.removeInspect( %obj );
|
|
|
-}
|
|
|
-function EditorTree::onSelect(%this, %obj)
|
|
|
-{
|
|
|
-}
|
|
|
-
|
|
|
-function EditorTree::onUnselect(%this, %obj)
|
|
|
-{
|
|
|
- EWorldEditor.unselectObject(%obj);
|
|
|
-}
|
|
|
-
|
|
|
-function EditorTree::onDragDropped(%this)
|
|
|
-{
|
|
|
- EWorldEditor.isDirty = true;
|
|
|
-}
|
|
|
-
|
|
|
-function EditorTree::onAddGroupSelected(%this, %group)
|
|
|
-{
|
|
|
- EWCreatorWindow.setNewObjectGroup(%group);
|
|
|
-}
|
|
|
-
|
|
|
-function EditorTree::onRightMouseUp( %this, %itemId, %mouse, %obj )
|
|
|
-{
|
|
|
- %haveObjectEntries = false;
|
|
|
- %haveLockAndHideEntries = true;
|
|
|
-
|
|
|
- // Handle multi-selection.
|
|
|
- if( %this.getSelectedItemsCount() > 1 )
|
|
|
- {
|
|
|
- %popup = ETMultiSelectionContextPopup;
|
|
|
- if( !isObject( %popup ) )
|
|
|
- %popup = new PopupMenu( ETMultiSelectionContextPopup )
|
|
|
- {
|
|
|
- superClass = "MenuBuilder";
|
|
|
- isPopup = "1";
|
|
|
-
|
|
|
- item[ 0 ] = "Delete" TAB "" TAB "EditorMenuEditDelete();";
|
|
|
- item[ 1 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );";
|
|
|
- };
|
|
|
- }
|
|
|
-
|
|
|
- // Open context menu if this is a CameraBookmark
|
|
|
- else if( %obj.isMemberOfClass( "CameraBookmark" ) )
|
|
|
- {
|
|
|
- %popup = ETCameraBookmarkContextPopup;
|
|
|
- if( !isObject( %popup ) )
|
|
|
- %popup = new PopupMenu( ETCameraBookmarkContextPopup )
|
|
|
- {
|
|
|
- superClass = "MenuBuilder";
|
|
|
- isPopup = "1";
|
|
|
-
|
|
|
- item[ 0 ] = "Go To Bookmark" TAB "" TAB "EditorGui.jumpToBookmark( %this.bookmark.getInternalName() );";
|
|
|
-
|
|
|
- bookmark = -1;
|
|
|
- };
|
|
|
-
|
|
|
- ETCameraBookmarkContextPopup.bookmark = %obj;
|
|
|
- }
|
|
|
-
|
|
|
- // Open context menu if this is set CameraBookmarks group.
|
|
|
- else if( %obj.name $= "CameraBookmarks" )
|
|
|
- {
|
|
|
- %popup = ETCameraBookmarksGroupContextPopup;
|
|
|
- if( !isObject( %popup ) )
|
|
|
- %popup = new PopupMenu( ETCameraBookmarksGroupContextPopup )
|
|
|
- {
|
|
|
- superClass = "MenuBuilder";
|
|
|
- isPopup = "1";
|
|
|
-
|
|
|
- item[ 0 ] = "Add Camera Bookmark" TAB "" TAB "EditorGui.addCameraBookmarkByGui();";
|
|
|
- };
|
|
|
- }
|
|
|
-
|
|
|
- // Open context menu if this is a SimGroup
|
|
|
- else if( !%obj.isMemberOfClass( "SceneObject" ) )
|
|
|
- {
|
|
|
- %popup = ETSimGroupContextPopup;
|
|
|
- if( !isObject( %popup ) )
|
|
|
- %popup = new PopupMenu( ETSimGroupContextPopup )
|
|
|
- {
|
|
|
- superClass = "MenuBuilder";
|
|
|
- isPopup = "1";
|
|
|
-
|
|
|
- item[ 0 ] = "Rename" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId( %this.object ) );";
|
|
|
- item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject( %this.object );";
|
|
|
- item[ 2 ] = "Inspect" TAB "" TAB "inspectObject( %this.object );";
|
|
|
- item[ 3 ] = "-";
|
|
|
- item[ 4 ] = "Toggle Lock Children" TAB "" TAB "EWorldEditor.toggleLockChildren( %this.object );";
|
|
|
- item[ 5 ] = "Toggle Hide Children" TAB "" TAB "EWorldEditor.toggleHideChildren( %this.object );";
|
|
|
- item[ 6 ] = "-";
|
|
|
- item[ 7 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );";
|
|
|
- item[ 8 ] = "-";
|
|
|
- item[ 9 ] = "Add New Objects Here" TAB "" TAB "EWCreatorWindow.setNewObjectGroup( %this.object );";
|
|
|
- item[ 10 ] = "Add Children to Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( %this.object, false );";
|
|
|
- item[ 11 ] = "Remove Children from Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( %this.object, true );";
|
|
|
-
|
|
|
- object = -1;
|
|
|
- };
|
|
|
-
|
|
|
- %popup.object = %obj;
|
|
|
-
|
|
|
- %hasChildren = %obj.getCount() > 0;
|
|
|
- %popup.enableItem( 10, %hasChildren );
|
|
|
- %popup.enableItem( 11, %hasChildren );
|
|
|
-
|
|
|
- %haveObjectEntries = true;
|
|
|
- %haveLockAndHideEntries = false;
|
|
|
- }
|
|
|
-
|
|
|
- // Open generic context menu.
|
|
|
- else
|
|
|
- {
|
|
|
- %popup = ETContextPopup;
|
|
|
- if( !isObject( %popup ) )
|
|
|
- %popup = new PopupMenu( ETContextPopup )
|
|
|
- {
|
|
|
- superClass = "MenuBuilder";
|
|
|
- isPopup = "1";
|
|
|
-
|
|
|
- item[ 0 ] = "Rename" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId( %this.object ) );";
|
|
|
- item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject( %this.object );";
|
|
|
- item[ 2 ] = "Inspect" TAB "" TAB "inspectObject( %this.object );";
|
|
|
- item[ 3 ] = "-";
|
|
|
- item[ 4 ] = "Locked" TAB "" TAB "%this.object.setLocked( !%this.object.locked ); EWorldEditor.syncGui();";
|
|
|
- item[ 5 ] = "Hidden" TAB "" TAB "EWorldEditor.hideObject( %this.object, !%this.object.hidden ); EWorldEditor.syncGui();";
|
|
|
- item[ 6 ] = "-";
|
|
|
- item[ 7 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );";
|
|
|
-
|
|
|
- object = -1;
|
|
|
- };
|
|
|
-
|
|
|
- if(%obj.isMemberOfClass("Entity"))
|
|
|
- {
|
|
|
- %popup = ETEntityContextPopup;
|
|
|
- if( !isObject( %popup ) )
|
|
|
- %popup = new PopupMenu( ETEntityContextPopup : ETSimGroupContextPopup )
|
|
|
- {
|
|
|
- superClass = "MenuBuilder";
|
|
|
- isPopup = "1";
|
|
|
-
|
|
|
- item[ 12 ] = "-";
|
|
|
- item[ 13 ] = "Convert to Game Object" TAB "" TAB "EWorldEditor.createGameObject( %this.object );";
|
|
|
- };
|
|
|
- }
|
|
|
-
|
|
|
- // Specialized version for ConvexShapes.
|
|
|
- else if( %obj.isMemberOfClass( "ConvexShape" ) )
|
|
|
- {
|
|
|
- %popup = ETConvexShapeContextPopup;
|
|
|
- if( !isObject( %popup ) )
|
|
|
- %popup = new PopupMenu( ETConvexShapeContextPopup : ETContextPopup )
|
|
|
- {
|
|
|
- superClass = "MenuBuilder";
|
|
|
- isPopup = "1";
|
|
|
-
|
|
|
- item[ 8 ] = "-";
|
|
|
- item[ 9 ] = "Convert to Zone" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Zone\" );";
|
|
|
- item[ 10 ] = "Convert to Portal" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Portal\" );";
|
|
|
- item[ 11 ] = "Convert to Occluder" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"OcclusionVolume\" );";
|
|
|
- item[ 12 ] = "Convert to Sound Space" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"SFXSpace\" );";
|
|
|
- };
|
|
|
- }
|
|
|
-
|
|
|
- // Specialized version for polyhedral objects.
|
|
|
- else if( %obj.isMemberOfClass( "Zone" ) ||
|
|
|
- %obj.isMemberOfClass( "Portal" ) ||
|
|
|
- %obj.isMemberOfClass( "OcclusionVolume" ) ||
|
|
|
- %obj.isMemberOfClass( "SFXSpace" ) )
|
|
|
- {
|
|
|
- %popup = ETPolyObjectContextPopup;
|
|
|
- if( !isObject( %popup ) )
|
|
|
- %popup = new PopupMenu( ETPolyObjectContextPopup : ETContextPopup )
|
|
|
- {
|
|
|
- superClass = "MenuBuilder";
|
|
|
- isPopup = "1";
|
|
|
-
|
|
|
- item[ 8 ] = "-";
|
|
|
- item[ 9 ] = "Convert to ConvexShape" TAB "" TAB "EWorldEditor.convertSelectionToConvexShape();";
|
|
|
- };
|
|
|
- }
|
|
|
-
|
|
|
- %popup.object = %obj;
|
|
|
- %haveObjectEntries = true;
|
|
|
- }
|
|
|
-
|
|
|
- if( %haveObjectEntries )
|
|
|
- {
|
|
|
- %popup.enableItem( 0, %obj.isNameChangeAllowed() && %obj.getName() !$= "MissionGroup" );
|
|
|
- %popup.enableItem( 1, %obj.getName() !$= "MissionGroup" );
|
|
|
- if( %haveLockAndHideEntries )
|
|
|
- {
|
|
|
- %popup.checkItem( 4, %obj.locked );
|
|
|
- %popup.checkItem( 5, %obj.hidden );
|
|
|
- }
|
|
|
- %popup.enableItem( 7, %this.isItemSelected( %itemId ) );
|
|
|
- }
|
|
|
-
|
|
|
- %popup.showPopup( Canvas );
|
|
|
-}
|
|
|
-
|
|
|
-function EditorTree::positionContextMenu( %this, %menu )
|
|
|
-{
|
|
|
- if( (getWord(%menu.position, 0) + getWord(%menu.extent, 0)) > getWord(EWorldEditor.extent, 0) )
|
|
|
- {
|
|
|
- %posx = getWord(%menu.position, 0);
|
|
|
- %offset = getWord(EWorldEditor.extent, 0) - (%posx + getWord(%menu.extent, 0)) - 5;
|
|
|
- %posx += %offset;
|
|
|
- %menu.position = %posx @ " " @ getWord(%menu.position, 1);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-function EditorTree::isValidDragTarget( %this, %id, %obj )
|
|
|
-{
|
|
|
- if( %obj.isMemberOfClass( "Path" ) )
|
|
|
- return EWorldEditor.areAllSelectedObjectsOfType( "Marker" );
|
|
|
- if( %obj.name $= "CameraBookmarks" )
|
|
|
- return EWorldEditor.areAllSelectedObjectsOfType( "CameraBookmark" );
|
|
|
- else
|
|
|
- return ( %obj.getClassName() $= "SimGroup" );
|
|
|
-}
|
|
|
-
|
|
|
-function EditorTree::onBeginReparenting( %this )
|
|
|
-{
|
|
|
- if( isObject( %this.reparentUndoAction ) )
|
|
|
- %this.reparentUndoAction.delete();
|
|
|
-
|
|
|
- %action = UndoActionReparentObjects::create( %this );
|
|
|
-
|
|
|
- %this.reparentUndoAction = %action;
|
|
|
-}
|
|
|
-
|
|
|
-function EditorTree::onReparent( %this, %obj, %oldParent, %newParent )
|
|
|
-{
|
|
|
- %this.reparentUndoAction.add( %obj, %oldParent, %newParent );
|
|
|
-}
|
|
|
-
|
|
|
-function EditorTree::onEndReparenting( %this )
|
|
|
-{
|
|
|
- %action = %this.reparentUndoAction;
|
|
|
- %this.reparentUndoAction = "";
|
|
|
-
|
|
|
- if( %action.numObjects > 0 )
|
|
|
- {
|
|
|
- if( %action.numObjects == 1 )
|
|
|
- %action.actionName = "Reparent Object";
|
|
|
- else
|
|
|
- %action.actionName = "Reparent Objects";
|
|
|
-
|
|
|
- %action.addToManager( Editor.getUndoManager() );
|
|
|
-
|
|
|
- EWorldEditor.syncGui();
|
|
|
- }
|
|
|
- else
|
|
|
- %action.delete();
|
|
|
-}
|
|
|
-
|
|
|
-function EditorTree::update( %this )
|
|
|
-{
|
|
|
- %this.buildVisibleTree( false );
|
|
|
-}
|
|
|
-
|
|
|
-//------------------------------------------------------------------------------
|
|
|
-
|
|
|
-// Tooltip for TSStatic
|
|
|
-function EditorTree::GetTooltipTSStatic( %this, %obj )
|
|
|
-{
|
|
|
- return "Shape: " @ %obj.shapeName;
|
|
|
-}
|
|
|
-
|
|
|
-// Tooltip for ShapeBase
|
|
|
-function EditorTree::GetTooltipShapeBase( %this, %obj )
|
|
|
-{
|
|
|
- return "Datablock: " @ %obj.dataBlock;
|
|
|
-}
|
|
|
-
|
|
|
-// Tooltip for StaticShape
|
|
|
-function EditorTree::GetTooltipStaticShape( %this, %obj )
|
|
|
-{
|
|
|
- return "Datablock: " @ %obj.dataBlock;
|
|
|
-}
|
|
|
-
|
|
|
-// Tooltip for Item
|
|
|
-function EditorTree::GetTooltipItem( %this, %obj )
|
|
|
-{
|
|
|
- return "Datablock: " @ %obj.dataBlock;
|
|
|
-}
|
|
|
-
|
|
|
-// Tooltip for RigidShape
|
|
|
-function EditorTree::GetTooltipRigidShape( %this, %obj )
|
|
|
-{
|
|
|
- return "Datablock: " @ %obj.dataBlock;
|
|
|
-}
|
|
|
-
|
|
|
-// Tooltip for Prefab
|
|
|
-function EditorTree::GetTooltipPrefab( %this, %obj )
|
|
|
-{
|
|
|
- return "File: " @ %obj.filename;
|
|
|
-}
|
|
|
-
|
|
|
-// Tooltip for GroundCover
|
|
|
-function EditorTree::GetTooltipGroundCover( %this, %obj )
|
|
|
-{
|
|
|
- %text = "Material: " @ %obj.material;
|
|
|
- for(%i=0; %i<8; %i++)
|
|
|
- {
|
|
|
- if(%obj.probability[%i] > 0 && %obj.shapeFilename[%i] !$= "")
|
|
|
- {
|
|
|
- %text = %text NL "Shape " @ %i @ ": " @ %obj.shapeFilename[%i];
|
|
|
- }
|
|
|
- }
|
|
|
- return %text;
|
|
|
-}
|
|
|
-
|
|
|
-// Tooltip for SFXEmitter
|
|
|
-function EditorTree::GetTooltipSFXEmitter( %this, %obj )
|
|
|
-{
|
|
|
- if(%obj.fileName $= "")
|
|
|
- return "Track: " @ %obj.track;
|
|
|
- else
|
|
|
- return "File: " @ %obj.fileName;
|
|
|
-}
|
|
|
-
|
|
|
-// Tooltip for ParticleEmitterNode
|
|
|
-function EditorTree::GetTooltipParticleEmitterNode( %this, %obj )
|
|
|
-{
|
|
|
- %text = "Datablock: " @ %obj.dataBlock;
|
|
|
- %text = %text NL "Emitter: " @ %obj.emitter;
|
|
|
- return %text;
|
|
|
-}
|
|
|
-
|
|
|
-// Tooltip for WorldEditorSelection
|
|
|
-function EditorTree::GetTooltipWorldEditorSelection( %this, %obj )
|
|
|
-{
|
|
|
- %text = "Objects: " @ %obj.getCount();
|
|
|
-
|
|
|
- if( !%obj.getCanSave() )
|
|
|
- %text = %text NL "Persistent: No";
|
|
|
- else
|
|
|
- %text = %text NL "Persistent: Yes";
|
|
|
-
|
|
|
- return %text;
|
|
|
-}
|
|
|
-
|
|
|
-//------------------------------------------------------------------------------
|
|
|
-
|
|
|
-function EditorTreeTabBook::onTabSelected( %this )
|
|
|
-{
|
|
|
- if( EditorTreeTabBook.getSelectedPage() == 0)
|
|
|
- {
|
|
|
- EWTreeWindow-->DeleteSelection.visible = true;
|
|
|
- EWTreeWindow-->LockSelection.visible = true;
|
|
|
- EWTreeWindow-->AddSimGroup.visible = true;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- EWTreeWindow-->DeleteSelection.visible = false;
|
|
|
- EWTreeWindow-->LockSelection.visible = false;
|
|
|
- EWTreeWindow-->AddSimGroup.visible = false;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-//------------------------------------------------------------------------------
|
|
|
-
|
|
|
-function Editor::open(%this)
|
|
|
-{
|
|
|
- // prevent the mission editor from opening while the GuiEditor is open.
|
|
|
- if(Canvas.getContent() == GuiEditorGui.getId())
|
|
|
- return;
|
|
|
-
|
|
|
- EditorGui.buildMenus();
|
|
|
-
|
|
|
- if( !EditorGui.isInitialized )
|
|
|
- EditorGui.init();
|
|
|
-
|
|
|
- %this.editorEnabled();
|
|
|
- Canvas.setContent(EditorGui);
|
|
|
- EditorGui.syncCameraGui();
|
|
|
-}
|
|
|
-
|
|
|
-function Editor::close(%this, %gui)
|
|
|
-{
|
|
|
- %this.editorDisabled();
|
|
|
- Canvas.setContent(%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 = "";
|
|
|
-
|
|
|
-function EditorLightingComplete()
|
|
|
-{
|
|
|
- $lightingMission = false;
|
|
|
- RelightStatus.visible = false;
|
|
|
-
|
|
|
- if ($RelightCallback !$= "")
|
|
|
- {
|
|
|
- eval($RelightCallback);
|
|
|
- }
|
|
|
-
|
|
|
- $RelightCallback = "";
|
|
|
-}
|
|
|
-
|
|
|
-function updateEditorLightingProgress()
|
|
|
-{
|
|
|
- RelightProgress.setValue(($SceneLighting::lightingProgress));
|
|
|
- if ($lightingMission)
|
|
|
- $lightingProgressThread = schedule(1, 0, "updateEditorLightingProgress");
|
|
|
-}
|
|
|
-
|
|
|
-function Editor::lightScene(%this, %callback, %forceAlways)
|
|
|
-{
|
|
|
- if ($lightingMission)
|
|
|
- return;
|
|
|
-
|
|
|
- $lightingMission = true;
|
|
|
- $RelightCallback = %callback;
|
|
|
- RelightStatus.visible = true;
|
|
|
- RelightProgress.setValue(0);
|
|
|
- Canvas.repaint();
|
|
|
- lightScene("EditorLightingComplete", %forceAlways);
|
|
|
- updateEditorLightingProgress();
|
|
|
-}
|
|
|
-
|
|
|
-//------------------------------------------------------------------------------
|
|
|
-
|
|
|
-function EditorGui::handleEscape( %this )
|
|
|
-{
|
|
|
- %result = false;
|
|
|
- if ( isObject( %this.currentEditor ) )
|
|
|
- %result = %this.currentEditor.handleEscape();
|
|
|
-
|
|
|
- if ( !%result )
|
|
|
- {
|
|
|
- Editor.close("PlayGui");
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-function EditTSCtrl::updateGizmoMode( %this, %mode )
|
|
|
-{
|
|
|
- // Called when the gizmo mode is changed from C++
|
|
|
-
|
|
|
- if ( %mode $= "None" )
|
|
|
- EditorGuiToolbar->NoneModeBtn.performClick();
|
|
|
- else if ( %mode $= "Move" )
|
|
|
- EditorGuiToolbar->MoveModeBtn.performClick();
|
|
|
- else if ( %mode $= "Rotate" )
|
|
|
- EditorGuiToolbar->RotateModeBtn.performClick();
|
|
|
- else if ( %mode $= "Scale" )
|
|
|
- EditorGuiToolbar->ScaleModeBtn.performClick();
|
|
|
-}
|
|
|
-
|
|
|
-//------------------------------------------------------------------------------
|
|
|
-
|
|
|
-function EWorldEditor::syncGui( %this )
|
|
|
-{
|
|
|
- %this.syncToolPalette();
|
|
|
-
|
|
|
- EditorTree.update();
|
|
|
- Editor.getUndoManager().updateUndoMenu( EditorGui.menuBar-->EditMenu );
|
|
|
- EditorGuiStatusBar.setSelectionObjectsByCount( %this.getSelectionSize() );
|
|
|
-
|
|
|
- EWTreeWindow-->LockSelection.setStateOn( %this.getSelectionLockCount() > 0 );
|
|
|
-
|
|
|
- EWorldEditorToolbar-->boundingBoxColBtn.setStateOn( EWorldEditor.boundingBoxCollision );
|
|
|
-
|
|
|
- if( EWorldEditor.objectsUseBoxCenter )
|
|
|
- {
|
|
|
- EWorldEditorToolbar-->centerObject.setBitmap("tools/gui/images/menubar/bounds-center");
|
|
|
- objectCenterDropdown-->objectBoundsBtn.setStateOn( 1 );
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- EWorldEditorToolbar-->centerObject.setBitmap("tools/gui/images/menubar/object-center");
|
|
|
- objectCenterDropdown-->objectBoxBtn.setStateOn( 1 );
|
|
|
- }
|
|
|
-
|
|
|
- if( GlobalGizmoProfile.getFieldValue(alignment) $= "Object" )
|
|
|
- {
|
|
|
- EWorldEditorToolbar-->objectTransform.setBitmap("tools/gui/images/menubar/object-transform");
|
|
|
- objectTransformDropdown-->objectTransformBtn.setStateOn( 1 );
|
|
|
-
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- EWorldEditorToolbar-->objectTransform.setBitmap("tools/gui/images/menubar/world-transform");
|
|
|
- objectTransformDropdown-->worldTransformBtn.setStateOn( 1 );
|
|
|
- }
|
|
|
-
|
|
|
- EWorldEditorToolbar-->renderHandleBtn.setStateOn( EWorldEditor.renderObjHandle );
|
|
|
- EWorldEditorToolbar-->renderTextBtn.setStateOn( EWorldEditor.renderObjText );
|
|
|
-
|
|
|
- EWorldEditorToolbar-->objectSnapDownBtn.setStateOn( %this.stickToGround );
|
|
|
- SnapToBar-->objectSnapBtn.setStateOn( EWorldEditor.getSoftSnap() );
|
|
|
- EWorldEditorToolbar-->softSnapSizeTextEdit.setText( EWorldEditor.getSoftSnapSize() );
|
|
|
- ESnapOptions-->SnapSize.setText( EWorldEditor.getSoftSnapSize() );
|
|
|
- ESnapOptions-->GridSize.setText( EWorldEditor.getGridSize() );
|
|
|
-
|
|
|
- ESnapOptions-->GridSnapButton.setStateOn( %this.getGridSnap() );
|
|
|
- ESnapOptions-->GroupSnapButton.setStateOn( %this.UseGroupCenter );
|
|
|
- SnapToBar-->objectGridSnapBtn.setStateOn( %this.getGridSnap() );
|
|
|
- ESnapOptions-->NoSnapButton.setStateOn( !%this.stickToGround && !%this.getSoftSnap() && !%this.getGridSnap() );
|
|
|
-}
|
|
|
-
|
|
|
-function EWorldEditor::syncToolPalette( %this )
|
|
|
-{
|
|
|
- switch$ ( GlobalGizmoProfile.mode )
|
|
|
- {
|
|
|
- case "None":
|
|
|
- EWorldEditorNoneModeBtn.performClick();
|
|
|
- case "Move":
|
|
|
- EWorldEditorMoveModeBtn.performClick();
|
|
|
- case "Rotate":
|
|
|
- EWorldEditorRotateModeBtn.performClick();
|
|
|
- case "Scale":
|
|
|
- EWorldEditorScaleModeBtn.performClick();
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-function EWorldEditor::addSimGroup( %this, %groupCurrentSelection )
|
|
|
-{
|
|
|
- %activeSelection = %this.getActiveSelection();
|
|
|
- if ( %activeSelection.getObjectIndex( MissionGroup ) != -1 )
|
|
|
- {
|
|
|
- MessageBoxOK( "Error", "Cannot add MissionGroup to a new SimGroup" );
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- // Find our parent.
|
|
|
-
|
|
|
- %parent = MissionGroup;
|
|
|
- if( !%groupCurrentSelection && isObject( %activeSelection ) && %activeSelection.getCount() > 0 )
|
|
|
- {
|
|
|
- %firstSelectedObject = %activeSelection.getObject( 0 );
|
|
|
- if( %firstSelectedObject.isMemberOfClass( "SimGroup" ) )
|
|
|
- %parent = %firstSelectedObject;
|
|
|
- else if( %firstSelectedObject.getId() != MissionGroup.getId() )
|
|
|
- %parent = %firstSelectedObject.parentGroup;
|
|
|
- }
|
|
|
-
|
|
|
- // If we are about to do a group-selected as well,
|
|
|
- // starting recording an undo compound.
|
|
|
-
|
|
|
- if( %groupCurrentSelection )
|
|
|
- Editor.getUndoManager().pushCompound( "Group Selected" );
|
|
|
-
|
|
|
- // Create the SimGroup.
|
|
|
|
|
|
- %object = new SimGroup()
|
|
|
- {
|
|
|
- parentGroup = %parent;
|
|
|
- };
|
|
|
- MECreateUndoAction::submit( %object );
|
|
|
-
|
|
|
- // Put selected objects into the group, if requested.
|
|
|
-
|
|
|
- if( %groupCurrentSelection && isObject( %activeSelection ) )
|
|
|
- {
|
|
|
- %undo = UndoActionReparentObjects::create( EditorTree );
|
|
|
-
|
|
|
- %numObjects = %activeSelection.getCount();
|
|
|
- for( %i = 0; %i < %numObjects; %i ++ )
|
|
|
- {
|
|
|
- %sel = %activeSelection.getObject( %i );
|
|
|
- %undo.add( %sel, %sel.parentGroup, %object );
|
|
|
- %object.add( %sel );
|
|
|
- }
|
|
|
-
|
|
|
- %undo.addToManager( Editor.getUndoManager() );
|
|
|
- }
|
|
|
-
|
|
|
- // Stop recording for group-selected.
|
|
|
-
|
|
|
- if( %groupCurrentSelection )
|
|
|
- Editor.getUndoManager().popCompound();
|
|
|
-
|
|
|
- // When not grouping selection, make the newly created SimGroup the
|
|
|
- // current selection.
|
|
|
-
|
|
|
- if( !%groupCurrentSelection )
|
|
|
- {
|
|
|
- EWorldEditor.clearSelection();
|
|
|
- EWorldEditor.selectObject( %object );
|
|
|
- }
|
|
|
-
|
|
|
- // Refresh the Gui.
|
|
|
-
|
|
|
- %this.syncGui();
|
|
|
-}
|
|
|
-
|
|
|
-function EWorldEditor::toggleLockChildren( %this, %simGroup )
|
|
|
-{
|
|
|
- foreach( %child in %simGroup )
|
|
|
- {
|
|
|
- if( %child.class $= "SimGroup" )
|
|
|
- {
|
|
|
- %this.toggleHideChildren( %child );
|
|
|
- }
|
|
|
- if( %child.isMemberOfClass( "SimGroup" ) )
|
|
|
- {
|
|
|
- %this.toggleHideChildren( %child );
|
|
|
- %child.setLocked( !%child.locked );
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- %child.setLocked( !%child.locked );
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- EWorldEditor.syncGui();
|
|
|
-}
|
|
|
-
|
|
|
-function EWorldEditor::toggleHideChildren( %this, %simGroup )
|
|
|
-{
|
|
|
- foreach( %child in %simGroup )
|
|
|
- {
|
|
|
- if( %child.class $= "SimGroup" )
|
|
|
- {
|
|
|
- %this.toggleHideChildren( %child );
|
|
|
- }
|
|
|
- if( %child.isMemberOfClass( "SimGroup" ) )
|
|
|
- {
|
|
|
- %this.toggleHideChildren( %child );
|
|
|
- %this.hideObject( %child, !%child.hidden );
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- %this.hideObject( %child, !%child.hidden );
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- EWorldEditor.syncGui();
|
|
|
-}
|
|
|
-
|
|
|
-function EWorldEditor::convertSelectionToPolyhedralObjects( %this, %className )
|
|
|
-{
|
|
|
- %group = %this.getNewObjectGroup();
|
|
|
- %undoManager = Editor.getUndoManager();
|
|
|
-
|
|
|
- %activeSelection = %this.getActiveSelection();
|
|
|
- while( %activeSelection.getCount() != 0 )
|
|
|
- {
|
|
|
- %oldObject = %activeSelection.getObject( 0 );
|
|
|
- %newObject = %this.createPolyhedralObject( %className, %oldObject );
|
|
|
- if( isObject( %newObject ) )
|
|
|
- {
|
|
|
- %undoManager.pushCompound( "Convert ConvexShape to " @ %className );
|
|
|
- %newObject.parentGroup = %oldObject.parentGroup;
|
|
|
- MECreateUndoAction::submit( %newObject );
|
|
|
- MEDeleteUndoAction::submit( %oldObject );
|
|
|
- %undoManager.popCompound();
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-function EWorldEditor::convertSelectionToConvexShape( %this )
|
|
|
-{
|
|
|
- %group = %this.getNewObjectGroup();
|
|
|
- %undoManager = Editor.getUndoManager();
|
|
|
-
|
|
|
- %activeSelection = %this.getActiveSelection();
|
|
|
- while( %activeSelection.getCount() != 0 )
|
|
|
- {
|
|
|
- %oldObject = %activeSelection.getObject( 0 );
|
|
|
- %newObject = %this.createConvexShapeFrom( %oldObject );
|
|
|
- if( isObject( %newObject ) )
|
|
|
- {
|
|
|
- %undoManager.pushCompound( "Convert " @ %oldObject.getClassName() @ " to ConvexShape" );
|
|
|
- %newObject.parentGroup = %oldObject.parentGroup;
|
|
|
- MECreateUndoAction::submit( %newObject );
|
|
|
- MEDeleteUndoAction::submit( %oldObject );
|
|
|
- %undoManager.popCompound();
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-function EWorldEditor::getNewObjectGroup( %this )
|
|
|
-{
|
|
|
- return EWCreatorWindow.getNewObjectGroup();
|
|
|
-}
|
|
|
-
|
|
|
-function EWorldEditor::deleteMissionObject( %this, %object )
|
|
|
-{
|
|
|
- // Unselect in editor tree.
|
|
|
-
|
|
|
- %id = EditorTree.findItemByObjectId( %object );
|
|
|
- EditorTree.selectItem( %id, false );
|
|
|
-
|
|
|
- // Delete object.
|
|
|
-
|
|
|
- MEDeleteUndoAction::submit( %object );
|
|
|
- EWorldEditor.isDirty = true;
|
|
|
- EditorTree.buildVisibleTree( true );
|
|
|
-}
|
|
|
-
|
|
|
-function EWorldEditor::createGameObject( %this, %entity )
|
|
|
-{
|
|
|
- if(!isObject(GameObjectBuilder))
|
|
|
- {
|
|
|
- new GuiControl(GameObjectBuilder, EditorGuiGroup) {
|
|
|
- profile = "ToolsGuiDefaultProfile";
|
|
|
- horizSizing = "right";
|
|
|
- vertSizing = "bottom";
|
|
|
- position = "0 0";
|
|
|
- extent = "800 600";
|
|
|
- minExtent = "8 8";
|
|
|
- visible = "1";
|
|
|
- setFirstResponder = "0";
|
|
|
- modal = "1";
|
|
|
- helpTag = "0";
|
|
|
-
|
|
|
- new GuiWindowCtrl(GameObjectBuilderTargetWindow) {
|
|
|
- profile = "ToolsGuiWindowProfile";
|
|
|
- horizSizing = "center";
|
|
|
- vertSizing = "center";
|
|
|
- position = "384 205";
|
|
|
- extent = "256 102";
|
|
|
- minExtent = "256 8";
|
|
|
- visible = "1";
|
|
|
- setFirstResponder = "0";
|
|
|
- modal = "1";
|
|
|
- helpTag = "0";
|
|
|
- resizeWidth = "1";
|
|
|
- resizeHeight = "1";
|
|
|
- canMove = "1";
|
|
|
- canClose = "0";
|
|
|
- canMinimize = "0";
|
|
|
- canMaximize = "0";
|
|
|
- minSize = "50 50";
|
|
|
- text = "Create Object";
|
|
|
-
|
|
|
- new GuiTextCtrl() {
|
|
|
- profile = "GuiCenterTextProfile";
|
|
|
- horizSizing = "right";
|
|
|
- vertSizing = "bottom";
|
|
|
- position = "9 26";
|
|
|
- extent = "84 16";
|
|
|
- minExtent = "8 8";
|
|
|
- visible = "1";
|
|
|
- setFirstResponder = "0";
|
|
|
- modal = "1";
|
|
|
- helpTag = "0";
|
|
|
- text = "Object Name:";
|
|
|
- };
|
|
|
- new GuiTextEditCtrl(GameObjectBuilderObjectName) {
|
|
|
- class = ObjectBuilderGuiTextEditCtrl;
|
|
|
- profile = "ToolsGuiTextEditProfile";
|
|
|
- horizSizing = "width";
|
|
|
- vertSizing = "bottom";
|
|
|
- position = "78 26";
|
|
|
- extent = "172 18";
|
|
|
- minExtent = "8 8";
|
|
|
- visible = "1";
|
|
|
- setFirstResponder = "0";
|
|
|
- modal = "1";
|
|
|
- helpTag = "0";
|
|
|
- historySize = "0";
|
|
|
- };
|
|
|
- new GuiButtonCtrl(GameObjectBuilderOKButton) {
|
|
|
- profile = "ToolsGuiButtonProfile";
|
|
|
- horizSizing = "width";
|
|
|
- vertSizing = "bottom";
|
|
|
- position = "7 250";
|
|
|
- extent = "156 24";
|
|
|
- minExtent = "8 8";
|
|
|
- visible = "1";
|
|
|
- setFirstResponder = "0";
|
|
|
- modal = "1";
|
|
|
- command = "EWorldEditor.buildGameObject();";
|
|
|
- helpTag = "0";
|
|
|
- text = "Create New";
|
|
|
- Accelerator = "return";
|
|
|
- };
|
|
|
- new GuiButtonCtrl(GameObjectBuilderCancelButton) {
|
|
|
- profile = "ToolsGuiButtonProfile";
|
|
|
- horizSizing = "left";
|
|
|
- vertSizing = "bottom";
|
|
|
- position = "170 250";
|
|
|
- extent = "80 24";
|
|
|
- minExtent = "8 8";
|
|
|
- visible = "1";
|
|
|
- setFirstResponder = "0";
|
|
|
- modal = "1";
|
|
|
- command = "Canvas.popDialog(GameObjectBuilder);";
|
|
|
- helpTag = "0";
|
|
|
- text = "Cancel";
|
|
|
- Accelerator = "escape";
|
|
|
- };
|
|
|
- };
|
|
|
- };
|
|
|
-
|
|
|
- GameObjectBuilderTargetWindow.extent = getWord(GameObjectBuilderTargetWindow.extent, 0) SPC 88;
|
|
|
- GameObjectBuilderOKButton.position = getWord(GameObjectBuilderOKButton.position, 0) SPC 57;
|
|
|
- GameObjectBuilderCancelButton.position = getWord(GameObjectBuilderCancelButton.position, 0) SPC 57;
|
|
|
- }
|
|
|
-
|
|
|
- GameObjectBuilderObjectName.text = "";
|
|
|
- GameObjectBuilder.selectedEntity = %entity;
|
|
|
-
|
|
|
- Canvas.pushDialog(GameObjectBuilder);
|
|
|
-}
|
|
|
-
|
|
|
-function EWorldEditor::buildGameObject(%this)
|
|
|
-{
|
|
|
- if(GameObjectBuilderObjectName.getText() $= "")
|
|
|
- {
|
|
|
- error("Attempted to make a new Game Object with no name!");
|
|
|
- Canvas.popDialog(GameObjectBuilder);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- %path = EditorSettings.value( "WorldEditor/newGameObjectDir" );
|
|
|
- %className = GameObjectBuilderObjectName.getText();
|
|
|
- GameObjectBuilder.selectedEntity.class = %className;
|
|
|
- Inspector.inspect(GameObjectBuilder.selectedEntity);
|
|
|
-
|
|
|
- %file = new FileObject();
|
|
|
-
|
|
|
- if(%file.openForWrite(%path @ "\\" @ %className @ ".cs"))
|
|
|
- {
|
|
|
- %file.writeline("function " @ %className @ "::onAdd(%this)\n{\n\n}\n");
|
|
|
- %file.writeline("function " @ %className @ "::onRemove(%this)\n{\n\n}\n");
|
|
|
-
|
|
|
- //todo, pre-write any event functions of interest
|
|
|
-
|
|
|
- %file.close();
|
|
|
- }
|
|
|
-
|
|
|
- //set up the paths
|
|
|
- %tamlPath = %path @ "/" @ %className @ ".taml";
|
|
|
- %scriptPath = %path @ "/" @ %className @ ".cs";
|
|
|
- saveGameObject(%className, %tamlPath, %scriptPath);
|
|
|
-
|
|
|
- //reload it
|
|
|
- execGameObjects();
|
|
|
-
|
|
|
- //now, add the script file and a ref to the taml into our SGO manifest so we can readily spawn it later.
|
|
|
- TamlWrite(GameObjectBuilder.selectedEntity, %tamlpath);
|
|
|
-
|
|
|
- GameObjectBuilder.selectedEntity = "";
|
|
|
-
|
|
|
- Canvas.popDialog(GameObjectBuilder);
|
|
|
-}
|
|
|
-
|
|
|
-function EWorldEditor::selectAllObjectsInSet( %this, %set, %deselect )
|
|
|
-{
|
|
|
- if( !isObject( %set ) )
|
|
|
- return;
|
|
|
-
|
|
|
- foreach( %obj in %set )
|
|
|
- {
|
|
|
- if( %deselect )
|
|
|
- %this.unselectObject( %obj );
|
|
|
- else
|
|
|
- %this.selectObject( %obj );
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-function toggleSnappingOptions( %var )
|
|
|
-{
|
|
|
- if( SnapToBar->objectSnapDownBtn.getValue() && SnapToBar->objectSnapBtn.getValue() )
|
|
|
- {
|
|
|
- if( %var $= "terrain" )
|
|
|
- {
|
|
|
- EWorldEditor.stickToGround = 1;
|
|
|
- EWorldEditor.setSoftSnap(false);
|
|
|
- ESnapOptionsTabBook.selectPage(0);
|
|
|
- SnapToBar->objectSnapBtn.setStateOn(0);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- // soft snapping
|
|
|
- EWorldEditor.stickToGround = 0;
|
|
|
- EWorldEditor.setSoftSnap(true);
|
|
|
- ESnapOptionsTabBook.selectPage(1);
|
|
|
- SnapToBar->objectSnapDownBtn.setStateOn(0);
|
|
|
- }
|
|
|
- }
|
|
|
- else if( %var $= "terrain" && EWorldEditor.stickToGround == 0 )
|
|
|
- {
|
|
|
- // Terrain Snapping
|
|
|
- EWorldEditor.stickToGround = 1;
|
|
|
- EWorldEditor.setSoftSnap(false);
|
|
|
- ESnapOptionsTabBook.selectPage(0);
|
|
|
- SnapToBar->objectSnapDownBtn.setStateOn(1);
|
|
|
- SnapToBar->objectSnapBtn.setStateOn(0);
|
|
|
-
|
|
|
- }
|
|
|
- else if( %var $= "soft" && EWorldEditor.getSoftSnap() == false )
|
|
|
- {
|
|
|
- // Object Snapping
|
|
|
- EWorldEditor.stickToGround = 0;
|
|
|
- EWorldEditor.setSoftSnap(true);
|
|
|
- ESnapOptionsTabBook.selectPage(1);
|
|
|
- SnapToBar->objectSnapBtn.setStateOn(1);
|
|
|
- SnapToBar->objectSnapDownBtn.setStateOn(0);
|
|
|
-
|
|
|
- }
|
|
|
- else if( %var $= "grid" )
|
|
|
- {
|
|
|
- EWorldEditor.setGridSnap( !EWorldEditor.getGridSnap() );
|
|
|
- }
|
|
|
- else if( %var $= "byGroup" )
|
|
|
- {
|
|
|
- EWorldEditor.UseGroupCenter = !EWorldEditor.UseGroupCenter;
|
|
|
- ESnapOptions->GroupSnapButton.setStateOn(EWorldEditor.UseGroupCenter);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- // No snapping.
|
|
|
-
|
|
|
- EWorldEditor.stickToGround = false;
|
|
|
- EWorldEditor.setGridSnap( false );
|
|
|
- EWorldEditor.setSoftSnap( false );
|
|
|
-
|
|
|
- SnapToBar->objectSnapDownBtn.setStateOn(0);
|
|
|
- SnapToBar->objectSnapBtn.setStateOn(0);
|
|
|
- }
|
|
|
-
|
|
|
- EWorldEditor.syncGui();
|
|
|
-}
|
|
|
-
|
|
|
-function objectCenterDropdown::toggle()
|
|
|
-{
|
|
|
- if ( objectCenterDropdown.visible )
|
|
|
- {
|
|
|
- EWorldEditorToolbar-->centerObject.setStateOn(false);
|
|
|
- objectCenterDropdownDecoy.setVisible(false);
|
|
|
- objectCenterDropdownDecoy.setActive(false);
|
|
|
- objectCenterDropdown.setVisible(false);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- EWorldEditorToolbar-->centerObject.setStateOn(true);
|
|
|
- objectCenterDropdown.setVisible(true);
|
|
|
- objectCenterDropdownDecoy.setActive(true);
|
|
|
- objectCenterDropdownDecoy.setVisible(true);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-function objectTransformDropdown::toggle()
|
|
|
-{
|
|
|
- if ( objectTransformDropdown.visible )
|
|
|
- {
|
|
|
- EWorldEditorToolbar-->objectTransform.setStateOn(false);
|
|
|
- objectTransformDropdownDecoy.setVisible(false);
|
|
|
- objectTransformDropdownDecoy.setActive(false);
|
|
|
- objectTransformDropdown.setVisible(false);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- EWorldEditorToolbar-->objectTransform.setStateOn(true);
|
|
|
- objectTransformDropdown.setVisible(true);
|
|
|
- objectTransformDropdownDecoy.setActive(true);
|
|
|
- objectTransformDropdownDecoy.setVisible(true);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-function objectSnapDropdownDecoy::onMouseLeave()
|
|
|
-{
|
|
|
- objectSnapDropdown.toggle();
|
|
|
-}
|
|
|
-
|
|
|
-function objectCenterDropdownDecoy::onMouseLeave()
|
|
|
-{
|
|
|
- objectCenterDropdown.toggle();
|
|
|
-}
|
|
|
-
|
|
|
-function objectTransformDropdownDecoy::onMouseLeave()
|
|
|
-{
|
|
|
- objectTransformDropdown.toggle();
|
|
|
-}
|
|
|
-
|
|
|
-//------------------------------------------------------------------------------
|
|
|
-
|
|
|
-function EWAddSimGroupButton::onDefaultClick( %this )
|
|
|
-{
|
|
|
- EWorldEditor.addSimGroup();
|
|
|
-}
|
|
|
-
|
|
|
-function EWAddSimGroupButton::onCtrlClick( %this )
|
|
|
-{
|
|
|
- EWorldEditor.addSimGroup( true );
|
|
|
-}
|
|
|
-
|
|
|
-//------------------------------------------------------------------------------
|
|
|
-
|
|
|
-function EWToolsToolbar::reset( %this )
|
|
|
-{
|
|
|
- %count = ToolsToolbarArray.getCount();
|
|
|
- for( %i = 0 ; %i < %count; %i++ )
|
|
|
- ToolsToolbarArray.getObject(%i).setVisible(true);
|
|
|
-
|
|
|
- %this.setExtent((29 + 4) * %count + 12, 33);
|
|
|
- %this.isClosed = 0;
|
|
|
- EWToolsToolbar.isDynamic = 0;
|
|
|
-
|
|
|
- EWToolsToolbarDecoy.setVisible(false);
|
|
|
- EWToolsToolbarDecoy.setExtent((29 + 4) * %count + 4, 31);
|
|
|
-
|
|
|
- %this-->resizeArrow.setBitmap( "tools/gui/images/collapse-toolbar" );
|
|
|
-}
|
|
|
-
|
|
|
-function EWToolsToolbar::toggleSize( %this, %useDynamics )
|
|
|
-{
|
|
|
- // toggles the size of the tooltoolbar. also goes through
|
|
|
- // and hides each control not currently selected. we hide the controls
|
|
|
- // in a very neat, spiffy way
|
|
|
-
|
|
|
- if ( %this.isClosed == 0 )
|
|
|
- {
|
|
|
- %image = "tools/gui/images/expand-toolbar";
|
|
|
-
|
|
|
- for( %i = 0 ; %i < ToolsToolbarArray.getCount(); %i++ )
|
|
|
- {
|
|
|
- if( ToolsToolbarArray.getObject(%i).getValue() != 1 )
|
|
|
- ToolsToolbarArray.getObject(%i).setVisible(false);
|
|
|
- }
|
|
|
-
|
|
|
- %this.setExtent(43, 33);
|
|
|
- %this.isClosed = 1;
|
|
|
-
|
|
|
- if(!%useDynamics)
|
|
|
- {
|
|
|
- EWToolsToolbarDecoy.setVisible(true);
|
|
|
- EWToolsToolbar.isDynamic = 1;
|
|
|
- }
|
|
|
-
|
|
|
- EWToolsToolbarDecoy.setExtent(35, 31);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- %image = "tools/gui/images/collapse-toolbar";
|
|
|
-
|
|
|
- %count = ToolsToolbarArray.getCount();
|
|
|
- for( %i = 0 ; %i < %count; %i++ )
|
|
|
- ToolsToolbarArray.getObject(%i).setVisible(true);
|
|
|
-
|
|
|
- %this.setExtent((29 + 4) * %count + 12, 33);
|
|
|
- %this.isClosed = 0;
|
|
|
-
|
|
|
- if(!%useDynamics)
|
|
|
- {
|
|
|
- EWToolsToolbarDecoy.setVisible(false);
|
|
|
- EWToolsToolbar.isDynamic = 0;
|
|
|
- }
|
|
|
-
|
|
|
- EWToolsToolbarDecoy.setExtent((29 + 4) * %count + 4, 32);
|
|
|
- }
|
|
|
-
|
|
|
- %this-->resizeArrow.setBitmap( %image );
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-function EWToolsToolbarDecoy::onMouseEnter( %this )
|
|
|
-{
|
|
|
- EWToolsToolbar.toggleSize(true);
|
|
|
-}
|
|
|
-
|
|
|
-function EWToolsToolbarDecoy::onMouseLeave( %this )
|
|
|
-{
|
|
|
- EWToolsToolbar.toggleSize(true);
|
|
|
-}
|
|
|
-
|
|
|
-//------------------------------------------------------------------------------
|
|
|
-
|
|
|
-function EditorGuiStatusBar::reset( %this )
|
|
|
-{
|
|
|
- EWorldEditorStatusBarInfo.clearInfo();
|
|
|
-}
|
|
|
-
|
|
|
-function EditorGuiStatusBar::getInfo( %this )
|
|
|
-{
|
|
|
- return EWorldEditorStatusBarInfo.getValue();
|
|
|
-}
|
|
|
-
|
|
|
-function EditorGuiStatusBar::setInfo( %this, %text )
|
|
|
-{
|
|
|
- EWorldEditorStatusBarInfo.setText(%text);
|
|
|
-}
|
|
|
-
|
|
|
-function EditorGuiStatusBar::clearInfo( %this )
|
|
|
-{
|
|
|
- EWorldEditorStatusBarInfo.setText("");
|
|
|
-}
|
|
|
-
|
|
|
-function EditorGuiStatusBar::getSelection( %this )
|
|
|
-{
|
|
|
- return EWorldEditorStatusBarSelection.getValue();
|
|
|
-}
|
|
|
-
|
|
|
-function EditorGuiStatusBar::setSelection( %this, %text )
|
|
|
-{
|
|
|
- EWorldEditorStatusBarSelection.setText(%text);
|
|
|
-}
|
|
|
-
|
|
|
-function EditorGuiStatusBar::setSelectionObjectsByCount( %this, %count )
|
|
|
-{
|
|
|
- %text = " objects selected";
|
|
|
- if(%count == 1)
|
|
|
- %text = " object selected";
|
|
|
-
|
|
|
- EWorldEditorStatusBarSelection.setText(%count @ %text);
|
|
|
-}
|
|
|
-
|
|
|
-function EditorGuiStatusBar::clearSelection( %this )
|
|
|
-{
|
|
|
- EWorldEditorStatusBarSelection.setText("");
|
|
|
-}
|
|
|
-
|
|
|
-function EditorGuiStatusBar::getCamera( %this )
|
|
|
-{
|
|
|
- return EWorldEditorStatusBarCamera.getText();
|
|
|
-}
|
|
|
-
|
|
|
-function EditorGuiStatusBar::setCamera( %this, %text )
|
|
|
-{
|
|
|
- %id = EWorldEditorStatusBarCamera.findText( %text );
|
|
|
- if( %id != -1 )
|
|
|
- {
|
|
|
- if ( EWorldEditorStatusBarCamera.getSelected() != %id )
|
|
|
- EWorldEditorStatusBarCamera.setSelected( %id, true );
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-function EWorldEditorStatusBarCamera::onWake( %this )
|
|
|
-{
|
|
|
- %this.add( "Standard Camera" );
|
|
|
- %this.add( "1st Person Camera" );
|
|
|
- %this.add( "3rd Person Camera" );
|
|
|
- %this.add( "Orbit Camera" );
|
|
|
- %this.add( "Top View" );
|
|
|
- %this.add( "Bottom View" );
|
|
|
- %this.add( "Left View" );
|
|
|
- %this.add( "Right View" );
|
|
|
- %this.add( "Front View" );
|
|
|
- %this.add( "Back View" );
|
|
|
- %this.add( "Isometric View" );
|
|
|
- %this.add( "Smooth Camera" );
|
|
|
- %this.add( "Smooth Rot Camera" );
|
|
|
-}
|
|
|
-
|
|
|
-function EWorldEditorStatusBarCamera::onSelect( %this, %id, %text )
|
|
|
-{
|
|
|
- switch$( %text )
|
|
|
- {
|
|
|
- case "Top View":
|
|
|
- commandToServer( 'SetEditorCameraStandard' );
|
|
|
- EditorGui.setDisplayType( $EditTsCtrl::DisplayTypeTop );
|
|
|
-
|
|
|
- case "Bottom View":
|
|
|
- commandToServer( 'SetEditorCameraStandard' );
|
|
|
- EditorGui.setDisplayType( $EditTsCtrl::DisplayTypeBottom );
|
|
|
-
|
|
|
- case "Left View":
|
|
|
- commandToServer( 'SetEditorCameraStandard' );
|
|
|
- EditorGui.setDisplayType( $EditTsCtrl::DisplayTypeLeft );
|
|
|
-
|
|
|
- case "Right View":
|
|
|
- commandToServer( 'SetEditorCameraStandard' );
|
|
|
- EditorGui.setDisplayType( $EditTsCtrl::DisplayTypeRight );
|
|
|
-
|
|
|
- case "Front View":
|
|
|
- commandToServer( 'SetEditorCameraStandard' );
|
|
|
- EditorGui.setDisplayType( $EditTsCtrl::DisplayTypeFront );
|
|
|
-
|
|
|
- case "Back View":
|
|
|
- commandToServer( 'SetEditorCameraStandard' );
|
|
|
- EditorGui.setDisplayType( $EditTsCtrl::DisplayTypeBack );
|
|
|
-
|
|
|
- case "Isometric View":
|
|
|
- commandToServer( 'SetEditorCameraStandard' );
|
|
|
- EditorGui.setDisplayType( $EditTsCtrl::DisplayTypeIsometric );
|
|
|
-
|
|
|
- case "Standard Camera":
|
|
|
- commandToServer( 'SetEditorCameraStandard' );
|
|
|
- EditorGui.setDisplayType( $EditTsCtrl::DisplayTypePerspective );
|
|
|
-
|
|
|
- case "1st Person Camera":
|
|
|
- commandToServer( 'SetEditorCameraPlayer' );
|
|
|
- EditorGui.setDisplayType( $EditTsCtrl::DisplayTypePerspective );
|
|
|
-
|
|
|
- case "3rd Person Camera":
|
|
|
- commandToServer( 'SetEditorCameraPlayerThird' );
|
|
|
- EditorGui.setDisplayType( $EditTsCtrl::DisplayTypePerspective );
|
|
|
-
|
|
|
- case "Orbit Camera":
|
|
|
- commandToServer( 'SetEditorOrbitCamera' );
|
|
|
- EditorGui.setDisplayType( $EditTsCtrl::DisplayTypePerspective );
|
|
|
-
|
|
|
- case "Smooth Camera":
|
|
|
- commandToServer( 'SetEditorCameraNewton' );
|
|
|
- EditorGui.setDisplayType( $EditTsCtrl::DisplayTypePerspective );
|
|
|
-
|
|
|
- case "Smooth Rot Camera":
|
|
|
- commandToServer( 'SetEditorCameraNewtonDamped' );
|
|
|
- EditorGui.setDisplayType( $EditTsCtrl::DisplayTypePerspective );
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-//------------------------------------------------------------------------------------
|
|
|
-// Each a gui slider bar is pushed on the editor gui, it maps itself with value
|
|
|
-// located in its connected text control
|
|
|
-//------------------------------------------------------------------------------------
|
|
|
-function softSnapSizeSliderCtrlContainer::onWake(%this)
|
|
|
-{
|
|
|
- %this-->slider.setValue(EWorldEditorToolbar-->softSnapSizeTextEdit.getValue());
|
|
|
+ return 0;
|
|
|
}
|
|
|
-function softSnapSizeSliderCtrlContainer::onSliderChanged(%this)
|
|
|
-{
|
|
|
- EWorldEditor.setSoftSnapSize( %this-->slider.value );
|
|
|
- EWorldEditor.syncGui();
|
|
|
-}
|
|
|
-//------------------------------------------------------------------------------------
|
|
|
-
|
|
|
-function PaintBrushSizeSliderCtrlContainer::onWake(%this)
|
|
|
-{
|
|
|
- %this-->slider.range = "1" SPC getWord(ETerrainEditor.maxBrushSize, 0);
|
|
|
- %this-->slider.setValue(PaintBrushSizeTextEditContainer-->textEdit.getValue());
|
|
|
-}
|
|
|
-
|
|
|
-function PaintBrushPressureSliderCtrlContainer::onWake(%this)
|
|
|
-{
|
|
|
- %this-->slider.setValue(PaintBrushPressureTextEditContainer-->textEdit.getValue() / 100);
|
|
|
-}
|
|
|
-
|
|
|
-function PaintBrushSoftnessSliderCtrlContainer::onWake(%this)
|
|
|
-{
|
|
|
- %this-->slider.setValue(PaintBrushSoftnessTextEditContainer-->textEdit.getValue() / 100);
|
|
|
-}
|
|
|
-
|
|
|
-//------------------------------------------------------------------------------------
|
|
|
-
|
|
|
-function TerrainBrushSizeSliderCtrlContainer::onWake(%this)
|
|
|
-{
|
|
|
- %this-->slider.range = "1" SPC getWord(ETerrainEditor.maxBrushSize, 0);
|
|
|
- %this-->slider.setValue(TerrainBrushSizeTextEditContainer-->textEdit.getValue());
|
|
|
-}
|
|
|
-
|
|
|
-function TerrainBrushPressureSliderCtrlContainer::onWake(%this)
|
|
|
-{
|
|
|
- %this-->slider.setValue(TerrainBrushPressureTextEditContainer-->textEdit.getValue() / 100.0);
|
|
|
-}
|
|
|
-
|
|
|
-function TerrainBrushSoftnessSliderCtrlContainer::onWake(%this)
|
|
|
-{
|
|
|
- %this-->slider.setValue(TerrainBrushSoftnessTextEditContainer-->textEdit.getValue() / 100.0);
|
|
|
-}
|
|
|
-
|
|
|
-function TerrainSetHeightSliderCtrlContainer::onWake(%this)
|
|
|
-{
|
|
|
- %this-->slider.setValue(TerrainSetHeightTextEditContainer-->textEdit.getValue());
|
|
|
-}
|
|
|
-//------------------------------------------------------------------------------------
|
|
|
-function CameraSpeedDropdownCtrlContainer::onWake(%this)
|
|
|
-{
|
|
|
- %this-->slider.setValue(CameraSpeedDropdownContainer-->textEdit.getText());
|
|
|
-}
|
|
|
-
|
|
|
-//------------------------------------------------------------------------------------
|
|
|
-// Callbacks to close the dropdown slider controls like the camera speed,
|
|
|
-// that are marked with this class name.
|
|
|
-
|
|
|
-function EditorDropdownSliderContainer::onMouseDown(%this)
|
|
|
-{
|
|
|
- Canvas.popDialog(%this);
|
|
|
-}
|
|
|
-
|
|
|
-function EditorDropdownSliderContainer::onRightMouseDown(%this)
|
|
|
-{
|
|
|
- Canvas.popDialog(%this);
|
|
|
-}
|