blender-to-gmstudio / blender-to-smf

Import-Export of Blender model from/to SMF model format
MIT License
11 stars 2 forks source link

Missing linked images throw an error, handle this properly #15

Closed bartteunis closed 3 years ago

bartteunis commented 3 years ago
Traceback (most recent call last):
  File "C:\Users\bart_\AppData\Roaming\Blender Foundation\Blender\2.90\scripts\addons\blender-to-smf\__init__.py", line 108, in execute
    return export_smf(self, self.filepath, context, self.export_textures, self.export_nla_tracks, self.export_type, self.mult, self.subdivisions)
  File "C:\Users\bart_\AppData\Roaming\Blender Foundation\Blender\2.90\scripts\addons\blender-to-smf\smf.py", line 140, in export_smf
    pixel_number = int(item_number/channels)
ZeroDivisionError: division by zero

location: <unknown location>:-1

location: <unknown location>:-1

Both Image.pixels and Image.channels return 0 in this case, which causes the error to occur.

bartteunis commented 3 years ago

The best way to fix this seems to export the default texture (empty string "") and let the exporter show a warning in Blender.