Browse Source

Refine coding

* Adjust a few things per Hoikas' suggestion
pull/374/head
Patrick Dulebohn 10 months 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
def export_cubic_env(self, bo, layer, texture):
if texture.image == None:
raise ExportError("CubeMap '{}' has no cube image!".format(texture.name))
else:
width, height = texture.image.size
# Sanity check: the image here should be 3x2 faces, so we should not have any
# dam remainder...
if width % 3 != 0:
raise ExportError("CubeMap '{}' width must be a multiple of 3".format(texture.image.name))
if height % 2 != 0:
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...
layer.UVWSrc = plLayerInterface.kUVWReflect
layer.state.miscFlags |= hsGMatState.kMiscUseReflectionXform
# Well, this is kind of sad...
# 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
# prevent that as well, so we could theoretically slice-and-dice the single
# image here... but... meh. Offloading taim.
self.export_prepared_image(texture=texture, owner=layer, indent=3,
alpha_type=TextureAlpha.opaque, mipmap=True,
allowed_formats={"DDS"}, is_cube_map=True, tag="cubemap")
if texture.image is None:
raise ExportError(f"CubeMap '{texture.name}' has no cube image!")
width, height = texture.image.size
# Sanity check: the image here should be 3x2 faces, so we should not have any
# dam remainder...
if width % 3 != 0:
raise ExportError("CubeMap '{}' width must be a multiple of 3".format(texture.image.name))
if height % 2 != 0:
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...
layer.UVWSrc = plLayerInterface.kUVWReflect
layer.state.miscFlags |= hsGMatState.kMiscUseReflectionXform
# Well, this is kind of sad...
# 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
# prevent that as well, so we could theoretically slice-and-dice the single
# image here... but... meh. Offloading taim.
self.export_prepared_image(texture=texture, owner=layer, indent=3,
alpha_type=TextureAlpha.opaque, mipmap=True,
allowed_formats={"DDS"}, is_cube_map=True, tag="cubemap")
def export_dynamic_env(self, bo, layer, texture, pl_class):

Loading…
Cancel
Save