Mesh properties API does not allow for zeros in byte array
Closed, ResolvedPublic


easy to reproduce at console with default scene:

layer =["Cube"]"Data")[0].value = bytes([1, 2, 0, 1, 2])





Confirmed, to support we need to
- add a length variable to the MStringProperty struct. so it can have a length besides 256
- add a callback into rna that can set byte strings - current assignment only takes a 'const char *' which is assumed to be NULL terminated.
... a new callback would have to take a length argument too.

For BMesh support this is simple but for rna a few callbacks would have to support this especially.

Additionally the name of the property layer is misleading, you cannot actually assign strings at all, it must be a bytes object (which makes it especially broken at the moment). I understand this is probably for historical reasons but thought I should mention it anyway.

Committed support for bmesh: r53681.
# ---
import bpy
import bmesh

me =

bm = # create an empty BMesh
bm.from_mesh(me) # fill it in from a Mesh

layer =
v = bm.verts[0]
v[layer] = bytes([1, 2, 0, 1, 2])


bm.to_mesh(me) # free and prevent further access

setting as todo