Getting and setting the data of Image.pixels is unacceptably slow. As an example, loading a normally sized texture image of 512x512 using the current importer code in dev takes minutes.
Blender's bpy_prop_collection has foreach_get/foreach_set methods that allow fast get/set on the pixel data. That way, the slow loop is moved entirely to optimized Python code.
One additional difficulty is the conversion from np.ubyte values in [0, 255] range to np.float values in [0, 1] range. NumPy can be used to perform that conversion very quickly.
Getting and setting the data of
Image.pixels
is unacceptably slow. As an example, loading a normally sized texture image of 512x512 using the current importer code indev
takes minutes.Blender's bpy_prop_collection has foreach_get/foreach_set methods that allow fast get/set on the pixel data. That way, the slow loop is moved entirely to optimized Python code. One additional difficulty is the conversion from
np.ubyte
values in[0, 255]
range tonp.float
values in[0, 1]
range. NumPy can be used to perform that conversion very quickly.Fixed in 19dfb6c in
dev
.To be changed in the exporter as well.