[Bf-python] Thinmesh module
Joseph Gilbert
jgilbert at TIGR.org
Mon Sep 19 16:48:39 CEST 2005
Campbell Barton wrote:
>>
>> Since other use meshes much more than I, suggestions for the API will
>> really be needed. My current plan would be to use the existing NMesh
>> API as a template as far as access to vert/faces/edges and their
>> data, but can use more guidance.
>>
>> Ken
>
The current NMesh creates python objects from the struct Mesh and the
rebuilding the struct Mesh later. Using NMesh as a template may not be
what you want to do. The idea behind Mesh (aka thinmesh) is that you
access the data directly by address and modify it.
However as willian (always on target :)) has said there needs to be a
'pythonic' way of accessing the struct Mesh data for script users.
Willian (and i think he is right on) mentioned this should be a python
list. Something similiar may need to exist for access to edges, dverts,
etc. etc.
> Hi Ken,
> I have written a few mesh editing scripts -
> http://members.iinet.net.au/~cpbarton/ideasman/
> good to here your serious about ThinMesh. Here are some random comments.
>
> * Will you use EditMesh or Mesh structure? the 1 shortcoming with
> using editmesh is that you cant modify texFaces in edit mode (not
> sure if that applies to a python wrapper)
> - In the case where you dont use editMesh you are stuck with C
> arrays, your probably aware of how applications handle allocating
> chunks of memory for arrays to grow in size.
> It might be worth looking at how Jiri implimented Verse in
> blender, he did some tricky memory management stuff for that.
Correct me if I'm wrong here but if editmesh is like editarmature, they
are 2 halves of the same whole. Blender most likely uses editmesh to
manipulate mesh data by putting creating an editmesh from a mesh,
manipulating the editmesh, and rebuilding the mesh from the editmesh.
I guess the question that Cam could be asking is whether you will use
the edimode code for manipulations. It might be a good idea.
>
> * Direct, non edit mesh accsess would be realy nice for Python
> modifiers.
>
> * Some python/Mesh script only modify UV coords, vertex colours,
> vertex locations. It would be good if the wrapper was designed so
> a lot of memory allocating was not needed for just modifying data.
> (as is the case now)
This is entire idea behind 'thinmesh' :)
>
> * Would using EditMesh data for the thin wrapper limit you to
> modifying 1 mesh at a time?
It depends on how Ken you want to make this. For Armatures it has not,
through a little bit of manipulation and avoidance of any global
structures. Remember that Blender has a '1 object can be in editmode at
1 time' policy which may hamper your abilities to use editmode code
effectively. It something to think about because python is a bit more
flexible than blender in what it will allow.
Meshes are complex to say the least. There is also a 'derived mesh'.
There is also the dependency graph, etc. etc. etc. etc. As willian has
stated before I also think that maybe this requires 'milestone'
releases. The first thing to shoot for is a wrapper for a struct Mesh
with some 'pythonic' list access to data members.
BTW good luck (your gonna need it) j/k :)
More information about the Bf-python
mailing list