Fix: Errors in python test helper script

Introduced in 4b7ffbe48c

Pull Request: https://projects.blender.org/blender/blender/pulls/154779
This commit is contained in:
Sean Kim 2026-02-24 22:03:20 +01:00 • committed by Sean Kim
parent 9f5cd90dbf
commit 109721cf00

View file

@ -67,6 +67,9 @@ def _get_mesh(backend_type):
def get_attribute_data(backend_type, attribute_type):
if attribute_type in {AttributeType.COLOR, AttributeType.COLOR_CORNER} and backend_type == BackendType.MULTIRES:
raise Exception("Multires does not support color attributes")
import numpy as np
mesh = _get_mesh(backend_type)
@ -75,40 +78,37 @@ def get_attribute_data(backend_type, attribute_type):
attribute_name = 'position'
attribute_domain = 'POINT'
attribute_size = 3
attribute_type = np.float32
attribute_data_type = np.float32
is_color = False
case AttributeType.MASK:
attribute_name = '.sculpt_mask'
attribute_domain = 'POINT'
attribute_size = 1
attribute_type = np.float32
attribute_data_type = np.float32
is_color = False
case AttributeType.FACE_SET:
attribute_name = '.sculpt_face_set'
attribute_domain = 'FACE'
attribute_size = 1
attribute_type = np.int32
attribute_data_type = np.int32
is_color = False
case AttributeType.COLOR:
attribute_name = 'Color'
attribute_domain = 'POINT'
attribute_size = 4
attribute_type = np.float32
attribute_data_type = np.float32
is_color = True
case AttributeType.COLOR:
case AttributeType.COLOR_CORNER:
attribute_name = 'Color'
attribute_domain = 'CORNER'
attribute_size = 4
attribute_type = np.float32
attribute_data_type = np.float32
is_color = True
case _:
raise Exception("Invalid type specified")
if attribute_type == AttributeType.COLOR and backend_type == BackendType.MULTIRES:
raise Exception("Multires does not support color attributes")
num_elements = mesh.attributes.domain_size(attribute_domain)
attribute_data = np.zeros((num_elements * attribute_size), dtype=attribute_type)
attribute_data = np.zeros((num_elements * attribute_size), dtype=attribute_data_type)
attribute = mesh.attributes.get(attribute_name)
if is_color: