Browse Source

Refine coding

* Adjust a few things per Hoikas' suggestion
pull/374/head
Patrick Dulebohn 2 years ago
parent
commit
31064dcd62
  1. 47
      korman/exporter/material.py

47
korman/exporter/material.py

@ -701,30 +701,29 @@ class MaterialConverter:
layer.texture = pl_env.key layer.texture = pl_env.key
def export_cubic_env(self, bo, layer, texture): def export_cubic_env(self, bo, layer, texture):
if texture.image == None: if texture.image is None:
raise ExportError("CubeMap '{}' has no cube image!".format(texture.name)) raise ExportError(f"CubeMap '{texture.name}' has no cube image!")
else: width, height = texture.image.size
width, height = texture.image.size
# Sanity check: the image here should be 3x2 faces, so we should not have any
# Sanity check: the image here should be 3x2 faces, so we should not have any # dam remainder...
# dam remainder... if width % 3 != 0:
if width % 3 != 0: raise ExportError("CubeMap '{}' width must be a multiple of 3".format(texture.image.name))
raise ExportError("CubeMap '{}' width must be a multiple of 3".format(texture.image.name)) if height % 2 != 0:
if height % 2 != 0: raise ExportError("CubeMap '{}' height must be a multiple of 2".format(texture.image.name))
raise ExportError("CubeMap '{}' height must be a multiple of 2".format(texture.image.name))
# According to PlasmaMAX, we don't give a rip about UVs...
# According to PlasmaMAX, we don't give a rip about UVs... layer.UVWSrc = plLayerInterface.kUVWReflect
layer.UVWSrc = plLayerInterface.kUVWReflect layer.state.miscFlags |= hsGMatState.kMiscUseReflectionXform
layer.state.miscFlags |= hsGMatState.kMiscUseReflectionXform
# Well, this is kind of sad...
# Well, this is kind of sad... # Back before the texture cache existed, all the image work was offloaded
# Back before the texture cache existed, all the image work was offloaded # to a big "finalize" save step to prevent races. The texture cache would
# to a big "finalize" save step to prevent races. The texture cache would # prevent that as well, so we could theoretically slice-and-dice the single
# prevent that as well, so we could theoretically slice-and-dice the single # image here... but... meh. Offloading taim.
# image here... but... meh. Offloading taim. self.export_prepared_image(texture=texture, owner=layer, indent=3,
self.export_prepared_image(texture=texture, owner=layer, indent=3, alpha_type=TextureAlpha.opaque, mipmap=True,
alpha_type=TextureAlpha.opaque, mipmap=True, allowed_formats={"DDS"}, is_cube_map=True, tag="cubemap")
allowed_formats={"DDS"}, is_cube_map=True, tag="cubemap")
def export_dynamic_env(self, bo, layer, texture, pl_class): def export_dynamic_env(self, bo, layer, texture, pl_class):

Loading…
Cancel
Save