glTF exporter: Fix T68822 speedup pixel transfer from blender to numpy
if more speed is needed, we will need to check API side
This commit is contained in:
parent
fb55d80bfb
commit
a9283e526f
Notes:
blender-bot
2023-02-14 19:09:55 +01:00
Referenced by issue #68822, Exporting GLTF with big texture is super slow
|
@ -15,7 +15,7 @@
|
|||
bl_info = {
|
||||
'name': 'glTF 2.0 format',
|
||||
'author': 'Julien Duroure, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors',
|
||||
"version": (0, 9, 51),
|
||||
"version": (0, 9, 52),
|
||||
'blender': (2, 80, 0),
|
||||
'location': 'File > Import-Export',
|
||||
'description': 'Import-Export as glTF 2.0',
|
||||
|
|
|
@ -148,7 +148,7 @@ def __get_image_data(sockets_or_slots, export_settings) -> gltf2_blender_image.E
|
|||
if image.name in channelcache:
|
||||
return channelcache[image.name]
|
||||
|
||||
pixels = np.array(image.pixels)
|
||||
pixels = np.array(image.pixels[:])
|
||||
pixels = pixels.reshape((pixels.shape[0] // image.channels, image.channels))
|
||||
channels = np.split(pixels, pixels.shape[1], axis=1)
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ class ExportImage:
|
|||
|
||||
@classmethod
|
||||
def from_blender_image(cls, blender_image: bpy.types.Image):
|
||||
img = np.array(blender_image.pixels)
|
||||
img = np.array(blender_image.pixels[:])
|
||||
img = img.reshape((blender_image.size[0], blender_image.size[1], blender_image.channels))
|
||||
has_alpha = blender_image.depth == 32
|
||||
return ExportImage(img=img, blender_image=blender_image, has_alpha=has_alpha)
|
||||
|
|
Loading…
Reference in New Issue