Sfoglia il codice sorgente

Corrected the logic for the GenerateComposite import config rule so it only applies if there's any of the ORM maps detected
Added new import config rule: AlwaysPresentImageMaps so it will add entries for the regular map inputs on a material, even if they weren't actually found
Disabled a number of inactive popup menu items
Added Create New Module to normal add asset popup for more obvious/simplified use-flow
Adjusted the editor loading logic so it will properly display the loading splash to inform loading is happening instead of just lagging
Adjusted the assimp shape loader code so if it doesn't find a texture, and thus just sets a material value as the material color, it has a more parsable formatting

Areloch 6 anni fa
parent
commit
e621e362f4

+ 1 - 1
Engine/source/ts/assimp/assimpShapeLoader.cpp

@@ -346,7 +346,7 @@ bool AssimpShapeLoader::fillGuiTreeView(const char* sourceShapePath, GuiTreeView
       {
          aiColor3D read_color(1.f, 1.f, 1.f);
          if (AI_SUCCESS == aiMat->Get(AI_MATKEY_COLOR_DIFFUSE, read_color))
-            texName = String::ToString("Color: (%0.3f, %0.3f, %0.3f)", (F32)read_color.r, (F32)read_color.g, (F32)read_color.b);
+            texName = String::ToString("Color: %0.3f %0.3f %0.3f", (F32)read_color.r, (F32)read_color.g, (F32)read_color.b); //formatted as words for easy parsing
          else
             texName = "No Texture";
       }

+ 0 - 3
Templates/BaseGame/game/tools/Tools.cs

@@ -16,9 +16,6 @@ function ToolsModule::onCreate(%this)
    // to find exactly which subsystems should be readied before kicking things off. 
    // ----------------------------------------------------------------------------
    
-   new Settings(EditorSettings) { file = "tools/settings.xml"; };
-   EditorSettings.read();
-   
    ModuleDatabase.LoadExplicit( "MainEditor" );
    ModuleDatabase.LoadExplicit( "Tools_ObjectViewer" );
 }

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

@@ -1064,7 +1064,7 @@ function ImportAssetWindow::refreshChildItem(%this, %id)
          {
             position = %filePathBtnPos SPC "0";
             extent = %height SPC %height;
-            command = "ImportAssetOptionsWindow.findMissingFile(" @ %assetItem @ ");";
+            command = "ImportAssetWindow.findMissingFile(" @ %assetItem @ ");";
             text = "...";
             internalName = "InputPathButton";
             tooltip = %toolTip;

+ 3 - 0
Templates/BaseGame/game/tools/assetBrowser/scripts/assetImportConfig.cs

@@ -45,6 +45,8 @@ function setupImportConfigSettingsList()
       ImportAssetConfigSettingsList.addNewConfigSetting("Materials/UseDiffuseSuffixOnOriginImage", "Use Diffuse Suffix for Origin Image", "bool", "", "1", "");
       ImportAssetConfigSettingsList.addNewConfigSetting("Materials/UseExistingMaterials", "Use Existing Materials", "bool", "", "1", "");
       ImportAssetConfigSettingsList.addNewConfigSetting("Materials/IgnoreMaterials", "Ignore Materials", "command", "", "", "");
+      ImportAssetConfigSettingsList.addNewConfigSetting("Materials/AlwaysPresentImageMaps", "Always Present Image Maps", "bool", 
+                                                         "Wether to always display all normal material map fields, even if an image isn't detected.", "", "");
       
       //Animations
       ImportAssetConfigSettingsList.addNewConfigSetting("Animations/ImportAnimations", "Import Animations", "bool", "", "1", "");
@@ -289,6 +291,7 @@ function ImportAssetConfigEditorWindow::addNewConfig(%this)
    AssetImportSettings.setValue("Materials/CreateComposites", "1");
    AssetImportSettings.setValue("Materials/UseDiffuseSuffixOnOriginImage", "1");
    AssetImportSettings.setValue("Materials/UseExistingMaterials", "1");
+   AssetImportSettings.setValue("Materials/AlwaysPresentImageMaps", "0");
    
    //Animations
    AssetImportSettings.setValue("Animations/ImportAnimations", "1");

+ 60 - 38
Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/material.cs

@@ -33,23 +33,14 @@ function AssetBrowser::createMaterialAsset(%this)
 
 function AssetBrowser::editMaterialAsset(%this, %assetDef)
 {
-   //if(EditorSettings.materialEditMode $= "MaterialEditor")
-   //{
-      %assetDef.materialDefinitionName.reload();
-      
-      EditorGui.setEditor(MaterialEditorPlugin);
-      
-      MaterialEditorGui.currentMaterial = %assetDef.materialDefinitionName;
-      MaterialEditorGui.setActiveMaterial( %assetDef.materialDefinitionName );
-      
-      AssetBrowser.hideDialog();
-   /*}
-   else
-   {
-      Canvas.pushDialog(ShaderEditor); 
-      ShaderEditorGraph.loadGraph(%assetDef.shaderGraph);
-      $ShaderGen::targetShaderFile = filePath(%assetDef.shaderGraph) @"/"@fileBase(%assetDef.shaderGraph);
-   //}   */
+   %assetDef.materialDefinitionName.reload();
+   
+   EditorGui.setEditor(MaterialEditorPlugin);
+   
+   MaterialEditorGui.currentMaterial = %assetDef.materialDefinitionName;
+   MaterialEditorGui.setActiveMaterial( %assetDef.materialDefinitionName );
+   
+   AssetBrowser.hideDialog();
 }
 
 function AssetBrowser::prepareImportMaterialAsset(%this, %assetItem)
@@ -93,6 +84,13 @@ function AssetBrowser::prepareImportMaterialAsset(%this, %assetItem)
             %diffuseAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem);
             %assetItem.diffuseImageAsset = %diffuseAsset;
          }
+         else if(getAssetImportConfigValue("Materials/AlwaysPresentImageMaps", "0") == 1)
+         {
+            //In the event we don't have this image asset, but we DO wish to always display the field(affording when names don't aline with
+            //the material name), then we go ahead and create a blank entry
+            %suff = getTokenCount(%diffuseTypeSuffixes, ",;") == 0 ? "_albedo" : getToken(%diffuseTypeSuffixes, ",;", 0);
+            %diffuseAsset = AssetBrowser.addImportingAsset("Image", %assetItem.AssetName @ %suff, %assetItem);
+         }
       }
       
       //Now, iterate over our comma-delimited suffixes to see if we have any matches. We'll use the first match in each case, if any.
@@ -108,28 +106,14 @@ function AssetBrowser::prepareImportMaterialAsset(%this, %assetItem)
             %normalAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem);
             %assetItem.normalImageAsset = %normalAsset;
          }
-      }
-      /*if(%assetItem.specularImageAsset $= "")
-      {
-         //Specular
-         %listCount = getTokenCount(ImportAssetWindow.activeImportConfig.SpecularTypeSuffixes, ",;");
-   
-         %foundFile = 0;
-         for(%i=0; %i < %listCount; %i++)
+         else if(getAssetImportConfigValue("Materials/AlwaysPresentImageMaps", "0") == 1)
          {
-            %entryText = getToken(ImportAssetWindow.activeImportConfig.SpecularTypeSuffixes, ",;", %i);
-            
-            %targetFilePath = %fileDir @ "/" @ %filename @ %entryText @ %fileExt;
-            %foundFile = isFile(%targetFilePath);
-            
-            if(%foundFile)
-            {
-               %specularAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem);
-               %assetItem.specularImageAsset = %specularAsset;
-               break;  
-            }
+            //In the event we don't have this image asset, but we DO wish to always display the field(affording when names don't aline with
+            //the material name), then we go ahead and create a blank entry
+            %suff = getTokenCount(%normalTypeSuffixes, ",;") == 0 ? "_normal" : getToken(%normalTypeSuffixes, ",;", 0);
+            %normalAsset = AssetBrowser.addImportingAsset("Image", %assetItem.AssetName @ %suff, %assetItem);
          }
-      }*/
+      }
       
       if(%assetItem.metalImageAsset $= "")
       {
@@ -142,6 +126,13 @@ function AssetBrowser::prepareImportMaterialAsset(%this, %assetItem)
             %metalAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem);
             %assetItem.metalImageAsset = %metalAsset;
          }
+         else if(getAssetImportConfigValue("Materials/AlwaysPresentImageMaps", "0") == 1)
+         {
+            //In the event we don't have this image asset, but we DO wish to always display the field(affording when names don't aline with
+            //the material name), then we go ahead and create a blank entry
+            %suff = getTokenCount(%metalnessTypeSuffixes, ",;") == 0 ? "_metalness" : getToken(%metalnessTypeSuffixes, ",;", 0);
+            %metalAsset = AssetBrowser.addImportingAsset("Image", %assetItem.AssetName @ %suff, %assetItem);
+         }
       }
       
       if(%assetItem.roughnessImageAsset $= "")
@@ -155,6 +146,13 @@ function AssetBrowser::prepareImportMaterialAsset(%this, %assetItem)
             %roughnessAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem);
             %assetItem.roughnessImageAsset = %roughnessAsset;
          }
+         else if(getAssetImportConfigValue("Materials/AlwaysPresentImageMaps", "0") == 1)
+         {
+            //In the event we don't have this image asset, but we DO wish to always display the field(affording when names don't aline with
+            //the material name), then we go ahead and create a blank entry
+            %suff = getTokenCount(%roughnessTypeSuffixes, ",;") == 0 ? "_roughness" : getToken(%roughnessTypeSuffixes, ",;", 0);
+            %roughnessAsset = AssetBrowser.addImportingAsset("Image", %assetItem.AssetName @ %suff, %assetItem);
+         }
       }
       
       if(%assetItem.smoothnessImageAsset $= "")
@@ -168,6 +166,13 @@ function AssetBrowser::prepareImportMaterialAsset(%this, %assetItem)
             %smoothnessAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem);
             %assetItem.SmoothnessImageAsset = %smoothnessAsset;
          }
+         else if(getAssetImportConfigValue("Materials/AlwaysPresentImageMaps", "0") == 1)
+         {
+            //In the event we don't have this image asset, but we DO wish to always display the field(affording when names don't aline with
+            //the material name), then we go ahead and create a blank entry
+            %suff = getTokenCount(%smoothnessTypeSuffixes, ",;") == 0 ? "_smoothness" : getToken(%smoothnessTypeSuffixes, ",;", 0);
+            %smoothnessAsset = AssetBrowser.addImportingAsset("Image", %assetItem.AssetName @ %suff, %assetItem);
+         }
       }
       
       if(%assetItem.AOImageAsset $= "")
@@ -181,6 +186,13 @@ function AssetBrowser::prepareImportMaterialAsset(%this, %assetItem)
             %AOAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem);
             %assetItem.AOImageAsset = %AOAsset;
          }
+         else if(getAssetImportConfigValue("Materials/AlwaysPresentImageMaps", "0") == 1)
+         {
+            //In the event we don't have this image asset, but we DO wish to always display the field(affording when names don't aline with
+            //the material name), then we go ahead and create a blank entry
+            %suff = getTokenCount(%aoTypeSuffixes, ",;") == 0 ? "_AO" : getToken(%aoTypeSuffixes, ",;", 0);
+            %AOAsset = AssetBrowser.addImportingAsset("Image", %assetItem.AssetName @ %suff, %assetItem);
+         }
       }
       
       if(%assetItem.compositeImageAsset $= "")
@@ -194,10 +206,20 @@ function AssetBrowser::prepareImportMaterialAsset(%this, %assetItem)
             %compositeAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem);
             %assetItem.compositeImageAsset = %compositeAsset;
          }
+         else if(getAssetImportConfigValue("Materials/AlwaysPresentImageMaps", "0") == 1)
+         {
+            //In the event we don't have this image asset, but we DO wish to always display the field(affording when names don't aline with
+            //the material name), then we go ahead and create a blank entry
+            %suff = getTokenCount(%compositeTypeSuffixes, ",;") == 0 ? "_composite" : getToken(%compositeTypeSuffixes, ",;", 0);
+            %compositeAsset = AssetBrowser.addImportingAsset("Image", %assetItem.AssetName @ %suff, %assetItem);
+         }
       }
       
       //If after the above we didn't find any, check to see if we should be generating one
-      if(%assetItem.compositeImageAsset $= "" && getAssetImportConfigValue("Materials/CreateComposites", "1") == 1)
+      if(%assetItem.compositeImageAsset $= "" && 
+         (%assetItem.roughnessImageAsset !$= "" || %assetItem.AOImageAsset !$= "" || %assetItem.metalnessImageAsset !$= "") &&
+         getAssetImportConfigValue("Materials/CreateComposites", "1") == 1 &&
+         getAssetImportConfigValue("Materials/AlwaysPresentImageMaps", "0") == 0)
       {
          %assetItem.roughnessImageAsset.skip = true;
          %assetItem.AOImageAsset.skip = true;

+ 26 - 10
Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shape.cs

@@ -114,12 +114,20 @@ function AssetBrowser::prepareImportShapeAsset(%this, %assetItem)
       }
       else
       {
-         //we need to try and find our material, since the shapeInfo wasn't able to find it automatically
-         %filePath = findImageFile(filePath(%assetItem.filePath), %matName);
-         if(%filePath !$= "" && isFile(%filePath))
-            AssetBrowser.addImportingAsset("Material", %filePath, %assetItem);
+         //check to see if it's actually just a flat color
+         if(getWordCount(%filePath) == 4 && getWord(%filePath, 0) $= "Color:")
+         {
+            AssetBrowser.addImportingAsset("Material", %matName, %assetItem);
+         }
          else
-            AssetBrowser.addImportingAsset("Material", filePath(%assetItem.filePath) @ "/" @ %matName, %assetItem);
+         {
+            //we need to try and find our material, since the shapeInfo wasn't able to find it automatically
+            %filePath = findImageFile(filePath(%assetItem.filePath), %matName);
+            if(%filePath !$= "" && isFile(%filePath))
+               AssetBrowser.addImportingAsset("Material", %filePath, %assetItem);
+            else
+               AssetBrowser.addImportingAsset("Material", filePath(%assetItem.filePath) @ "/" @ %matName, %assetItem);
+         }
       }
       
       %materialItem = %assetItem.shapeInfo.getNextSibling(%materialItem);
@@ -133,12 +141,20 @@ function AssetBrowser::prepareImportShapeAsset(%this, %assetItem)
          }
          else
          {
-            //we need to try and find our material, since the shapeInfo wasn't able to find it automatically
-            %filePath = findImageFile(filePath(%assetItem.filePath), %matName);
-            if(%filePath !$= "" && isFile(%filePath))
-               AssetBrowser.addImportingAsset("Material", %filePath, %assetItem);
+            //check to see if it's actually just a flat color
+            if(getWordCount(%filePath) == 4 && getWord(%filePath, 0) $= "Color:")
+            {
+               AssetBrowser.addImportingAsset("Material", %matName, %assetItem);
+            }
             else
-               AssetBrowser.addImportingAsset("Material", filePath(%assetItem.filePath) @ "/" @ %matName, %assetItem);
+            {
+               //we need to try and find our material, since the shapeInfo wasn't able to find it automatically
+               %filePath = findImageFile(filePath(%assetItem.filePath), %matName);
+               if(%filePath !$= "" && isFile(%filePath))
+                  AssetBrowser.addImportingAsset("Material", %filePath, %assetItem);
+               else
+                  AssetBrowser.addImportingAsset("Material", filePath(%assetItem.filePath) @ "/" @ %matName, %assetItem);
+            }
          }
             
          %materialItem = %assetItem.shapeInfo.getNextSibling(%materialItem);

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

@@ -11,6 +11,8 @@ function AssetBrowser::buildPopupMenus(%this)
          item[ 0 ] = "Create New Module" TAB "" TAB "AssetBrowser.CreateNewModule();";
          item[ 1 ] = "Refresh Module Dependencies" TAB "" TAB "AssetBrowser.RefreshModuleDependencies();";
       };
+      
+      AddNewModulePopup.enableItem(1, false);
    }
       
    if( !isObject( EditAssetPopup ) )
@@ -153,6 +155,8 @@ function AssetBrowser::buildPopupMenus(%this)
          item[4] = "Create Level" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"LevelAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewLevelAsset(\"NewLevel\", AssetBrowser.selectedModule);";
          item[5] = "-";
          item[6] = "Create C++ Asset" TAB AddNewCppAssetPopup;
+         item[7] = "-";
+         item[8] = "Create New Module" TAB "" TAB "AssetBrowser.CreateNewModule();";
       
       };
    }

+ 39 - 36
Templates/BaseGame/game/tools/gui/EditorLoadingGui.gui

@@ -1,53 +1,56 @@
 //--- OBJECT WRITE BEGIN ---
-%guiContent = new GuiControl(EditorLoadingGui, EditorGuiGroup) {
-   isContainer = "1";
-   Profile = "GuiOverlayProfile";
-   HorizSizing = "right";
-   VertSizing = "bottom";
+%guiContent = new GuiControl(EditorLoadingGui,EditorGuiGroup) {
    position = "0 0";
-   Extent = "800 600";
-   MinExtent = "8 2";
-   canSave = "1";
-   Visible = "1";
-   tooltipprofile = "ToolsGuiToolTipProfile";
+   extent = "1024 768";
+   minExtent = "8 2";
+   horizSizing = "right";
+   vertSizing = "bottom";
+   profile = "GuiOverlayProfile";
+   visible = "1";
+   active = "1";
+   tooltipProfile = "ToolsGuiToolTipProfile";
    hovertime = "1000";
+   isContainer = "1";
+   canSave = "1";
    canSaveDynamicFields = "1";
 
    new GuiControl() {
-      isContainer = "1";
-      Profile = "editorMenu_wBorderProfile";
-      HorizSizing = "center";
-      VertSizing = "center";
-      position = "277 271";
-      Extent = "245 57";
-      MinExtent = "8 2";
-      canSave = "1";
-      Visible = "1";
-      tooltipprofile = "ToolsGuiToolTipProfile";
+      position = "389 355";
+      extent = "245 57";
+      minExtent = "8 2";
+      horizSizing = "center";
+      vertSizing = "center";
+      profile = "ToolsGuiDefaultProfile";
+      visible = "1";
+      active = "1";
+      tooltipProfile = "ToolsGuiToolTipProfile";
       hovertime = "1000";
+      isContainer = "1";
       internalName = "Dialog";
+      canSave = "1";
       canSaveDynamicFields = "0";
 
       new GuiTextCtrl() {
-         text = "Loading the World Editor...";
+         text = "Loading the Editor...";
          maxLength = "1024";
-         Margin = "0 0 0 0";
-         Padding = "0 0 0 0";
-         AnchorTop = "1";
-         AnchorBottom = "0";
-         AnchorLeft = "1";
-         AnchorRight = "0";
-         isContainer = "0";
-         Profile = "ToolsGuiTextBoldCenterProfile";
-         HorizSizing = "width";
-         VertSizing = "center";
+         margin = "0 0 0 0";
+         padding = "0 0 0 0";
+         anchorTop = "1";
+         anchorBottom = "0";
+         anchorLeft = "1";
+         anchorRight = "0";
          position = "5 19";
-         Extent = "236 18";
-         MinExtent = "8 2";
-         canSave = "1";
-         Visible = "1";
-         tooltipprofile = "ToolsGuiToolTipProfile";
+         extent = "236 18";
+         minExtent = "8 2";
+         horizSizing = "width";
+         vertSizing = "center";
+         profile = "ToolsGuiTextBoldCenterProfile";
+         visible = "1";
+         active = "1";
+         tooltipProfile = "ToolsGuiToolTipProfile";
          hovertime = "1000";
+         isContainer = "0";
+         canSave = "1";
          canSaveDynamicFields = "0";
       };
    };

+ 0 - 1
Templates/BaseGame/game/tools/gui/guiDialogs.ed.cs

@@ -29,7 +29,6 @@ exec("./colorPicker.ed.gui");
 exec("./materialSelector.ed.gui");
 exec("./scriptEditorDlg.ed.gui");
 exec("./colladaImport.ed.gui");
-exec("./EditorLoadingGui.gui");
 exec("./GuiEaseEditDlg.ed.gui");
 exec("./GuiEaseEditDlg.ed.cs");
 exec("./guiObjectInspector.ed.cs");

+ 179 - 174
Templates/BaseGame/game/tools/main.cs

@@ -33,191 +33,200 @@ $Tools::loadFirst = "editorClasses base worldEditor";
 //---------------------------------------------------------------------------------------------
 $Tools::materialEditorList = "";
 
-//---------------------------------------------------------------------------------------------
-// Tools Package.
-//---------------------------------------------------------------------------------------------
-package Tools
+if(!$Tools::loaded)
+{
+   new Settings(EditorSettings) { file = "tools/settings.xml"; };
+   EditorSettings.read();
+   
+   exec( "tools/gui/profiles.ed.cs" );
+   exec("tools/gui/EditorLoadingGui.gui");
+}
+
+function EditorIsActive()
+{
+   return ( isObject(EditorGui) && Canvas.getContent() == EditorGui.getId() );
+}
+
+function GuiEditorIsActive()
+{
+   return ( isObject(GuiEditorGui) && Canvas.getContent() == GuiEditorGui.getId() );
+}
+
+function loadKeybindings()
 {
-   function loadKeybindings()
+   Parent::loadKeybindings();
+}
+
+// Start-up.
+function onStart()
+{
+   //First, we want to ensure we don't inadvertently clean up our editor objects by leaving them in the MissionCleanup group, so lets change that real fast
+   $instantGroup = "";
+   pushInstantGroup();
+         
+   echo( " % - Initializing Tools" );         
+   
+   // Default file path when saving from the editor (such as prefabs)
+   if ($Pref::WorldEditor::LastPath $= "")
    {
-      Parent::loadKeybindings();
+      $Pref::WorldEditor::LastPath = getMainDotCsDir();
    }
    
-   // Start-up.
-   function onStart()
+   // Common GUI stuff.
+   exec( "./gui/cursors.ed.cs" );
+   exec( "./gui/messageBoxes/messageBox.ed.cs" );
+   exec( "./editorClasses/gui/panels/navPanelProfiles.ed.cs" );
+   
+   // Make sure we get editor profiles before any GUI's
+   // BUG: these dialogs are needed earlier in the init sequence, and should be moved to
+   // common, along with the guiProfiles they depend on.
+   exec( "./gui/guiDialogs.ed.cs" );
+   
+   //%toggle = $Scripts::ignoreDSOs;
+   //$Scripts::ignoreDSOs = true;
+   
+   $ignoredDatablockSet = new SimSet();
+
+   // fill the list of editors
+   $editors[count] = getWordCount( $Tools::loadFirst );
+   for ( %i = 0; %i < $editors[count]; %i++ )
    {
-      //First, we want to ensure we don't inadvertently clean up our editor objects by leaving them in the MissionCleanup group, so lets change that real fast
-      $instantGroup = "";
-      pushInstantGroup();
-            
-      echo( " % - Initializing Tools" );         
-      
-      // Default file path when saving from the editor (such as prefabs)
-      if ($Pref::WorldEditor::LastPath $= "")
-      {
-         $Pref::WorldEditor::LastPath = getMainDotCsDir();
-      }
-      
-      // Common GUI stuff.
-      exec( "./gui/cursors.ed.cs" );
-      exec( "./gui/profiles.ed.cs" );
-      exec( "./gui/messageBoxes/messageBox.ed.cs" );
-      exec( "./editorClasses/gui/panels/navPanelProfiles.ed.cs" );
-      
-      // Make sure we get editor profiles before any GUI's
-      // BUG: these dialogs are needed earlier in the init sequence, and should be moved to
-      // common, along with the guiProfiles they depend on.
-      exec( "./gui/guiDialogs.ed.cs" );
-      
-      //%toggle = $Scripts::ignoreDSOs;
-      //$Scripts::ignoreDSOs = true;
-      
-      $ignoredDatablockSet = new SimSet();
+      $editors[%i] = getWord( $Tools::loadFirst, %i );
+   }
    
-      // fill the list of editors
-      $editors[count] = getWordCount( $Tools::loadFirst );
-      for ( %i = 0; %i < $editors[count]; %i++ )
-      {
-         $editors[%i] = getWord( $Tools::loadFirst, %i );
-      }
-      
-      %pattern = $Tools::resourcePath @ "/*/main.cs";
+   %pattern = $Tools::resourcePath @ "/*/main.cs";
+   %folder = findFirstFile( %pattern );
+   if ( %folder $= "")
+   {
+      // if we have absolutely no matches for main.cs, we look for main.cs.dso
+      %pattern = $Tools::resourcePath @ "/*/main.cs.dso";
       %folder = findFirstFile( %pattern );
-      if ( %folder $= "")
-      {
-         // if we have absolutely no matches for main.cs, we look for main.cs.dso
-         %pattern = $Tools::resourcePath @ "/*/main.cs.dso";
-         %folder = findFirstFile( %pattern );
-      }
-      while ( %folder !$= "" )
+   }
+   while ( %folder !$= "" )
+   {
+      if( filePath( %folder ) !$= "tools" ) // Skip the actual 'tools' folder...we want the children
       {
-         if( filePath( %folder ) !$= "tools" ) // Skip the actual 'tools' folder...we want the children
+         %folder = filePath( %folder );
+         %editor = fileName( %folder );
+         if ( IsDirectory( %folder ) )
          {
-            %folder = filePath( %folder );
-            %editor = fileName( %folder );
-            if ( IsDirectory( %folder ) )
+            // Yes, this sucks and should be done better
+            if ( strstr( $Tools::loadFirst, %editor ) == -1 )
             {
-               // Yes, this sucks and should be done better
-               if ( strstr( $Tools::loadFirst, %editor ) == -1 )
-               {
-                  $editors[$editors[count]] = %editor;
-                  $editors[count]++;
-               }
+               $editors[$editors[count]] = %editor;
+               $editors[count]++;
             }
          }
-         %folder = findNextFile( %pattern );
       }
-
-      // initialize every editor
-      new SimSet( EditorPluginSet );      
-      %count = $editors[count];
-      for ( %i = 0; %i < %count; %i++ )
-      {
-         exec( "./" @ $editors[%i] @ "/main.cs" );
-         
-         %initializeFunction = "initialize" @ $editors[%i];
-         if( isFunction( %initializeFunction ) )
-            call( %initializeFunction );
-      }
-      
-      // Popuplate the default SimObject icons that 
-      // are used by the various editors.
-      EditorIconRegistry::loadFromPath( "tools/classIcons/" );
-      
-      // Load up the tools resources. All the editors are initialized at this point, so
-      // resources can override, redefine, or add functionality.
-      Tools::LoadResources( $Tools::resourcePath );
-      
-      //Now, go through and load any tool-group modules
-      ModuleDatabase.setModuleExtension("module");
-      
-      //Any common tool modules
-      ModuleDatabase.scanModules( "tools", false );
-      ModuleDatabase.LoadGroup( "Tools" );
-      
-      //Now that we're done loading, we can set the instant group back
-      popInstantGroup();
-      $instantGroup = MissionCleanup;
-      pushInstantGroup();
-      
-      $Tools::loaded = true;
+      %folder = findNextFile( %pattern );
    }
-   
-   function startToolTime(%tool)
+
+   // initialize every editor
+   new SimSet( EditorPluginSet );      
+   %count = $editors[count];
+   for ( %i = 0; %i < %count; %i++ )
    {
-      if($toolDataToolCount $= "")
-         $toolDataToolCount = 0;
-      
-      if($toolDataToolEntry[%tool] !$= "true")
-      {
-         $toolDataToolEntry[%tool] = "true";
-         $toolDataToolList[$toolDataToolCount] = %tool;
-         $toolDataToolCount++;
-         $toolDataClickCount[%tool] = 0;
-      }
+      exec( "./" @ $editors[%i] @ "/main.cs" );
       
-      $toolDataStartTime[%tool] = getSimTime();
-      $toolDataClickCount[%tool]++;
+      %initializeFunction = "initialize" @ $editors[%i];
+      if( isFunction( %initializeFunction ) )
+         call( %initializeFunction );
    }
    
-   function endToolTime(%tool)
+   // Popuplate the default SimObject icons that 
+   // are used by the various editors.
+   EditorIconRegistry::loadFromPath( "tools/classIcons/" );
+   
+   // Load up the tools resources. All the editors are initialized at this point, so
+   // resources can override, redefine, or add functionality.
+   Tools::LoadResources( $Tools::resourcePath );
+   
+   //Now, go through and load any tool-group modules
+   ModuleDatabase.setModuleExtension("module");
+   
+   //Any common tool modules
+   ModuleDatabase.scanModules( "tools", false );
+   ModuleDatabase.LoadGroup( "Tools" );
+   
+   //Now that we're done loading, we can set the instant group back
+   popInstantGroup();
+   $instantGroup = MissionCleanup;
+   pushInstantGroup();
+   
+   $Tools::loaded = true;
+}
+
+function startToolTime(%tool)
+{
+   if($toolDataToolCount $= "")
+      $toolDataToolCount = 0;
+   
+   if($toolDataToolEntry[%tool] !$= "true")
    {
-      %startTime = 0;
-      
-      if($toolDataStartTime[%tool] !$= "")
-         %startTime = $toolDataStartTime[%tool];
-      
-      if($toolDataTotalTime[%tool] $= "")
-         $toolDataTotalTime[%tool] = 0;
-         
-      $toolDataTotalTime[%tool] += getSimTime() - %startTime;
+      $toolDataToolEntry[%tool] = "true";
+      $toolDataToolList[$toolDataToolCount] = %tool;
+      $toolDataToolCount++;
+      $toolDataClickCount[%tool] = 0;
    }
    
-   function dumpToolData()
+   $toolDataStartTime[%tool] = getSimTime();
+   $toolDataClickCount[%tool]++;
+}
+
+function endToolTime(%tool)
+{
+   %startTime = 0;
+   
+   if($toolDataStartTime[%tool] !$= "")
+      %startTime = $toolDataStartTime[%tool];
+   
+   if($toolDataTotalTime[%tool] $= "")
+      $toolDataTotalTime[%tool] = 0;
+      
+   $toolDataTotalTime[%tool] += getSimTime() - %startTime;
+}
+
+function dumpToolData()
+{
+   %count = $toolDataToolCount;
+   for(%i=0; %i<%count; %i++)
    {
-      %count = $toolDataToolCount;
-      for(%i=0; %i<%count; %i++)
-      {
-         %tool = $toolDataToolList[%i];
-         %totalTime = $toolDataTotalTime[%tool];
-         if(%totalTime $= "")
-            %totalTime = 0;
-         %clickCount = $toolDataClickCount[%tool];
-         echo("---");
-         echo("Tool: " @ %tool);
-         echo("Time (seconds): " @ %totalTime / 1000);
-         echo("Activated: " @ %clickCount);
-         echo("---");
-      }
+      %tool = $toolDataToolList[%i];
+      %totalTime = $toolDataTotalTime[%tool];
+      if(%totalTime $= "")
+         %totalTime = 0;
+      %clickCount = $toolDataClickCount[%tool];
+      echo("---");
+      echo("Tool: " @ %tool);
+      echo("Time (seconds): " @ %totalTime / 1000);
+      echo("Activated: " @ %clickCount);
+      echo("---");
    }
+}
+
+// Shutdown.
+function onExit()
+{
+   if( EditorGui.isInitialized )
+      EditorGui.shutdown();
    
-   // Shutdown.
-   function onExit()
+   // Free all the icon images in the registry.
+   EditorIconRegistry::clear();
+               
+   // Save any Layouts we might be using
+   //GuiFormManager::SaveLayout(LevelBuilder, Default, User);
+         
+   %count = $editors[count];
+   for (%i = 0; %i < %count; %i++)
    {
-      if( EditorGui.isInitialized )
-         EditorGui.shutdown();
-      
-      // Free all the icon images in the registry.
-      EditorIconRegistry::clear();
-                  
-      // Save any Layouts we might be using
-      //GuiFormManager::SaveLayout(LevelBuilder, Default, User);
-            
-      %count = $editors[count];
-      for (%i = 0; %i < %count; %i++)
-      {
-         %destroyFunction = "destroy" @ $editors[%i];
-         if( isFunction( %destroyFunction ) )
-            call( %destroyFunction );
-      }
-      	
-      // Call Parent.
-      Parent::onExit();
-
-      // write out our settings xml file
-      EditorSettings.write();
+      %destroyFunction = "destroy" @ $editors[%i];
+      if( isFunction( %destroyFunction ) )
+         call( %destroyFunction );
    }
-};
+      
+   // write out our settings xml file
+   EditorSettings.write();
+}
 
 function EditorCreateFakeGameSession(%fileName)
 {
@@ -248,7 +257,12 @@ function fastLoadWorldEdit(%val)
    {
       if(!$Tools::loaded)
       {
+         canvas.pushDialog( EditorLoadingGui );
+         canvas.repaint();
+      
          onStart();
+         
+         canvas.popDialog(EditorLoadingGui);
       }
       
       %timerId = startPrecisionTimer();
@@ -290,7 +304,7 @@ function fastLoadWorldEdit(%val)
          {
             canvas.pushDialog( EditorLoadingGui );
             canvas.repaint();
-            
+      
             Editor.open();
 			
             // Cancel the scheduled event to prevent
@@ -318,7 +332,12 @@ function fastLoadGUIEdit(%val)
    {
       if(!$Tools::loaded)
       {
+         canvas.pushDialog( EditorLoadingGui );
+         canvas.repaint();
+      
          onStart();
+         
+         canvas.popDialog(EditorLoadingGui);
       }
 
       toggleGuiEditor(true);
@@ -339,21 +358,7 @@ function Tools::LoadResources( %path )
    }
 }
 
-//-----------------------------------------------------------------------------
-// Activate Package.
-//-----------------------------------------------------------------------------
-activatePackage(Tools);
-
 //This lets us fast-load the editor from the menu
 GlobalActionMap.bind(keyboard, "F11", fastLoadWorldEdit);
 GlobalActionMap.bind(keyboard, "F10", fastLoadGUIEdit);
 
-function EditorIsActive()
-{
-   return ( isObject(EditorGui) && Canvas.getContent() == EditorGui.getId() );
-}
-
-function GuiEditorIsActive()
-{
-   return ( isObject(GuiEditorGui) && Canvas.getContent() == GuiEditorGui.getId() );
-}

+ 4 - 0
Templates/BaseGame/game/tools/worldEditor/scripts/visibility/visibilityLayer.ed.cs

@@ -105,6 +105,7 @@ function setupEditorVisibilityMenu()
       item[ 6 ] = "Show Texel Density" TAB "" TAB "toggleTexelDensityViz();";
    };
    
+   %probespopup.enableItem(5, false);
    %probespopup.enableItem(6, false);
    
    //
@@ -135,6 +136,9 @@ function setupEditorVisibilityMenu()
       item[ 3 ] = "Show Diffuse Light" TAB "" TAB "";
    };
    
+   %lightspopup.enableItem(2, false);
+   %lightspopup.enableItem(3, false);
+   
    //
    //Probes
    %probespopup = new PopupMenu(EVisibilityProbesOptions)