Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sawich committed Oct 22, 2023
1 parent 1e8d7bb commit de01d6b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
7 changes: 1 addition & 6 deletions io_soulworker/chunks/readers/wght_reader.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from logging import debug

from io_soulworker.chunks.wght_chunk import WGHTChunk
from io_soulworker.core.binary_reader import BinaryReader
Expand All @@ -8,11 +7,7 @@ class WGHTChunkReader:

def all_of(self, vertices_count: int) -> list[WGHTChunk]:

def re(i: int):
debug('read: %d', i)
return WGHTChunk(self.__reader__)

return [re(i) for i in range(vertices_count)]
return [WGHTChunk(self.__reader__) for _ in range(vertices_count)]

def __init__(self, reader: BinaryReader):

Expand Down
14 changes: 8 additions & 6 deletions io_soulworker/out/model_file_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ def __xml_material(reader: BinaryReader) -> dict[str, VisMaterial]:
@staticmethod
def __material_from_file(path: Path) -> dict[str, VisMaterial]:

def __float(name: str, node: Element): return float(node.attrib[name])
# def __int(name: str, node: Element): return int(node.attrib[name])
def __float(name: str, node: Element):
return float(node.attrib[name])

def __color(name: str, node: Element): return [
int(v) for v in node.attrib[name].split(',')]
def __color(name: str, node: Element):
return [int(v) for v in node.attrib[name].split(',')]

def create(node: Element) -> tuple[str, VisMaterial]:
material = VisMaterial()
Expand Down Expand Up @@ -138,8 +138,10 @@ def create(node: Element) -> tuple[str, VisMaterial]:
@staticmethod
def __materials_paths(path: Path):

file = Path(path.name + "_data", "materials.xml")

# NPC_0001_Mirium.model -> NPC_0001_Mirium.model_data\\materials.xml
yield path.parent / (path.name + "_data/materials.xml")
yield path.parent / file

# NPC_0001_Mirium.model -> Overrides\\NPC_0001_Mirium.model_data\\materials.xml
yield path.parent / "Overrides" / (path.name + "_data/materials.xml")
yield path.parent / "Overrides" / file
4 changes: 2 additions & 2 deletions io_soulworker/out/model_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def create_blender_nodes(material: Material):
texture_node: ShaderNodeTexImage = nodes.new("ShaderNodeTexImage")
debug("texture path: %s", path)

texture_node.image = bpy.data.images.load(path.__str__())
texture_node.image = bpy.data.images.load(str(path))
debug("texture loaded: %s", path)

input = pbsdf_node.inputs["Base Color"]
Expand Down Expand Up @@ -179,7 +179,7 @@ def on_skeleton(self, chunk: SkelChunk):
editbone = armature.edit_bones[bone.parent_id]
new.parent = editbone

bpy.ops.object.mode_set(mode="OBJECT")
bpy.ops.object.mode_set(mode="OBJECT")

self.context.view_layer.update()

Expand Down

0 comments on commit de01d6b

Please sign in to comment.