[Bf-python] Animation keys and vertex influences

Willian Padovani Germano wgermano at ig.com.br
Sun Jul 27 03:04:01 CEST 2003


Jiba sent this to me, but this reply may be useful for others here. 
It's about "SubSurf" meshes.

On Sat, 2003-07-26 at 23:18, Jiba wrote:
> Willian Padovani Germano <wgermano at ig.com.br> wrote:
> > Can't you use NMesh.GetRaw with the meshes, instead of
> > NMesh.GetRawFromObject with the objects?  You can do something like: for
> > each object check if it's a mesh, and if so use NMesh.GetRaw(obj.data).
> 
> It seems that GetRaw() does not apply the SubSurf to the mesh -- the nmesh returned by GetRaw() has only 12 vertices while the one returned by GetRawFromObject() has 42 vertices !!! I need both subsurf and vertex influences.
> 
> Jiba

Ok, I looked at the relevant files, covering display list meshes,
deformation with armatures and Catmull-Clark subdivision surfaces.  The
hyper_mesh, as is called the subdivided mesh in the source, is
incomplete and is another thing that waits for a blender kernel rewrite
to have some issues solved, like uv-mapping, etc.

But the point is that these things were hacked in with only Blender's
own renderer in mind.  When a display list mesh is created, first its
vertices are deformed according to its parent object (lattice, armature)
and only then there's a check for SubSurf.  So there really is no
armature info for the extra vertices created, and the one available
before was already applied to the vertices at this point.  What comes
out is really a "raw" mesh, for rendering.

Maybe this pedestrian work-around could help you, if you want to use
SubSurf:

- create your meshes, turn SubSurf "on" for them
- Python: get them with NMesh.GetRawFromObject(), save them to new
meshes (to get meshes with the extra vertices from subdivision)
- only then parent your armature to these smoothed meshes and
- Python: get them with NMesh.GetRaw() and export them.

I know, I know ...

A quick test with "Suzanne", the default monkey head, with SubSurf "on":
#--------
import Blender
from Blender import NMesh

a = NMesh.GetRawFromObject("Suzanne")
NMesh.PutRaw(a)
#--------

shows that the new object has more than 4 times the vertices of the
original, so this works as a way to turn the SubSurf verts into "real"
verts.

--
Willian, wgermano at ig.com.br




More information about the Bf-python mailing list