From 15f9970044711a3a1d511bfe3f1ebdae5ca437db Mon Sep 17 00:00:00 2001 From: HenryOfCarim Date: Sun, 24 Nov 2024 15:52:22 +0200 Subject: [PATCH] Fix for export - ignore meshes with broken UV during tangents calculation - add null material hash for mrl features --- albam/engines/mtfw/material.py | 1 + albam/lib/blender.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/albam/engines/mtfw/material.py b/albam/engines/mtfw/material.py index 1b038de..5edafbe 100644 --- a/albam/engines/mtfw/material.py +++ b/albam/engines/mtfw/material.py @@ -74,6 +74,7 @@ MRL_MATERIAL_TYPE_STR_TO_ID = {ext_desc: h for h, ext_desc in MRL_MATERIAL_TYPE_STR.items()} MRL_PER_MATERIAL_FEATURES = { + 0x854D484: [], 0x5FB0EBE4: ["FVertexDisplacement"], 0x7D2B31B3: ["FVertexDisplacement"], 0x1CAB245E: ["CBDDMaterialParam", diff --git a/albam/lib/blender.py b/albam/lib/blender.py index 8eacead..f955f1a 100644 --- a/albam/lib/blender.py +++ b/albam/lib/blender.py @@ -246,7 +246,11 @@ def get_tangents_per_vertex(blender_mesh): uv_name = blender_mesh.uv_layers[0].name except IndexError: return tangents - blender_mesh.calc_tangents(uvmap=uv_name) + try: + blender_mesh.calc_tangents(uvmap=uv_name) + except RuntimeError: + print("Mesh {} has no UV".format(blender_mesh.name)) + return tangents for loop in blender_mesh.loops: tangents.setdefault(loop.vertex_index, loop.tangent) return tangents