Grimrukh / soulstruct-blender

Blender plugins for FromSoft games, via `soulstruct`.
97 stars 4 forks source link

[2.1.2] UV Array length mismatch #68

Closed EclipsedButter closed 1 month ago

EclipsedButter commented 1 month ago

When attempting to import Elden Ring c2110 (Maliketh), got the following error:

# INFO: Merged FLVER submeshes in 0.6366596659645438 s
# INFO: Merging reduced 176676 vertices to 149167 (15.57% reduction)
# INFO: Removed 136 invalid/degenerate mesh faces from c2110.
Error: Array length mismatch (got 1303200, expected more)
Traceback (most recent call last):
  File "io_soulstruct/flver/models/import_operators.py", line 107, in execute
    bl_flver = BlenderFLVER.new_from_soulstruct_obj(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "io_soulstruct/flver/models/types.py", line 841, in new_from_soulstruct_obj
    bl_vert_bone_weights, bl_vert_bone_indices = cls.create_bl_mesh(operator, mesh_data, merged_mesh)
                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "io_soulstruct/flver/models/types.py", line 1208, in create_bl_mesh
    uv_layer.data.foreach_set("uv", loop_uv_data)
RuntimeError: internal error setting the array
# ERROR: Cannot import FLVER: c2110. Error: internal error setting the array

happens with a number of other chrs, and those that the error does not occur for, are instead very messed up; see c2100. Does not happen with DS1 PTDE, but seems to have a similar 'mutilation' effect on the FLVER skeletons of DS3 chrs. This behavior was not present prior to 2.1.1, and still persists in 2.1.2. Can this error be replicated on your end?

EclipsedButter commented 1 month ago

looked into things a bit, and using the non-deprecated uv.vector attributes instead of data.uv got a slightly more specific error: Error: Array length mismatch (expected 1304016, got 1303200) whether that small amount of extra floats is extra data that didn't get merged or the entire dataset is already wrong (which is what I'm leaning towards, given c2100) is something I'm still investigating...

Grimrukh commented 1 month ago

This should be fixed in v2.1.3!

The number of face loops being generated in Blender was accidentally being set BEFORE degenerate faces were being removed.

EclipsedButter commented 1 month ago

Tried things with 2.1.3, and while the error no longer happens, submeshes are still coming out very wrong. I suspect that the behavior I described may be a result of two separate errors, as the array length error never occurred in 2.1.2 for c2100; in fact, it wouldn't happen if 'Merge Submesh Vertices' was disabled. In that case, the submesh would come out with that same mutilation effect that I described, and this problem is still universally present and unchanged for ER chr flvers.

Grimrukh commented 1 month ago

Ahh gotcha, damn. Will figure it out today! The list of possible causes is pretty small thankfully.

Grimrukh commented 1 month ago

Should be fixed now in v2.1.4 - characters with certain cloth materials were being wrongly identified as Map Pieces and were being auto-posed by their bones :/