Couldn't you add 4 faces.layers.float (vmax, vmin,hmax, hmin) ?
Am 24.04.2013 11:57, schrieb Treyer Lukas: > Dear mailing list readers > > For some reason the only doc I found yesterday on google about custom layers > was "blah blah" in the the BMesh > API<http://www.blender.org/documentation/blender_python_api_2_63_5/bmesh.types.html#bmesh.types.BMVertSeq.layers>. > Now with the the help of CoDEmanX, I discovered custom layers in Bmesh. > > Just for clarification for "dumb" readers like me (an extension to the BMesh > API > Doc<http://www.blender.org/documentation/blender_python_api_2_63_2/bmesh.html#customdata-access>): > > bm.verts, bm.edges, bm.faces are not just a lists but they are of type > bmesh.types.BMVertSeq, bmesh.types.BMEdgeSeq, bmesh.types.BMFaceSeq > > The access to custom data of a vert for instance is implemented in > bmesh.types.BMVert > and bmesh.types.VertSeq together. > > Let's say you want to store the coordinates of a bounding box of a BMFace. > What I wanted to do in the first place was: > bm.faces[0].b_rect = [vmax,vmin,hmax,hmin] > > Now with layers it looks a bit different: > bm.faces[0][b_rect] = "we will come to the bounding box later" > Note that the following will not work: > bm.faces[0]['b_rect'] = "something" > > The layer needs to be accessed with the key generated by the face sequence as > follows: > key = bm.faces.layers.int.new("b_rect") > bm.faces[0][key] #read/write access > > You can retrieve the key by typing: > key = bm.faces.layers.int['b_rect'] > > Now what Campbell suggested to my problem was storing my complex data in a > list and adding the index of the data in that list to my face as an int layer: > > MyData = [] > MyData.append([vmax,vmin,hmax,hmin]) > index = len(MyData)-1 > > bm.faces[0][b_rect] = index > > > I still hope that at some point I could extend the wrapper classes directly > to store my data. > > > Best, Lukas > _______________________________________________ > Bf-python mailing list > [email protected] > http://lists.blender.org/mailman/listinfo/bf-python > _______________________________________________ Bf-python mailing list [email protected] http://lists.blender.org/mailman/listinfo/bf-python
