Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List index out of range when importing Renderware 3 DFF model #325

Open
hejsanbajs opened this issue Jul 13, 2024 · 2 comments
Open

List index out of range when importing Renderware 3 DFF model #325

hejsanbajs opened this issue Jul 13, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@hejsanbajs
Copy link

Python: Traceback (most recent call last):
File "C:\Users\wrenq\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\DragonFF-master\gui\dff_ot.py", line 286, in execute
importer = dff_importer.import_dff(
File "C:\Users\wrenq\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\DragonFF-master\ops\dff_importer.py", line 839, in import_dff
dff_importer.import_dff(options['file_name'])
File "C:\Users\wrenq\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\DragonFF-master\ops\dff_importer.py", line 810, in import_dff
self.import_atomics()
File "C:\Users\wrenq\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\DragonFF-master\ops\dff_importer.py", line 116, in import_atomics
geom = self.dff.geometry_list[atomic.geometry]
IndexError: list index out of range

DLL file

@Psycrow101
Copy link
Collaborator

After the latest update this model can be imported without errors, but it will not have any rigging. I suspect the necessary data is stored in the "Bone PLG" section, but I don't know how to parse it

image

@Psycrow101
Copy link
Collaborator

Psycrow101 commented Sep 16, 2024

I did some research on the "Bone PLG" section.
The "Bone PLG" section contains a set of vertex groups data:

uint start_vertex
uint num_vertices
uint bone_id

For parsing:

GeomBone = namedtuple("GeomBone", "start_vertex num_vertices bone_id") # "<3I"

def read_bone_plg(self, parent_chunk, geometry):
    chunk_end = self.pos + parent_chunk.size

    geom_bones = []
    while self.pos < chunk_end:
        bone = Sections.read(GeomBone, self.data, self._read(12))
        if bone.num_vertices > 0:
            geom_bones.append(bone)

    geometry.extensions['bones'] = geom_bones

Frame's bone_id is stored in the "Animation PLG" section.

image

What needs to be added to the DFF importer:

  • construct armature if "Animation PLG" is found
  • set vertex groups if "Bone PLG" is found (no weights)
  • optionally import animation from "Animation PLG"

@Psycrow101 Psycrow101 added the enhancement New feature or request label Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants