Merge pull request #2338 from Areloch/MoreMenubarFixes

Fixes some outstanding menubar problems.
This commit is contained in:
Areloch 2019-03-31 12:39:31 -05:00 committed by GitHub
commit 6daf0c8d34
8 changed files with 113 additions and 54 deletions

View file

@ -64,28 +64,6 @@ function destroyPhysicsTools()
function PhysicsEditorPlugin::onWorldEditorStartup( %this )
{
new PopupMenu( PhysicsToolsMenu )
{
superClass = "MenuBuilder";
//class = "PhysXToolsMenu";
barTitle = "Physics";
item[0] = "Start Simulation" TAB "Ctrl-Alt P" TAB "physicsStartSimulation( \"client\" );physicsStartSimulation( \"server\" );";
//item[1] = "Stop Simulation" TAB "" TAB "physicsSetTimeScale( 0 );";
item[1] = "-";
item[2] = "Speed 25%" TAB "" TAB "physicsSetTimeScale( 0.25 );";
item[3] = "Speed 50%" TAB "" TAB "physicsSetTimeScale( 0.5 );";
item[4] = "Speed 100%" TAB "" TAB "physicsSetTimeScale( 1.0 );";
item[5] = "-";
item[6] = "Reload NXBs" TAB "" TAB "";
};
// Add our menu.
EditorGui.menuBar.insert( PhysicsToolsMenu, EditorGui.menuBar.dynamicItemInsertPos );
// Add ourselves to the window menu.
//EditorGui.addToWindowMenu( "Road and Path Editor", "", "RoadEditor" );
}
function PhysicsToolsMenu::onMenuSelect(%this)

View file

@ -317,10 +317,15 @@ function EditorGui::shutdown( %this )
/// will take over the default world editor window.
function EditorGui::addToEditorsMenu( %this, %displayName, %accel, %newPlugin )
{
//We need to cache the editors list. So first see if we have our list we cache the entries into
if(!isObject(EditorsMenuList))
{
new ArrayObject(EditorsMenuList);
}
%windowMenu = %this.findMenu( "Editors" );
%count = %windowMenu.getItemCount();
%alreadyExists = false;
for ( %i = 0; %i < %count; %i++ )
{
@ -336,7 +341,10 @@ function EditorGui::addToEditorsMenu( %this, %displayName, %accel, %newPlugin )
%accel = "";
if(!%alreadyExists)
{
EditorsMenuList.add(%displayName TAB %accel TAB %newPlugin);
%windowMenu.addItem( %count, %displayName TAB %accel TAB %newPlugin );
}
return %accel;
}

View file

@ -113,7 +113,7 @@ function EditorGui::buildMenus(%this)
%this.menuBar = new GuiMenuBar(WorldEditorMenubar)
{
dynamicItemInsertPos = 3;
extent = "1024 20";
extent = Canvas.extent.x SPC "20";
minExtent = "320 20";
horizSizing = "width";
profile = "GuiMenuBarProfile";
@ -251,6 +251,41 @@ function EditorGui::buildMenus(%this)
//item[5] = "-";
};
%this.menuBar.insert(%editorsMenu);
//if we're just refreshing the menus, we probably have a list of editors we want added to the Editors menu there, so check and if so, add them now
if(isObject(EditorsMenuList))
{
%editorsListCount = EditorsMenuList.count();
for(%e = 0; %e < %editorsListCount; %e++)
{
%menuEntry = EditorsMenuList.getKey(%e);
%editorsMenu.addItem(%e, %menuEntry);
}
}
if(isObject(PhysicsEditorPlugin))
{
%physicsToolsMenu = new PopupMenu()
{
superClass = "MenuBuilder";
//class = "PhysXToolsMenu";
barTitle = "Physics";
item[0] = "Start Simulation" TAB "Ctrl-Alt P" TAB "physicsStartSimulation( \"client\" );physicsStartSimulation( \"server\" );";
//item[1] = "Stop Simulation" TAB "" TAB "physicsSetTimeScale( 0 );";
item[1] = "-";
item[2] = "Speed 25%" TAB "" TAB "physicsSetTimeScale( 0.25 );";
item[3] = "Speed 50%" TAB "" TAB "physicsSetTimeScale( 0.5 );";
item[4] = "Speed 100%" TAB "" TAB "physicsSetTimeScale( 1.0 );";
item[5] = "-";
item[6] = "Reload NXBs" TAB "" TAB "";
};
// Add our menu.
%this.menuBar.insert( %physicsToolsMenu, EditorGui.menuBar.dynamicItemInsertPos );
}
// Lighting Menu
%lightingMenu = new PopupMenu()
@ -389,6 +424,11 @@ function EditorGui::buildMenus(%this)
//////////////////////////////////////////////////////////////////////////
function WorldEditorMenubar::onResize(%this)
{
%this.extent.x = Canvas.extent.x;
}
function EditorGui::attachMenus(%this)
{
%this.menuBar.attachToCanvas(Canvas, 0);