Browse Source

Art Pack Template and Bug Fixes

Added an Art Pack Template and fixed a few problems with the editing modules.
Peter Robinson 3 năm trước cách đây
mục cha
commit
4125601332

+ 1 - 1
editor/ProjectManager/scripts/EditModuleDialog.cs

@@ -48,7 +48,7 @@ function EditModuleDialog::init(%this, %width, %height)
 		VertSizing = "bottom";
 		Position = "12 320";
 		Extent = (%width - 24) SPC 80;
-		text = "Saving changes to a module will require the module to be unloaded. Changes will not apply until after a restart. Also, changing the name or version of a module may break dependencies. You will need to find and fix these.";
+		text = "Saving changes to a module will require the module to be unloaded and will likely require the game to be restarted. Also, changing the name or version of a module may break dependencies. You will need to find and fix these.";
 		textWrap = true;
 		textExtend = true;
 	};

+ 12 - 0
editor/ProjectManager/scripts/ProjectGamePanel.cs

@@ -169,6 +169,17 @@ function ProjectGamePanel::onModuleEdited(%this, %data)
 		%moduleID = %this.card.activeModule.moduleID;
 		%projectPath = ProjectManager.getProjectFolder();
 		%modulePath = pathConcat(%projectPath, %module.moduleID);
+		if(ModuleDatabase.isModuleLoaded(%module.moduleID))
+		{
+			if(%module.group !$= "")
+			{
+				ModuleDatabase.unloadGroup(%module.group);
+			}
+			else
+			{
+				ModuleDatabase.unloadExplicit(%module.moduleID);
+			}
+		}
 		ModuleDatabase.unregisterModule(%module.moduleID, %module.versionID);
 		%newModulePath = pathConcat(%projectPath, %data.moduleID);
 		if(%moduleID !$= %data.moduleID && !isDirectory(%newModulePath))
@@ -179,6 +190,7 @@ function ProjectGamePanel::onModuleEdited(%this, %data)
 				%modulePath = %newModulePath;
 			}
 		}
+		echo("Editing Module at " @ %modulePath);
 		%file = TamlRead(pathConcat(%modulePath, "module.taml"));
 		%file.moduleID = %data.moduleID;
 		%file.versionID = %data.versionID;

+ 7 - 2
engine/source/module/moduleManager.cc

@@ -1795,6 +1795,12 @@ bool ModuleManager::removeModuleDefinition( ModuleDefinition* pModuleDefinition
         // Delete module definition.
         pModuleDefinition->deleteObject();
 
+        // Is that the last one?
+        if (pDefinitions->size() <= 1)
+        {
+            mModuleIdDatabase.erase(moduleId);
+        }
+
         // Are there any modules left for this module Id?
         if ( findModuleId( moduleId ) == NULL )
         {
@@ -1827,7 +1833,6 @@ bool ModuleManager::removeModuleDefinition( ModuleDefinition* pModuleDefinition
                     break;
             }
         }
-
         return true;
     }
 
@@ -1986,7 +1991,7 @@ bool ModuleManager::registerModule( const char* pModulePath, const char* pModule
         {
             // No, so warn.
             Con::warnf( "Module Manager: Found module: '%s' but its module type '%s' is not the same as other module definitions of the same module Id.",
-                pModuleDefinition->getModuleFilePath(), moduleGroup );
+                pModuleDefinition->getModuleFilePath(), moduleType );
 
             // Destroy module definition and finish.
             pModuleDefinition->deleteObject();

+ 24 - 0
library/ArtPack/module.taml

@@ -0,0 +1,24 @@
+<ModuleDefinition
+	ModuleId="ArtPack"
+	VersionId="1"
+	BuildID="1"
+	Type="Template"
+	Description="A module to pack your art. How refined."
+	Author="Torque2D">
+		<DeclaredAssets
+			Path=""
+			Extension="image.taml"
+			Recurse="true"/>
+		<DeclaredAssets
+			Path=""
+			Extension="animation.taml"
+			Recurse="true"/>
+		<DeclaredAssets
+			Path=""
+			Extension="font.taml"
+			Recurse="true"/>
+		<DeclaredAssets
+			Path=""
+			Extension="particle.taml"
+			Recurse="true"/>
+</ModuleDefinition>