Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions fbs/ndi/NDIServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,17 @@ 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:
# Reshape to (height, width, 4) to maintain RGBA channels
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()
Expand Down
7 changes: 4 additions & 3 deletions fbs/spout/SpoutServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down