On Tue, Apr 23, 2013 at 10:32 PM, Treyer Lukas <[email protected]> wrote: > Dear bpy Dev's > > I would highly appreciate it, if the bmesh module could be extended with > "bmesh.types.BMFace.'myProperty'/'myFunction' = 'myProperty' or 'myFunction' > > It would allow for cleaner python code when dealing with BMesh as geometry > generation tool. > For instance: I would like to write a python definition > "bmesh.types.BMFace.split(line)" or > "bmesh.types.BMFaceSeq.remove_hidden_surface()" or a class "Surface" that is > a subclass of BMFaceSeq. > > Is there an easy way for this to be implemented? Or would it call for a GSoC? > What are the implications of making BMFace not a final class? > > > Best, Lukas
Hi Lukas, Realistically I don't think this will be added, with mesh data we use a C based API (see customdata.c), and any complicated data types (Vertex Groups for eg), have to be added in C and manage their own memory, comparison, interpolation etc. This is really low level stuff - so python _could_ define some binary blob thay fits into customdata, but it wouldn't be handled nicely for subdivde. extrude etc. and IMHO this is too low level for python to be used. Suggest to use existing primitive data types to either store data (255 bytes), or an id (probably an int) which python can use to lookup a dictionary to do whatever it likes. Not sure how familier you are with the bmesh api but steps would be... - add customdata int layer to faces with a name unique to your purpose. - keep a store of data in python (can be stored anywhere - as an ID property on the mesh for example). - Map each faces int property to your data-store. - Make some small python api so you can do: data = mydata_face_get(f), mydata_face_set(f, data) .... where data can be any python object. _______________________________________________ Bf-python mailing list [email protected] http://lists.blender.org/mailman/listinfo/bf-python
