diff --git a/fbs/ndi/NDIServer.py b/fbs/ndi/NDIServer.py index 4e8f294..4d04c3e 100644 --- a/fbs/ndi/NDIServer.py +++ b/fbs/ndi/NDIServer.py @@ -75,8 +75,10 @@ def send_texture(self, offscreen: gpu.types.GPUOffScreen, width: int, height: in # Get texture data in 3d array texture_data = texture.read() - # Convert texture data to numpy array and ensure correct format - flat_np = np.asarray(texture_data, dtype=np.uint8).transpose() + # Blender 5.2 corrected GPU buffer strides (89a0750); transpose legacy layouts only. + flat_np = np.asarray(texture_data, dtype=np.uint8) + if flat_np.strides[-1] != flat_np.itemsize: + flat_np = flat_np.transpose() # If texture is flipped, flip it vertically while preserving RGBA channels if is_flipped: @@ -84,7 +86,6 @@ def send_texture(self, offscreen: gpu.types.GPUOffScreen, width: int, height: in flat_np = flat_np.reshape(self.height, self.width, 4) # Flip only the height dimension flat_np = np.flip(flat_np, axis=0) - # Flatten back to 1D array # Flatten the array from 3d to 1d flat_np = flat_np.flatten() diff --git a/fbs/spout/SpoutServer.py b/fbs/spout/SpoutServer.py index e265425..9fe2d08 100644 --- a/fbs/spout/SpoutServer.py +++ b/fbs/spout/SpoutServer.py @@ -44,9 +44,10 @@ def send_texture(self, offscreen: gpu.types.GPUOffScreen, width: int, height: in # Read texture data texture_data = texture.read() - # Convert texture data to numpy array and transpose - # This is the correct way to handle Blender's Buffer object - flat_np = np.asarray(texture_data, dtype=np.uint8).transpose() + # Blender 5.2 corrected GPU buffer strides (89a0750); transpose legacy layouts only. + flat_np = np.asarray(texture_data, dtype=np.uint8) + if flat_np.strides[-1] != flat_np.itemsize: + flat_np = flat_np.transpose() # Reshape to image array (height, width, 4) image_array = flat_np.reshape(self.height, self.width, 4)