Only search projects.blender.org
Log In
New Account
Home
My Page
Projects
Blender 2.x BF release
Summary
Activity
Tracker
SCM
Files
Blender 2.6 Bug Tracker: Browse
[#32581] Mesh properties API does not allow for zeros in byte array
Date:
2012-09-19 06:37
Priority:
3
State:
Closed
Submitted by:
Geoffrey Bantle (
briggs
)
Assigned to:
Campbell Barton (campbellbarton)
Category:
Python
Status:
Fixed / Closed
Relates to:
Duplicates:
Patches:
Summary:
Mesh properties API does not allow for zeros in byte array
Detailed description
easy to reproduce at console with default scene:
layer = bpy.data.meshes["Cube"].polygon_layers_string.new("Data")
layer.data[0].value = bytes([1, 2, 0, 1, 2])
print(layer.data[0].value)
result:
b'\x01\x02'
Followup
Message
Date
: 2012-09-19 14:33
Sender
:
Campbell Barton
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.
Date
: 2012-09-20 19:42
Sender
:
Geoffrey Bantle
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.
Date
: 2013-01-09 14:27
Sender
:
Campbell Barton
Committed support for bmesh: r53681.
# ---
import bpy
import bmesh
me = bpy.context.object.data
bm = bmesh.new() # create an empty BMesh
bm.from_mesh(me) # fill it in from a Mesh
layer = bm.verts.layers.string.new()
v = bm.verts[0]
v[layer] = bytes([1, 2, 0, 1, 2])
print(v[layer])
bm.to_mesh(me)
bm.free() # free and prevent further access
Date
: 2013-02-19 18:12
Sender
:
Campbell Barton
setting as todo
http://wiki.blender.org/index.php/Dev:2.5/Source/Development/Todo/Scripting#Python.2FRNA_API_Design_TODO
Attached Files:
No Files Currently Attached
Changes:
Field
Old Value
Date
By
status_id
Open
2013-02-19 18:12
campbellbarton
close_date
None
2013-02-19 18:12
campbellbarton
details
easy to reproduce at console with default scene: layer = bpy.data.meshes["Cube"].polygon_layers_string.new("Data") layer.data[0].value = bytes([1, 2, 0, 1, 2]) print(layer.data[0].value) result: b\'\\x01\\x02\'
2013-02-19 18:12
campbellbarton
Status
Confirmed
2013-02-19 18:12
campbellbarton
details
easy to reproduce at console with default scene: layer = bpy.data.meshes["Cube"].polygon_layers_string.new("Data") layer.data[0].value = bytes([1, 2, 0, 1, 2]) print(layer.data[0].value) result: b\'\\x01\\x02\'
2013-01-09 14:27
campbellbarton
details
easy to reproduce at console with default scene: layer = bpy.data.meshes["Cube"].polygon_layers_string.new("Data") layer.data[0].value = bytes([1, 2, 0, 1, 2]) print(layer.data[0].value) result: b\'\\x01\\x02\'
2012-09-20 19:42
briggs
details
easy to reproduce at console with default scene: layer = bpy.data.meshes["Cube"].polygon_layers_string.new("Data") layer.data[0].value = bytes([1, 2, 0, 1, 2]) print(layer.data[0].value) result: b\'\\x01\\x02\'
2012-09-19 15:16
campbellbarton
Status
New
2012-09-19 15:16
campbellbarton
details
easy to reproduce at console with default scene: layer = bpy.data.meshes["Cube"].polygon_layers_string.new("Data") layer.data[0].value = bytes([1, 2, 0, 1, 2]) print(layer.data[0].value) result: b\'\\x01\\x02\'
2012-09-19 14:33
campbellbarton