From 705d14511444d8f4e9e57cdc63264089101f5097 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Wed, 6 Sep 2023 16:00:29 -0500 Subject: [PATCH] Only create a Textures PRP if it is requested. --- korman/exporter/manager.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/korman/exporter/manager.py b/korman/exporter/manager.py index 1001511..6e02eea 100644 --- a/korman/exporter/manager.py +++ b/korman/exporter/manager.py @@ -159,9 +159,14 @@ class ExportManager: pfm.filename = replace_python2_identifier(age) # Textures.prp - # FIXME: unconditional creation will overwrite any existing textures PRP. This should - # be addressed by a successful implementation of #145. - self.create_page(age, "Textures", -1, builtin=True) + # TODO: #145 load any already existing Textures PRP and resave it. + if bpy.context.scene.world.plasma_age.use_texture_page: + self.create_page(age, "Textures", -1, builtin=True) + elif self.getVer() <= pvPots: + self._exporter().report.warn( + "No textures page was created - be sure this Age has one " + "or the game may crash!" + ) def create_page(self, age, name, id, *, builtin=False, external=False): location = plLocation(self.mgr.getVer()) @@ -328,10 +333,9 @@ class ExportManager: def get_textures_page(self, key: plKey) -> plLocation: """Gets the appropriate page for a texture for a given plLayer""" # The point of this is to account for per-page textures... - if bpy.context.scene.world.plasma_age.use_texture_page: - return self._pages["Textures"] - else: + if not bpy.context.scene.world.plasma_age.use_texture_page: return key.location + return self._pages.get("Textures", key.location) def _pack_agesdl_hook(self, age): output = self._exporter().output