krenyy / botw_havok

Library for deserializing and reserializing Breath of the Wild Havok packfiles to and from JSON.
4 stars 6 forks source link

Can't load unedited RigidBody JSON file. TypeError: Class object is not iterable #4

Closed GingerAvalanche closed 4 years ago

GingerAvalanche commented 4 years ago

Trying to do the following:

hk0 = Havok.from_file(path)
hk.deserialize()
hk.to_json(other_path)

hk1 = Havok.from_json(other_path)

gives me the following error for a bunch of vanilla files:

Traceback (most recent call last):
  File "d:\python37\lib\multiprocessing\pool.py", line 121, in worker
    result = (True, func(*args, **kwds))
  File "d:\python37\lib\multiprocessing\pool.py", line 44, in mapstar
    return list(map(*args))
  File "d:\python37\lib\site-packages\hyrule_builder\builder.py", line 167, in _build_json
    hk = Havok.from_json(f)
  File "d:\python37\lib\site-packages\botw_havok\havok.py", line 129, in from_json
    return cls.from_dict(json.load(f), Path(path))
  File "d:\python37\lib\site-packages\botw_havok\havok.py", line 122, in from_dict
    inst.files = [HKFile.from_dict(file) for file in l]
  File "d:\python37\lib\site-packages\botw_havok\havok.py", line 122, in <listcomp>
    inst.files = [HKFile.from_dict(file) for file in l]
  File "d:\python37\lib\site-packages\botw_havok\hkfile.py", line 108, in from_dict
    inst.data = HKDataSection.from_dict(d["data"])
  File "d:\python37\lib\site-packages\botw_havok\container\sections\data\hkdatasection.py", line 223, in from_dict
    for content in d["contents"]
  File "d:\python37\lib\site-packages\botw_havok\container\sections\data\hkdatasection.py", line 223, in <listcomp>
    for content in d["contents"]
  File "d:\python37\lib\site-packages\botw_havok\classes\hkRootLevelContainer.py", line 100, in from_dict
    hkRootLevelContainerNamedVariant.from_dict(nv) for nv in d["namedVariants"]
  File "d:\python37\lib\site-packages\botw_havok\classes\hkRootLevelContainer.py", line 100, in <listcomp>
    hkRootLevelContainerNamedVariant.from_dict(nv) for nv in d["namedVariants"]
  File "d:\python37\lib\site-packages\botw_havok\classes\common\hkRootLevelContainerNamedVariant.py", line 69, in from_dict
    inst.variant = class_map.HKClassMap.get(d["className"]).from_dict(d["variant"])
  File "d:\python37\lib\site-packages\botw_havok\classes\hkpPhysicsData.py", line 117, in from_dict
    inst.systems = [hkpPhysicsSystem.from_dict(ps) for ps in d["systems"]]
  File "d:\python37\lib\site-packages\botw_havok\classes\hkpPhysicsData.py", line 117, in <listcomp>
    inst.systems = [hkpPhysicsSystem.from_dict(ps) for ps in d["systems"]]
  File "d:\python37\lib\site-packages\botw_havok\classes\hkpPhysicsSystem.py", line 188, in from_dict
    inst.rigidBodies = [hkpRigidBody.from_dict(rb) for rb in d["rigidBodies"]]
  File "d:\python37\lib\site-packages\botw_havok\classes\hkpPhysicsSystem.py", line 188, in <listcomp>
    inst.rigidBodies = [hkpRigidBody.from_dict(rb) for rb in d["rigidBodies"]]
  File "d:\python37\lib\site-packages\botw_havok\classes\hkpRigidBody.py", line 35, in from_dict
    inst.__dict__.update(hkpEntity.from_dict(d).__dict__)
  File "d:\python37\lib\site-packages\botw_havok\classes\common\hkpEntity.py", line 229, in from_dict
    inst.__dict__.update(super().from_dict(d).__dict__)
  File "d:\python37\lib\site-packages\botw_havok\classes\common\hkpWorldObject.py", line 128, in from_dict
    inst.collidable = hkpLinkedCollidable.from_dict(d["collidable"])
  File "d:\python37\lib\site-packages\botw_havok\classes\common\hkpLinkedCollidable.py", line 43, in from_dict
    inst.__dict__.update(super().from_dict(d).__dict__)
  File "d:\python37\lib\site-packages\botw_havok\classes\common\hkpCollidable.py", line 72, in from_dict
    inst.__dict__.update(super().from_dict(d).__dict__)
  File "d:\python37\lib\site-packages\botw_havok\classes\common\hkpCdBody.py", line 83, in from_dict
    d["shape"]
  File "d:\python37\lib\site-packages\botw_havok\classes\hkpConvexTranslateShape.py", line 50, in from_dict
    inst.__dict__.update(hkpConvexTransformShapeBase.from_dict(d).__dict__)
  File "d:\python37\lib\site-packages\botw_havok\classes\common\hkpConvexTransformShapeBase.py", line 55, in from_dict
    inst.__dict__.update(super().from_dict(d))
TypeError: 'hkpConvexTransformShapeBase' object is not iterable

This one only happens for a single file that I've tested, though I only tested a subset of the game files, so I'm not sure if there are others. The file is in any/all of the Enemy_Golem actor packs.

content/Physics/RigidBody/Enemy_Golem/Golem.hkrb.json
krenyy commented 4 years ago

Fixed in 9ba961b7d04c6b0f984774b059970ad397d56fe8