Przeglądaj źródła

Implemented initial pass at proper client/server separation handling for module initialization
Added GameModeName to Scene
Added function to get number of active scenes
Added logic to level/client loading to enact gameplay mode logic driven by either Scene's GameModeName or project setting's default game mode
Added template module.cs file for module creation and adjusted new module logic in AssetBrowser to create off template
Updated FPSGameplay code to have deathmatchGame mode work with new GameMode logic
Updated EmptyLevel scene to define deathMatchGame as gamemode
Updated FPSGameplay module script to properly client/server initialize

Areloch 6 lat temu
rodzic
commit
1228fbcb78
25 zmienionych plików z 651 dodań i 182 usunięć
  1. 12 1
      Engine/source/T3D/Scene.cpp
  2. 3 1
      Engine/source/T3D/Scene.h
  3. 0 1
      Templates/BaseGame/game/core/Core.cs
  4. 2 0
      Templates/BaseGame/game/core/clientServer/scripts/client/client.cs
  5. 2 22
      Templates/BaseGame/game/core/clientServer/scripts/client/connectionToServer.cs
  6. 29 1
      Templates/BaseGame/game/core/clientServer/scripts/server/connectionToClient.cs
  7. 30 4
      Templates/BaseGame/game/core/clientServer/scripts/server/levelDownload.cs
  8. 89 5
      Templates/BaseGame/game/core/clientServer/scripts/server/levelLoad.cs
  9. 34 22
      Templates/BaseGame/game/core/clientServer/scripts/server/server.cs
  10. BIN
      Templates/BaseGame/game/core/gui/scripts/fonts/ArialItalic 14 (ansi).uft
  11. BIN
      Templates/BaseGame/game/core/gui/scripts/fonts/Lucida Console 12 (ansi).uft
  12. 0 5
      Templates/BaseGame/game/core/settings.xml
  13. 1 0
      Templates/BaseGame/game/core/utility/Core_Utility.cs
  14. 20 0
      Templates/BaseGame/game/core/utility/scripts/module.cs
  15. 0 0
      Templates/BaseGame/game/core/utility/scripts/scene.cs
  16. 14 0
      Templates/BaseGame/game/core/utility/scripts/signalManager.cs
  17. 52 0
      Templates/BaseGame/game/tools/assetBrowser/assetImportConfigs.xml
  18. 7 7
      Templates/BaseGame/game/tools/assetBrowser/guis/assetImport.gui
  19. 25 0
      Templates/BaseGame/game/tools/assetBrowser/scripts/addModuleWindow.cs
  20. 12 17
      Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.cs
  21. 193 7
      Templates/BaseGame/game/tools/assetBrowser/scripts/assetImportConfig.cs
  22. 1 1
      Templates/BaseGame/game/tools/assetBrowser/scripts/fieldTypes.cs
  23. 37 0
      Templates/BaseGame/game/tools/assetBrowser/scripts/templateFiles/module.cs.template
  24. 7 7
      Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorTreeView.ed.cs
  25. 81 81
      Templates/BaseGame/game/tools/settings.xml

+ 12 - 1
Engine/source/T3D/Scene.cpp

@@ -12,7 +12,7 @@ Scene::Scene() :
    mIsEditing(false),
    mIsEditing(false),
    mIsDirty(false)
    mIsDirty(false)
 {
 {
-
+   mGameModeName = StringTable->EmptyString();
 }
 }
 
 
 Scene::~Scene()
 Scene::~Scene()
@@ -29,6 +29,10 @@ void Scene::initPersistFields()
    addField("isEditing", TypeBool, Offset(mIsEditing, Scene), "", AbstractClassRep::FIELD_HideInInspectors);
    addField("isEditing", TypeBool, Offset(mIsEditing, Scene), "", AbstractClassRep::FIELD_HideInInspectors);
    addField("isDirty", TypeBool, Offset(mIsDirty, Scene), "", AbstractClassRep::FIELD_HideInInspectors);
    addField("isDirty", TypeBool, Offset(mIsDirty, Scene), "", AbstractClassRep::FIELD_HideInInspectors);
    endGroup("Internal");
    endGroup("Internal");
+
+   addGroup("Gameplay");
+   addField("gameModeName", TypeString, Offset(mGameModeName, Scene), "The name of the gamemode that this scene utilizes");
+   endGroup("Gameplay");
 }
 }
 
 
 bool Scene::onAdd()
 bool Scene::onAdd()
@@ -186,6 +190,13 @@ DefineEngineFunction(getScene, Scene*, (U32 sceneId), (0),
    return Scene::smSceneList[sceneId];
    return Scene::smSceneList[sceneId];
 }
 }
 
 
+DefineEngineFunction(getSceneCount, S32, (),,
+   "Get the number of active Scene objects that are loaded.\n"
+   "@return The number of active scenes")
+{
+   return Scene::smSceneList.size();
+}
+
 DefineEngineFunction(getRootScene, S32, (), ,
 DefineEngineFunction(getRootScene, S32, (), ,
    "Get the root Scene object that is loaded.\n"
    "Get the root Scene object that is loaded.\n"
    "@return The id of the Root Scene. Will be 0 if no root scene is loaded")
    "@return The id of the Root Scene. Will be 0 if no root scene is loaded")

+ 3 - 1
Engine/source/T3D/Scene.h

@@ -35,6 +35,8 @@ class Scene : public NetObject, public virtual ITickable
 
 
    bool mIsDirty;
    bool mIsDirty;
 
 
+   StringTableEntry mGameModeName;
+
 protected:
 protected:
    static Scene * smRootScene;
    static Scene * smRootScene;
 
 
@@ -76,4 +78,4 @@ public:
    }
    }
 
 
    static Vector<Scene*> smSceneList;
    static Vector<Scene*> smSceneList;
-};
+};

+ 0 - 1
Templates/BaseGame/game/core/Core.cs

@@ -25,7 +25,6 @@ function CoreModule::onCreate(%this)
    ModuleDatabase.LoadExplicit( "Core_PostFX" );
    ModuleDatabase.LoadExplicit( "Core_PostFX" );
    ModuleDatabase.LoadExplicit( "Core_Components" );
    ModuleDatabase.LoadExplicit( "Core_Components" );
    ModuleDatabase.LoadExplicit( "Core_GameObjects" );
    ModuleDatabase.LoadExplicit( "Core_GameObjects" );
-   ModuleDatabase.LoadExplicit( "Core_ClientServer" );
    
    
    new Settings(ProjectSettings) { file = "core/settings.xml"; };
    new Settings(ProjectSettings) { file = "core/settings.xml"; };
    ProjectSettings.read();
    ProjectSettings.read();

+ 2 - 0
Templates/BaseGame/game/core/clientServer/scripts/client/client.cs

@@ -20,6 +20,8 @@ function initClient()
       exec( %prefPath @ "/clientPrefs.cs" );
       exec( %prefPath @ "/clientPrefs.cs" );
    else
    else
       exec( "data/defaults.cs" );
       exec( "data/defaults.cs" );
+      
+   callOnModules("initClient");
 
 
    loadMaterials();
    loadMaterials();
 
 

+ 2 - 22
Templates/BaseGame/game/core/clientServer/scripts/client/connectionToServer.cs

@@ -32,18 +32,7 @@ function GameConnection::onConnectionAccepted(%this)
    // datablocks and objects are ghosted over.
    // datablocks and objects are ghosted over.
    physicsInitWorld( "client" ); 
    physicsInitWorld( "client" ); 
    
    
-   //Get our modules so we can exec any specific client-side loading/handling
-   %modulesList = ModuleDatabase.findModules(true);
-   for(%i=0; %i < getWordCount(%modulesList); %i++)
-   {
-      %module = getWord(%modulesList, %i);
-      %moduleID = %module.ModuleId;
-      
-      if(%module.scopeSet.isMethod("onCreateClient"))
-      {
-         eval(%module.scopeSet @ ".onCreateClient();");
-      }
-   }  
+   callOnModules("onCreateClient", "Game");
 }
 }
 
 
 function GameConnection::initialControlSet(%this)
 function GameConnection::initialControlSet(%this)
@@ -141,14 +130,5 @@ function disconnectedCleanup()
    // We can now delete the client physics simulation.
    // We can now delete the client physics simulation.
    physicsDestroyWorld( "client" );    
    physicsDestroyWorld( "client" );    
    
    
-   //Get our modules so we can exec any specific client-side loading/handling
-   %modulesList = ModuleDatabase.findModules(true);
-   for(%i=0; %i < getWordCount(%modulesList); %i++)
-   {
-      %module = getWord(%modulesList, %i);
-      if(%module.scopeSet.isMethod("onDestroyClient"))
-      {
-         eval(%module.scopeSet @ ".onDestroyClient();");
-      }
-   }             
+   callOnModules("onDestroyClient", "Game");
 }
 }

+ 29 - 1
Templates/BaseGame/game/core/clientServer/scripts/server/connectionToClient.cs

@@ -150,7 +150,35 @@ function GameConnection::onDrop(%client, %reason)
    }
    }
    
    
    if($missionRunning)
    if($missionRunning)
-      theLevelInfo.onClientLeaveGame();
+   {
+      %hasGameMode = 0;
+      for(%i=0; %i < %activeSceneCount; %i++)
+      {
+         if(getScene(%i).gameModeName !$= "")
+         {
+            //if the scene defines a game mode, go ahead and envoke it here
+            if(isMethod(getScene(%i).gameModeName, "onClientLeaveGame"))
+            {
+               eval(getScene(%i).gameModeName @ "::onClientLeaveGame(" @ %client @ ");" );
+               %hasGameMode = 1;
+            }
+         }
+      }
+      
+      //if none of our scenes have gamemodes, we need to kick off a default
+      if(%hasGameMode == 0)
+      {
+         %defaultModeName = ProjectSettings.value("Gameplay/GameModes/defaultModeName");
+         if(%defaultModeName !$= "")
+         {
+            if(isMethod(%defaultModeName, "onClientLeaveGame"))
+            {
+               eval(%defaultModeName @ "::onClientLeaveGame(" @ %client @ ");" );
+               %hasGameMode = 1;
+            }
+         }
+      }  
+   }
    
    
    removeFromServerGuidList( %client.guid );
    removeFromServerGuidList( %client.guid );
 
 

+ 30 - 4
Templates/BaseGame/game/core/clientServer/scripts/server/levelDownload.cs

@@ -148,12 +148,38 @@ function serverCmdMissionStartPhase3Ack(%client, %seq)
       %entity.notify("onClientConnect", %client);
       %entity.notify("onClientConnect", %client);
    }
    }
    
    
-   //Have any special game-play handling here
-   if(theLevelInfo.isMethod("onClientEnterGame"))
+   %activeSceneCount = getSceneCount();
+   
+   %hasGameMode = 0;
+   for(%i=0; %i < %activeSceneCount; %i++)
    {
    {
-      theLevelInfo.onClientEnterGame(%client);
+      if(getScene(%i).gameModeName !$= "")
+      {
+         //if the scene defines a game mode, go ahead and envoke it here
+         if(isMethod(getScene(%i).gameModeName, "onClientEnterGame"))
+         {
+            eval(getScene(%i).gameModeName @ "::onClientEnterGame(" @ %client @ ");" );
+            %hasGameMode = 1;
+         }
+      }
    }
    }
-   else
+   
+   //if none of our scenes have gamemodes, we need to kick off a default
+   if(%hasGameMode == 0)
+   {
+      %defaultModeName = ProjectSettings.value("Gameplay/GameModes/defaultModeName");
+      if(%defaultModeName !$= "")
+      {
+         if(isMethod(%defaultModeName, "onClientEnterGame"))
+         {
+            eval(%defaultModeName @ "::onClientEnterGame(" @ %client @ ");" );
+            %hasGameMode = 1;
+         }
+      }
+   }
+   
+   //if that also failed, just spawn a camera
+   if(%hasGameMode == 0)
    {
    {
       //No Game mode class for the level info, so just spawn a default camera
       //No Game mode class for the level info, so just spawn a default camera
       // Set the control object to the default camera
       // Set the control object to the default camera

+ 89 - 5
Templates/BaseGame/game/core/clientServer/scripts/server/levelLoad.cs

@@ -135,8 +135,35 @@ function loadMissionStage2()
       ClientGroup.getObject(%clientIndex).loadMission();
       ClientGroup.getObject(%clientIndex).loadMission();
 
 
    // Go ahead and launch the game
    // Go ahead and launch the game
-   if(TheLevelInfo.isMethod("onMissionStart"))
-      TheLevelInfo.onMissionStart();
+   %activeSceneCount = getSceneCount();
+   
+   %hasGameMode = 0;
+   for(%i=0; %i < %activeSceneCount; %i++)
+   {
+      if(getScene(%i).gameModeName !$= "")
+      {
+         //if the scene defines a game mode, go ahead and envoke it here
+         if(isMethod(getScene(%i).gameModeName, "onMissionStart"))
+         {
+            eval(getScene(%i).gameModeName @ "::onMissionStart();" );
+            %hasGameMode = 1;
+         }
+      }
+   }
+   
+   //if none of our scenes have gamemodes, we need to kick off a default
+   if(%hasGameMode == 0)
+   {
+      %defaultModeName = ProjectSettings.value("Gameplay/GameModes/defaultModeName");
+      if(%defaultModeName !$= "")
+      {
+         if(isMethod(%defaultModeName, "onMissionStart"))
+         {
+            eval(%defaultModeName @ "::onMissionStart();" );
+            %hasGameMode = 1;
+         }
+      }
+   }
 }
 }
 
 
 function endMission()
 function endMission()
@@ -147,7 +174,35 @@ function endMission()
    echo("*** ENDING MISSION");
    echo("*** ENDING MISSION");
    
    
    // Inform the game code we're done.
    // Inform the game code we're done.
-   TheLevelInfo.onMissionEnded();
+   %activeSceneCount = getSceneCount();
+   
+   %hasGameMode = 0;
+   for(%i=0; %i < %activeSceneCount; %i++)
+   {
+      if(getScene(%i).gameModeName !$= "")
+      {
+         //if the scene defines a game mode, go ahead and envoke it here
+         if(isMethod(getScene(%i).gameModeName, "onMissionEnded"))
+         {
+            eval(getScene(%i).gameModeName @ "::onMissionEnded();" );
+            %hasGameMode = 1;
+         }
+      }
+   }
+   
+   //if none of our scenes have gamemodes, we need to kick off a default
+   if(%hasGameMode == 0)
+   {
+      %defaultModeName = ProjectSettings.value("Gameplay/GameModes/defaultModeName");
+      if(%defaultModeName !$= "")
+      {
+         if(isMethod(%defaultModeName, "onMissionEnded"))
+         {
+            eval(%defaultModeName @ "::onMissionEnded();" );
+            %hasGameMode = 1;
+         }
+      }
+   }
 
 
    // Inform the clients
    // Inform the clients
    for( %clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++ ) {
    for( %clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++ ) {
@@ -176,6 +231,35 @@ function resetMission()
    $instantGroup = MissionCleanup;
    $instantGroup = MissionCleanup;
 
 
    clearServerPaths();
    clearServerPaths();
-   //
-   TheLevelInfo.onMissionReset();
+   
+   // Inform the game code we're resetting.
+   %activeSceneCount = getSceneCount();
+   
+   %hasGameMode = 0;
+   for(%i=0; %i < %activeSceneCount; %i++)
+   {
+      if(getScene(%i).gameModeName !$= "")
+      {
+         //if the scene defines a game mode, go ahead and envoke it here
+         if(isMethod(getScene(%i).gameModeName, "onMissionReset"))
+         {
+            eval(getScene(%i).gameModeName @ "::onMissionReset(" @ %client @ ");" );
+            %hasGameMode = 1;
+         }
+      }
+   }
+   
+   //if none of our scenes have gamemodes, we need to kick off a default
+   if(%hasGameMode == 0)
+   {
+      %defaultModeName = ProjectSettings.value("Gameplay/GameModes/defaultModeName");
+      if(%defaultModeName !$= "")
+      {
+         if(isMethod(%defaultModeName, "onMissionReset"))
+         {
+            eval(%defaultModeName @ "::onMissionReset(" @ %client @ ");" );
+            %hasGameMode = 1;
+         }
+      }
+   }
 }
 }

+ 34 - 22
Templates/BaseGame/game/core/clientServer/scripts/server/server.cs

@@ -52,6 +52,8 @@ function initServer()
 
 
    // Specify where the mission files are.
    // Specify where the mission files are.
    $Server::MissionFileSpec = "data/levels/*.mis";
    $Server::MissionFileSpec = "data/levels/*.mis";
+   
+   callOnModules("initServer");
 }
 }
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
@@ -156,17 +158,8 @@ function createServer(%serverType, %level)
          schedule(0,0,startHeartbeat);
          schedule(0,0,startHeartbeat);
    }
    }
    
    
-   //Get our modules so we can exec any specific server-side loading/handling
-   %modulesList = ModuleDatabase.findModules(true);
-   for(%i=0; %i < getWordCount(%modulesList); %i++)
-   {
-      %module = getWord(%modulesList, %i);
-      if(%module.scopeSet.isMethod("onCreateServer"))
-      {
-         eval(%module.scopeSet @ ".onCreateServer();");
-      }
-   }
-
+   callOnModules("onCreateServer", "Game");
+   
    // Let the game initialize some things now that the
    // Let the game initialize some things now that the
    // the server has been created
    // the server has been created
    onServerCreated();
    onServerCreated();
@@ -241,15 +234,7 @@ function destroyServer()
    deleteDataBlocks();
    deleteDataBlocks();
    
    
    //Get our modules so we can exec any specific server-side loading/handling
    //Get our modules so we can exec any specific server-side loading/handling
-   %modulesList = ModuleDatabase.findModules(true);
-   for(%i=0; %i < getWordCount(%modulesList); %i++)
-   {
-      %module = getWord(%modulesList, %i);
-      if(%module.scopeSet.isMethod("onDestroyServer"))
-      {
-         eval(%module.scopeSet @ ".onDestroyServer();");
-      }
-   }
+   callOnModules("onDestroyServer", "Game");
    
    
    // Save any server settings
    // Save any server settings
    %prefPath = getPrefpath();
    %prefPath = getPrefpath();
@@ -273,8 +258,35 @@ function onServerDestroyed()
    echo("*** ENDING MISSION");
    echo("*** ENDING MISSION");
    
    
    // Inform the game code we're done.
    // Inform the game code we're done.
-   if(TheLevelInfo.isMethod("onMissionEnded"))
-      TheLevelInfo.onMissionEnded();
+   %activeSceneCount = getSceneCount();
+   
+   %hasGameMode = 0;
+   for(%i=0; %i < %activeSceneCount; %i++)
+   {
+      if(getScene(%i).gameModeName !$= "")
+      {
+         //if the scene defines a game mode, go ahead and envoke it here
+         if(isMethod(getScene(%i).gameModeName, "onMissionEnded"))
+         {
+            eval(getScene(%i).gameModeName @ "::onMissionEnded();" );
+            %hasGameMode = 1;
+         }
+      }
+   }
+   
+   //if none of our scenes have gamemodes, we need to kick off a default
+   if(%hasGameMode == 0)
+   {
+      %defaultModeName = ProjectSettings.value("Gameplay/GameModes/defaultModeName");
+      if(%defaultModeName !$= "")
+      {
+         if(isMethod(%defaultModeName, "onMissionEnded"))
+         {
+            eval(%defaultModeName @ "::onMissionEnded();" );
+            %hasGameMode = 1;
+         }
+      }
+   }
 
 
    // Inform the clients
    // Inform the clients
    for( %clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++ ) {
    for( %clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++ ) {

BIN
Templates/BaseGame/game/core/gui/scripts/fonts/ArialItalic 14 (ansi).uft


BIN
Templates/BaseGame/game/core/gui/scripts/fonts/Lucida Console 12 (ansi).uft


+ 0 - 5
Templates/BaseGame/game/core/settings.xml

@@ -5,9 +5,4 @@
             <Setting name="coreModulePath">core/</Setting>
             <Setting name="coreModulePath">core/</Setting>
         </Group>
         </Group>
     </Group>
     </Group>
-    <Group name="Gameplay">
-        <Group name="GameModes">
-            <Setting name="defaultModeName">a</Setting>
-        </Group>
-    </Group>
 </ProjectSettings>
 </ProjectSettings>

+ 1 - 0
Templates/BaseGame/game/core/utility/Core_Utility.cs

@@ -6,6 +6,7 @@ function Core_Utility::onCreate(%this)
    exec("./scripts/helperFunctions.cs");
    exec("./scripts/helperFunctions.cs");
    exec("./scripts/gameObjectManagement.cs");
    exec("./scripts/gameObjectManagement.cs");
    exec("./scripts/persistanceManagement.cs");
    exec("./scripts/persistanceManagement.cs");
+   exec("./scripts/module.cs");
 }
 }
 
 
 function Core_Utility::onDestroy(%this)
 function Core_Utility::onDestroy(%this)

+ 20 - 0
Templates/BaseGame/game/core/utility/scripts/module.cs

@@ -0,0 +1,20 @@
+function callOnModules(%functionName, %moduleGroup)
+{
+   //Get our modules so we can exec any specific client-side loading/handling
+   %modulesList = ModuleDatabase.findModules(false);
+   for(%i=0; %i < getWordCount(%modulesList); %i++)
+   {
+      %module = getWord(%modulesList, %i);
+      
+      if(%moduleGroup !$= "")
+      {
+         if(%module.group !$= %moduleGroup)
+            continue;  
+      }
+      
+      if(isObject(%module.scopeSet) && %module.scopeSet.isMethod(%functionName))
+      {
+         eval(%module.scopeSet @ "." @ %functionName @ "();");
+      }
+   }   
+}

+ 0 - 0
Templates/BaseGame/game/core/utility/scripts/scene.cs


+ 14 - 0
Templates/BaseGame/game/core/utility/scripts/signalManager.cs

@@ -0,0 +1,14 @@
+function SimObject::notify(%this, %signalName)
+{
+   
+}
+
+function SimObject::removeNotify(%this, %signalName)
+{
+   
+}
+
+function SimObject::removeNotify(%this, %signalName)
+{
+   
+}

+ 52 - 0
Templates/BaseGame/game/tools/assetBrowser/assetImportConfigs.xml

@@ -1,3 +1,55 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <AssetImportSettings>
 <AssetImportSettings>
+    <Group name="TestConfig">
+        <Group name="Collision">
+            <Setting name="LOSCollisionMeshPrefix">LOS</Setting>
+            <Setting name="GenerateCollisions">1</Setting>
+            <Setting name="GenLOSCollisionType">CollisionMesh</Setting>
+            <Setting name="GenerateLOSCollisions">1</Setting>
+            <Setting name="CollisionMeshPrefix">Col</Setting>
+            <Setting name="GenCollisionType">CollisionMesh</Setting>
+        </Group>
+        <Group name="Meshes">
+            <Setting name="AdjustFloor">0</Setting>
+            <Setting name="ScaleOverride">1</Setting>
+            <Setting name="LODType">TrailingNumber</Setting>
+            <Setting name="AdjustCenter">0</Setting>
+            <Setting name="UpAxisOverride">Z_AXIS</Setting>
+            <Setting name="CollapseSubmeshes">0</Setting>
+            <Setting name="IgnoreNodeScale">0</Setting>
+            <Setting name="DoUpAxisOverride">0</Setting>
+        </Group>
+        <Group name="Sounds">
+            <Setting name="VolumeAdjust">1.0</Setting>
+            <Setting name="Compressed">0</Setting>
+            <Setting name="PitchAdjust">1.0</Setting>
+        </Group>
+        <Group name="Images">
+            <Setting name="AOTypeSuffixes">_AO,_AMBIENT,_AMBIENTOCCLUSION</Setting>
+            <Setting name="NormalTypeSuffixes">_NORMAL,_NORM</Setting>
+            <Setting name="UseMips">1</Setting>
+            <Setting name="SmoothnessTypeSuffixes">_SMOOTH,_SMOOTHNESS</Setting>
+            <Setting name="PopulateMaterialMaps">1</Setting>
+            <Setting name="Scaling">1.0</Setting>
+            <Setting name="DiffuseTypeSuffixes">_ALBEDO,_DIFFUSE,_ALB,_DIF,_COLOR,_COL</Setting>
+            <Setting name="TextureFilteringMode">Bilinear</Setting>
+            <Setting name="GenerateMaterialOnImport">1</Setting>
+            <Setting name="RoughnessTypeSuffixes">_ROUGH,_ROUGHNESS</Setting>
+            <Setting name="CompositeTypeSuffixes">_COMP,_COMPOSITE</Setting>
+            <Setting name="ImageType">N/A</Setting>
+            <Setting name="IsHDR">0</Setting>
+            <Setting name="MetalnessTypeSuffixes">_METAL,_MET,_METALNESS,_METALLIC</Setting>
+            <Setting name="Compressed">1</Setting>
+        </Group>
+        <Group name="Materials">
+            <Setting name="UseExistingMaterials">1</Setting>
+            <Setting name="UseDiffuseSuffixOnOriginImage">1</Setting>
+            <Setting name="CreateComposites">1</Setting>
+            <Setting name="ImportMaterials">1</Setting>
+        </Group>
+        <Group name="Animations">
+            <Setting name="SeparateAnimations">1</Setting>
+            <Setting name="ImportAnimations">1</Setting>
+        </Group>
+    </Group>
 </AssetImportSettings>
 </AssetImportSettings>

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

@@ -1,7 +1,7 @@
 //--- OBJECT WRITE BEGIN ---
 //--- OBJECT WRITE BEGIN ---
 %guiContent = new GuiControl(AssetImportCtrl) {
 %guiContent = new GuiControl(AssetImportCtrl) {
    position = "0 0";
    position = "0 0";
-   extent = "1440 900";
+   extent = "1024 768";
    minExtent = "8 2";
    minExtent = "8 2";
    horizSizing = "right";
    horizSizing = "right";
    vertSizing = "bottom";
    vertSizing = "bottom";
@@ -296,7 +296,7 @@
       anchorBottom = "0";
       anchorBottom = "0";
       anchorLeft = "1";
       anchorLeft = "1";
       anchorRight = "0";
       anchorRight = "0";
-      position = "140 98";
+      position = "145 133";
       extent = "733 502";
       extent = "733 502";
       minExtent = "48 92";
       minExtent = "48 92";
       horizSizing = "center";
       horizSizing = "center";
@@ -625,9 +625,9 @@
       anchorBottom = "0";
       anchorBottom = "0";
       anchorLeft = "1";
       anchorLeft = "1";
       anchorRight = "0";
       anchorRight = "0";
-      position = "524 332";
-      extent = "376 50";
-      minExtent = "48 92";
+      position = "348 332";
+      extent = "376 70";
+      minExtent = "48 70";
       horizSizing = "center";
       horizSizing = "center";
       vertSizing = "center";
       vertSizing = "center";
       profile = "ToolsGuiWindowProfile";
       profile = "ToolsGuiWindowProfile";
@@ -695,7 +695,7 @@
          groupNum = "-1";
          groupNum = "-1";
          buttonType = "PushButton";
          buttonType = "PushButton";
          useMouseEvents = "0";
          useMouseEvents = "0";
-         position = "301 27";
+         position = "301 45";
          extent = "64 22";
          extent = "64 22";
          minExtent = "8 2";
          minExtent = "8 2";
          horizSizing = "left";
          horizSizing = "left";
@@ -703,7 +703,7 @@
          profile = "ToolsGuiButtonProfile";
          profile = "ToolsGuiButtonProfile";
          visible = "1";
          visible = "1";
          active = "1";
          active = "1";
-         command = "ImportAssetConfigEditorWindow.saveAssetOptionsConfig();";
+         command = "ImportAssetConfigEditorWindow.createNewImportConfig();";
          tooltipProfile = "ToolsGuiToolTipProfile";
          tooltipProfile = "ToolsGuiToolTipProfile";
          hovertime = "1000";
          hovertime = "1000";
          isContainer = "0";
          isContainer = "0";

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

@@ -75,6 +75,31 @@ function AssetBrowser_addModuleWindow::CreateNewModule(%this)
    
    
    //Now generate the script file for it
    //Now generate the script file for it
    %file = new FileObject();
    %file = new FileObject();
+   %templateFile = new FileObject();
+   
+   %moduleTemplateCodeFilePath = AssetBrowser.templateFilesPath @ "module.cs.template";
+   
+   if(%file.openForWrite(%moduleScriptFilePath) && %templateFile.openForRead(%moduleTemplateCodeFilePath))
+   {
+      while( !%templateFile.isEOF() )
+      {
+         %line = %templateFile.readline();
+         %line = strreplace( %line, "@@", %newModuleName );
+         
+         %file.writeline(%line);
+         echo(%line);
+      }
+      
+      %file.close();
+      %templateFile.close();
+   }
+   else
+   {
+      %file.close();
+      %templateFile.close();
+      
+      warnf("CreateNewModule - Something went wrong and we couldn't write the script file!");
+   }
 	
 	
 	if(%file.openForWrite(%moduleScriptFilePath))
 	if(%file.openForWrite(%moduleScriptFilePath))
 	{
 	{

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

@@ -513,7 +513,7 @@ function ImportAssetWindow::reloadImportOptionConfigs(%this)
    if(%xmlDoc.loadFile($AssetBrowser::importConfigsFile))
    if(%xmlDoc.loadFile($AssetBrowser::importConfigsFile))
    {
    {
       //StateMachine element
       //StateMachine element
-      if(!%xmlDoc.pushFirstChildElement("AssetImportConfigs"))
+      if(!%xmlDoc.pushFirstChildElement("AssetImportSettings"))
       {
       {
          error("Invalid Import Configs file");
          error("Invalid Import Configs file");
          return;  
          return;  
@@ -521,26 +521,21 @@ function ImportAssetWindow::reloadImportOptionConfigs(%this)
       
       
       //Config Groups
       //Config Groups
       %configCount = 0;
       %configCount = 0;
-      while(%xmlDoc.pushChildElement(%configCount))
+      %hasGroup = %xmlDoc.pushFirstChildElement("Group");
+      while(%hasGroup)
       {
       {
-         %configName = %xmlDoc.attribute("Name");
-        
-         %xmlDoc.popElement();
-         %configCount++;
+         %configName = %xmlDoc.attribute("name");
          
          
          ImportAssetWindow.importConfigsList.add(%configName);
          ImportAssetWindow.importConfigsList.add(%configName);
+         ImportAssetConfigList.add(%configName);
+         
+         %hasGroup = %xmlDoc.nextSiblingElement("Group");
       }
       }
-      
+
       %xmlDoc.popElement();
       %xmlDoc.popElement();
    }
    }
    
    
-   ImportAssetWindow.importConfigsList.add(%configName);
-   
-   for(%i = 0; %i < ImportAssetWindow.importConfigsList.count(); %i++)
-   {
-      %configName = ImportAssetWindow.importConfigsList.getKey(%i);
-      ImportAssetConfigList.add(%configName);
-   }
+   %xmlDoc.delete();
    
    
    %importConfigIdx = ImportAssetWindow.activeImportConfigIndex;
    %importConfigIdx = ImportAssetWindow.activeImportConfigIndex;
    if(%importConfigIdx $= "")
    if(%importConfigIdx $= "")
@@ -620,14 +615,14 @@ function ImportAssetWindow::processNewImportAssets(%this, %id)
       
       
       if(isObject(%assetItem) && %assetItem.processed == false)
       if(isObject(%assetItem) && %assetItem.processed == false)
       {
       {
-         %assetConfigObj = ImportAssetWindow.activeImportConfig.clone();
-         %assetConfigObj.assetIndex = %i;
+         //%assetConfigObj = ImportAssetWindow.activeImportConfig.clone();
+         //%assetConfigObj.assetIndex = %i;
 
 
          //sanetize before modifying our asset name(suffix additions, etc)      
          //sanetize before modifying our asset name(suffix additions, etc)      
          if(%assetItem.assetName !$= %assetItem.cleanAssetName)
          if(%assetItem.assetName !$= %assetItem.cleanAssetName)
             %assetItem.assetName = %assetItem.cleanAssetName;
             %assetItem.assetName = %assetItem.cleanAssetName;
             
             
-         %assetConfigObj.assetName = %assetItem.assetName;
+         //%assetConfigObj.assetName = %assetItem.assetName;
          
          
          if(%assetItem.assetType $= "Model")
          if(%assetItem.assetType $= "Model")
          {
          {

+ 193 - 7
Templates/BaseGame/game/tools/assetBrowser/scripts/assetImportConfig.cs

@@ -12,6 +12,79 @@ function ImportAssetConfigList::onSelect( %this, %id, %text )
    AssetBrowser.reloadImportingFiles();
    AssetBrowser.reloadImportingFiles();
 }
 }
 
 
+function setupImportConfigSettingsList()
+{
+   if(!isObject(ImportAssetConfigSettingsList))
+   {
+      new ArrayObject(ImportAssetConfigSettingsList);
+   
+      ImportAssetConfigSettingsList.addNewConfigSetting("Mesh/ImportMesh", "Import Mesh", "bool", "", "1", "", "ToggleImportMesh");
+      ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/DoUpAxisOverride", "Do Up-axis Override", "bool", "", "0", "");
+      ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/UpAxisOverride", "Up-axis Override", "list", "", "Z_AXIS", "X_AXIS,Y_AXIS,Z_AXIS");
+      ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/ScaleOverride", "Do Scale Override", "bool", "", "0", "");
+      ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/ScaleOverride", "Scale Override", "float", "", "1", "");
+      ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/IgnoreNodeScale", "Ignore Node Scale", "bool", "", "0", "");
+      ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/AdjustCenter", "Adjust Center", "bool", "", "0", "");
+      ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/AdjustFloor", "Adjust Floor", "bool", "", "0", "");
+      ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/CollapseSubmeshes", "Collapse Submeshes", "bool", "", "0", "");
+      ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/LODType", "LOD Type", "list", "", "TrailingNumber", "TrailingNumber,DetectDTS");
+      //ImportAssetConfigSettingsList.addNewConfigSetting("TrailingNumber", "Trailing Number", "float", "", "2", "", "Mesh");
+      ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/ImportedNodes", "Imported Nodes", "command", "", "", "");
+      ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/IgnoreNodes", "Ignore Nodes", "command", "", "", "");
+      ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/ImportMeshes", "Import Meshes", "command", "", "", "");
+      ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/IgnoreMeshes", "Imported Meshes", "command", "", "", "");
+      
+      //Materials
+      ImportAssetConfigSettingsList.addNewConfigSetting("Materials/ImportMaterials", "Import Materials", "bool", "", "1", "");
+      ImportAssetConfigSettingsList.addNewConfigSetting("Materials/CreateComposites", "Create Composites", "bool", "", "1", "");
+      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", "", "", "");
+      
+      //Animations
+      ImportAssetConfigSettingsList.addNewConfigSetting("Animations/ImportAnimations", "Import Animations", "bool", "", "1", "");
+      ImportAssetConfigSettingsList.addNewConfigSetting("Animations/SeparateAnimations", "Separate Animations", "bool", "", "1", "");
+      ImportAssetConfigSettingsList.addNewConfigSetting("Animations/SeparateAnimationPrefix", "Separate Animation Prefix", "string", "", "", "");
+      
+      //Collision
+      ImportAssetConfigSettingsList.addNewConfigSetting("Collision/GenerateCollisions", "Generate Collisions", "bool", "", "1", "");
+      ImportAssetConfigSettingsList.addNewConfigSetting("Collision/GenCollisionType", "Generate Collision Type", "list", "", "CollisionMesh", "CollisionMesh,ConvexHull");
+      ImportAssetConfigSettingsList.addNewConfigSetting("Collision/CollisionMeshPrefix", "CollisionMesh Prefix", "string", "", "Col", "");
+      ImportAssetConfigSettingsList.addNewConfigSetting("Collision/GenerateLOSCollisions", "Generate LOS Collisions", "bool", "", "1", "");
+      ImportAssetConfigSettingsList.addNewConfigSetting("Collision/GenLOSCollisionType", "Generate LOS Collision Type", "list", "", "CollisionMesh", "CollisionMesh,ConvexHull");
+      ImportAssetConfigSettingsList.addNewConfigSetting("Collision/LOSCollisionMeshPrefix", "LOS CollisionMesh Prefix", "string", "", "LOS", "");
+      
+      //Images
+      ImportAssetConfigSettingsList.addNewConfigSetting("Images/ImageType", "Image Type", "list", "", "N/A", "N/A,Diffuse,Normal,Specular,Metalness,Roughness,AO,Composite,GUI");
+      ImportAssetConfigSettingsList.addNewConfigSetting("Images/DiffuseTypeSuffixes", "Diffuse Type Suffixes", "command", "", "_ALBEDO,_DIFFUSE,_ALB,_DIF,_COLOR,_COL", "");
+      ImportAssetConfigSettingsList.addNewConfigSetting("Images/NormalTypeSuffixes", "Normal Type Suffixes", "command", "", "_NORMAL,_NORM", "");
+      
+      ImportAssetConfigSettingsList.addNewConfigSetting("Images/MetalnessTypeSuffixes", "Metalness Type Suffixes", "command", "", "_METAL,_MET,_METALNESS,_METALLIC", "");
+      ImportAssetConfigSettingsList.addNewConfigSetting("Images/RoughnessTypeSuffixes", "Roughness Type Suffixes", "command", "", "_ROUGH,_ROUGHNESS", "");
+      ImportAssetConfigSettingsList.addNewConfigSetting("Images/SmoothnessTypeSuffixes", "Smoothness Type Suffixes", "command", "", "_SMOOTH,_SMOOTHNESS", "");
+      ImportAssetConfigSettingsList.addNewConfigSetting("Images/AOTypeSuffixes", "AO Type Suffixes", "command", "", "_AO,_AMBIENT,_AMBIENTOCCLUSION", "");
+      ImportAssetConfigSettingsList.addNewConfigSetting("Images/CompositeTypeSuffixes", "Composite Type Suffixes", "command", "", "_COMP,_COMPOSITE", "");
+      
+      ImportAssetConfigSettingsList.addNewConfigSetting("Images/TextureFilteringMode", "Texture Filtering Mode", "list", "", "Bilinear", "None,Bilinear,Trilinear");
+      ImportAssetConfigSettingsList.addNewConfigSetting("Images/UseMips", "Use Mipmaps", "bool", "", "1", "");
+      ImportAssetConfigSettingsList.addNewConfigSetting("Images/IsHDR", "Is HDR", "bool", "", "0", "");
+      ImportAssetConfigSettingsList.addNewConfigSetting("Images/Scaling", "Scaling", "float", "", "1.0", "");
+      ImportAssetConfigSettingsList.addNewConfigSetting("Images/Compressed", "Is Compressed", "bool", "", "1", "");
+      ImportAssetConfigSettingsList.addNewConfigSetting("Images/GenerateMaterialOnImport", "Generate Material On Import", "bool", "", "1", "");
+      ImportAssetConfigSettingsList.addNewConfigSetting("Images/PopulateMaterialMaps", "Populate Material Maps", "bool", "", "1", "");
+
+      //Sounds
+      ImportAssetConfigSettingsList.addNewConfigSetting("Sounds/VolumeAdjust", "Volume Adjustment", "float", "", "1.0", "");
+      ImportAssetConfigSettingsList.addNewConfigSetting("Sounds/PitchAdjust", "Pitch Adjustment", "float", "", "1.0", "");
+      ImportAssetConfigSettingsList.addNewConfigSetting("Sounds/Compressed", "Is Compressed", "bool", "", "0", "");
+   }
+}
+
+function ImportAssetConfigSettingsList::addNewConfigSetting(%this, %settingName, %settingFieldLabel, %type, %tooltip, %defaultValue, %fieldData)
+{
+   %this.add(%settingName TAB %settingFieldLabel TAB %type TAB %tooltip, %defaultValue TAB %fieldData);
+}
+
 function ImportAssetOptionsWindow::findMissingFile(%this, %assetItem)
 function ImportAssetOptionsWindow::findMissingFile(%this, %assetItem)
 {
 {
    if(%assetItem.assetType $= "Model")
    if(%assetItem.assetType $= "Model")
@@ -99,6 +172,7 @@ function ImportAssetOptionsWindow::editImportSettings(%this, %assetItem)
       if(%meshCount > 0)
       if(%meshCount > 0)
       {
       {
          ImportOptionsList.startGroup("Mesh");
          ImportOptionsList.startGroup("Mesh");
+         
          ImportOptionsList.addField("AutogenCollisions", "Auto-gen Collisions", "bool", "", "0", "", %assetConfigObj);
          ImportOptionsList.addField("AutogenCollisions", "Auto-gen Collisions", "bool", "", "0", "", %assetConfigObj);
          ImportOptionsList.addField("CollapseSubmeshes", "Collapse Submeshes", "bool", "", "0", "", %assetConfigObj);
          ImportOptionsList.addField("CollapseSubmeshes", "Collapse Submeshes", "bool", "", "0", "", %assetConfigObj);
          ImportOptionsList.addField("UpAxisOverride", "Up-Axis Override", "list", "", "Z_AXIS", "Z_AXIS,Y_AXIS,X_AXIS", %assetConfigObj);
          ImportOptionsList.addField("UpAxisOverride", "Up-Axis Override", "list", "", "Z_AXIS", "Z_AXIS,Y_AXIS,X_AXIS", %assetConfigObj);
@@ -194,15 +268,21 @@ function getAssetImportConfigValue(%fieldName, %defaultValue)
    return AssetImportSettings.value(ImportAssetWindow.activeImportConfig @ "/" @ %fieldName, %defaultValue);
    return AssetImportSettings.value(ImportAssetWindow.activeImportConfig @ "/" @ %fieldName, %defaultValue);
 }
 }
 
 
-function ImportAssetConfigEditorWindow::populateConfigList(%this, %optionsObj)
+function ImportAssetConfigEditorWindow::populateConfigList(%this, %configName)
 {
 {
-   AssetImportConfigName.setText(%optionsObj.Name);
+   //Ensure our config list is set up
+   setupImportConfigSettingsList();
+   
+   AssetImportConfigName.setText(%configName);
    
    
    ImportOptionsConfigList.clearFields();
    ImportOptionsConfigList.clearFields();
    
    
-   ImportOptionsConfigList.startGroup("Mesh");
-   ImportOptionsConfigList.addSettingsField("Mesh/ImportMesh", "Import Mesh", "bool", "Should meshes be imported", "");
-   ImportOptionsConfigList.endGroup();
+   %this.populateConfigListByGroup("Meshes");
+   %this.populateConfigListByGroup("Materials");
+   %this.populateConfigListByGroup("Animations");
+   %this.populateConfigListByGroup("Images");
+   %this.populateConfigListByGroup("Collision");
+   %this.populateConfigListByGroup("Sound");
    
    
    /*ImportOptionsConfigList.addCallbackField("ImportMesh", "Import Mesh", "bool", "", "1", "", "ToggleImportMesh", %optionsObj);
    /*ImportOptionsConfigList.addCallbackField("ImportMesh", "Import Mesh", "bool", "", "1", "", "ToggleImportMesh", %optionsObj);
    ImportOptionsConfigList.addField("DoUpAxisOverride", "Do Up-axis Override", "bool", "", "0", "", %optionsObj);
    ImportOptionsConfigList.addField("DoUpAxisOverride", "Do Up-axis Override", "bool", "", "0", "", %optionsObj);
@@ -283,8 +363,31 @@ function ImportAssetConfigEditorWindow::populateConfigList(%this, %optionsObj)
    ImportOptionsConfigList.endGroup();*/
    ImportOptionsConfigList.endGroup();*/
 }
 }
 
 
+function ImportAssetConfigEditorWindow::populateConfigListByGroup(%this, %groupName)
+{
+   ImportOptionsConfigList.startGroup(%groupName);
+   for(%i=0; %i < ImportAssetConfigSettingsList.count(); %i++)
+   {
+      %settingName = getField(ImportAssetConfigSettingsList.getKey(%i),0);
+      if(startsWith(%settingName, %groupName@"/"))
+      {
+         %labelName = getField(ImportAssetConfigSettingsList.getKey(%i), 1);
+         %type = getField(ImportAssetConfigSettingsList.getKey(%i), 2);
+         %tooltip = getField(ImportAssetConfigSettingsList.getKey(%i), 3);
+         
+         %defaultValue = getField(ImportAssetConfigSettingsList.getValue(%i), 0);
+         %dataValues = getField(ImportAssetConfigSettingsList.getValue(%i), 1);
+         ImportOptionsConfigList.addSettingsField(%settingName, %labelName, %type, %tooltip, %defaultValue, %dataValues);
+      }
+   }
+   ImportOptionsConfigList.endGroup();
+}
+
 function ImportAssetConfigEditorWindow::addNewConfig(%this)
 function ImportAssetConfigEditorWindow::addNewConfig(%this)
 {
 {
+   //Ensure our list is set up
+   setupImportConfigSettingsList();
+   
    ImportAssetNewConfigEditorWindow.setVisible(1);
    ImportAssetNewConfigEditorWindow.setVisible(1);
    ImportAssetNewConfigEditorWindow.selectWindow();
    ImportAssetNewConfigEditorWindow.selectWindow();
    
    
@@ -358,6 +461,7 @@ function ImportAssetConfigEditorWindow::addNewConfig(%this)
 
 
 function ImportAssetConfigEditorWindow::editConfig(%this)
 function ImportAssetConfigEditorWindow::editConfig(%this)
 {
 {
+   //Ensure our list is set up
    ImportAssetConfigEditorWindow.setVisible(1);
    ImportAssetConfigEditorWindow.setVisible(1);
    ImportAssetConfigEditorWindow.selectWindow();
    ImportAssetConfigEditorWindow.selectWindow();
    
    
@@ -366,6 +470,10 @@ function ImportAssetConfigEditorWindow::editConfig(%this)
 
 
 function ImportAssetConfigEditorWindow::deleteConfig(%this)
 function ImportAssetConfigEditorWindow::deleteConfig(%this)
 {
 {
+   for(%i=0; %i < %configList.count(); %i++)
+   {
+      
+   }
    ImportAssetWindow.importConfigsList.erase(ImportAssetWindow.activeImportConfigIndex);
    ImportAssetWindow.importConfigsList.erase(ImportAssetWindow.activeImportConfigIndex);
    ImportAssetConfigList.setSelected(0); //update it
    ImportAssetConfigList.setSelected(0); //update it
    
    
@@ -380,11 +488,89 @@ function ImportAssetConfigEditorWindow::saveAssetOptionsConfig(%this)
    ImportAssetWindow.reloadImportOptionConfigs();
    ImportAssetWindow.reloadImportOptionConfigs();
 }
 }
 
 
-function ImportOptionsConfigList::addSettingsField(%this, %settingsFieldName, %labelText, %fieldType, %tooltip, %fieldData)
+function ImportAssetConfigEditorWindow::createNewImportConfig(%this)
+{
+   %configName = AssetImportNewConfigName.getText();
+   %configList = ImportAssetConfigSettingsList;
+   
+   AssetImportSettings.beginGroup(%configName);
+   
+   for(%i=0; %i < %configList.count(); %i++)
+   {
+      %settingName = getField(%configList.getKey(%i),0);
+      if(startsWith(%settingName, "Meshes/"))
+      {
+         %defaultValue = getField(%configList.getValue(%i), 0);
+         AssetImportSettings.setValue(%settingName, %defaultValue);
+      }
+   }
+   
+   for(%i=0; %i < %configList.count(); %i++)
+   {
+      %settingName = getField(%configList.getKey(%i),0);
+      if(startsWith(%settingName, "Materials/"))
+      {
+         %defaultValue = getField(%configList.getValue(%i), 0);
+         AssetImportSettings.setValue(%settingName, %defaultValue);
+      }
+   }
+   
+   for(%i=0; %i < %configList.count(); %i++)
+   {
+      %settingName = getField(%configList.getKey(%i),0);
+      if(startsWith(%settingName, "Animations/"))
+      {
+         %defaultValue = getField(%configList.getValue(%i), 0);
+         AssetImportSettings.setValue(%settingName, %defaultValue);
+      }
+   }
+   
+   for(%i=0; %i < %configList.count(); %i++)
+   {
+      %settingName = getField(%configList.getKey(%i),0);
+      if(startsWith(%settingName, "Collision/"))
+      {
+         %defaultValue = getField(%configList.getValue(%i), 0);
+         AssetImportSettings.setValue(%settingName, %defaultValue);
+      }
+   }
+   
+   for(%i=0; %i < %configList.count(); %i++)
+   {
+      %settingName = getField(%configList.getKey(%i),0);
+      if(startsWith(%settingName, "Images/"))
+      {
+         %defaultValue = getField(%configList.getValue(%i), 0);
+         AssetImportSettings.setValue(%settingName, %defaultValue);
+      }
+   }
+
+   for(%i=0; %i < %configList.count(); %i++)
+   {
+      %settingName = getField(%configList.getKey(%i),0);
+      if(startsWith(%settingName, "Sounds/"))
+      {
+         %defaultValue = getField(%configList.getValue(%i), 0);
+         AssetImportSettings.setValue(%settingName, %defaultValue);
+      }
+   }
+   
+   AssetImportSettings.endGroup();
+   
+   %success = AssetImportSettings.write();
+   
+   ImportAssetNewConfigEditorWindow.setVisible(0);
+}
+
+function ImportOptionsConfigList::addSettingsField(%this, %settingsFieldName, %labelText, %fieldType, %tooltip, %fieldValue, %fieldData)
 {
 {
    %moddedSettingsFieldName = strreplace(%settingsFieldName, "/", "-");
    %moddedSettingsFieldName = strreplace(%settingsFieldName, "/", "-");
    
    
-   %this.addCallbackField(%moddedSettingsFieldName, %labelText, %fieldType, "", AssetImportSettings.value(%settingsFieldName), %fieldData, "changeEditorSetting");
+   %value = AssetImportSettings.value(%settingsFieldName);
+   if(%value $= "")
+      %value = %fieldValue;
+   
+   %this.addCallbackField(%moddedSettingsFieldName, %labelText, %fieldType, "", %value, %fieldData, "changeEditorSetting");
 }
 }
 
 
 function ImportOptionsConfigList::changeEditorSetting(%this, %varName, %value)
 function ImportOptionsConfigList::changeEditorSetting(%this, %varName, %value)

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

@@ -90,7 +90,7 @@ function GuiInspectorVariableGroup::buildListField(%this, %fieldName, %fieldLabe
       if(%fieldName $= "")
       if(%fieldName $= "")
          %editControl.setText(%fieldName);
          %editControl.setText(%fieldName);
    }
    }
-   else
+   else if(isObject(%ownerObj))
    {
    {
       //regular variable
       //regular variable
       %setCommand = %editControl @ ".setText(" @ %ownerObj @ "." @ %fieldName @ ");";
       %setCommand = %editControl @ ".setText(" @ %ownerObj @ "." @ %fieldName @ ");";

+ 37 - 0
Templates/BaseGame/game/tools/assetBrowser/scripts/templateFiles/module.cs.template

@@ -0,0 +1,37 @@
+function @@::onCreate(%this)
+{
+}
+
+function @@::onDestroy(%this)
+{
+}
+
+//This is called when the server is initially set up by the game application
+function @@::initServer(%this)
+{
+}
+
+//This is called when the server is created for an actual game/map to be played
+function @@::onCreateServer(%this)
+{
+}
+
+//This is called when the server is shut down due to the game/map being exited
+function @@::onDestroyServer(%this)
+{
+}
+
+//This is called when the client is initially set up by the game application
+function @@::initClient(%this)
+{
+}
+
+//This is called when a client connects to a server
+function @@::onCreateClient(%this)
+{
+}
+
+//This is called when a client disconnects from a server
+function @@::onDestroyClient(%this)
+{
+}

+ 7 - 7
Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorTreeView.ed.cs

@@ -107,15 +107,15 @@ function GuiEditorTreeView::onRightMouseDown( %this, %item, %pts, %obj )
          object = %obj;
          object = %obj;
       };
       };
       
       
-      %popup.item[ 0 ] = "Rename" TAB "" TAB "GuiEditorTreeView.showItemRenameCtrl( GuiEditorTreeView.findItemByObjectId(" @ %popup.object @ ") );";
-      %popup.item[ 1 ] = "Delete" TAB "" TAB "GuiEditor.deleteControl(" @ %popup.object @ ");";
+      %popup.item[ 0 ] = "Rename" TAB "" TAB "GuiEditorTreeView.showItemRenameCtrl( GuiEditorTreeView.findItemByObjectId(" @ %obj @ ") );";
+      %popup.item[ 1 ] = "Delete" TAB "" TAB "GuiEditor.deleteControl(" @ %obj @ ");";
       %popup.item[ 2 ] = "-";
       %popup.item[ 2 ] = "-";
-      %popup.item[ 3 ] = "Locked" TAB "" TAB "%this.object.setLocked( !" @ %popup.object @ ".locked); GuiEditorTreeView.update();";
-      %popup.item[ 4 ] = "Hidden" TAB "" TAB "%this.object.setVisible( !" @ %popup.object @ ".isVisible() ); GuiEditorTreeView.update();";
+      %popup.item[ 3 ] = "Locked" TAB "" TAB %obj @ ".setLocked( !" @ %obj @ ".locked); GuiEditorTreeView.update();";
+      %popup.item[ 4 ] = "Hidden" TAB "" TAB %obj @ ".setVisible( !" @ %obj @ ".isVisible() ); GuiEditorTreeView.update();";
       %popup.item[ 5 ] = "-";
       %popup.item[ 5 ] = "-";
-      %popup.item[ 6 ] = "Add New Controls Here" TAB "" TAB "GuiEditor.setCurrentAddSet( " @ %popup.object @ ");";
-      %popup.item[ 7 ] = "Add Child Controls to Selection" TAB "" TAB "GuiEditor.selectAllControlsInSet( " @ %popup.object @ ", false );";
-      %popup.item[ 8 ] = "Remove Child Controls from Selection" TAB "" TAB "GuiEditor.selectAllControlsInSet( " @ %popup.object @ ", true );";
+      %popup.item[ 6 ] = "Add New Controls Here" TAB "" TAB "GuiEditor.setCurrentAddSet( " @ %obj @ ");";
+      %popup.item[ 7 ] = "Add Child Controls to Selection" TAB "" TAB "GuiEditor.selectAllControlsInSet( " @ %obj @ ", false );";
+      %popup.item[ 8 ] = "Remove Child Controls from Selection" TAB "" TAB "GuiEditor.selectAllControlsInSet( " @ %obj @ ", true );";
       
       
       %popup.checkItem( 3, %obj.locked );
       %popup.checkItem( 3, %obj.locked );
       %popup.checkItem( 4, !%obj.isVisible() );
       %popup.checkItem( 4, !%obj.isVisible() );

+ 81 - 81
Templates/BaseGame/game/tools/settings.xml

@@ -1,142 +1,145 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <EditorSettings>
 <EditorSettings>
     <Group name="WorldEditor">
     <Group name="WorldEditor">
+        <Setting name="displayType">6</Setting>
         <Setting name="orthoFOV">50</Setting>
         <Setting name="orthoFOV">50</Setting>
-        <Setting name="currentEditor">WorldEditorInspectorPlugin</Setting>
         <Setting name="torsionPath">AssetWork_Debug.exe</Setting>
         <Setting name="torsionPath">AssetWork_Debug.exe</Setting>
-        <Setting name="displayType">6</Setting>
         <Setting name="dropType">screenCenter</Setting>
         <Setting name="dropType">screenCenter</Setting>
-        <Setting name="undoLimit">40</Setting>
         <Setting name="forceLoadDAE">0</Setting>
         <Setting name="forceLoadDAE">0</Setting>
+        <Setting name="currentEditor">WorldEditorInspectorPlugin</Setting>
         <Setting name="orthoShowGrid">1</Setting>
         <Setting name="orthoShowGrid">1</Setting>
-        <Group name="Docs">
-            <Setting name="documentationLocal">../../../Documentation/Official Documentation.html</Setting>
-            <Setting name="documentationURL">http://www.garagegames.com/products/torque-3d/documentation/user</Setting>
-            <Setting name="forumURL">http://www.garagegames.com/products/torque-3d/forums</Setting>
-            <Setting name="documentationReference">../../../Documentation/Torque 3D - Script Manual.chm</Setting>
-        </Group>
-        <Group name="Theme">
-            <Setting name="windowTitleBGNAColor">180 180 180 255</Setting>
-            <Setting name="windowTitleFontHLColor">255 255 255 255</Setting>
-            <Setting name="windowTitleBGHLColor">48 48 48 255</Setting>
-            <Setting name="windowTitleFontColor">215 215 215 255</Setting>
-            <Setting name="windowTitleBGColor">50 50 50 255</Setting>
+        <Setting name="undoLimit">40</Setting>
+        <Group name="Render">
+            <Setting name="showMousePopupInfo">1</Setting>
+            <Setting name="renderObjText">1</Setting>
+            <Setting name="renderPopupBackground">1</Setting>
+            <Setting name="renderSelectionBox">1</Setting>
+            <Setting name="renderObjHandle">1</Setting>
         </Group>
         </Group>
-        <Group name="ObjectIcons">
-            <Setting name="fadeIconsEndAlpha">0</Setting>
-            <Setting name="fadeIconsStartAlpha">255</Setting>
-            <Setting name="fadeIconsEndDist">20</Setting>
-            <Setting name="fadeIconsStartDist">8</Setting>
-            <Setting name="fadeIcons">1</Setting>
+        <Group name="Grid">
+            <Setting name="gridSize">1</Setting>
+            <Setting name="gridOriginColor">255 255 255 100</Setting>
+            <Setting name="gridSnap">0</Setting>
+            <Setting name="gridMinorColor">51 51 51 100</Setting>
+            <Setting name="gridColor">102 102 102 100</Setting>
         </Group>
         </Group>
         <Group name="Color">
         <Group name="Color">
+            <Setting name="selectionBoxColor">255 255 0 255</Setting>
+            <Setting name="objMouseOverColor">0 255 0 255</Setting>
             <Setting name="objMouseOverSelectColor">0 0 255 255</Setting>
             <Setting name="objMouseOverSelectColor">0 0 255 255</Setting>
+            <Setting name="dragRectColor">255 255 0 255</Setting>
             <Setting name="objectTextColor">255 255 255 255</Setting>
             <Setting name="objectTextColor">255 255 255 255</Setting>
             <Setting name="popupBackgroundColor">100 100 100 255</Setting>
             <Setting name="popupBackgroundColor">100 100 100 255</Setting>
             <Setting name="objSelectColor">255 0 0 255</Setting>
             <Setting name="objSelectColor">255 0 0 255</Setting>
-            <Setting name="selectionBoxColor">255 255 0 255</Setting>
-            <Setting name="objMouseOverColor">0 255 0 255</Setting>
-            <Setting name="dragRectColor">255 255 0 255</Setting>
         </Group>
         </Group>
         <Group name="Tools">
         <Group name="Tools">
-            <Setting name="snapSoftSize">2</Setting>
-            <Setting name="snapGround">0</Setting>
             <Setting name="objectsUseBoxCenter">1</Setting>
             <Setting name="objectsUseBoxCenter">1</Setting>
-            <Setting name="snapSoft">0</Setting>
+            <Setting name="snapGround">0</Setting>
             <Setting name="dropAtScreenCenterMax">100</Setting>
             <Setting name="dropAtScreenCenterMax">100</Setting>
             <Setting name="dropAtScreenCenterScalar">1</Setting>
             <Setting name="dropAtScreenCenterScalar">1</Setting>
+            <Setting name="snapSoft">0</Setting>
+            <Setting name="snapSoftSize">2</Setting>
             <Setting name="boundingBoxCollision">0</Setting>
             <Setting name="boundingBoxCollision">0</Setting>
         </Group>
         </Group>
-        <Group name="Render">
-            <Setting name="renderObjText">1</Setting>
-            <Setting name="showMousePopupInfo">1</Setting>
-            <Setting name="renderObjHandle">1</Setting>
-            <Setting name="renderSelectionBox">1</Setting>
-            <Setting name="renderPopupBackground">1</Setting>
+        <Group name="ObjectIcons">
+            <Setting name="fadeIcons">1</Setting>
+            <Setting name="fadeIconsEndAlpha">0</Setting>
+            <Setting name="fadeIconsStartAlpha">255</Setting>
+            <Setting name="fadeIconsEndDist">20</Setting>
+            <Setting name="fadeIconsStartDist">8</Setting>
         </Group>
         </Group>
-        <Group name="Grid">
-            <Setting name="gridOriginColor">255 255 255 100</Setting>
-            <Setting name="gridSnap">0</Setting>
-            <Setting name="gridMinorColor">51 51 51 100</Setting>
-            <Setting name="gridColor">102 102 102 100</Setting>
-            <Setting name="gridSize">1</Setting>
+        <Group name="Theme">
+            <Setting name="windowTitleFontColor">215 215 215 255</Setting>
+            <Setting name="windowTitleBGNAColor">180 180 180 255</Setting>
+            <Setting name="windowTitleFontHLColor">255 255 255 255</Setting>
+            <Setting name="windowTitleBGColor">50 50 50 255</Setting>
+            <Setting name="windowTitleBGHLColor">48 48 48 255</Setting>
         </Group>
         </Group>
         <Group name="Images">
         <Group name="Images">
             <Setting name="lockedHandle">tools/worldEditor/images/LockedHandle</Setting>
             <Setting name="lockedHandle">tools/worldEditor/images/LockedHandle</Setting>
             <Setting name="defaultHandle">tools/worldEditor/images/DefaultHandle</Setting>
             <Setting name="defaultHandle">tools/worldEditor/images/DefaultHandle</Setting>
             <Setting name="selectHandle">tools/worldEditor/images/SelectHandle</Setting>
             <Setting name="selectHandle">tools/worldEditor/images/SelectHandle</Setting>
         </Group>
         </Group>
+        <Group name="Docs">
+            <Setting name="documentationLocal">../../../Documentation/Official Documentation.html</Setting>
+            <Setting name="documentationURL">http://www.garagegames.com/products/torque-3d/documentation/user</Setting>
+            <Setting name="forumURL">http://www.garagegames.com/products/torque-3d/forums</Setting>
+            <Setting name="documentationReference">../../../Documentation/Torque 3D - Script Manual.chm</Setting>
+        </Group>
+    </Group>
+    <Group name="AxisGizmo">
+        <Setting name="axisGizmoMaxScreenLen">100</Setting>
+        <Setting name="snapRotations">0</Setting>
+        <Setting name="rotationSnap">15</Setting>
+        <Setting name="mouseRotateScalar">0.8</Setting>
+        <Setting name="mouseScaleScalar">0.8</Setting>
+        <Setting name="renderInfoText">1</Setting>
+        <Setting name="renderWhenUsed">0</Setting>
+        <Group name="Grid">
+            <Setting name="planeDim">500</Setting>
+            <Setting name="renderPlane">0</Setting>
+            <Setting name="renderPlaneHashes">0</Setting>
+            <Setting name="snapToGrid">0</Setting>
+            <Setting name="gridColor">255 255 255 20</Setting>
+            <Setting name="gridSize">10 10 10</Setting>
+        </Group>
     </Group>
     </Group>
     <Group name="Theme">
     <Group name="Theme">
-        <Setting name="fieldTextColor">178 175 172 255</Setting>
-        <Setting name="fieldTextSELColor">240 240 240 255</Setting>
+        <Setting name="dividerLightColor">96 94 92 255</Setting>
         <Setting name="windowBackgroundColor">32 31 30 255</Setting>
         <Setting name="windowBackgroundColor">32 31 30 255</Setting>
         <Setting name="tooltipTextColor">255 255 255 255</Setting>
         <Setting name="tooltipTextColor">255 255 255 255</Setting>
-        <Setting name="tabsSELColor">59 58 57 255</Setting>
-        <Setting name="headerColor">50 49 48 255</Setting>
-        <Setting name="tabsHLColor">50 49 48 255</Setting>
-        <Setting name="tooltipBGColor">43 43 43 255</Setting>
+        <Setting name="fieldTextColor">178 175 172 255</Setting>
         <Setting name="dividerDarkColor">17 16 15 255</Setting>
         <Setting name="dividerDarkColor">17 16 15 255</Setting>
-        <Setting name="tooltipDividerColor">72 70 68 255</Setting>
+        <Setting name="headerTextColor">236 234 232 255</Setting>
+        <Setting name="tabsSELColor">59 58 57 255</Setting>
+        <Setting name="fieldBGSELColor">100 98 96 255</Setting>
         <Setting name="fieldBGHLColor">72 70 68 255</Setting>
         <Setting name="fieldBGHLColor">72 70 68 255</Setting>
-        <Setting name="dividerMidColor">50 49 48 255</Setting>
+        <Setting name="tooltipDividerColor">72 70 68 255</Setting>
+        <Setting name="fieldTextSELColor">240 240 240 255</Setting>
+        <Setting name="fieldBGColor">59 58 57 255</Setting>
         <Setting name="fieldTextHLColor">234 232 230 255</Setting>
         <Setting name="fieldTextHLColor">234 232 230 255</Setting>
-        <Setting name="fieldBGSELColor">100 98 96 255</Setting>
-        <Setting name="headerTextColor">236 234 232 255</Setting>
-        <Setting name="dividerLightColor">96 94 92 255</Setting>
+        <Setting name="dividerMidColor">50 49 48 255</Setting>
         <Setting name="tabsColor">37 36 35 255</Setting>
         <Setting name="tabsColor">37 36 35 255</Setting>
-        <Setting name="fieldBGColor">59 58 57 255</Setting>
+        <Setting name="tabsHLColor">50 49 48 255</Setting>
+        <Setting name="headerColor">50 49 48 255</Setting>
+        <Setting name="tooltipBGColor">43 43 43 255</Setting>
     </Group>
     </Group>
     <Group name="GuiEditor">
     <Group name="GuiEditor">
-        <Setting name="lastPath">tools/gui</Setting>
         <Setting name="previewResolution">1024 768</Setting>
         <Setting name="previewResolution">1024 768</Setting>
+        <Setting name="lastPath">tools/gui</Setting>
         <Group name="EngineDevelopment">
         <Group name="EngineDevelopment">
+            <Setting name="showEditorGuis">0</Setting>
             <Setting name="showEditorProfiles">0</Setting>
             <Setting name="showEditorProfiles">0</Setting>
             <Setting name="toggleIntoEditor">0</Setting>
             <Setting name="toggleIntoEditor">0</Setting>
-            <Setting name="showEditorGuis">0</Setting>
         </Group>
         </Group>
         <Group name="Snapping">
         <Group name="Snapping">
-            <Setting name="snap2Grid">0</Setting>
             <Setting name="snapToControls">1</Setting>
             <Setting name="snapToControls">1</Setting>
             <Setting name="snap2GridSize">8</Setting>
             <Setting name="snap2GridSize">8</Setting>
             <Setting name="snapToCenters">1</Setting>
             <Setting name="snapToCenters">1</Setting>
+            <Setting name="snap2Grid">0</Setting>
             <Setting name="snapToCanvas">1</Setting>
             <Setting name="snapToCanvas">1</Setting>
             <Setting name="snapToGuides">1</Setting>
             <Setting name="snapToGuides">1</Setting>
             <Setting name="sensitivity">2</Setting>
             <Setting name="sensitivity">2</Setting>
             <Setting name="snapToEdges">1</Setting>
             <Setting name="snapToEdges">1</Setting>
         </Group>
         </Group>
+        <Group name="Rendering">
+            <Setting name="drawBorderLines">1</Setting>
+            <Setting name="drawGuides">1</Setting>
+        </Group>
         <Group name="Help">
         <Group name="Help">
-            <Setting name="documentationURL">http://www.garagegames.com/products/torque-3d/documentation/user</Setting>
             <Setting name="documentationReference">../../../Documentation/Torque 3D - Script Manual.chm</Setting>
             <Setting name="documentationReference">../../../Documentation/Torque 3D - Script Manual.chm</Setting>
             <Setting name="documentationLocal">../../../Documentation/Official Documentation.html</Setting>
             <Setting name="documentationLocal">../../../Documentation/Official Documentation.html</Setting>
+            <Setting name="documentationURL">http://www.garagegames.com/products/torque-3d/documentation/user</Setting>
         </Group>
         </Group>
         <Group name="Selection">
         <Group name="Selection">
             <Setting name="fullBox">0</Setting>
             <Setting name="fullBox">0</Setting>
         </Group>
         </Group>
-        <Group name="Rendering">
-            <Setting name="drawBorderLines">1</Setting>
-            <Setting name="drawGuides">1</Setting>
-        </Group>
         <Group name="Library">
         <Group name="Library">
             <Setting name="viewType">Categorized</Setting>
             <Setting name="viewType">Categorized</Setting>
         </Group>
         </Group>
     </Group>
     </Group>
-    <Group name="AxisGizmo">
-        <Setting name="snapRotations">0</Setting>
-        <Setting name="mouseRotateScalar">0.8</Setting>
-        <Setting name="renderInfoText">1</Setting>
-        <Setting name="axisGizmoMaxScreenLen">100</Setting>
-        <Setting name="rotationSnap">15</Setting>
-        <Setting name="mouseScaleScalar">0.8</Setting>
-        <Setting name="renderWhenUsed">0</Setting>
-        <Group name="Grid">
-            <Setting name="gridSize">10 10 10</Setting>
-            <Setting name="snapToGrid">0</Setting>
-            <Setting name="gridColor">255 255 255 20</Setting>
-            <Setting name="planeDim">500</Setting>
-            <Setting name="renderPlaneHashes">0</Setting>
-            <Setting name="renderPlane">0</Setting>
-        </Group>
+    <Group name="ConvexEditor">
+        <Setting name="materialName">Grid_512_Orange</Setting>
     </Group>
     </Group>
     <Group name="NavEditor">
     <Group name="NavEditor">
         <Setting name="SpawnClass">AIPlayer</Setting>
         <Setting name="SpawnClass">AIPlayer</Setting>
@@ -144,15 +147,12 @@
     <Group name="LevelInformation">
     <Group name="LevelInformation">
         <Setting name="levelsDirectory">data/FPSGameplay/levels</Setting>
         <Setting name="levelsDirectory">data/FPSGameplay/levels</Setting>
         <Group name="levels">
         <Group name="levels">
-            <Group name="PbrMatTest.mis">
-                <Setting name="cameraSpeed">5</Setting>
-            </Group>
             <Group name="BlankRoom.mis">
             <Group name="BlankRoom.mis">
                 <Setting name="cameraSpeed">25</Setting>
                 <Setting name="cameraSpeed">25</Setting>
             </Group>
             </Group>
+            <Group name="PbrMatTest.mis">
+                <Setting name="cameraSpeed">5</Setting>
+            </Group>
         </Group>
         </Group>
     </Group>
     </Group>
-    <Group name="ConvexEditor">
-        <Setting name="materialName">Grid_512_Orange</Setting>
-    </Group>
 </EditorSettings>
 </EditorSettings>