2
$\begingroup$

When the new sculpt paint brush (new ver 3.2) is used to paint on the object, where is the paint data saved? How can it be accessed from python code?

$\endgroup$

1 Answer 1

2
$\begingroup$

The paint brush writes to color attributes of the mesh. You can access it like so:

import bpy

mesh = bpy.data.objects['Cube'].data
color_data = mesh.color_attributes['Color'].data

# Color data is a per-vertex array, these two have the same size
print("Vertices: ", len(mesh.vertices))
print("Colors: ", len(color_data))

print(color_data[100].color[:])
color_data[200].color = (0.6, 0.2, 0.1, 1)

There seems to be experimental support in the latest alpha for texture-based painting but not in 3.2.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .