[Bf-python] Latest update on Mesh module
cbarton at metavr.com
Mon Oct 17 23:59:24 CEST 2005
Ken, brief reply...
There are cases where you would want to transform a mesh (as well as the
blender mesh) - I can think of a few cases Im alredy doing this-
Advanced array with skinning. and vertex displacement script, that
applys the objects matrix. Through without a copy function I can see
However a getRawFromObject would get the mesh data unlinked to the
original mesh, so transforming it would be fine.
it would be realy nice to do somthing like Mathutils and have a copymesh
newMesh = Blender.Mesh.New(existingMesh) # could be different syntax.
I was thinking of how Mathutils copys matrix/vector by "vec =
Scanfill is Shift+F in edit mode with an edge loop selected.
Recalc normals is Ctrl+N, hope that covers it, maybe I missed somthing.
Ken Hughes wrote:
> Campbell Barton wrote:
>> Ken Hughes wrote:
>>> So I'm looking now at the other miscellaneous methods in NMesh, with
>>> future thoughts of replacing NMesh completely. Should I recode all
>>> of those methods, or are there some "legacy" ones which don't make
>>> much sense anymore or are rarely used? Are they any methods
>>> glaringly missing, based on recent additions elsewhere in Blender.
>> Hi Ken, I use nmesh.transform(matrix) a lot for exporters, should be
>> trivial, and could use the same syntax as NMesh.
>> An equivilent to NMesh.getRawFromObject is needed for exporters
>> (maybe there could be added a function like Alt+C, then you get the
>> resulting mesh)
> I think the two points above are separate, so I'll discuss separately
> I don't know if a mesh.transform() is a good idea in the thin mesh
> case, since it's going to change all the mesh's vertices. It's not
> like NMesh where (as I understand it) you can do nmesh.transform() and
> as long as you don't do nmesh.update() the original mesh remains
> unchanged. An alternative might be to have the method return a
> sequence of transformed vertices and assign to mesh.verts:
> origverts = mesh.verts[:]
> mesh.verts = mesh.transform()
> # do export stuff with transformed verts
> mesh.verts = origverts
> I'll look into coding a version of getRawFromObject(); had forgot
> about that method completely.
> Combining the two points above, another way to approach
> mesh.transform() is to copy the mesh and transform it, leaving the
> original alone.
>> Another usefull function is scanfill. though this will probably be a
>> editmode only function too.
>> I have also needed a "Recalc Normals Outside" function, with some
>> mesh generation its tricky to work out wich way to flip the face,
> Are there scanfill and "recalc normals" tools already somewhere in
> blender? Not only do I want to avoid reinventing the wheel, if the
> code isn't already in Blender itself them maybe it should be?
>> I was wondering if the editMode functions work when there are no ed
>> views open?
> Well, if you call mesh.subdivide() and have marked the edges you want
> to subdivide (either in the UI or by selecting their vertices in
> BPython) it works. It does so by using the editmesh structure, which
> is why you can't have an edit view open. Specifically, I set G.obedit
> to an object linked to the current mesh. Elsewhere in the editmesh
> code it relies on G.editMesh to point at the edit mesh structures
> (which, from what I can see, always points to the static variable
> theEditMesh). I haven't looked into creating my own copy of the edit
> mesh structures and pointing G.editMesh at that as well... if others
> think "you can't be in edit mode" is too much of a constraint I'll
> look into it.
> Bf-python mailing list
> Bf-python at projects.blender.org
Campbell J Barton
133 Hope Street
Geelong West, Victoria 3218 Australia
e-mail: cbarton at metavr.com
phone: AU (03) 5229 0241
More information about the Bf-python