[Bf-python] Some bpy.types Custom Properties Are Read-Only

Khalifa Lame khalibloo at gmail.com
Sat Jul 2 00:01:44 CEST 2016


I went down the BMesh road and everything worked fine. I was able to store
custom string IDs on the mesh elements while the main property groups were
stored on the mesh itself as normal ID properties. Worked like a charm.
Just thought I'd let you know. Thanks again.

On Thu, Jun 30, 2016 at 8:20 PM, Khalifa Lame <khalibloo at gmail.com> wrote:

> That's a good place to start! I was reluctant to look into BMesh because I
> thought the bmesh data was only temporary and volatile. It looks that way
> especially because you have to create the bmesh object yourself.
>
> Thank you very much.
>
> On Thu, Jun 30, 2016 at 5:06 PM, Bastien Montagne <montagne29 at wanadoo.fr>
> wrote:
>
>> Using BMesh you can use custom data layers (see
>> https://www.blender.org/api/blender_python_api_2_77_0/bmesh.types.html#custom-data-layer-access
>> ) - generic int/float/string ones.
>>
>> Beyond that not much to do, mesh items have no uid at all, outside of
>> bmesh I guess you could encode some data into a vgroup e.g. (for vertices
>> at least), but that’s rather limited and hackish.
>>
>> Le 30/06/2016 à 17:35, Khalifa Lame a écrit :
>>
>> Alternatively, do those mesh elements have internal unique constant IDs i
>> can access? Indices change all the time (I believe), so they are not a
>> reliable way to identify mesh elements.
>>
>> On Thu, Jun 30, 2016 at 3:21 PM, Khalifa Lame <khalibloo at gmail.com>
>> wrote:
>>
>>> Ah, that explains a lot. An error message during prop creation would
>>> have been very helpful. So what options (if any) do I have? Verts, edges
>>> and faces do have individual properties like bevel and crease weights. How
>>> were those properties created? Can I somehow squeeze in my own custom
>>> properties as well?
>>>
>>> On Thu, Jun 30, 2016 at 1:11 PM, Bastien Montagne <
>>> <montagne29 at wanadoo.fr>montagne29 at wanadoo.fr> wrote:
>>>
>>>> ID properties are only available for IDs (and a few other special
>>>> cases, like bones and some UI classes). Other types just do not support
>>>> them at all.
>>>>
>>>> To check wether a type supports ID properties, just try to use one of
>>>> its mapping protocol item (e.g. C.object.keys() works, while
>>>> C.object.vertex_groups[0].keys() does not).
>>>>
>>>> Le 30/06/2016 à 13:08, Khalifa Lame a écrit :
>>>>
>>>> Hi. I need assign custom properties to mesh vertices, edges and faces.
>>>> It doesn't throw any errors on creation of the custom props, but after
>>>> they've been created, they don't behave as one would expect. They are
>>>> read-only tuples rather than bpy.props.IntProperty() for example.
>>>>
>>>> For comparison, here's the normal behavior of a custom property
>>>>
>>>>
>>>> Here's what I get on certain bpy.types
>>>>
>>>> ​An unusable tuple!
>>>>
>>>> And if I try to assign a value, I get
>>>>
>>>>>>>>
>>>> Is there a reason for this? Is there a known workaround or hack? I
>>>> really do need to store custom props on vertices, edges, faces and vertex
>>>> groups.
>>>>>>>>
>>>> --
>>>> khalibloo®
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Bf-python mailing listBf-python at blender.orghttps://lists.blender.org/mailman/listinfo/bf-python
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Bf-python mailing list
>>>> Bf-python at blender.org
>>>> https://lists.blender.org/mailman/listinfo/bf-python
>>>>
>>>>
>>>
>>>
>>> --
>>> khalibloo®
>>>
>>>
>>
>>
>> --
>> khalibloo®
>>
>>
>>
>> _______________________________________________
>> Bf-python mailing listBf-python at blender.orghttps://lists.blender.org/mailman/listinfo/bf-python
>>
>>
>>
>> _______________________________________________
>> Bf-python mailing list
>> Bf-python at blender.org
>> https://lists.blender.org/mailman/listinfo/bf-python
>>
>>
>
>
> --
> khalibloo®
>
>


-- 
khalibloo®
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20160701/bd646b69/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 8127 bytes
Desc: not available
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20160701/bd646b69/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 6632 bytes
Desc: not available
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20160701/bd646b69/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 3940 bytes
Desc: not available
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20160701/bd646b69/attachment-0002.png>


More information about the Bf-python mailing list