فهرست منبع

Fixes issue where storing of AB position and extent wasn't applying correctly
Changes ShapeEditor's Library tab to an "Assets" tab and opens the AB with the shapeAsset filter on
Adds Asset tab to world editor scenetree window that opens the assetBrowser
Fixes issue where opening default scene in worldEditor would activate the saveAs dirty flag, then if you exit the level and open a new one, you can only saveAs and not save the existing level asset

JeffR 3 سال پیش
والد
کامیت
4f3d6c918b

+ 2 - 2
Templates/BaseGame/game/tools/assetBrowser/guis/assetBrowser.gui

@@ -157,8 +157,8 @@ $guiContent = new GuiControl(AssetBrowser) {
       position = "204 80";
       position = "204 80";
       extent = "615 608";
       extent = "615 608";
       minExtent = "383 274";
       minExtent = "383 274";
-      horizSizing = "center";
-      vertSizing = "center";
+      horizSizing = "windowRelative";
+      vertSizing = "windowRelative";
       profile = "ToolsGuiWindowProfile";
       profile = "ToolsGuiWindowProfile";
       visible = "1";
       visible = "1";
       active = "1";
       active = "1";

+ 9 - 0
Templates/BaseGame/game/tools/assetBrowser/main.tscript

@@ -169,6 +169,15 @@ function AssetBrowserPlugin::onWorldEditorStartup( %this )
 { 
 { 
 }
 }
 
 
+function AssetBrowserPlugin::onWorldEditorShutdown( %this )
+{
+   //force close us real fast to save off current settings/configs
+   if(AssetBrowser.isAwake())
+   {
+      AssetBrowser.hideDialog();
+   }
+}
+
 function AssetBrowserPlugin::initSettings( %this )
 function AssetBrowserPlugin::initSettings( %this )
 {
 {
    EditorSettings.beginGroup( "Assets", true );
    EditorSettings.beginGroup( "Assets", true );

+ 2 - 120
Templates/BaseGame/game/tools/shapeEditor/gui/shapeEdSelectWindow.ed.gui

@@ -45,7 +45,7 @@ $guiContent = new GuiControl() {
       EdgeSnap = "1";
       EdgeSnap = "1";
       text = "Shapes";
       text = "Shapes";
 
 
-      new GuiTabBookCtrl() {
+      new GuiTabBookCtrl(ShapeEditorTabbook) {
          internalName = "tabBook";
          internalName = "tabBook";
          canSaveDynamicFields = "0";
          canSaveDynamicFields = "0";
          isContainer = "1";
          isContainer = "1";
@@ -175,126 +175,8 @@ $guiContent = new GuiControl() {
             AnchorBottom = "0";
             AnchorBottom = "0";
             AnchorLeft = "1";
             AnchorLeft = "1";
             AnchorRight = "0";
             AnchorRight = "0";
-            text = "Library";
+            text = "Assets";
             maxLength = "1024";
             maxLength = "1024";
-
-            new GuiContainer() {
-               isContainer = "1";
-               HorizSizing = "width";
-               VertSizing = "height";
-               position = "0 0";
-               Extent = "202 146";
-               MinExtent = "0 -500";
-               Profile = "GuiInspectorProfile";
-            };
-            new GuiBitmapBorderCtrl() {
-               isContainer = "1";
-               HorizSizing = "width";
-               VertSizing = "height";
-               position = "0 0";
-               Extent = "202 146";
-               MinExtent = "0 -500";
-               Profile = "ToolsGuiTabBorderProfile";
-            };
-            new GuiBitmapButtonCtrl() {
-               canSaveDynamicFields = "0";
-               isContainer = "0";
-               Profile = "ToolsGuiButtonProfile";
-               HorizSizing = "right";
-               VertSizing = "bottom";
-               position = "3 4";
-               Extent = "20 19";
-               MinExtent = "8 2";
-               canSave = "1";
-               Visible = "1";
-               Command = "ShapeEdSelectWindow.navigateUp();";
-               tooltipprofile = "ToolsGuiToolTipProfile";
-               hovertime = "1000";
-               groupNum = "0";
-               buttonType = "PushButton";
-               useMouseEvents = "0";
-               bitmapAsset = "ToolsModule:folderUp_image";
-            };
-            new GuiPopUpMenuCtrl(ShapeEdSelectMenu) {
-               canSaveDynamicFields = "0";
-               isContainer = "0";
-               Profile = "ToolsGuiPopUpMenuProfile";
-               HorizSizing = "width";
-               VertSizing = "bottom";
-               position = "26 4";
-               Extent = "172 18";
-               MinExtent = "8 2";
-               canSave = "1";
-               Visible = "1";
-               tooltipprofile = "ToolsGuiToolTipProfile";
-               hovertime = "1000";
-               Margin = "0 0 0 0";
-               Padding = "0 0 0 0";
-               AnchorTop = "1";
-               AnchorBottom = "0";
-               AnchorLeft = "1";
-               AnchorRight = "0";
-               text = "art";
-               maxLength = "1024";
-               maxPopupHeight = "200";
-               sbUsesNAColor = "0";
-               reverseTextList = "0";
-               bitmapBounds = "16 16";
-            };
-            new GuiScrollCtrl() {
-               canSaveDynamicFields = "0";
-               isContainer = "1";
-               Profile = "ToolsGuiScrollProfile";
-               HorizSizing = "width";
-               VertSizing = "height";
-               position = "0 24";
-               Extent = "202 122";
-               MinExtent = "8 -500";
-               canSave = "1";
-               Visible = "1";
-               tooltipprofile = "ToolsGuiToolTipProfile";
-               hovertime = "1000";
-               Margin = "0 0 0 0";
-               Padding = "0 0 0 0";
-               AnchorTop = "1";
-               AnchorBottom = "0";
-               AnchorLeft = "1";
-               AnchorRight = "0";
-               willFirstRespond = "1";
-               hScrollBar = "dynamic";
-               vScrollBar = "dynamic";
-               lockHorizScroll = false;
-               lockVertScroll = "false";
-               constantThumbHeight = "0";
-               childMargin = "0 0";
-               mouseWheelScrollSpeed = "-1";
-
-               new GuiDynamicCtrlArrayControl() {
-                  internalName = "shapeLibrary";
-                  canSaveDynamicFields = "0";
-                  isContainer = "1";
-                  Profile = "ToolsGuiTransparentProfile";
-                  HorizSizing = "right";
-                  VertSizing = "bottom";
-                  position = "1 1";
-                  Extent = "189 42";
-                  MinExtent = "8 11";
-                  canSave = "1";
-                  Visible = "1";
-                  tooltipprofile = "ToolsGuiToolTipProfile";
-                  hovertime = "1000";
-                  colCount = "1";
-                  colSize = "64";
-                  rowCount = "0";
-                  RowSize = "64";
-                  rowSpacing = "4";
-                  colSpacing = "4";
-                  frozen = "0";
-                  autoCellSize = "1";
-                  fillRowFirst = "1";
-                  dynamicSize = "1";
-               };
-            };
          };
          };
 
 
          //---------------------------------------------------------------
          //---------------------------------------------------------------

+ 0 - 1
Templates/BaseGame/game/tools/shapeEditor/main.tscript

@@ -127,7 +127,6 @@ function ShapeEditorPlugin::onWorldEditorStartup(%this)
    ShapeEdSeqNodeTabBook.selectPage(0);
    ShapeEdSeqNodeTabBook.selectPage(0);
    ShapeEdAdvancedWindow-->tabBook.selectPage(0);
    ShapeEdAdvancedWindow-->tabBook.selectPage(0);
    ShapeEdSelectWindow-->tabBook.selectPage(0);
    ShapeEdSelectWindow-->tabBook.selectPage(0);
-   ShapeEdSelectWindow.navigate("");
 
 
    SetToggleButtonValue( ShapeEditorToolbar-->orbitNodeBtn, 0 );
    SetToggleButtonValue( ShapeEditorToolbar-->orbitNodeBtn, 0 );
    SetToggleButtonValue( ShapeEditorToolbar-->ghostMode, 0 );
    SetToggleButtonValue( ShapeEditorToolbar-->ghostMode, 0 );

+ 10 - 224
Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditor.ed.tscript

@@ -366,230 +366,6 @@ function ShapeEdShapeTreeView::onSelect( %this, %obj )
    ShapeEdHintMenu.setSelected( %hintId );
    ShapeEdHintMenu.setSelected( %hintId );
 }
 }
 
 
-// Find all DTS or COLLADA models. Note: most of this section was shamelessly
-// stolen from creater.ed.tscript => great work whoever did the original!
-function ShapeEdSelectWindow::navigate( %this, %address )
-{
-   // Freeze the icon array so it doesn't update until we've added all of the
-   // icons
-   %this-->shapeLibrary.frozen = true;
-   %this-->shapeLibrary.clear();
-   ShapeEdSelectMenu.clear();
-
-   %filePatterns = getFormatExtensions();
-   %fullPath = findFirstFileMultiExpr( %filePatterns );
-
-   while ( %fullPath !$= "" )
-   {
-      // Ignore cached DTS files
-      if ( endswith( %fullPath, "cached.dts" ) )
-      {
-         %fullPath = findNextFileMultiExpr( %filePatterns );
-         continue;
-      }
-
-      // Ignore assets in the tools folder
-      %fullPath = makeRelativePath( %fullPath, getMainDotCSDir() );
-      %splitPath = strreplace( %fullPath, " ", "_" );
-      %splitPath = strreplace( %splitPath, "/", " " );
-      if ( getWord( %splitPath, 0 ) $= "tools" )
-      {
-         %fullPath = findNextFileMultiExpr( %filePatterns );
-         continue;
-      }
-
-      %dirCount = getWordCount( %splitPath ) - 1;
-      %pathFolders = getWords( %splitPath, 0, %dirCount - 1 );
-
-      // Add this file's path ( parent folders ) to the
-      // popup menu if it isn't there yet.
-      %temp = strreplace( %pathFolders, " ", "/" );
-      %temp = strreplace( %temp, "_", " " );
-      %r = ShapeEdSelectMenu.findText( %temp );
-      if ( %r == -1 )
-         ShapeEdSelectMenu.add( %temp );
-
-      // Is this file in the current folder?
-      if ( stricmp( %pathFolders, %address ) == 0 )
-      {
-         %this.addShapeIcon( %fullPath );
-      }
-      // Then is this file in a subfolder we need to add
-      // a folder icon for?
-      else
-      {
-         %wordIdx = 0;
-         %add = false;
-
-         if ( %address $= "" )
-         {
-            %add = true;
-            %wordIdx = 0;
-         }
-         else
-         {
-            for ( ; %wordIdx < %dirCount; %wordIdx++ )
-            {
-               %temp = getWords( %splitPath, 0, %wordIdx );
-               if ( stricmp( %temp, %address ) == 0 )
-               {
-                  %add = true;
-                  %wordIdx++;
-                  break;
-               }
-            }
-         }
-
-         if ( %add == true )
-         {
-            %folder = getWord( %splitPath, %wordIdx );
-
-            // Add folder icon if not already present
-            %ctrl = %this.findIconCtrl( %folder );
-            if ( %ctrl == -1 )
-               %this.addFolderIcon( %folder );
-         }
-      }
-
-      %fullPath = findNextFileMultiExpr( %filePatterns );
-   }
-
-   %this-->shapeLibrary.sort( "alphaIconCompare" );
-   for ( %i = 0; %i < %this-->shapeLibrary.getCount(); %i++ )
-      %this-->shapeLibrary.getObject( %i ).autoSize = false;
-
-   %this-->shapeLibrary.frozen = false;
-   %this-->shapeLibrary.refresh();
-   %this.address = %address;
-
-   ShapeEdSelectMenu.sort();
-
-   %str = strreplace( %address, " ", "/" );
-   %r = ShapeEdSelectMenu.findText( %str );
-   if ( %r != -1 )
-      ShapeEdSelectMenu.setSelected( %r, false );
-   else
-      ShapeEdSelectMenu.setText( %str );
-}
-
-function ShapeEdSelectWindow::navigateDown( %this, %folder )
-{
-   if ( %this.address $= "" )
-      %address = %folder;
-   else
-      %address = %this.address SPC %folder;
-
-   // Because this is called from an IconButton::onClick command
-   // we have to wait a tick before actually calling navigate, else
-   // we would delete the button out from under itself.
-   %this.schedule( 1, "navigate", %address );
-}
-
-function ShapeEdSelectWindow::navigateUp( %this )
-{
-   %count = getWordCount( %this.address );
-
-   if ( %count == 0 )
-      return;
-
-   if ( %count == 1 )
-      %address = "";
-   else
-      %address = getWords( %this.address, 0, %count - 2 );
-
-   %this.navigate( %address );
-}
-
-function ShapeEdSelectWindow::findIconCtrl( %this, %name )
-{
-   for ( %i = 0; %i < %this-->shapeLibrary.getCount(); %i++ )
-   {
-      %ctrl = %this-->shapeLibrary.getObject( %i );
-      if ( %ctrl.text $= %name )
-         return %ctrl;
-   }
-   return -1;
-}
-
-function ShapeEdSelectWindow::createIcon( %this )
-{
-   %ctrl = new GuiIconButtonCtrl()
-   {
-      profile = "GuiCreatorIconButtonProfile";
-      iconLocation = "Left";
-      textLocation = "Right";
-      extent = "348 19";
-      textMargin = 8;
-      buttonMargin = "2 2";
-      autoSize = false;
-      sizeIconToButton = true;
-      makeIconSquare = true;
-      buttonType = "radioButton";
-      groupNum = "-1";   
-   };
-
-   return %ctrl;
-}
-
-function ShapeEdSelectWindow::addFolderIcon( %this, %text )
-{
-   %ctrl = %this.createIcon();
-
-   %ctrl.altCommand = "ShapeEdSelectWindow.navigateDown( \"" @ %text @ "\" );";
-   %ctrl.iconBitmap = "tools/gui/images/folder.png";
-   %ctrl.text = %text;
-   %ctrl.tooltip = %text;
-   %ctrl.class = "CreatorFolderIconBtn";
-   
-   %ctrl.buttonType = "radioButton";
-   %ctrl.groupNum = "-1";
-   
-   %this-->shapeLibrary.addGuiControl( %ctrl );
-}
-
-function ShapeEdSelectWindow::addShapeIcon( %this, %fullPath )
-{
-   %ctrl = %this.createIcon();
-
-   %ext = fileExt( %fullPath );
-   %file = fileBase( %fullPath );
-   %fileLong = %file @ %ext;
-   %tip = %fileLong NL
-          "Size: " @ fileSize( %fullPath ) / 1000.0 SPC "KB" NL
-          "Date Created: " @ fileCreatedTime( %fullPath ) NL
-          "Last Modified: " @ fileModifiedTime( %fullPath );
-
-   %ctrl.altCommand = "ShapeEdSelectWindow.onSelect( \"" @ %fullPath @ "\" );";
-   %ctrl.iconBitmap = ( ( %ext $= ".dts" ) ? EditorIconRegistry::findIconByClassName( "TSStatic" ) : "tools/gui/images/iconCollada" );
-   %ctrl.text = %file;
-   %ctrl.class = "CreatorStaticIconBtn";
-   %ctrl.tooltip = %tip;
-   
-   %ctrl.buttonType = "radioButton";
-   %ctrl.groupNum = "-1";
-
-   // Check if a shape specific icon is available
-   %formats = ".png .jpg .dds .bmp .gif .jng .tga";
-   %count = getWordCount( %formats );
-   for ( %i = 0; %i < %count; %i++ )
-   {
-      %ext = getWord( %formats, %i );
-      if ( isFile( %fullPath @ %ext ) )
-      {
-         %ctrl.iconBitmap = %fullPath @ %ext;
-         break;
-      }
-   }
-
-   %this-->shapeLibrary.addGuiControl( %ctrl );
-}
-
-function ShapeEdSelectMenu::onSelect( %this, %id, %text )
-{
-   %split = strreplace( %text, "/", " " );
-   ShapeEdSelectWindow.navigate( %split );
-}
-
 // Update the GUI in response to the shape selection changing
 // Update the GUI in response to the shape selection changing
 function ShapeEdPropWindow::update_onShapeSelectionChanged( %this )
 function ShapeEdPropWindow::update_onShapeSelectionChanged( %this )
 {
 {
@@ -3444,3 +3220,13 @@ function showShapeEditorPreview()
    %visible = ShapeEditorToolbar-->showPreview.getValue();
    %visible = ShapeEditorToolbar-->showPreview.getValue();
    ShapeEdPreviewGui.setVisible( %visible );
    ShapeEdPreviewGui.setVisible( %visible );
 }
 }
+
+//
+function ShapeEditorTabbook::onTabSelected( %this )
+{
+   if( EditorTreeTabBook.getSelectedPage() == 1)
+   {
+      AssetBrowser.toggleDialog();
+      AssetBrowser.toggleAssetTypeFilter(12); //show only shapeAssets
+   }
+}

+ 23 - 0
Templates/BaseGame/game/tools/worldEditor/gui/WorldEditorTreeWindow.ed.gui

@@ -176,6 +176,29 @@ $guiContent = new GuiControl() {
                };
                };
             };
             };
          };
          };
+      
+         new GuiTabPageCtrl() {
+            canSaveDynamicFields = "0";
+            Enabled = "1";
+            isContainer = "1";
+            Profile = "ToolsGuiEditorTabPage";
+            HorizSizing = "width";
+            VertSizing = "height";
+            position = "0 19";
+            Extent = "197 271";
+            MinExtent = "8 2";
+            canSave = "1";
+            Visible = "1";
+            hovertime = "1000";
+            Margin = "0 0 0 0";
+            Padding = "0 0 0 0";
+            AnchorTop = "1";
+            AnchorBottom = "0";
+            AnchorLeft = "1";
+            AnchorRight = "0";
+            text = "Assets";
+            maxLength = "1024";
+         };
       };
       };
       new GuiBitmapButtonCtrl() {
       new GuiBitmapButtonCtrl() {
          canSaveDynamicFields = "0";
          canSaveDynamicFields = "0";

+ 2 - 0
Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.tscript

@@ -1932,6 +1932,8 @@ function EditorTreeTabBook::onTabSelected( %this )
    }
    }
    else
    else
    {
    {
+      AssetBrowser.toggleDialog();
+      EditorTreeTabBook.selectPage(0);
       EWTreeWindow-->DeleteSelection.visible = false;
       EWTreeWindow-->DeleteSelection.visible = false;
       EWTreeWindow-->LockSelection.visible = false;
       EWTreeWindow-->LockSelection.visible = false;
       EWTreeWindow-->AddSimGroup.visible = false;
       EWTreeWindow-->AddSimGroup.visible = false;

+ 1 - 0
Templates/BaseGame/game/tools/worldEditor/scripts/editor.ed.tscript

@@ -191,6 +191,7 @@ package EditorDisconnectOverride
    {
    {
       if ( isObject( Editor ) && Editor.isEditorEnabled() )
       if ( isObject( Editor ) && Editor.isEditorEnabled() )
       {
       {
+         EditorGui.saveAs = false; //whatever edits we were doing are irrelevent now
          %mainMenuGUI = ProjectSettings.value("UI/mainMenuName");
          %mainMenuGUI = ProjectSettings.value("UI/mainMenuName");
          if (isObject( %mainMenuGUI ))
          if (isObject( %mainMenuGUI ))
             Editor.close( %mainMenuGUI );
             Editor.close( %mainMenuGUI );