[Bf-python] Vertex Influence for no-armatured objs

models at paposo.com models at paposo.com
Sat Sep 13 16:57:49 CEST 2003


> /* hack: to mark that (deformed) mesh is readonly, so the update function
>  * will not try to write it. */
>   ((BPy_NMesh *)nmesh)->mesh = 0;

This hack makes no sense to me. I think it's refering to the following in
NMesh_update:

  if (mesh)
  {
    unlink_existingMeshData(mesh);
    convert_NMeshToMesh(mesh, nmesh);
  }
  else
  {
    nmesh->mesh = Mesh_fromNMesh(nmesh);
    mesh = nmesh->mesh;
  }

This simply says that if your python mesh has a pointer to mesh data:
    1. Free the mesh data
    2. Set the mesh data to what's in the python mesh
If you have a python mesh with no mesh data then:
    1. Create a new mesh based on the python mesh
    2. link it to the python mesh

So the hack above refers to the fact that by setting the mesh pointer to
NULL in the python mesh you'll follow path #2.  What will happen then is
that your python mesh will create a new mesh and link it to the python mesh.
There are two meshes now, however, 1 for the object->data and 1 for the
pythonMesh->mesh. What was the point to this anyway?? I might be missing
something here, but it would seem to me that just letting a mesh retreived
from an object be updated by path #1 would make more sense then
creating(allocating) a separate mesh for the python object to use. Where
does this separate mesh get deallocated anyway? It would also seem to me
that someone calling update on a mesh returned from an object would be
attempting to write to the mesh. Am i missing something?




More information about the Bf-python mailing list