Merge branch 'development' into ConvexProxies

This commit is contained in:
Areloch 2018-12-09 15:34:12 -06:00 committed by GitHub
commit 8c2e27057e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2824 changed files with 196009 additions and 224327 deletions

View file

@ -152,9 +152,20 @@ function MenuBuilder::onAdd(%this)
}
}
function MenuBuilder::reloadItems(%this)
{
%this.clearItems();
for(%i = 0;%this.item[%i] !$= "";%i++)
{
%this.addItem(%i);
}
}
function MenuBuilder::onRemove(%this)
{
%this.removeFromMenuBar();
if(%this.isMethod("removeFromMenuBar"))
%this.removeFromMenuBar();
}
//////////////////////////////////////////////////////////////////////////

View file

@ -50,7 +50,7 @@ function ForestEditorGui::onActiveForestUpdated( %this, %forest, %createNew )
/// Called from a message box when a forest is not found.
function ForestEditorGui::createForest( %this )
{
%forestObject = parseMissionGroupForIds("Forest", "");
%forestObject = trim(parseMissionGroupForIds("Forest", ""));
if ( isObject( %forestObject ) )
{

View file

@ -143,7 +143,7 @@ function ForestEditorPlugin::onActivated( %this )
//ForestEditToolbar.setVisible( true );
//Get our existing forest object in our current mission if we have one
%forestObject = parseMissionGroupForIds("Forest", "");
%forestObject = trim(parseMissionGroupForIds("Forest", ""));
if(isObject(%forestObject))
{
ForestEditorGui.setActiveForest(%forestObject.getName());
@ -241,7 +241,7 @@ function ForestEditorPlugin::onSaveMission( %this, %missionFile )
ForestDataManager.saveDirty();
//First, find out if we have an existing forest object
%forestObject = parseMissionGroupForIds("Forest", "");
%forestObject = trim(parseMissionGroupForIds("Forest", ""));
if ( isObject( %forestObject ) )
{

View file

@ -35,4 +35,3 @@ exec("./GuiEaseEditDlg.ed.cs");
exec("./guiObjectInspector.ed.cs");
exec("./uvEditor.ed.gui");
exec("./objectSelection.ed.cs");
exec("./guiPlatformGenericMenubar.ed.cs");

View file

@ -1,19 +0,0 @@
if(isClass(GuiPlatformGenericMenuBar))
{
exec("./guiPlatformGenericMenubar.ed.gui");
}
else
{
%guiContent = new GuiControl(PlatformGenericMenubar) {
profile = "GuiModelessDialogProfile";
new GuiControl()
{
internalName = "menubar";
extent = "1024 20";
minExtent = "320 20";
horizSizing = "width";
profile = "GuiMenuBarProfile";
};
};
}

View file

@ -1,14 +0,0 @@
//--- OBJECT WRITE BEGIN ---
%guiContent = new GuiControl(PlatformGenericMenubar) {
profile = "GuiModelessDialogProfile";
new GuiPlatformGenericMenuBar()
{
internalName = "menubar";
extent = "1024 20";
minExtent = "320 20";
horizSizing = "width";
profile = "GuiMenuBarProfile";
};
};
//--- OBJECT WRITE END ---

View file

@ -223,7 +223,7 @@ function GuiEditor::switchToWorldEditor( %this )
function GuiEditor::enableMenuItems(%this, %val)
{
%menu = GuiEditCanvas.menuBar->EditMenu.getID();
%menu = GuiEditCanvas.menuBar.findMenu("Edit").getID();
%menu.enableItem( 3, %val ); // cut
%menu.enableItem( 4, %val ); // copy
@ -239,8 +239,8 @@ function GuiEditor::enableMenuItems(%this, %val)
%menu.enableItem( 18, %val ); // group
%menu.enableItem( 19, %val ); // ungroup
GuiEditCanvas.menuBar->LayoutMenu.enableAllItems( %val );
GuiEditCanvas.menuBar->MoveMenu.enableAllItems( %val );
GuiEditCanvas.menuBar.findMenu("Layout").enableAllItems( %val );
GuiEditCanvas.menuBar.findMenu("Move").enableAllItems( %val );
}
//---------------------------------------------------------------------------------------------
@ -294,7 +294,7 @@ function GuiEditor::updateUndoMenu(%this)
%nextUndo = %uman.getNextUndoName();
%nextRedo = %uman.getNextRedoName();
%editMenu = GuiEditCanvas.menuBar->editMenu;
%editMenu = GuiEditCanvas.menuBar.findMenu("Edit");
%editMenu.setItemName( 0, "Undo " @ %nextUndo );
%editMenu.setItemName( 1, "Redo " @ %nextRedo );
@ -443,7 +443,7 @@ function GuiEditor::setPreviewResolution( %this, %width, %height )
function GuiEditor::toggleEdgeSnap( %this )
{
%this.snapToEdges = !%this.snapToEdges;
GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_EDGESNAP_INDEX, %this.snapToEdges );
GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_EDGESNAP_INDEX, %this.snapToEdges );
GuiEditorEdgeSnapping_btn.setStateOn( %this.snapToEdges );
}
@ -452,7 +452,7 @@ function GuiEditor::toggleEdgeSnap( %this )
function GuiEditor::toggleCenterSnap( %this )
{
%this.snapToCenters = !%this.snapToCenters;
GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_CENTERSNAP_INDEX, %this.snapToCenters );
GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_CENTERSNAP_INDEX, %this.snapToCenters );
GuiEditorCenterSnapping_btn.setStateOn( %this.snapToCenters );
}
@ -461,7 +461,7 @@ function GuiEditor::toggleCenterSnap( %this )
function GuiEditor::toggleFullBoxSelection( %this )
{
%this.fullBoxSelection = !%this.fullBoxSelection;
GuiEditCanvas.menuBar->EditMenu.checkItem( $GUI_EDITOR_MENU_FULLBOXSELECT_INDEX, %this.fullBoxSelection );
GuiEditCanvas.menuBar.findMenu("Edit").checkItem( $GUI_EDITOR_MENU_FULLBOXSELECT_INDEX, %this.fullBoxSelection );
}
//---------------------------------------------------------------------------------------------
@ -469,7 +469,7 @@ function GuiEditor::toggleFullBoxSelection( %this )
function GuiEditor::toggleDrawGuides( %this )
{
%this.drawGuides= !%this.drawGuides;
GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_DRAWGUIDES_INDEX, %this.drawGuides );
GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_DRAWGUIDES_INDEX, %this.drawGuides );
}
//---------------------------------------------------------------------------------------------
@ -477,7 +477,7 @@ function GuiEditor::toggleDrawGuides( %this )
function GuiEditor::toggleGuideSnap( %this )
{
%this.snapToGuides = !%this.snapToGuides;
GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_GUIDESNAP_INDEX, %this.snapToGuides );
GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_GUIDESNAP_INDEX, %this.snapToGuides );
}
//---------------------------------------------------------------------------------------------
@ -485,7 +485,7 @@ function GuiEditor::toggleGuideSnap( %this )
function GuiEditor::toggleControlSnap( %this )
{
%this.snapToControls = !%this.snapToControls;
GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_CONTROLSNAP_INDEX, %this.snapToControls );
GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_CONTROLSNAP_INDEX, %this.snapToControls );
}
//---------------------------------------------------------------------------------------------
@ -493,7 +493,7 @@ function GuiEditor::toggleControlSnap( %this )
function GuiEditor::toggleCanvasSnap( %this )
{
%this.snapToCanvas = !%this.snapToCanvas;
GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_CANVASSNAP_INDEX, %this.snapToCanvas );
GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_CANVASSNAP_INDEX, %this.snapToCanvas );
}
//---------------------------------------------------------------------------------------------
@ -506,7 +506,7 @@ function GuiEditor::toggleGridSnap( %this )
else
%this.setSnapToGrid( %this.snap2GridSize );
GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_GRIDSNAP_INDEX, %this.snap2Grid );
GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_GRIDSNAP_INDEX, %this.snap2Grid );
GuiEditorSnapCheckBox.setStateOn( %this.snap2Grid );
}
@ -993,14 +993,14 @@ function GuiEditorGui::onWake( %this )
// Set up initial menu toggle states.
GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_EDGESNAP_INDEX, GuiEditor.snapToEdges );
GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_CENTERSNAP_INDEX, GuiEditor.snapToCenters );
GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_GUIDESNAP_INDEX, GuiEditor.snapToGuides );
GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_CONTROLSNAP_INDEX, GuiEditor.snapToControls );
GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_CANVASSNAP_INDEX, GuiEditor.snapToCanvas );
GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_GRIDSNAP_INDEX, GuiEditor.snap2Grid );
GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_DRAWGUIDES_INDEX, GuiEditor.drawGuides );
GuiEditCanvas.menuBar->EditMenu.checkItem( $GUI_EDITOR_MENU_FULLBOXSELECT_INDEX, GuiEditor.fullBoxSelection );
GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_EDGESNAP_INDEX, GuiEditor.snapToEdges );
GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_CENTERSNAP_INDEX, GuiEditor.snapToCenters );
GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_GUIDESNAP_INDEX, GuiEditor.snapToGuides );
GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_CONTROLSNAP_INDEX, GuiEditor.snapToControls );
GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_CANVASSNAP_INDEX, GuiEditor.snapToCanvas );
GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_GRIDSNAP_INDEX, GuiEditor.snap2Grid );
GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_DRAWGUIDES_INDEX, GuiEditor.drawGuides );
GuiEditCanvas.menuBar.findMenu("Edit").checkItem( $GUI_EDITOR_MENU_FULLBOXSELECT_INDEX, GuiEditor.fullBoxSelection );
// Sync toolbar buttons.

View file

@ -66,9 +66,13 @@ function GuiEditCanvas::onCreateMenu(%this)
}
// Menu bar
%this.menuBar = new MenuBar()
%this.menuBar = new GuiMenuBar(GuiEditorMenubar)
{
dynamicItemInsertPos = 3;
extent = "1024 20";
minExtent = "320 20";
horizSizing = "width";
profile = "GuiMenuBarProfile";
new PopupMenu()
{

View file

@ -28,33 +28,6 @@
function GuiEditorTreeView::init(%this)
{
if( !isObject( %this.contextMenu ) )
%this.contextMenu = new PopupMenu()
{
superClass = "MenuBuilder";
isPopup = true;
item[ 0 ] = "Rename" TAB "" TAB "GuiEditorTreeView.showItemRenameCtrl( GuiEditorTreeView.findItemByObjectId( %this.object ) );";
item[ 1 ] = "Delete" TAB "" TAB "GuiEditor.deleteControl( %this.object );";
item[ 2 ] = "-";
item[ 3 ] = "Locked" TAB "" TAB "%this.object.setLocked( !%this.object.locked ); GuiEditorTreeView.update();";
item[ 4 ] = "Hidden" TAB "" TAB "%this.object.setVisible( !%this.object.isVisible() ); GuiEditorTreeView.update();";
item[ 5 ] = "-";
item[ 6 ] = "Add New Controls Here" TAB "" TAB "GuiEditor.setCurrentAddSet( %this.object );";
item[ 7 ] = "Add Child Controls to Selection" TAB "" TAB "GuiEditor.selectAllControlsInSet( %this.object, false );";
item[ 8 ] = "Remove Child Controls from Selection" TAB "" TAB "GuiEditor.selectAllControlsInSet( %this.object, true );";
object = -1;
};
if( !isObject( %this.contextMenuMultiSel ) )
%this.contextMenuMultiSel = new PopupMenu()
{
superClass = "MenuBuilder";
isPopup = true;
item[ 0 ] = "Delete" TAB "" TAB "GuiEditor.deleteSelection();";
};
}
//---------------------------------------------------------------------------------------------
@ -113,12 +86,36 @@ function GuiEditorTreeView::onRightMouseDown( %this, %item, %pts, %obj )
{
if( %this.getSelectedItemsCount() > 1 )
{
%popup = %this.contextMenuMultiSel;
%popup = new PopupMenu()
{
superClass = "MenuBuilder";
isPopup = true;
object = -1;
};
%popup.item[ 0 ] = "Delete" TAB "" TAB "GuiEditor.deleteSelection();";
%popup.reloadItems();
%popup.showPopup( Canvas );
}
else if( %obj )
{
%popup = %this.contextMenu;
%popup = new PopupMenu()
{
superClass = "MenuBuilder";
isPopup = true;
object = %obj;
};
%popup.item[ 0 ] = "Rename" TAB "" TAB "GuiEditorTreeView.showItemRenameCtrl( GuiEditorTreeView.findItemByObjectId(" @ %popup.object @ ") );";
%popup.item[ 1 ] = "Delete" TAB "" TAB "GuiEditor.deleteControl(" @ %popup.object @ ");";
%popup.item[ 2 ] = "-";
%popup.item[ 3 ] = "Locked" TAB "" TAB "%this.object.setLocked( !" @ %popup.object @ ".locked); GuiEditorTreeView.update();";
%popup.item[ 4 ] = "Hidden" TAB "" TAB "%this.object.setVisible( !" @ %popup.object @ ".isVisible() ); GuiEditorTreeView.update();";
%popup.item[ 5 ] = "-";
%popup.item[ 6 ] = "Add New Controls Here" TAB "" TAB "GuiEditor.setCurrentAddSet( " @ %popup.object @ ");";
%popup.item[ 7 ] = "Add Child Controls to Selection" TAB "" TAB "GuiEditor.selectAllControlsInSet( " @ %popup.object @ ", false );";
%popup.item[ 8 ] = "Remove Child Controls from Selection" TAB "" TAB "GuiEditor.selectAllControlsInSet( " @ %popup.object @ ", true );";
%popup.checkItem( 3, %obj.locked );
%popup.checkItem( 4, !%obj.isVisible() );
@ -127,7 +124,8 @@ function GuiEditorTreeView::onRightMouseDown( %this, %item, %pts, %obj )
%popup.enableItem( 7, %obj.getCount() > 0 );
%popup.enableItem( 8, %obj.getCount() > 0 );
%popup.object = %obj;
%popup.reloadItems();
%popup.showPopup( Canvas );
}
}

View file

@ -2719,7 +2719,7 @@ function ShapeEdDetailTree::onRightMouseUp( %this, %itemId, %mouse )
superClass = "MenuBuilder";
isPopup = "1";
item[ 0 ] = "Hidden" TAB "" TAB "ShapeEdDetailTree.onHideMeshItem( %this._objName, !%this._itemHidden );";
item[ 0 ] = "Hidden" TAB "" TAB "ShapeEdDetailTree.onHideMeshItem(" @ ShapeEdMeshPopup._objName @ ", !" @ ShapeEdMeshPopup @ "._itemHidden );";
item[ 1 ] = "-";
item[ 2 ] = "Hide all" TAB "" TAB "ShapeEdDetailTree.onHideMeshItem( \"\", true );";
item[ 3 ] = "Show all" TAB "" TAB "ShapeEdDetailTree.onHideMeshItem( \"\", false );";

View file

@ -1302,6 +1302,7 @@ function VisibilityDropdownToggle()
{
EVisibility.setVisible(true);
visibilityToggleBtn.setStateOn(1);
EVisibility.setExtent("200 540");
}
}
@ -1569,169 +1570,112 @@ function EditorTree::onRightMouseUp( %this, %itemId, %mouse, %obj )
%haveObjectEntries = false;
%haveLockAndHideEntries = true;
// Handle multi-selection.
//Set up the generic pop-up pre-emptively if we haven't already
%popup = new PopupMenu()
{
superClass = "MenuBuilder";
isPopup = "1";
object = -1;
bookmark = -1;
};
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 );";
};
%popup.item[ 0 ] = "Delete" TAB "" TAB "EditorMenuEditDelete();";
%popup.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( "CameraBookmark" ) )
{
%popup.bookmark = %obj;
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 );";
};
%popup.item[ 0 ] = "Go To Bookmark" TAB "" TAB "EditorGui.jumpToBookmark( " @ %popup.bookmark.getInternalName() @ " );";
}
// Specialized version for ConvexShapes.
else if( %obj.isMemberOfClass( "ConvexShape" ) )
else if( %obj.name $= "CameraBookmarks" )
{
%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\" );";
};
%popup.item[ 0 ] = "Add Camera Bookmark" TAB "" TAB "EditorGui.addCameraBookmarkByGui();";
}
// Specialized version for polyhedral objects.
else if( %obj.isMemberOfClass( "Zone" ) ||
else
{
%popup.object = %obj;
%haveObjectEntries = true;
%popup.item[ 0 ] = "Rename" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId(" @ %popup.object @ ") );";
%popup.item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject(" @ %popup.object @ ");";
%popup.item[ 2 ] = "Inspect" TAB "" TAB "inspectObject(" @ %popup.object @ ");";
%popup.item[ 3 ] = "-";
%popup.item[ 4 ] = "Locked" TAB "" TAB "%this.object.setLocked( !" @ %popup.object @ ".locked ); EWorldEditor.syncGui();";
%popup.item[ 5 ] = "Hidden" TAB "" TAB "EWorldEditor.hideObject( " @ %popup.object @ ", !" @ %popup.object @ ".hidden ); EWorldEditor.syncGui();";
%popup.item[ 6 ] = "-";
%popup.item[ 7 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );";
if( %obj.isMemberOfClass( "ConvexShape" ) )
{
%popup.item[ 8 ] = "-";
%popup.item[ 9 ] = "Convert to Zone" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Zone\" );";
%popup.item[ 10 ] = "Convert to Portal" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Portal\" );";
%popup.item[ 11 ] = "Convert to Occluder" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"OcclusionVolume\" );";
%popup.item[ 12 ] = "Convert to Sound Space" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"SFXSpace\" );";
}
else if( %obj.isMemberOfClass( "Zone" ) ||
%obj.isMemberOfClass( "Portal" ) ||
%obj.isMemberOfClass( "OcclusionVolume" ) ||
%obj.isMemberOfClass( "SFXSpace" ) )
{
%popup = ETPolyObjectContextPopup;
if( !isObject( %popup ) )
%popup = new PopupMenu( ETPolyObjectContextPopup : ETContextPopup )
{
%popup.item[ 8 ] = "-";
%popup.item[ 9 ] = "Convert to ConvexShape" TAB "" TAB "EWorldEditor.convertSelectionToConvexShape();";
}
else if(%obj.getClassName() $= "SimGroup" ||
%obj.isMemberOfClass( "Path" ) ||
%obj.isMemberOfClass("Entity") )
{
//If it's not any special-handle classes above, then it'll be group-based stuff here
%popup.item[ 4 ] = "Toggle Lock Children" TAB "" TAB "EWorldEditor.toggleLockChildren( " @ %popup.object @ " );";
%popup.item[ 5 ] = "Toggle Hide Children" TAB "" TAB "EWorldEditor.toggleHideChildren( " @ %popup.object @ " );";
%popup.item[ 8 ] = "-";
%popup.item[ 9 ] = "Add New Objects Here" TAB "" TAB "EWCreatorWindow.setNewObjectGroup( " @ %popup.object @ " );";
%popup.item[ 10 ] = "Add Children to Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( " @ %popup.object @ ", false );";
%popup.item[ 11 ] = "Remove Children from Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( " @ %popup.object @ ", true );";
%hasChildren = %obj.getCount() > 0;
%popup.enableItem( 10, %hasChildren );
%popup.enableItem( 11, %hasChildren );
%haveObjectEntries = true;
%haveLockAndHideEntries = false;
//Special case for Entities, which is special-case AND does group stuff with chld objects
if(%obj.isMemberOfClass("Entity"))
{
superClass = "MenuBuilder";
isPopup = "1";
item[ 8 ] = "-";
item[ 9 ] = "Convert to ConvexShape" TAB "" TAB "EWorldEditor.convertSelectionToConvexShape();";
};
%popup.item[ 12 ] = "-";
%popup.item[ 13 ] = "Convert to Game Object" TAB "" TAB "EWorldEditor.createGameObject( " @ %popup.object @ " );";
%popup.item[ 14 ] = "Duplicate Game Object" TAB "" TAB "EWorldEditor.duplicateGameObject( " @ %popup.object @ " );";
%popup.item[ 15 ] = "Show in Asset Browser" TAB "" TAB "EWorldEditor.showGameObjectInAssetBrowser( " @ %popup.object @ " );";
if(!isObject(AssetDatabase.acquireAsset(%obj.gameObjectAsset)))
{
%popup.enableItem(13, true);
%popup.enableItem(14, false);
%popup.enableItem(15, false);
}
else
{
%popup.enableItem(13, false);
%popup.enableItem(14, true);
%popup.enableItem(15, true);
}
}
}
}
%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 );
@ -1740,6 +1684,7 @@ function EditorTree::onRightMouseUp( %this, %itemId, %mouse, %obj )
%popup.enableItem( 7, %this.isItemSelected( %itemId ) );
}
%popup.reloadItems();
%popup.showPopup( Canvas );
}
@ -2017,7 +1962,7 @@ function EWorldEditor::syncGui( %this )
%this.syncToolPalette();
EditorTree.update();
Editor.getUndoManager().updateUndoMenu( EditorGui.menuBar-->EditMenu );
Editor.getUndoManager().updateUndoMenu( EditorGui.findMenu("Edit") );
EditorGuiStatusBar.setSelectionObjectsByCount( %this.getSelectionSize() );
EWTreeWindow-->LockSelection.setStateOn( %this.getSelectionLockCount() > 0 );
@ -2253,155 +2198,6 @@ function EWorldEditor::deleteMissionObject( %this, %object )
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 ) )

View file

@ -34,7 +34,6 @@ EditorSettings.setDefaultValue( "orthoFOV", "50" );
EditorSettings.setDefaultValue( "orthoShowGrid", "1" );
EditorSettings.setDefaultValue( "currentEditor", "WorldEditorInspectorPlugin" );
EditorSettings.setDefaultValue( "newLevelFile", "tools/levels/BlankRoom.mis" );
EditorSettings.setDefaultValue( "newGameObjectDir", "scripts/server/gameObjects" );
if( isFile( "C:/Program Files/Torsion/Torsion.exe" ) )
EditorSettings.setDefaultValue( "torsionPath", "C:/Program Files/Torsion/Torsion.exe" );

View file

@ -304,36 +304,6 @@ function EWCreatorWindow::navigate( %this, %address )
%this.addShapeIcon( %obj );
}
}
//Add a separate folder for Game Objects
if(isClass("Entity"))
{
if(%address $= "")
{
%this.addFolderIcon("GameObjects");
}
else
{
//find all GameObjectAssets
%assetQuery = new AssetQuery();
if(!AssetDatabase.findAssetType(%assetQuery, "GameObjectAsset"))
return 0; //if we didn't find ANY, just exit
%count = %assetQuery.getCount();
for(%i=0; %i < %count; %i++)
{
%assetId = %assetQuery.getAsset(%i);
%gameObjectAsset = AssetDatabase.acquireAsset(%assetId);
if(isFile(%gameObjectAsset.TAMLFilePath))
{
%this.addGameObjectIcon( %gameObjectAsset.gameObjectName );
}
}
}
}
}
if ( %this.tab $= "Meshes" )
@ -768,22 +738,6 @@ function EWCreatorWindow::addPrefabIcon( %this, %fullPath )
%this.contentCtrl.addGuiControl( %ctrl );
}
function EWCreatorWindow::addGameObjectIcon( %this, %gameObjectName )
{
%ctrl = %this.createIcon();
%ctrl.altCommand = "spawnGameObject( \"" @ %gameObjectName @ "\", true );";
%ctrl.iconBitmap = EditorIconRegistry::findIconByClassName( "Prefab" );
%ctrl.text = %gameObjectName;
%ctrl.class = "CreatorGameObjectIconBtn";
%ctrl.tooltip = "Spawn the " @ %gameObjectName @ " GameObject";
%ctrl.buttonType = "radioButton";
%ctrl.groupNum = "-1";
%this.contentCtrl.addGuiControl( %ctrl );
}
function CreatorPopupMenu::onSelect( %this, %id, %text )
{
%split = strreplace( %text, "/", " " );

View file

@ -110,9 +110,13 @@ function EditorGui::buildMenus(%this)
};
// Menu bar
%this.menuBar = new MenuBar(WorldEditorMenubar)
%this.menuBar = new GuiMenuBar(WorldEditorMenubar)
{
dynamicItemInsertPos = 3;
extent = "1024 20";
minExtent = "320 20";
horizSizing = "width";
profile = "GuiMenuBarProfile";
};
// File Menu
@ -158,7 +162,7 @@ function EditorGui::buildMenus(%this)
%fileMenu.appendItem("Exit Level" TAB "" TAB "EditorExitMission();");
%fileMenu.appendItem("Quit" TAB %quitShortcut TAB "EditorQuitGame();");
%this.menuBar.insert(%fileMenu, %this.menuBar.getCount());
%this.menuBar.insert(%fileMenu);
// Edit Menu
%editMenu = new PopupMenu()
@ -187,7 +191,7 @@ function EditorGui::buildMenus(%this)
item[15] = "Game Options..." TAB "" TAB "Canvas.pushDialog(optionsDlg);";
item[16] = "PostEffect Manager" TAB "" TAB "Canvas.pushDialog(PostFXManager);";
};
%this.menuBar.insert(%editMenu, %this.menuBar.getCount());
%this.menuBar.insert(%editMenu);
// View Menu
%viewMenu = new PopupMenu()
@ -201,7 +205,7 @@ function EditorGui::buildMenus(%this)
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, %this.menuBar.getCount());
%this.menuBar.insert(%viewMenu);
// Camera Menu
%cameraMenu = new PopupMenu()
@ -229,7 +233,7 @@ function EditorGui::buildMenus(%this)
Item[15] = "Manage Bookmarks..." TAB "Ctrl-Shift B" TAB "EditorGui.toggleCameraBookmarkWindow();";
item[16] = "Jump to Bookmark" TAB %this.cameraBookmarksMenu;
};
%this.menuBar.insert(%cameraMenu, %this.menuBar.getCount());
%this.menuBar.insert(%cameraMenu);
// Editors Menu
%editorsMenu = new PopupMenu()
@ -246,7 +250,7 @@ function EditorGui::buildMenus(%this)
//item[4] = "Terrain Painter" TAB "F4" TAB TerrainPainterPlugin;
//item[5] = "-";
};
%this.menuBar.insert(%editorsMenu, %this.menuBar.getCount());
%this.menuBar.insert(%editorsMenu);
// Lighting Menu
%lightingMenu = new PopupMenu()
@ -263,7 +267,7 @@ function EditorGui::buildMenus(%this)
// NOTE: The light managers will be inserted as the
// last menu items in EditorLightingMenu::onAdd().
};
%this.menuBar.insert(%lightingMenu, %this.menuBar.getCount());
%this.menuBar.insert(%lightingMenu);
// Tools Menu
%toolsMenu = new PopupMenu()
@ -278,7 +282,7 @@ function EditorGui::buildMenus(%this)
item[2] = "Torque SimView" TAB "" TAB "tree();";
item[3] = "Make Selected a Mesh" TAB "" TAB "makeSelectedAMesh();";
};
%this.menuBar.insert(%toolsMenu, %this.menuBar.getCount());
%this.menuBar.insert(%toolsMenu);
// Help Menu
%helpMenu = new PopupMenu()
@ -293,7 +297,7 @@ function EditorGui::buildMenus(%this)
item[2] = "Offline Reference Guide..." TAB "" TAB "shellexecute(EWorldEditor.documentationReference);";
item[3] = "Torque 3D Forums..." TAB "" TAB "gotoWebPage(EWorldEditor.forumURL);";
};
%this.menuBar.insert(%helpMenu, %this.menuBar.getCount());
%this.menuBar.insert(%helpMenu);
// Menus that are added/removed dynamically (temporary)
@ -398,9 +402,9 @@ function EditorGui::setMenuDefaultState(%this)
if(! isObject(%this.menuBar))
return 0;
for(%i = 0;%i < %this.menuBar.getCount();%i++)
for(%i = 0;%i < %this.menuBar.getMenuCount();%i++)
{
%menu = %this.menuBar.getObject(%i);
%menu = %this.menuBar.getMenu(%i);
%menu.setupDefaultState();
}
@ -414,9 +418,10 @@ function EditorGui::findMenu(%this, %name)
if(! isObject(%this.menuBar))
return 0;
for(%i = 0;%i < %this.menuBar.getCount();%i++)
for(%i = 0; %i < %this.menuBar.getMenuCount(); %i++)
{
%menu = %this.menuBar.getObject(%i);
%menu = %this.menuBar.getMenu(%i);
if(%name $= %menu.barTitle)
return %menu;