Daniele Bartolini 12 лет назад
Родитель
Сommit
1dd81477ff
2 измененных файлов с 48 добавлено и 12 удалено
  1. 40 4
      tools/pycrown/Compiler.py
  2. 8 8
      tools/pycrown/Repository.py

+ 40 - 4
tools/pycrown/Compiler.py

@@ -79,13 +79,47 @@ class Compiler:
 			resource_hashes.clear()
 			seed = seed + 1;
 
+	# Compiles all the texture resources in the repository
+	def compile_textures(self):
+		textures = self.m_repository.texture_resources();
+
+		for res in textures:
+			self.compile(res)
+
+	# Compiles all the mesh resources in the repository
+	def compile_meshes(self):
+		meshes = self.m_repository.mesh_resources();
+
+		for res in meshes:
+			self.compile(res)
+
+	# Compiles all the text resources in the repository
+	def compile_texts(self):
+		texts = self.m_repository.text_resources();
+
+		for res in texts:
+			self.compile(res)
+
+	# Compiles all the script resources in the repository
+	def compile_scripts(self):
+		scripts = self.m_repository.script_resources();
+
+		for res in scripts:
+			self.compile(res)
+
 	# Compiles all the resources in the repository
 	def compile_all(self):
-		# Obtain resources from repository
-		resources = self.m_repository.all_resources()
+		print("Compiling textures...")
+		self.compile_textures()
 
-		for res in resources:
-			self.compile(res)
+		print("Compiling meshes...")
+		self.compile_meshes()
+
+		print("Compiling texts...")
+		self.compile_texts()
+
+		print("Compiling scripts...")
+		self.compile_scripts()
 
 	# Compile a single resource from the repository
 	def compile(self, resource):
@@ -95,6 +129,8 @@ class Compiler:
 
 		root_path = self.m_repository.root_path()
 
+		print(resource + " => ???")
+
 		# Call appropriate compiler based on resource extension
 		if resource.endswith('.txt'):
 			p = subprocess.call([TXT_C, ROOT_P, root_path, DEST_P, self.m_dest_path, RES_IN, resource, SEED, str(self.m_perfect_seed)]);

+ 8 - 8
tools/pycrown/Repository.py

@@ -50,7 +50,7 @@ class Repository:
 	def texture_resources(self):
 		textures = []
 
-		for res in resources:
+		for res in self.m_resources:
 			if (res.endswith(TEXTURE_EXTENSION)):
 				textures.append(res)
 
@@ -60,7 +60,7 @@ class Repository:
 	def text_resources(self):
 		texts = []
 
-		for res in resources:
+		for res in self.m_resources:
 			if (res.endswith(TEXT_EXTENSION)):
 				texts.append(res)
 
@@ -70,21 +70,21 @@ class Repository:
 	def mesh_resources(self):
 		meshes = []
 
-		for res in resources:
+		for res in self.m_resources:
 			if (res.endswith(MESH_EXTENSION)):
 				meshes.append(res)
 
 		return meshes
 
 	# Returns a list of all the lua resources found
-	def lua_resources(self):
-		luas = []
+	def script_resources(self):
+		scripts = []
 
-		for res in resources:
+		for res in self.m_resources:
 			if (res.endswith(LUA_EXTENSION)):
-				luas.append(res)
+				scripts.append(res)
 
-		return luas
+		return scripts
 
 	# Scans the root path to find resources
 	def scan(self):