Closed nagadomi closed 3 years ago
Thanks for the changes. :smile:
I think that is the nature of Blender's render system, the objects are different instances even if they refer to the same object (on Blender 2.80+), so we use hash() to prevent the conflict. I'm not sure if there are some issues which were solved might be happened again when using object's name as the key. :worried:
How did you reproduce this error? Which version of Blender? I might need to do more tests when I have time. :thinking:
hash(obj) sometimes returns different hash values for the same blender object.
I was mistaken. Different blender objects return the same hash value. So IndexError is raised because the number of vertices is different. This issue occurs in 2.83.9 and 2.91.0.
How did you reproduce this error?
Saved: '/tmp/sdef/0001.png'
Time: 00:00.93 (Saving: 00:00.01)
Saved: '/tmp/sdef/0002.png'
Time: 00:00.74 (Saving: 00:00.01)
Error in Driver: The following Python expression failed:
'mmd_sdef_driver(self, obj, bulk_update=True, use_skip=True, use_scale=False)'
Traceback (most recent call last):
File "<bpy driver>", line 1, in <module>
File "~/.config/blender/2.83/scripts/addons/mmd_tools/core/sdef.py", line 202, in driver_function
shapekey.data.foreach_set('co', shapekey_data.reshape(3 * len(shapekey.data)))
ValueError: cannot reshape array of size 67593 into shape (52098,)
Saved: '/tmp/sdef/0003.png'
Time: 00:00.58 (Saving: 00:00.01)
Saved: '/tmp/sdef/0004.png'
Time: 00:00.41 (Saving: 00:00.01)
Error in Driver: The following Python expression failed:
'mmd_sdef_driver(self, obj, bulk_update=True, use_skip=True, use_scale=False)'
Traceback (most recent call last):
File "<bpy driver>", line 1, in <module>
File "~/.config/blender/2.83/scripts/addons/mmd_tools/core/sdef.py", line 202, in driver_function
shapekey.data.foreach_set('co', shapekey_data.reshape(3 * len(shapekey.data)))
ValueError: cannot reshape array of size 67593 into shape (52098,)
Saved: '/tmp/sdef/0005.png'
Time: 00:00.42 (Saving: 00:00.01)
...
Tested. I'll merge this change since hash() doesn't work in this case. And currently it's working fine so far using this fix. Thank you. :smile:
When
render(animation=True)
,hash(obj)
sometimes returns different hash values for the same blender object. During rendering,cache info:
keeps increasing, sometimes raising an IndexError.So this fix calculates the hash value based on the name of the object.