Browse Source

Merge pull request #381 from Hoikas/fix_376

Fix #376
pull/385/head
Adam Johnson 1 year ago committed by GitHub
parent
commit
b45c4860ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 29
      korman/exporter/manager.py

29
korman/exporter/manager.py

@ -151,17 +151,23 @@ class ExportManager:
# present and valid. They do not have to have any contents. See AvatarCustomization.
# BuiltIn.prp
want_pysdl = bpy.context.scene.world.plasma_age.age_sdl
builtin = self.create_page(age, "BuiltIn", -2, builtin=True)
if want_pysdl:
self._pack_agesdl_hook(age)
sdl = self.add_object(plSceneObject, name="AgeSDLHook", loc=builtin)
pfm = self.add_object(plPythonFileMod, name="VeryVerySpecialPythonFileMod", so=sdl)
pfm.filename = replace_python2_identifier(age)
if self.getVer() <= pvPots or want_pysdl:
builtin = self.create_page(age, "BuiltIn", -2, builtin=True)
if want_pysdl:
self._pack_agesdl_hook(age)
sdl = self.add_object(plSceneObject, name="AgeSDLHook", loc=builtin)
pfm = self.add_object(plPythonFileMod, name="VeryVerySpecialPythonFileMod", so=sdl)
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 +334,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

Loading…
Cancel
Save