DragonFF icon indicating copy to clipboard operation
DragonFF copied to clipboard

Export error

Open SimplyCEO opened this issue 3 years ago • 11 comments

I got this error while exporting my model:

Python: Traceback (most recent call last):
  File "/home/kanux/.config/blender/3.1/scripts/addons/gta/gui.py", line 140, in execute
    dff_exporter.export_dff(
  File "/home/kanux/.config/blender/3.1/scripts/addons/gta/dff_exporter.py", line 836, in export_dff
    dff_exporter.export_dff(options['file_name'])
  File "/home/kanux/.config/blender/3.1/scripts/addons/gta/dff_exporter.py", line 824, in export_dff
    self.export_objects(objects)
  File "/home/kanux/.config/blender/3.1/scripts/addons/gta/dff_exporter.py", line 780, in export_objects
    self.dff.write_file(self.file_name, self.version )
  File "/home/kanux/.config/blender/3.1/scripts/addons/gta/dff.py", line 1954, in write_file
    content = self.write_memory(version)
  File "/home/kanux/.config/blender/3.1/scripts/addons/gta/dff.py", line 1946, in write_memory
    data += self.write_clump()
  File "/home/kanux/.config/blender/3.1/scripts/addons/gta/dff.py", line 1920, in write_clump
    data = Sections.write_chunk(Clump,
TypeError: Sections.write_chunk() takes 2 positional arguments but 3 were given

location: <unknown location>:-1

So I decided to test it with a original model, that also gave me the same error. I deleted the entire generic hierarchy just to be sure and gave the same error again.

OS: Arch Linux Python: 3.10.4 Blender: 3.1.2

SimplyCEO avatar May 09 '22 23:05 SimplyCEO

It doesn't seem to be the latest version. Get the latest master branch (or new_export branch) version and try again.

Parik27 avatar May 10 '22 01:05 Parik27

The version of DragonFF installed is v0.1.1 and all the packages in my system are up-to-date.

SimplyCEO avatar May 10 '22 01:05 SimplyCEO

TypeError: Sections.write_chunk() takes 2 positional arguments but 3 were given

One thing that I noticed is that indeed this function is receiving 1 more argument.

def write_chunk(data, type):

Seen in dff.py, line 206.

data = Sections.write_chunk(Clump, pack("<I", len(self.atomic_list)), types["Clump"])

Is the only call in the file that gives 3 arguments to write_chunk function.

SimplyCEO avatar May 10 '22 01:05 SimplyCEO

v0.1.1 is 3 years old. The releases aren't being updated since there's no need for them. I realise that the readme mentions the releases, but you should ideally use the master branch (it doesn't contain unstable code).

Direct link: https://github.com/Parik27/DragonFF/archive/refs/heads/master.zip https://github.com/Parik27/DragonFF/archive/refs/heads/new-export.zip (if you experience issues with normals/shading exports)

Parik27 avatar May 10 '22 01:05 Parik27

Both give the same error, even removing manually the camera and light.

SimplyCEO avatar May 10 '22 01:05 SimplyCEO

Can you share the full stack trace when using the version from either of the links and possibly the blend file you're using to export.

Parik27 avatar May 10 '22 01:05 Parik27

DragonFF-master:

Read prefs: /home/kanux/.config/blender/3.1/config/userpref.blend
Info: Deleted 1 object(s)

Python: Traceback (most recent call last):
  File "/home/kanux/.config/blender/3.1/scripts/addons/DragonFF-master/gui/dff_ot.py", line 122, in execute
    dff_exporter.export_dff(
  File "/home/kanux/.config/blender/3.1/scripts/addons/DragonFF-master/ops/dff_exporter.py", line 842, in export_dff
    dff_exporter.export_dff(options['file_name'])
  File "/home/kanux/.config/blender/3.1/scripts/addons/DragonFF-master/ops/dff_exporter.py", line 830, in export_dff
    self.export_objects(objects)
  File "/home/kanux/.config/blender/3.1/scripts/addons/DragonFF-master/ops/dff_exporter.py", line 786, in export_objects
    self.dff.write_file(self.file_name, self.version )
  File "/home/kanux/.config/blender/3.1/scripts/addons/DragonFF-master/gtaLib/dff.py", line 2075, in write_file
    content = self.write_memory(version)
  File "/home/kanux/.config/blender/3.1/scripts/addons/DragonFF-master/gtaLib/dff.py", line 2067, in write_memory
    data += self.write_clump()
  File "/home/kanux/.config/blender/3.1/scripts/addons/DragonFF-master/gtaLib/dff.py", line 2041, in write_clump
    data = Sections.write_chunk(Clump,
TypeError: Sections.write_chunk() takes 2 positional arguments but 3 were given

location: <unknown location>:-1

DragonFF-new-export:

Read prefs: /home/kanux/.config/blender/3.1/config/userpref.blend
Info: Deleted 1 object(s)

Python: Traceback (most recent call last):
  File "/home/kanux/.config/blender/3.1/scripts/addons/DragonFF-new-export/gui/dff_ot.py", line 122, in execute
    dff_exporter.export_dff(
  File "/home/kanux/.config/blender/3.1/scripts/addons/DragonFF-new-export/ops/dff_exporter.py", line 877, in export_dff
    dff_exporter.export_dff(options['file_name'])
  File "/home/kanux/.config/blender/3.1/scripts/addons/DragonFF-new-export/ops/dff_exporter.py", line 865, in export_dff
    self.export_objects(objects)
  File "/home/kanux/.config/blender/3.1/scripts/addons/DragonFF-new-export/ops/dff_exporter.py", line 819, in export_objects
    self.dff.write_file(self.file_name, self.version )
  File "/home/kanux/.config/blender/3.1/scripts/addons/DragonFF-new-export/gtaLib/dff.py", line 2128, in write_file
    content = self.write_memory(version)
  File "/home/kanux/.config/blender/3.1/scripts/addons/DragonFF-new-export/gtaLib/dff.py", line 2120, in write_memory
    data += self.write_clump()
  File "/home/kanux/.config/blender/3.1/scripts/addons/DragonFF-new-export/gtaLib/dff.py", line 2094, in write_clump
    data = Sections.write_chunk(Clump,
TypeError: Sections.write_chunk() takes 2 positional arguments but 3 were given

location: <unknown location>:-1

File police.DFF

SimplyCEO avatar May 10 '22 02:05 SimplyCEO

The solution would be to change write_chunk to just write. Seems to have been an oversight while writing that code and this section of the code wasn't tested before because of the rare RW version.

Parik27 avatar May 11 '22 06:05 Parik27

I already tried it, but got the following:

Read prefs: /home/kanux/.config/blender/3.1/config/userpref.blend
Info: Deleted 1 object(s)

Python: Traceback (most recent call last):
  File "/home/kanux/.config/blender/3.1/scripts/addons/DragonFF-master/gui/dff_ot.py", line 122, in execute
    dff_exporter.export_dff(
  File "/home/kanux/.config/blender/3.1/scripts/addons/DragonFF-master/ops/dff_exporter.py", line 842, in export_dff
    dff_exporter.export_dff(options['file_name'])
  File "/home/kanux/.config/blender/3.1/scripts/addons/DragonFF-master/ops/dff_exporter.py", line 830, in export_dff
    self.export_objects(objects)
  File "/home/kanux/.config/blender/3.1/scripts/addons/DragonFF-master/ops/dff_exporter.py", line 786, in export_objects
    self.dff.write_file(self.file_name, self.version )
  File "/home/kanux/.config/blender/3.1/scripts/addons/DragonFF-master/gtaLib/dff.py", line 2075, in write_file
    content = self.write_memory(version)
  File "/home/kanux/.config/blender/3.1/scripts/addons/DragonFF-master/gtaLib/dff.py", line 2067, in write_memory
    data += self.write_clump()
  File "/home/kanux/.config/blender/3.1/scripts/addons/DragonFF-master/gtaLib/dff.py", line 2041, in write_clump
    data = Sections.write(Clump,
  File "/home/kanux/.config/blender/3.1/scripts/addons/DragonFF-master/gtaLib/dff.py", line 189, in write
    _data = pack(packer, *data)
struct.error: pack expected 3 items for packing (got 4)

location: <unknown location>:-1

I tried to follow this pack function, but couldn't find.

SimplyCEO avatar May 11 '22 06:05 SimplyCEO

Tried to catch the error and it gave me the following: packer - <3I data - b'\x18\x00\x00\x00' Apparently data gets 3 NULLs instead of 2

SimplyCEO avatar May 11 '22 07:05 SimplyCEO

I manually sent the *data packet as 24, 0, 0 instead of 24, 0, 0, 0 and it exported. But in order to import back, it gave me a animation error. Viewing in DFF Viewer seems to show eveything well. While importing it to the gta3.img file crashes the game.

SimplyCEO avatar May 11 '22 08:05 SimplyCEO

This issue is fixed in the typing branch

Parik27 avatar Apr 11 '23 14:04 Parik27