Browse Source

Fixes the member-of-class check order to properly sort the context. Also fixes a bug with the spacer entries being filtered from the popup menu, which threw off the selection.

Areloch 9 years ago
parent
commit
51049b6e8c

+ 3 - 1
Engine/source/platformSDL/menus/popupMenuSDL.cpp

@@ -99,7 +99,9 @@ void PopupMenu::createPlatformMenu()
 S32 PopupMenu::insertItem(S32 pos, const char *title, const char* accelerator, const char* cmd)
 S32 PopupMenu::insertItem(S32 pos, const char *title, const char* accelerator, const char* cmd)
 {   
 {   
    GuiMenuBar::MenuItem *item = GuiMenuBar::findMenuItem( mData->mMenuGui, title );
    GuiMenuBar::MenuItem *item = GuiMenuBar::findMenuItem( mData->mMenuGui, title );
-   if(item)
+   
+   //We'll make a special exception for the spacer items
+   if(item && dStrcmp(title, ""))
    {
    {
       setItem( pos, title, accelerator, cmd);
       setItem( pos, title, accelerator, cmd);
       return pos;
       return pos;

+ 16 - 16
Templates/Full/game/tools/worldEditor/scripts/EditorGui.ed.cs

@@ -1619,7 +1619,7 @@ function EditorTree::onRightMouseUp( %this, %itemId, %mouse, %obj )
    }
    }
 
 
    // Open context menu if this is a SimGroup
    // Open context menu if this is a SimGroup
-   else if( %obj.isMemberOfClass( "SimGroup" ) )
+   else if( !%obj.isMemberOfClass( "SceneObject" ) )
    {
    {
       %popup = ETSimGroupContextPopup;
       %popup = ETSimGroupContextPopup;
       if( !isObject( %popup ) )
       if( !isObject( %popup ) )
@@ -1643,20 +1643,6 @@ function EditorTree::onRightMouseUp( %this, %itemId, %mouse, %obj )
 
 
             object = -1;
             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 );";
-            };
-      }
 
 
       %popup.object = %obj;
       %popup.object = %obj;
       
       
@@ -1689,9 +1675,23 @@ function EditorTree::onRightMouseUp( %this, %itemId, %mouse, %obj )
 
 
             object = -1;
             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. 
       // Specialized version for ConvexShapes. 
-      if( %obj.isMemberOfClass( "ConvexShape" ) )
+      else if( %obj.isMemberOfClass( "ConvexShape" ) )
       {
       {
          %popup = ETConvexShapeContextPopup;      
          %popup = ETConvexShapeContextPopup;      
          if( !isObject( %popup ) )
          if( !isObject( %popup ) )