Procházet zdrojové kódy

Changed default terrain paths to go into data/terrains if nothing is set
Added default terrianmat definition for warning_material
Corrected separator-h image path for a few GUI controls
Corrected SelectAssetPathWindow reference so it focuses the window right
Changed new asset window to work with new Select Path window and address system
Added call to force AssetBrowser to load/initialize when the tools are initialized(ensures anything utilizing assets in other tools don't have reference issues)
Standardized drag-n-drop move behavior in the Asset browser so dragging onto the folder tree and a folder in the browser both behave more predictably
If import config is set to not allow importing with errors, then the Done button is disabled when errors are detected
Updated the example assettype file for the AB
Fixed up move/delete/rename behavior for folders in AB
Begun full standardization of move/delete/rename actions for other asset types in AB
Added standardized call for New Asset field fillouts by letting the asset types populate them
Moved terrain block creation to the standard create call so it can accept other normal fields like resolution
Updated the 'Do you want to create' terrain block prompts to generate the asset if yes, and if no it'll prompt to go find an existing terrain asset
Added placeholder image for terrain material asset for preview
Updated refresh behavior for terrain material assets so they properly populate on creation now
Added standardized functions to the directoryHandling class for folder/file manipulation
Corrected some warnMat image references

Areloch před 5 roky
rodič
revize
c0dd314c12
31 změnil soubory, kde provedl 538 přidání a 230 odebrání
  1. 1 1
      Engine/source/terrain/terrData.cpp
  2. 1 0
      Templates/BaseGame/game/core/rendering/Core_Rendering.cs
  3. 7 0
      Templates/BaseGame/game/core/rendering/scripts/gfxData/warningTerrainMat.cs
  4. 1 1
      Templates/BaseGame/game/tools/VPathEditor/GUI/VPathEditor.gui
  5. binární
      Templates/BaseGame/game/tools/assetBrowser/art/terrainMaterialIcon.png
  6. 2 2
      Templates/BaseGame/game/tools/assetBrowser/guis/assetImport.gui
  7. 75 40
      Templates/BaseGame/game/tools/assetBrowser/guis/newAsset.gui
  8. 1 1
      Templates/BaseGame/game/tools/assetBrowser/guis/selectPath.gui
  9. 4 0
      Templates/BaseGame/game/tools/assetBrowser/main.cs
  10. 0 1
      Templates/BaseGame/game/tools/assetBrowser/scripts/addModuleWindow.cs
  11. 69 20
      Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.cs
  12. 14 11
      Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.cs
  13. 33 16
      Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/assetTypeExample.cs
  14. 15 44
      Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/folder.cs
  15. 11 2
      Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/level.cs
  16. 77 2
      Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/script.cs
  17. 66 6
      Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/terrain.cs
  18. 5 3
      Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/terrainMaterial.cs
  19. 78 0
      Templates/BaseGame/game/tools/assetBrowser/scripts/directoryHandling.cs
  20. 12 24
      Templates/BaseGame/game/tools/assetBrowser/scripts/editAsset.cs
  21. 28 25
      Templates/BaseGame/game/tools/assetBrowser/scripts/newAsset.cs
  22. 18 18
      Templates/BaseGame/game/tools/assetBrowser/scripts/popupMenus.cs
  23. 2 2
      Templates/BaseGame/game/tools/componentEditor/interface/materialFieldType.cs
  24. 1 1
      Templates/BaseGame/game/tools/navEditor/NavEditorToolbar.gui
  25. 1 1
      Templates/BaseGame/game/tools/roadEditor/main.cs
  26. 1 1
      Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditor.ed.cs
  27. 1 1
      Templates/BaseGame/game/tools/worldEditor/gui/guiTerrainMaterialDlg.ed.gui
  28. 6 2
      Templates/BaseGame/game/tools/worldEditor/scripts/editors/terrainEditor.ed.cs
  29. 3 3
      Templates/BaseGame/game/tools/worldEditor/scripts/interfaces/terrainMaterialDlg.ed.cs
  30. 2 1
      Templates/BaseGame/game/tools/worldEditor/scripts/menuHandlers.ed.cs
  31. 3 1
      Templates/BaseGame/game/tools/worldEditor/scripts/menus.ed.cs

+ 1 - 1
Engine/source/terrain/terrData.cpp

@@ -1000,7 +1000,7 @@ bool TerrainBlock::onAdd()
          String terrainDirectory(Con::getVariable("$pref::Directories::Terrain"));
          if (terrainDirectory.isEmpty())
          {
-            terrainDirectory = "art/terrains/";
+            terrainDirectory = "data/terrains/";
          }
          mTerrFileName.replace("tools/levels/", terrainDirectory);
          mTerrFileName.replace("levels/", terrainDirectory);

+ 1 - 0
Templates/BaseGame/game/core/rendering/Core_Rendering.cs

@@ -18,6 +18,7 @@ function Core_Rendering::onCreate(%this)
    exec("./scripts/gfxData/shaders.cs");
    exec("./scripts/gfxData/terrainBlock.cs");
    exec("./scripts/gfxData/water.cs");
+   exec("./scripts/gfxData/warningTerrainMat.cs");
 }
 
 function Core_Rendering::onDestroy(%this)

+ 7 - 0
Templates/BaseGame/game/core/rendering/scripts/gfxData/warningTerrainMat.cs

@@ -0,0 +1,7 @@
+new TerrainMaterial()
+{
+   diffuseSize = "200";
+   detailSize = "10";
+   internalName = "warning_material";
+   diffuseMap = "core/rendering/images/warnMat";
+};

+ 1 - 1
Templates/BaseGame/game/tools/VPathEditor/GUI/VPathEditor.gui

@@ -162,7 +162,7 @@ new VPathEditor(EVPathEditor) {
          canSaveDynamicFields = "0";
       };
       new GuiBitmapButtonCtrl() {
-         bitmap = "core/art/gui/images/new";
+         bitmap = "core/gui/images/new";
          groupNum = "-1";
          buttonType = "PushButton";
          useMouseEvents = "0";

binární
Templates/BaseGame/game/tools/assetBrowser/art/terrainMaterialIcon.png


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

@@ -112,7 +112,7 @@
          profile = "ToolsGuiButtonProfile";
          visible = "1";
          active = "1";
-         command = "SelectAssetPath.showDialog(AssetBrowser.dirHandler.currentAddress, \"assetImportUpdatePath\");\nSelectAssetPath.selectWindow();";
+         command = "SelectAssetPath.showDialog(AssetBrowser.dirHandler.currentAddress, \"assetImportUpdatePath\");\nSelectAssetPathWindow.selectWindow();";
          tooltipProfile = "GuiToolTipProfile";
          tooltip = "New Module";
          hovertime = "1000";
@@ -463,7 +463,7 @@
             };
          };
       };
-      new GuiButtonCtrl() {
+      new GuiButtonCtrl(DoAssetImportButton) {
          text = "Done";
          groupNum = "-1";
          buttonType = "PushButton";

+ 75 - 40
Templates/BaseGame/game/tools/assetBrowser/guis/newAsset.gui

@@ -65,6 +65,32 @@
          canSave = "1";
          canSaveDynamicFields = "0";
       };
+      new GuiBitmapButtonCtrl() {
+         bitmap = "tools/gui/images/iconOpen.png";
+         bitmapMode = "Centered";
+         autoFitExtents = "0";
+         useModifiers = "0";
+         useStates = "1";
+         masked = "0";
+         groupNum = "-1";
+         buttonType = "PushButton";
+         useMouseEvents = "0";
+         position = "342 27";
+         extent = "22 22";
+         minExtent = "8 2";
+         horizSizing = "left";
+         vertSizing = "bottom";
+         profile = "ToolsGuiButtonProfile";
+         visible = "1";
+         active = "1";
+         command = "SelectAssetPath.showDialog(AssetBrowser.dirHandler.currentAddress, \"newAssetUpdatePath\");\nSelectAssetPathWindow.selectWindow();";
+         tooltipProfile = "GuiToolTipProfile";
+         tooltip = "New Module";
+         hovertime = "1000";
+         isContainer = "0";
+         canSave = "1";
+         canSaveDynamicFields = "0";
+      };
       new GuiButtonCtrl() {
          text = "Cancel";
          groupNum = "-1";
@@ -85,8 +111,12 @@
          canSave = "1";
          canSaveDynamicFields = "0";
       };
-      new GuiTextCtrl() {
-         text = "Target Module:";
+      new GuiTextEditCtrl(NewAssetTargetAddress) {
+         historySize = "0";
+         tabComplete = "0";
+         sinkAllKeyEvents = "0";
+         password = "0";
+         passwordMask = "*";
          maxLength = "1024";
          margin = "0 0 0 0";
          padding = "0 0 0 0";
@@ -94,26 +124,22 @@
          anchorBottom = "0";
          anchorLeft = "1";
          anchorRight = "0";
-         position = "12 30";
-         extent = "116 17";
+         position = "135 30";
+         extent = "204 18";
          minExtent = "8 2";
-         horizSizing = "right";
+         horizSizing = "width";
          vertSizing = "bottom";
-         profile = "ToolsGuiTextProfile";
+         profile = "ToolsGuiTextEditProfile";
          visible = "1";
-         active = "1";
+         active = "0";
          tooltipProfile = "GuiToolTipProfile";
          hovertime = "1000";
          isContainer = "1";
          canSave = "1";
          canSaveDynamicFields = "0";
       };
-      new GuiPopUpMenuCtrlEx(NewAssetModuleList) {
-         maxPopupHeight = "200";
-         sbUsesNAColor = "0";
-         reverseTextList = "0";
-         bitmapBounds = "16 16";
-         hotTrackCallback = "0";
+      new GuiTextCtrl() {
+         text = "Target Path:";
          maxLength = "1024";
          margin = "0 0 0 0";
          padding = "0 0 0 0";
@@ -121,55 +147,64 @@
          anchorBottom = "0";
          anchorLeft = "1";
          anchorRight = "0";
-         position = "134 27";
-         extent = "204 22";
+         position = "12 30";
+         extent = "116 17";
          minExtent = "8 2";
          horizSizing = "right";
          vertSizing = "bottom";
-         profile = "ToolsGuiPopupMenuProfile";
+         profile = "ToolsGuiTextProfile";
          visible = "1";
          active = "1";
          tooltipProfile = "GuiToolTipProfile";
          hovertime = "1000";
          isContainer = "1";
-         class = "AssetBrowserModuleList";
          canSave = "1";
          canSaveDynamicFields = "0";
       };
-      new GuiBitmapButtonCtrl(NewAssetModuleBtn) {
-         bitmap = "tools/gui/images/iconAdd.png";
-         bitmapMode = "Centered";
-         autoFitExtents = "0";
-         useModifiers = "0";
-         useStates = "1";
-         masked = "0";
-         groupNum = "-1";
-         buttonType = "PushButton";
-         useMouseEvents = "0";
-         position = "342 27";
-         extent = "22 22";
+      new GuiTextCtrl() {
+         text = "Target Module:";
+         maxLength = "1024";
+         margin = "0 0 0 0";
+         padding = "0 0 0 0";
+         anchorTop = "1";
+         anchorBottom = "0";
+         anchorLeft = "1";
+         anchorRight = "0";
+         position = "12 54";
+         extent = "116 17";
          minExtent = "8 2";
          horizSizing = "right";
          vertSizing = "bottom";
-         profile = "ToolsGuiButtonProfile";
+         profile = "ToolsGuiTextProfile";
          visible = "1";
          active = "1";
-         command = "Canvas.pushDialog(AssetBrowser_AddModule);\nAssetBrowser_addModuleWindow.selectWindow();";
          tooltipProfile = "GuiToolTipProfile";
          hovertime = "1000";
-         isContainer = "0";
+         isContainer = "1";
          canSave = "1";
          canSaveDynamicFields = "0";
       };
-      new GuiControl(NewComponentAssetSettings) {
-         position = "12 120";
-         extent = "344 107";
+      new GuiTextEditCtrl(NewAssetTargetModule) {
+         historySize = "0";
+         tabComplete = "0";
+         sinkAllKeyEvents = "0";
+         password = "0";
+         passwordMask = "*";
+         maxLength = "1024";
+         margin = "0 0 0 0";
+         padding = "0 0 0 0";
+         anchorTop = "1";
+         anchorBottom = "0";
+         anchorLeft = "1";
+         anchorRight = "0";
+         position = "135 53";
+         extent = "204 18";
          minExtent = "8 2";
-         horizSizing = "right";
+         horizSizing = "width";
          vertSizing = "bottom";
-         profile = "GuiDefaultProfile";
+         profile = "ToolsGuiTextEditProfile";
          visible = "1";
-         active = "1";
+         active = "0";
          tooltipProfile = "GuiToolTipProfile";
          hovertime = "1000";
          isContainer = "1";
@@ -191,8 +226,8 @@
          anchorBottom = "0";
          anchorLeft = "1";
          anchorRight = "0";
-         position = "7 56";
-         extent = "354 357";
+         position = "7 79";
+         extent = "354 334";
          minExtent = "8 2";
          horizSizing = "right";
          vertSizing = "bottom";

+ 1 - 1
Templates/BaseGame/game/tools/assetBrowser/guis/selectPath.gui

@@ -14,7 +14,7 @@
    canSave = "1";
    canSaveDynamicFields = "1";
 
-   new GuiWindowCtrl() {
+   new GuiWindowCtrl(SelectAssetPathWindow) {
       text = "Select Path";
       resizeWidth = "1";
       resizeHeight = "1";

+ 4 - 0
Templates/BaseGame/game/tools/assetBrowser/main.cs

@@ -129,6 +129,10 @@ function initializeAssetBrowser()
       new GuiTreeViewCtrl(ImportAssetTree);
    
    AssetBrowser.buildPopupMenus();
+   
+   //Force everything to initialize if other things need to reference it's behavior before we're displayed(usually other tools)
+   AssetBrowser.showDialog();
+   AssetBrowser.hideDialog();
 }
 
 function AssetBrowserPlugin::onWorldEditorStartup( %this )

+ 0 - 1
Templates/BaseGame/game/tools/assetBrowser/scripts/addModuleWindow.cs

@@ -96,7 +96,6 @@ function AssetBrowser_addModuleWindow::CreateNewModule(%this)
    ModuleDatabase.ignoreLoadedGroups(false);
    
    //force a reload of the Module lists
-   NewAssetModuleList.refresh();
    GameObjectModuleList.refresh();
    ImportAssetModuleList.refresh();
    

+ 69 - 20
Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.cs

@@ -292,7 +292,6 @@ function AssetBrowser::buildPreviewArray( %this, %asset, %moduleName )
       %assetDesc = AssetDatabase.acquireAsset(%asset);
       %assetName = AssetDatabase.getAssetName(%asset);
       %assetType = AssetDatabase.getAssetType(%asset);
-      
    }
    else
    {
@@ -345,6 +344,10 @@ function AssetBrowser::buildPreviewArray( %this, %asset, %moduleName )
    %previewImage = %this.previewData.previewImage;
    %doubleClickCommand = %this.previewData.doubleClickCommand;
    
+   %previewButton-->button.assetName = %assetName;
+   %previewButton-->button.moduleName = %moduleName;
+   %previewButton-->button.assetType = %assetType;
+   
    if(%assetType $= "ShapeAsset")
    {
       %previewButton-->shapeAssetView.setModel(%previewImage);
@@ -718,7 +721,7 @@ function AssetPreviewButton::onRightClick(%this)
       EditLevelAssetPopup.showPopup(Canvas);  
    else if(%assetType $= "Folder")
    {
-      EditFolderPopup.dirPath = %this.getParent().assetPath;
+      EditFolderPopup.dirPath = %this.getParent().moduleName @ "/" @ %this.getParent().assetName;
       EditFolderPopup.showPopup(Canvas);  
    }
    else
@@ -1246,8 +1249,11 @@ function AssetBrowser::toggleFolderCollapseButton(%this)
 function AssetPreviewButton::onMouseDragged(%this)
 {
    %payload = new GuiBitmapButtonCtrl();
-   %payload.assignFieldsFrom( %this );
-   %payload.className = "AssetPreviewControl";
+   //%payload.assignFieldsFrom( %this );
+   %payload.assetName = %this.assetName;
+   %payload.assetType = %this.assetType ;
+   %payload.moduleName = %this.moduleName;
+   %payload.class = "AssetPreviewControl";
    %payload.position = "0 0";
    %payload.dragSourceControl = %this;
    %payload.bitmap = %this.icon;
@@ -1318,7 +1324,6 @@ function AssetPreviewButton::onControlDropped( %this, %payload, %position )
 {
    Canvas.popDialog(EditorDragAndDropLayer);
    
-   // Make sure this is a color swatch drag operation.
    if( !%payload.parentGroup.isInNamespaceHierarchy( "AssetPreviewControlType_AssetDrop" ) )
       return;
 
@@ -1327,22 +1332,43 @@ function AssetPreviewButton::onControlDropped( %this, %payload, %position )
 
    if( %payload.dragSourceControl == %this )
       return;
+      
+   %assetType = %payload.dragSourceControl.parentGroup.assetType;
+   %assetName = %payload.dragSourceControl.parentGroup.assetName;
+   %moduleName = %payload.dragSourceControl.parentGroup.moduleName;
+   
+   %targetAssetName = %this.assetName;
+   %targetAssetType = %this.assetType;
+   %targetModuleName = %this.moduleName;
 
-   // If a swatch button control is dropped onto this control,
-   // copy it's color.
-
-   if( %payload.isMemberOfClass( "AssetPreviewButton" ) )
+   if( %payload.dragSourceControl.class $= "AssetPreviewButton" && %targetAssetType $= "Folder")
    {
-      // If the swatch button is part of a color-type inspector field,
-      // remember the inspector field so we can later set the color
-      // through it.
-
-      if( %this.parentGroup.isMemberOfClass( "GuiInspectorTypeColorI" ) )
-         %this.parentGroup.apply( ColorFloatToInt( %payload.color ) );
-      else if( %this.parentGroup.isMemberOfClass( "GuiInspectorTypeColorF" ) )
-         %this.parentGroup.apply( %payload.color );
+      %destination = %targetModuleName @ "/" @ %targetAssetName;
+      
+      if(%assetType $= "Folder")
+      {
+         %originFolder = %moduleName @ "/" @ %assetName;
+         %destination = %destination @ "/" @ %assetName;
+         
+         //Do any cleanup required given the type
+         if(AssetBrowser.isMethod("moveFolder"))
+            eval(AssetBrowser @ ".moveFolder(\""@%originFolder@"\",\""@%destination@"\");");
+      }
       else
-         %this.setColor( %payload.color );
+      {
+         %assetId = %moduleName @ ":" @ %assetName;
+         %assetDef = AssetDatabase.acquireAsset(%assetId);
+         %assetType = AssetDatabase.getAssetType(%assetId);
+         
+         //Do any cleanup required given the type
+         if(AssetBrowser.isMethod("move"@%assetType))
+         {
+            %command = AssetBrowser @ ".move" @ %assetType @ "(" @ %assetDef @ ",\"" @ %destination @ "\");";
+            eval(AssetBrowser @ ".move" @ %assetType @ "(" @ %assetDef @ ",\"" @ %destination @ "\");");
+         }
+      }
+      
+      AssetBrowser.refresh();
    }
 }
 
@@ -1477,8 +1503,31 @@ function AssetBrowserFilterTree::onControlDropped( %this, %payload, %position )
       if(%path !$= AssetBrowser.dirHandler.CurrentAddress)
       {
          //we're trying to move the asset to a different module!
-         MessageBoxYesNo( "Move Asset", "Do you wish to move asset " @ %assetName @ " to " @ %path @ "?", 
-               "AssetBrowser.moveAsset(\""@ %moduleName @ ":" @ %assetName @"\", \""@%path@"\");", "");  
+         //MessageBoxYesNo( "Move Asset", "Do you wish to move asset " @ %assetName @ " to " @ %path @ "?", 
+         //      "AssetBrowser.moveAsset(\""@ %moduleName @ ":" @ %assetName @"\", \""@%path@"\");", ""); 
+         
+         if(%assetType $= "Folder")
+         {
+            %originFolder = %moduleName @ "/" @ %assetName;
+            %path = %path @ "/" @ %assetName;
+            
+            //Do any cleanup required given the type
+            if(AssetBrowser.isMethod("moveFolder"))
+               eval(AssetBrowser @ ".moveFolder(\""@%originFolder@"\",\""@%path@"\");");
+         }
+         else
+         {
+            %assetId = %moduleName @ ":" @ %assetName;
+            %assetDef = AssetDatabase.acquireAsset(%assetId);
+            %assetType = AssetDatabase.getAssetType(%assetId);
+            
+            //Do any cleanup required given the type
+            if(AssetBrowser.isMethod("move"@%assetType))
+            {
+               %command = AssetBrowser @ ".move" @ %assetType @ "(" @ %assetDef @ ",\"" @ %path @ "\");";
+               eval(AssetBrowser @ ".move" @ %assetType @ "(" @ %assetDef @ ",\"" @ %path @ "\");");
+            }
+         }
       }
    }
 }

+ 14 - 11
Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.cs

@@ -194,6 +194,15 @@ function AssetBrowser::onEndDropFiles( %this )
       ImportAssetWindow.visible = true;
       ImportAssetWindow.selectWindow();
    }
+   
+   if(%hasIssues && getAssetImportConfigValue("General/PreventImportWithErrors", "0") == 1)
+   {
+      DoAssetImportButton.enabled = false;  
+   }
+   else
+   {
+      DoAssetImportButton.enabled = true;  
+   }
 
    // Update object library
    GuiFormManager::SendContentMessage($LBCreateSiderBar, %this, "refreshAll 1");
@@ -506,11 +515,7 @@ function ImportAssetWindow::processNewImportAssets(%this, %id)
             
          //%assetConfigObj.assetName = %assetItem.assetName;
          
-         if(%assetItem.assetType $= "Model")
-         {
-            AssetBrowser.prepareImportShapeAsset(%assetItem);
-         }
-         else if(%assetItem.assetType $= "Animation")
+         if(%assetItem.assetType $= "Animation")
          {
             //if we don't have our own file, that means we're gunna be using our parent shape's file so reference that
             if(!isFile(%assetItem.filePath))
@@ -518,13 +523,11 @@ function ImportAssetWindow::processNewImportAssets(%this, %id)
                %assetItem.filePath = %assetItem.parentAssetItem.filePath;
             }
          }
-         else if(%assetItem.assetType $= "Material")
-         {
-            AssetBrowser.prepareImportMaterialAsset(%assetItem);
-         } 
-         else if(%assetItem.assetType $= "Image")
+         
+         if(AssetBrowser.isMethod("prepareImport" @ %assetItem.assetType))
          {
-            AssetBrowser.prepareImportImageAsset(%assetItem);
+            %command = AssetBrowser @ ".prepareImport" @ %assetItem.assetType @ "(" @ %assetItem @ ");";
+            eval(%command);
          }
          
          %assetItem.processed = true;

+ 33 - 16
Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/assetTypeExample.cs

@@ -1,7 +1,33 @@
+function AssetBrowser::build_AssetPreview(%this, %assetDef, %previewData)
+{
+   %previewData.assetName = %assetDef.assetName;
+   %previewData.assetPath = "";
+   %previewData.doubleClickCommand = "";
+   
+   %previewData.previewImage = "tools/assetBrowser/art/gameObjectIcon";
+   
+   %previewData.assetFriendlyName = %assetDef.gameObjectName;
+   %previewData.assetDesc = %assetDef.description;
+   %previewData.tooltip = %assetDef.gameObjectName;
+}
+
+function AssetBrowser::prepareImport_Asset(%this, %assetItem)
+{
+   
+}
+
+function AssetBrowser::setupCreateNew_Asset(%this)
+{
+}
+
 function AssetBrowser::create_Asset(%this)
 {
 }
 
+function AssetBrowser::import_Asset(%this, %assetDef)
+{
+}
+
 function AssetBrowser::edit_Asset(%this, %assetDef)
 {
 }
@@ -10,35 +36,26 @@ function AssetBrowser::duplicate_Asset(%this, %assetDef, %targetModule)
 {
 }
 
-function AssetBrowser::import_Asset(%this, %assetDef)
+function AssetBrowser::rename_Asset(%this, %assetDef, %newAssetName)
 {
 }
 
-function AssetBrowser::dragAndDrop_Asset(%this, %assetDef, %dropTarget)
+function AssetBrowser::delete_Asset(%this, %assetDef)
 {
-   if(!isObject(%dropTarget))
-      return;
 }
 
-function AssetBrowser::rename_Asset(%this, %assetDef, %newAssetId, %originalName, %newName)
+function AssetBrowser::move_Asset(%this, %assetDef, %destinationFolder)
 {
 }
 
-function AssetBrowser::delete_Asset(%this, %assetDef)
+function AssetBrowser::dragAndDrop_Asset(%this, %assetDef, %dropTarget)
 {
+   if(!isObject(%dropTarget))
+      return;
 }
 
-function AssetBrowser::build_AssetPreview(%this, %assetDef, %previewData)
+function AssetBrowser::on_AssetEditorDropped(%this, %assetDef, %position)
 {
-   %previewData.assetName = %assetDef.assetName;
-   %previewData.assetPath = "";
-   %previewData.doubleClickCommand = "";
-   
-   %previewData.previewImage = "tools/assetBrowser/art/gameObjectIcon";
-   
-   %previewData.assetFriendlyName = %assetDef.gameObjectName;
-   %previewData.assetDesc = %assetDef.description;
-   %previewData.tooltip = %assetDef.gameObjectName;
 }
 
 function GuiInspectorType_AssetPtr::onClick( %this, %fieldName )

+ 15 - 44
Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/folder.cs

@@ -68,55 +68,17 @@ function AssetBrowser::renameFolder(%this, %folderPath, %newFolderName)
    //so, we nix any assets active for the module, do the delete action on the old folder, and then re-acquire our assets.
    //This will have the added benefit of updating paths for asset items
    
-   %module = AssetBrowser.getModuleFromAddress(AssetBrowser.dirHandler.currentAddress);
+   %module = AssetBrowser.dirHandler.getModuleFromAddress(AssetBrowser.dirHandler.currentAddress);
    %moduleId = %module.ModuleId;
    
    AssetDatabase.removeDeclaredAssets(%moduleId);
    
-   %copiedSuccess = pathCopy(%fullPath, %basePath @ "/" @ %newFolderName);
-   %this.deleteFolder(%fullPath);
-   
-   AssetDatabase.addModuleDeclaredAssets(%moduleId);
-}
-
-function AssetBrowser::deleteFolder(%this, %folderPath)
-{
-   doDeleteFolder(%folderPath);
+   %copiedSuccess = %this.dirHandler.copyFolder(%fullPath, %basePath @ "/" @ %newFolderName);
+   %this.dirHandler.deleteFolder(%fullPath);
    
    %this.loadDirectories();
-}
-
-function doDeleteFolder(%folderPath)
-{
-   %fullPath = makeFullPath(%folderPath);
-   
-   //First, wipe out any files inside the folder first
-   %file = findFirstFileMultiExpr( %fullPath @ "/*.*", true);
-
-   while( %file !$= "" )
-   {      
-      %success = fileDelete( %file );
-      
-      if(!%success)
-      {
-         error("doDeleteFolder - unable to delete file " @ %file);
-         return;         
-      }
-      
-      %file = findNextFileMultiExpr( %fullPath @ "/*.*" );
-   }
    
-   //next, walk through and delete any subfolders that may be remaining
-   while(fileDelete(%fullPath) == 0)
-   {
-      //We couldn't delete the folder, so get a directory list and recurse through it, deleteing them as we go
-      %paths = getDirectoryList(%fullPath);
-      for(%i=0; %i < getFieldCount(%paths); %i++)
-      {
-         %childPath = getField(%paths, %i);
-         doDeleteFolder(%fullPath @ "/" @ %childPath);
-      }
-   }  
+   AssetDatabase.addModuleDeclaredAssets(%moduleId);
 }
 
 function AssetBrowser::moveFolder(%this, %folderPath, %newFolderPath)
@@ -131,8 +93,10 @@ function AssetBrowser::moveFolder(%this, %folderPath, %newFolderPath)
    %basePath = getTokens(%fullPath, "/", 0, %count-2);
    %oldName = getToken(%fullPath, "/", %count-1);
    
-   %copiedSuccess = pathCopy(%fullPath, %newFullPath @ "/" @ %newFolderName);
-   %this.deleteFolder(%fullPath);
+   %copiedSuccess = %this.dirHandler.copyFolder(%fullPath, %newFullPath);
+   %this.dirHandler.deleteFolder(%fullPath);
+   
+   %this.loadDirectories();
    
    //thrash the modules and reload them
    %oldModule = %this.dirHandler.getModuleFromAddress(%folderPath);
@@ -153,4 +117,11 @@ function AssetBrowser::moveFolder(%this, %folderPath, %newFolderPath)
       ModuleDatabase.unloadExplicit(%newModule.getModuleId());
       ModuleDatabase.loadExplicit(%newModule.getModuleId());
    }
+}
+
+function AssetBrowser::deleteFolder(%this, %folderPath)
+{
+   %this.dirHandler.deleteFolder(%folderPath);
+   
+   %this.refresh();
 }

+ 11 - 2
Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/level.cs

@@ -1,3 +1,12 @@
+function AssetBrowser::setupCreateNewLevelAsset(%this)
+{
+   NewAssetPropertiesInspector.startGroup("Level");
+   NewAssetPropertiesInspector.addField("LevelName", "Level Name", "String",  "Human-readable name of new level", "", "", %this.newAssetSettings);
+   NewAssetPropertiesInspector.addField("levelPreviewImage", "Level Preview Image", "Image",  "Preview Image for the level", "", "", %this.newAssetSettings);
+
+   NewAssetPropertiesInspector.endGroup();
+}
+
 function AssetBrowser::createLevelAsset(%this)
 {
    %moduleName = AssetBrowser.newAssetSettings.moduleName;
@@ -36,9 +45,9 @@ function AssetBrowser::createLevelAsset(%this)
    PostFXManager::savePresetHandler( %assetPath @ %asset.PostFXPresetFile );
 
 	%moduleDef = ModuleDatabase.findModule(%moduleName, 1);
-	AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath);
+	%addSuccess = AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath);
 
-	AssetBrowser.loadFilters();
+	AssetBrowser.refresh();
 	
 	%treeItemId = AssetBrowserFilterTree.findItemByName(%moduleName);
 	%smItem = AssetBrowserFilterTree.findChildItemByName(%treeItemId, "Levels");

+ 77 - 2
Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/script.cs

@@ -47,18 +47,93 @@ function AssetBrowser::importScriptAsset(%this, %assetId)
 {
 }
 
-function AssetBrowser::dragAndDropScriptAsset(%this, %assetDef, %dropTarget)
+function AssetBrowser::onScriptAssetEditorDropped(%this, %assetDef, %position)
 {
    if(!isObject(%dropTarget))
       return;
 }
 
-function AssetBrowser::renameScriptAsset(%this, %assetDef, %originalName, %newName)
+function AssetBrowser::renameScriptAsset(%this, %assetDef, %newAssetName)
 {
+   %assetId = %assetDef.getAssetID();
+   
+   %module = AssetDatabase.getAssetModule(%assetId);
+   
+   %scriptPath = %assetDef.scriptFile;
+   %newScriptPath = filePath(%scriptPath) @ "/" @ %newAssetName @ fileExt(%scriptPath);
+   %copiedSuccess = pathCopy(%scriptPath, %newScriptPath);
+   
+   %looseFilepath = fileName(%newScriptPath);
+   
+   %assetDef.scriptFile = "\"@AssetFile=" @ %looseFilepath @ "\"";
+   %assetDef.saveAsset();
+   
+   AssetDatabase.renameDeclaredAsset("\"" @ %module @ ":" @ %newAssetName @ "\"");
+   
+   //%assetFilePath = makeFullPath(AssetDatabase.getAssetFilePath(%assetId));
+   //%newAssetFilePath = %newFullPath @ "/" @ fileName(%assetFilePath);
+   //%copiedSuccess = pathCopy(%assetFilePath, %newAssetFilePath);
+   
+   fileDelete(%scriptPath);
+   
+   //ModuleDatabase.unloadExplicit(%module.getModuleId());
+   //ModuleDatabase.loadExplicit(%module.getModuleId());
 }
 
 function AssetBrowser::deleteScriptAsset(%this, %assetDef)
 {
+   %assetId = %assetDef.getAssetID();
+   
+   %module = AssetDatabase.getAssetModule(%assetId);
+   
+   %assetFilePath = makeFullPath(AssetDatabase.getAssetFilePath(%assetId));
+   %scriptPath = %assetDef.scriptFile;
+   
+   fileDelete(%assetFilePath);
+   fileDelete(%scriptPath);
+   
+   //they're different moduels now, so we gotta unload/reload both
+   ModuleDatabase.unloadExplicit(%module.getModuleId());
+   ModuleDatabase.unloadExplicit(%newModule.getModuleId());
+}
+
+function AssetBrowser::moveScriptAsset(%this, %assetDef, %destination)
+{
+   %newFullPath = makeFullPath(%destination);
+   
+   %assetId = %assetDef.getAssetID();
+   
+   %module = AssetDatabase.getAssetModule(%assetId);
+   
+   %assetFilePath = makeFullPath(AssetDatabase.getAssetFilePath(%assetId));
+   %newAssetFilePath = %newFullPath @ "/" @ fileName(%assetFilePath);
+   %copiedSuccess = pathCopy(%assetFilePath, %newAssetFilePath);
+   
+   %scriptPath = %assetDef.scriptFile;
+   %newScriptPath = %newFullPath @ "/" @ fileName(%scriptPath);
+   %copiedSuccess = pathCopy(%scriptPath, %newScriptPath);
+   
+   fileDelete(%assetFilePath);
+   fileDelete(%scriptPath);
+   
+   //thrash the modules and reload them
+   %newModule = %this.dirHandler.getModuleFromAddress(%newFullPath);
+   
+   //if we didn't move modules, then we don't need to do anything other than refresh the assets within it
+   if(%module == %newModule)
+   {
+      //only do a refresh to update asset loose file paths
+      AssetDatabase.refreshAllAssets();
+   }
+   else
+   {
+      //they're different moduels now, so we gotta unload/reload both
+      ModuleDatabase.unloadExplicit(%module.getModuleId());
+      ModuleDatabase.loadExplicit(%module.getModuleId());
+      
+      ModuleDatabase.unloadExplicit(%newModule.getModuleId());
+      ModuleDatabase.loadExplicit(%newModule.getModuleId());
+   }
 }
 
 function AssetBrowser::buildScriptAssetPreview(%this, %assetDef, %previewData)

+ 66 - 6
Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/terrain.cs

@@ -1,3 +1,11 @@
+function AssetBrowser::setupCreateNewTerrainAsset(%this)
+{
+   NewAssetPropertiesInspector.startGroup("Terrain");
+   NewAssetPropertiesInspector.addField("resolution", "Terrain Texture Resolution", "list",  "Is this script used on the server?", "1024", "256,512,1024,2048,4096", %this.newAssetSettings);
+   NewAssetPropertiesInspector.addField("genWithNoise", "Generate Terrain With Noise", "bool",  "Is this script used on the server?", "0", "2", %this.newAssetSettings);
+   NewAssetPropertiesInspector.endGroup();
+}
+
 function AssetBrowser::createTerrainAsset(%this)
 {
    %moduleName = AssetBrowser.newAssetSettings.moduleName;
@@ -6,7 +14,10 @@ function AssetBrowser::createTerrainAsset(%this)
    %assetName = AssetBrowser.newAssetSettings.assetName;      
    
    %assetType = AssetBrowser.newAssetSettings.assetType;
-   %assetPath = AssetBrowser.dirHandler.currentAddress @ "/";   
+   %assetPath = AssetBrowser.dirHandler.currentAddress @ "/";  
+   
+   //Ensure anything we generate goes into the right directory
+   $pref::Directories::Terrain = %assetPath;
    
    %tamlpath = %assetPath @ %assetName @ ".asset.taml";
    %terPath = %assetPath @ %assetName @ ".ter";
@@ -16,6 +27,8 @@ function AssetBrowser::createTerrainAsset(%this)
       AssetName = %assetName;
       versionId = 1;
       terrainFile = %assetName @ ".ter";
+      resolution = %this.newAssetSettings.resolution;
+      genWithNoise = %this.newAssetSettings.genWithNoise;
    };
    
    TamlWrite(%asset, %tamlpath);
@@ -23,18 +36,65 @@ function AssetBrowser::createTerrainAsset(%this)
    %moduleDef = ModuleDatabase.findModule(%moduleName, 1);
 	AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath);
 
-	AssetBrowser.loadFilters();
-	
-	AssetBrowserFilterTree.onSelect(%smItem);
+	AssetBrowser.refresh();
 	
 	//Save out a basic terrain block here
-	%terrBlock = new TerrainBlock() { terrainFile = %terPath; };
+	/*%terrBlock = new TerrainBlock() { terrainFile = %terPath; };
 	%terrBlock.save(%terPath);
-	%terrBlock.delete();
+	%terrBlock.delete();*/
+	
+	//the terrain block creation is...weird and does coded path stuff engine-side.
+	//this needs reworking, but this is a sidestep for now
+	%misFile = $Client::MissionFile;
+	$Client::MissionFile = %terPath;
+	
+	//
+	$createdTerrainBlock = TerrainBlock::createNew( %assetName, %this.newAssetSettings.resolution, "", %this.newAssetSettings.genWithNoise );
+	
+	$Client::MissionFile = %misFile;
    
 	return %tamlpath;
 }
 
+//Called if we create the terrain asset as a launch-prompt action of any of the editors
+function createTerrainBlock(%assetId)
+{
+   %assetDef = AssetDatabase.acquireAsset(%assetId);
+   
+   if( %assetDef.genWithNoise )
+      ETerrainEditor.isDirty = true;
+      
+   if(!isObject($createdTerrainBlock))
+   {
+      $createdTerrainBlock = new TerrainBlock() { terrainAsset = %assetId; };  
+      //$createdTerrainBlock = new TerrainBlock() { terrainFile = %assetDef.terrainFile; };  
+   }
+
+   if( isObject( $createdTerrainBlock ) )
+   {
+      getRootScene().add($createdTerrainBlock);
+      
+      // Submit an undo action. 
+      MECreateUndoAction::submit($createdTerrainBlock);
+   
+      assert( isObject( EWorldEditor ), 
+         "ObjectBuilderGui::processNewObject - EWorldEditor is missing!" );
+
+      // Select it in the editor.
+      EWorldEditor.clearSelection();
+      EWorldEditor.selectObject($createdTerrainBlock);
+
+      // When we drop the selection don't store undo
+      // state for it... the creation deals with it.
+      EWorldEditor.dropSelection( true );
+   }
+   else
+   {
+      
+   }
+   //
+}
+
 function AssetBrowser::editTerrainAsset(%this, %assetDef)
 {
 }

+ 5 - 3
Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/terrainMaterial.cs

@@ -23,10 +23,12 @@ function AssetBrowser::createTerrainMaterialAsset(%this)
    
    %moduleDef = ModuleDatabase.findModule(%moduleName, 1);
 	AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath);
+	
+	AssetDatabase.acquireAsset("\"" @ %moduleName @ ":" @ %assetName @ "\"");
 
-	AssetBrowser.loadFilters();
+	AssetBrowser.refresh();
 	
-	AssetBrowserFilterTree.onSelect(%smItem);
+	//AssetBrowserFilterTree.onSelect(%smItem);
 	
 	%file = new FileObject();
 	%templateFile = new FileObject();
@@ -95,7 +97,7 @@ function AssetBrowser::buildTerrainMaterialAssetPreview(%this, %assetDef, %previ
    %previewData.assetPath = "";
    %previewData.doubleClickCommand = "";
    
-   %previewData.previewImage = "tools/assetBrowser/art/gameObjectIcon";
+   %previewData.previewImage = "tools/assetBrowser/art/terrainMaterialIcon";
    
    %previewData.assetFriendlyName = %assetDef.gameObjectName;
    %previewData.assetDesc = %assetDef.description;

+ 78 - 0
Templates/BaseGame/game/tools/assetBrowser/scripts/directoryHandling.cs

@@ -204,4 +204,82 @@ function directoryHandler::expandTreeToAddress(%this, %address)
       %curItem = %this.treeCtrl.findChildItemByName(%curItem, %folderName);
       %this.treeCtrl.expandItem(%curItem);
    }
+}
+
+function directoryHandler::createFolder(%this, %folderPath)
+{
+   //make a dummy file
+   %file = new FileObject();
+   %file.openForWrite(%folderPath @ "/test");
+   %file.close();
+   
+   fileDelete(%folderPath @ "/test");
+}
+
+function directoryHandler::deleteFolder(%this, %folderPath)
+{
+   %fullPath = makeFullPath(%folderPath);
+   
+   //First, wipe out any files inside the folder first
+   %file = findFirstFileMultiExpr( %fullPath @ "/*.*", true);
+
+   while( %file !$= "" )
+   {      
+      %success = fileDelete( %file );
+      
+      if(!%success)
+      {
+         error("doDeleteFolder - unable to delete file " @ %file);
+         return;         
+      }
+      
+      %file = findNextFileMultiExpr( %fullPath @ "/*.*" );
+   }
+   
+   //next, walk through and delete any subfolders that may be remaining
+   while(IsDirectory(%fullPath) && fileDelete(%fullPath) == 0)
+   {
+      //We couldn't delete the folder, so get a directory list and recurse through it, deleteing them as we go
+      %paths = getDirectoryList(%fullPath);
+      for(%i=0; %i < getFieldCount(%paths); %i++)
+      {
+         %childPath = getField(%paths, %i);
+         %this.deleteFolder(%fullPath @ "/" @ %childPath);
+      }
+   }  
+}
+
+function directoryHandler::copyFolder(%this, %fromFolder, %toFolder)
+{
+   if(!isDirectory(%toFolder))
+      %this.createFolder(%toFolder);
+      
+   %file = findFirstFileMultiExpr( %fromFolder @ "/*.*", false);
+
+   while( %file !$= "" )
+   {    
+      %copiedFile = strreplace(%file, %fromFolder, %toFolder);
+      
+      %copiedPath = filePath(%copiedFile);
+      
+      if(!isDirectory(%copiedPath))
+         createPath(%copiedPath);
+   
+      %success = pathCopy(%file, %copiedFile, false);
+      if(!%success)
+         error("copyProjectFolder() - failed to copy file: " @ %file);
+      
+      %file = findNextFileMultiExpr( %fullPath @ "/*.*" );
+   }
+   
+   //do sub directories
+   %paths = getDirectoryList(%fromFolder);
+   for(%i=0; %i < getFieldCount(%paths); %i++)
+   {
+      %childPath = getField(%paths, %i);
+         
+      %this.copyFolder(%fromFolder @ %childPath @ "/", %toFolder @ %childPath @ "/");
+   }
+      
+   return true;
 }

+ 12 - 24
Templates/BaseGame/game/tools/assetBrowser/scripts/editAsset.cs

@@ -83,8 +83,11 @@ function AssetBrowser::renameAsset(%this)
    if(%curFirstResponder != 0)
       %curFirstResponder.clearFirstResponder();
    
-   AssetBrowser.selectedAssetPreview-->AssetNameLabel.setActive(true);
-   AssetBrowser.selectedAssetPreview-->AssetNameLabel.setFirstResponder();
+   if(EditFolderPopup.visible == false)
+   {
+      AssetBrowser.selectedAssetPreview-->AssetNameLabel.setActive(true);
+      AssetBrowser.selectedAssetPreview-->AssetNameLabel.setFirstResponder();
+   }
 }
 
 function AssetBrowser::performRenameAsset(%this, %originalAssetName, %newName)
@@ -92,32 +95,17 @@ function AssetBrowser::performRenameAsset(%this, %originalAssetName, %newName)
    //if the name is different to the asset's original name, rename it!
    if(%originalAssetName !$= %newName)
    {
+      %moduleName = AssetBrowser.selectedModule;
+      
       if(EditAssetPopup.assetType !$= "Folder")
       {
-         %moduleName = AssetBrowser.selectedModule;
-         
-         //do a rename!
-         %success = AssetDatabase.renameDeclaredAsset(%moduleName @ ":" @ %originalAssetName, %moduleName @ ":" @ %newName);
-         
-         if(%success)
-            echo("AssetBrowser - renaming of asset " @ %moduleName @ ":" @ %originalAssetName @ " to " @ %moduleName @ ":" @ %newName @ " was a success.");
-         else 
-            echo("AssetBrowser - renaming of asset " @ %moduleName @ ":" @ %originalAssetName @ " to " @ %moduleName @ ":" @ %newName @ " was a failure.");
-         
-         if(%success)
+         if(%this.isMethod("rename" @ EditAssetPopup.assetType))
          {
-            %newAssetId = %moduleName @ ":" @ %newName;
-            %assetPath = AssetDatabase.getAssetFilePath(%newAssetId);
-            
-            //Rename any associated files as well
-            %assetDef = AssetDatabase.acquireAsset(%newAssetId);
-            %assetType = %assetDef.getClassName();
-            
-            //rename the file to match
-            %path = filePath(%assetPath);
+            %oldAssetId = %moduleName @ ":" @ %originalAssetName;
+            %assetDef = AssetDatabase.acquireAsset(%oldAssetId);
             
             //Do the rename command
-            %buildCommand = %this @ ".rename" @ %assetType @ "(" @ %assetDef @ "," @ %newAssetId @ ");";
+            %buildCommand = %this @ ".rename" @ EditAssetPopup.assetType @ "(" @ %assetDef @ "," @ %newName @ ");";
             eval(%buildCommand);
          }
       }
@@ -159,7 +147,7 @@ function AssetBrowser::moveAsset(%this, %assetId, %destination)
    {
       //Do any cleanup required given the type
       if(%this.isMethod("moveFolder"))
-         eval(%this @ ".moveFolder("@EditAssetPopup.assetId@",\""@%destination@"\");");
+         eval(%this @ ".moveFolder("@%assetId@",\""@%destination@"\");");
    }
    else
    {

+ 28 - 25
Templates/BaseGame/game/tools/assetBrowser/scripts/newAsset.cs

@@ -26,8 +26,9 @@ function CreateAssetButton::onClick(%this)
 
 function AssetBrowser_newAsset::onWake(%this)
 {
-   NewAssetModuleList.refresh();
-   //NewComponentParentClass.setText("Component");
+   NewAssetTargetAddress.text = AssetBrowser.dirHandler.currentAddress;
+   NewAssetTargetModule.text = AssetBrowser.dirHandler.getModuleFromAddress(AssetBrowser.dirHandler.currentAddress).ModuleId;
+
 }
 
 function AssetBrowser_newAssetWindow::onClose(%this)
@@ -75,12 +76,12 @@ function AssetBrowser::setupCreateNewAsset(%this, %assetType, %moduleName, %call
 {
    Canvas.pushDialog(AssetBrowser_newAsset);
    
-   AssetBrowser_newAssetWindow.text = "New" SPC %assetType SPC "Asset";
+   %shortAssetTypeName = strreplace(%assetType, "Asset", "");
+   
+   AssetBrowser_newAssetWindow.text = "New" SPC %shortAssetTypeName SPC "Asset";
    
    NewAssetPropertiesInspector.clearFields();
    
-   NewAssetModuleList.setText(%moduleName);
-   
    AssetBrowser_newAsset.callbackFunc = %callback;
    
    //get rid of the old one if we had one.
@@ -92,39 +93,28 @@ function AssetBrowser::setupCreateNewAsset(%this, %assetType, %moduleName, %call
    %this.newAssetSettings.assetType = %assetType;
    %this.newAssetSettings.moduleName = %moduleName;
    
-   %shortAssetTypeName = strreplace(%assetType, "Asset", "");
-   
    NewAssetPropertiesInspector.startGroup("General");
    NewAssetPropertiesInspector.addField("assetName", "New Asset Name", "String",  "Name of the new asset", "New" @ %shortAssetTypeName, "", %this.newAssetSettings);
    //NewAssetPropertiesInspector.addField("AssetType", "New Asset Type", "List",  "Type of the new asset", %assetType, "Component,Image,Material,Shape,Sound,State Machine", %newAssetSettings);
    
    //NewAssetPropertiesInspector.addField("friendlyName", "Friendly Name", "String",  "Human-readable name of new asset", "", "", %this.newAssetSettings);
       
-   NewAssetPropertiesInspector.addField("description", "Description", "Command",  "Description of the new asset", "", "", %this.newAssetSettings);   
+   NewAssetPropertiesInspector.addCallbackField("description", "Description", "Command",  "Description of the new asset", "", "", "updateNewAssetField", %this.newAssetSettings);   
    NewAssetPropertiesInspector.endGroup();
    
-   if(%assetType $= "ComponentAsset")
+   if(%this.isMethod("setupCreateNew"@%assetType))
+   {
+      %command = %this @ ".setupCreateNew"@%assetType @"();";
+      eval(%command);
+   }
+   /*if(%assetType $= "ComponentAsset")
    {
       NewAssetPropertiesInspector.startGroup("Components");
       NewAssetPropertiesInspector.addField("parentClass", "New Asset Parent Class", "String",  "Name of the new asset's parent class", "Component", "", %this.newAssetSettings);
       NewAssetPropertiesInspector.addField("componentGroup", "Component Group", "String",  "Name of the group of components this component asset belongs to", "", "", %this.newAssetSettings);
       //NewAssetPropertiesInspector.addField("componentName", "Component Name", "String",  "Name of the new component", "", "", %this.newAssetSettings);
       NewAssetPropertiesInspector.endGroup();
-   }
-   else if(%assetType $= "LevelAsset")
-   {
-      NewAssetPropertiesInspector.startGroup("Level");
-      NewAssetPropertiesInspector.addField("LevelName", "Level Name", "String",  "Human-readable name of new level", "", "", %this.newAssetSettings);
-      NewAssetPropertiesInspector.addField("levelPreviewImage", "Level Preview Image", "Image",  "Preview Image for the level", "", "", %this.newAssetSettings);
-      
-      NewAssetPropertiesInspector.endGroup();
-   }
-   else if(%assetType $= "ScriptAsset")
-   {
-      NewAssetPropertiesInspector.startGroup("Script");
-      NewAssetPropertiesInspector.addField("isServerScript", "Is Server Script", "bool",  "Is this script used on the server?", "1", "", %this.newAssetSettings);
-      NewAssetPropertiesInspector.endGroup();
-   }
+   }*/
    //Special case, we only do this via internal means like baking
    /*else if(%assetType $= "ShapeAsset")
    {
@@ -147,6 +137,19 @@ function AssetBrowser::setupCreateNewAsset(%this, %assetType, %moduleName, %call
    }*/
 }
 
+function NewAssetPropertiesInspector::updateNewAssetField(%this)
+{
+   %this.schedule(32, "update");
+}
+
+function newAssetUpdatePath(%newPath)
+{
+   AssetBrowser.navigateTo(%newPath);
+   
+   NewAssetTargetAddress.text = %newPath;
+   NewAssetTargetModule.text = AssetBrowser.dirHandler.getModuleFromAddress(AssetBrowser.dirHandler.currentAddress).ModuleId;
+}
+
 //We do a quick validation that mandatory fields are filled in before passing along to the asset-type specific function
 function CreateNewAsset()
 {
@@ -159,7 +162,7 @@ function CreateNewAsset()
 	}
 	
 	//get the selected module data
-   %moduleName = NewAssetModuleList.getText();
+   %moduleName = NewAssetTargetModule.getText();
    
    if(%moduleName $= "")
 	{

+ 18 - 18
Templates/BaseGame/game/tools/assetBrowser/scripts/popupMenus.cs

@@ -104,24 +104,24 @@ function AssetBrowser::buildPopupMenus(%this)
          class = "EditorWorldMenu";
          //isPopup = true;
 
-         item[ 0 ] = "Material" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"MaterialAsset\", AssetBrowser.selectedModule);";//"createNewMaterialAsset(\"NewMaterial\", AssetBrowser.selectedModule);";
-         item[ 1 ] = "Terrain Material" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"TerrainMaterialAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewImageAsset(\"NewImage\", AssetBrowser.selectedModule);";
-         item[ 2 ] = "Image" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"ImageAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewImageAsset(\"NewImage\", AssetBrowser.selectedModule);";
+         item[ 0 ] = "Create Material" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"MaterialAsset\", AssetBrowser.selectedModule);";//"createNewMaterialAsset(\"NewMaterial\", AssetBrowser.selectedModule);";
+         item[ 1 ] = "Create Terrain Material" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"TerrainMaterialAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewImageAsset(\"NewImage\", AssetBrowser.selectedModule);";
+         item[ 2 ] = "Create Image" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"ImageAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewImageAsset(\"NewImage\", AssetBrowser.selectedModule);";
          item[ 3 ] = "-";
-         item[ 4 ] = "Terrain Data" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"TerrainAsset\", AssetBrowser.selectedModule);";
+         item[ 4 ] = "Create Terrain Data" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"TerrainAsset\", AssetBrowser.selectedModule);";
          item[ 5 ] = "-";         
-         item[ 6 ] = "Shape" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"Shape\", AssetBrowser.selectedModule);";
-         item[ 7 ] = "Shape Animation" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"ShapeAnimationAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewShapeAnimationAsset(\"NewShapeAnimation\", AssetBrowser.selectedModule);";
+         item[ 6 ] = "Create Shape" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"Shape\", AssetBrowser.selectedModule);";
+         item[ 7 ] = "Create Shape Animation" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"ShapeAnimationAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewShapeAnimationAsset(\"NewShapeAnimation\", AssetBrowser.selectedModule);";
          item[ 8 ] = "-";
-         item[ 9 ] = "GUI" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"GUIAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewGUIAsset(\"NewGUI\", AssetBrowser.selectedModule);";
+         item[ 9 ] = "Create GUI" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"GUIAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewGUIAsset(\"NewGUI\", AssetBrowser.selectedModule);";
          item[ 10 ] = "-";
-         item[ 11 ] = "Post Effect" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"PostEffectAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewPostEffectAsset(\"NewPostEffect\", AssetBrowser.selectedModule);";
+         item[ 11 ] = "Create Post Effect" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"PostEffectAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewPostEffectAsset(\"NewPostEffect\", AssetBrowser.selectedModule);";
          item[ 12 ] = "-";
-         item[ 13 ] = "Sound" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"SoundAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewSoundAsset(\"NewSound\", AssetBrowser.selectedModule);";
+         item[ 13 ] = "Create Sound" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"SoundAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewSoundAsset(\"NewSound\", AssetBrowser.selectedModule);";
          item[ 14 ] = "-";
-         item[ 15 ] = "Particle Effect" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"ParticleEffectAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewParticleEffectAsset(\"NewParticleEffect\", AssetBrowser.selectedModule);";
+         item[ 15 ] = "Create Particle Effect" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"ParticleEffectAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewParticleEffectAsset(\"NewParticleEffect\", AssetBrowser.selectedModule);";
          item[ 16 ] = "-";
-         item[ 17 ] = "Cubemap" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"CubemapAsset\", AssetBrowser.selectedModule);";
+         item[ 17 ] = "Create Cubemap" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"CubemapAsset\", AssetBrowser.selectedModule);";
       };
    }
    
@@ -139,7 +139,7 @@ function AssetBrowser::buildPopupMenus(%this)
          item[ 3 ] = "Create Component Class" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"CppComponentAsset\", AssetBrowser.selectedModule);";
          item[ 4 ] = "Create Script Class" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"CppScriptClass\", AssetBrowser.selectedModule);";*/
          
-         item[ 0 ] = "C++ Class" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"CppAsset\", AssetBrowser.selectedModule);";
+         item[ 0 ] = "Create C++ Class" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"CppAsset\", AssetBrowser.selectedModule);";
       };
       //%this.AddNewScriptAssetPopup.insertSubMenu(0, "Create Component", AddNewComponentAssetPopup);
    }
@@ -151,17 +151,17 @@ function AssetBrowser::buildPopupMenus(%this)
          superClass = "MenuBuilder";
          class = "EditorWorldMenu";
          
-         item[0] = "Folder" TAB "" TAB "AssetBrowser.CreateNewFolder();";
+         item[0] = "Create Folder" TAB "" TAB "AssetBrowser.CreateNewFolder();";
          item[1] = "-";
-         item[2] = "Code Asset" TAB AddNewScriptAssetPopup;
+         item[2] = "Create Code Asset" TAB AddNewScriptAssetPopup;
          item[3] = "-";
-         item[4] = "Art Asset" TAB AddNewArtAssetPopup;
+         item[4] = "Create Art Asset" TAB AddNewArtAssetPopup;
          item[5] = "-";
-         item[6] = "Level" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"LevelAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewLevelAsset(\"NewLevel\", AssetBrowser.selectedModule);";
+         item[6] = "Create Level" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"LevelAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewLevelAsset(\"NewLevel\", AssetBrowser.selectedModule);";
          item[7] = "-";
-         item[8] = "C++ Asset" TAB AddNewCppAssetPopup;
+         item[8] = "Create C++ Asset" TAB AddNewCppAssetPopup;
          item[9] = "-";
-         item[10] = "New Module" TAB "" TAB "AssetBrowser.CreateNewModule();";
+         item[10] = "Create New Module" TAB "" TAB "AssetBrowser.CreateNewModule();";
       
       };
    }

+ 2 - 2
Templates/BaseGame/game/tools/componentEditor/interface/materialFieldType.cs

@@ -215,14 +215,14 @@ function GuiInspectorComponentGroup::buildMaterialField(%this, %component, %fiel
       %matName = %currentMaterial.getInternalName();
       
       if( %materialDef.diffuseMap $= "")
-         %previewImage = "core/art/warnmat";
+         %previewImage = "core/rendering/images/warnmat";
       else
          %previewImage = %materialDef.diffuseMap;
    }
    else if( %materialDef.toneMap[0] $= "" && %materialDef.diffuseMap[0] $= "" && !isObject(%materialDef.cubemap) )
    {
       %matName = %materialDef.name;
-      %previewImage = "core/art/warnmat";
+      %previewImage = "core/rendering/images/warnmat";
    }
    else
    {

+ 1 - 1
Templates/BaseGame/game/tools/navEditor/NavEditorToolbar.gui

@@ -40,7 +40,7 @@
       canSaveDynamicFields = "0";
    };
    new GuiBitmapCtrl() {
-      bitmap = "core/art/gui/images/separator-h.png";
+      bitmap = "core/gui/images/separator-h.png";
       wrap = "0";
       position = "90 3";
       extent = "2 26";

+ 1 - 1
Templates/BaseGame/game/tools/roadEditor/main.cs

@@ -166,7 +166,7 @@ function RoadEditorPlugin::setEditorFunction( %this )
    %terrainExists = parseMissionGroup( "TerrainBlock" );
 
    if( %terrainExists == false )
-      MessageBoxYesNoCancel("No Terrain","Would you like to create a New Terrain?", "Canvas.pushDialog(CreateNewTerrainGui);");
+      MessageBoxYesNoCancel("No Terrain","Would you like to create a New Terrain?", "AssetBrowser.setupCreateNewAsset(\"TerrainAsset\", AssetBrowser.selectedModule, createTerrainBlock);");
    
    return %terrainExists;
 }

+ 1 - 1
Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditor.ed.cs

@@ -3346,7 +3346,7 @@ function ShapeEdMountWindow::mountShape( %this, %slot )
    %type = %this-->mountType.getText();
 
    if ( %model $= "Browse..." )
-      %model = "core/art/shapes/octahedron.dts";
+      %model = "core/shapes/octahedron.dts";
 
    if ( ShapeEdShapeView.mountShape( %model, %node, %type, %slot ) )
    {

+ 1 - 1
Templates/BaseGame/game/tools/worldEditor/gui/guiTerrainMaterialDlg.ed.gui

@@ -164,7 +164,7 @@
          canSaveDynamicFields = "0";
 
          new GuiBitmapCtrl() {
-            bitmap = "core/art/gui/images/separator-v";
+            bitmap = "core/gui/images/separator-v";
             color = "White";
             wrap = "0";
             position = "1 0";

+ 6 - 2
Templates/BaseGame/game/tools/worldEditor/scripts/editors/terrainEditor.ed.cs

@@ -389,7 +389,9 @@ function TerrainEditorPlugin::setEditorFunction(%this)
    %terrainExists = parseMissionGroup( "TerrainBlock" );
 
    if( %terrainExists == false )
-      MessageBoxYesNoCancel("No Terrain","Would you like to create a New Terrain?", "Canvas.pushDialog(CreateNewTerrainGui);");
+      MessageBoxYesNoCancel("No Terrain","Would you like to create a New Terrain? No to Select Existing Terrain Block Asset", 
+         "AssetBrowser.setupCreateNewAsset(\"TerrainAsset\", AssetBrowser.selectedModule, createTerrainBlock);",
+         "AssetBrowser.showDialog(\"TerrainAsset\", createTerrainBlock, \"\", \"\", \"\");");
 
    return %terrainExists;
 }
@@ -399,7 +401,9 @@ function TerrainPainterPlugin::setEditorFunction(%this, %overrideGroup)
    %terrainExists = parseMissionGroup( "TerrainBlock" );
 
    if( %terrainExists == false )
-      MessageBoxYesNoCancel("No Terrain","Would you like to create a New Terrain?", "Canvas.pushDialog(CreateNewTerrainGui);");
+      MessageBoxYesNoCancel("No Terrain","Would you like to create a New Terrain? No to Select Existing Terrain Block Asset", 
+         "AssetBrowser.setupCreateNewAsset(\"TerrainAsset\", AssetBrowser.selectedModule, createTerrainBlock);",
+         "AssetBrowser.showDialog(\"TerrainAsset\", createTerrainBlock, \"\", \"\", \"\");");
 
    return %terrainExists;
 }

+ 3 - 3
Templates/BaseGame/game/tools/worldEditor/scripts/interfaces/terrainMaterialDlg.ed.cs

@@ -347,7 +347,7 @@ function TerrainMaterialDlg::newMat( %this )
 
    %scene = getRootScene();
    %path = filePath(%scene.getFilename());
-   %module = AssetBrowser.getModuleFromAddress(%path);
+   %module = AssetBrowser.dirHandler.getModuleFromAddress(%path);
    AssetBrowser.selectedModule = %module.moduleID;
    
    AssetBrowser.dirHandler.currentAddress = "data/" @ %module.moduleID;
@@ -575,7 +575,7 @@ function TerrainMaterialDlg::saveDirtyMaterial( %this, %mat )
    
    %fileName = %mat.getFileName();
    if( %fileName $= "" )
-      %fileName = "art/terrains/materials.cs";
+      %fileName = "data/terrains/materials.cs";
       
    ETerrainMaterialPersistMan.setDirty( %mat, %fileName ); 
 }
@@ -663,7 +663,7 @@ function TerrainMaterialDlg::restoreMaterials( %this )
 function TerrainMaterialDlg::_selectTextureFileDialog( %this, %defaultFileName )
 {
    if( $Pref::TerrainEditor::LastPath $= "" )
-      $Pref::TerrainEditor::LastPath = "art/terrains";
+      $Pref::TerrainEditor::LastPath = "data/";
 
    %dlg = new OpenFileDialog()
    {

+ 2 - 1
Templates/BaseGame/game/tools/worldEditor/scripts/menuHandlers.ed.cs

@@ -332,7 +332,8 @@ function EditorSaveMissionAs( %levelAsset )
       %missionName = %missionName @ ".mis";
       
    //Make sure we have a selected module so we can create our module
-   Canvas.pushDialog(AssetBrowser_selectModule);
+   //if(AssetBrowser.selectedModule $= "")
+   //   Canvas.pushDialog(
 }
 
 function EditorOpenMission(%levelAsset)

+ 3 - 1
Templates/BaseGame/game/tools/worldEditor/scripts/menus.ed.cs

@@ -149,7 +149,9 @@ function EditorGui::buildMenus(%this)
       %fileMenu.appendItem( "-" );
    }
    
-   %fileMenu.appendItem("Create Blank Terrain" TAB "" TAB "Canvas.pushDialog( CreateNewTerrainGui );");        
+   //%fileMenu.appendItem("Create Blank Terrain" TAB "" TAB "Canvas.pushDialog( CreateNewTerrainGui );");
+   %fileMenu.appendItem("Create Blank Terrain" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"TerrainAsset\", AssetBrowser.selectedModule, createTerrainBlock);");         
+     
    %fileMenu.appendItem("Import Terrain Heightmap" TAB "" TAB "Canvas.pushDialog( TerrainImportGui );");
    
    %fileMenu.appendItem("Export Terrain Heightmap" TAB "" TAB "Canvas.pushDialog( TerrainExportGui );");