Ver código fonte

WIP of marking active scene in the scenetree

Areloch 4 anos atrás
pai
commit
27cf3466c3

+ 15 - 4
Engine/source/gui/controls/guiTreeViewCtrl.cpp

@@ -540,8 +540,14 @@ void GuiTreeViewCtrl::Item::getDisplayText(U32 bufLen, char *buf)
             if( mState.test( ShowObjectName ) )
             {
                S32 n = 0;
-               if( hasObjectName )
-                  n = dSprintf( ptr, len, "%s", pObjName );
+               if (hasObjectName)
+               {
+                  //If it's been marked, reflect that
+                  if (mState.test(Item::Marked))
+                     n = dSprintf(ptr, len, "*%s", pObjName);
+                  else
+                     n = dSprintf(ptr, len, "%s", pObjName);                  
+               }
                else if( mState.test( ShowClassNameForUnnamed ) )
                   n = dSprintf( ptr, len, "%s", pClassName );
                   
@@ -549,8 +555,13 @@ void GuiTreeViewCtrl::Item::getDisplayText(U32 bufLen, char *buf)
                len -= n;
             }
             
-            if( hasInternalName && mState.test( ShowInternalName ) )
-               dSprintf( ptr, len, " [%s]", pInternalName );
+            if (hasInternalName && mState.test(ShowInternalName))
+            {
+               if (mState.test(Item::Marked))
+                  dSprintf(ptr, len, " *[%s]", pInternalName);
+               else
+                  dSprintf(ptr, len, " [%s]", pObjName);
+            }
          }
       }
       else

+ 23 - 1
Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.cs

@@ -615,6 +615,9 @@ function EditorGui::onNewLevelLoaded( %this, %levelName )
    //ECameraSettingsPage.init();
    EditorCameraSpeedOptions.setupDefaultState();
    
+   //Set our starting Active Scene being edited
+   EWorldEditor.SetActiveScene(getRootScene());
+   
    new ScriptObject( EditorMissionCleanup )
    {
       parentGroup = "MissionCleanup";
@@ -1647,7 +1650,10 @@ function EditorTree::onRightMouseUp( %this, %itemId, %mouse, %obj )
       }
       else if( %obj.isMemberOfClass( "Scene" ))
       {
-         %popup.item[ 0 ] = "Set as Active Scene" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId(" @ %popup.object @ ") );";
+         %popup.object = %obj;
+         %haveObjectEntries = true;
+         
+         %popup.item[ 0 ] = "Set as Active Scene" TAB "" TAB "EWorldEditor.SetActiveScene(" @ %popup.object @ ");";
          %popup.item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject(" @ %popup.object @ ");";
          %popup.item[ 2 ] = "Inspect" TAB "" TAB "inspectObject(" @ %popup.object @ ");";
          %popup.item[ 3 ] = "-";
@@ -2281,6 +2287,22 @@ function EWorldEditor::selectAllObjectsInSet( %this, %set, %deselect )
    }
 }
 
+function EWorldEditor::SetActiveScene(%this, %sceneObj)
+{
+   if(isObject($ActiveEditingScene))
+   {
+      $ActiveEditingScene.isEditing = false;
+      %itemId = EditorTree.findItemByObjectId($ActiveScene);
+      EditorTree.markItem(%itemId);
+   }
+      
+   %itemId = EditorTree.findItemByObjectId(%sceneObj);
+   EditorTree.markItem(%itemId);
+   
+   $ActiveEditingScene = %sceneObj;
+   $ActiveEditingScene.isEditing = true;
+}
+
 function toggleSnappingOptions( %var )
 {
    if( SnapToBar->objectSnapDownBtn.getValue() && SnapToBar->objectSnapBtn.getValue() )