[Bf-python] Fixing NMesh.getVertexInfluences

Gilbert, Joseph T. jgilbert at tigr.ORG
Sun Jan 15 05:49:41 CET 2006


Here's the dillo:

When i worked on the vertex groups DeformWeights contained a pointer to the bone that they were weighting. Basically things worked like this:

Mesh->dverts[x].dweight->bBone;

In other words every deform vertex had a weight that held a pointer to the bone that it was weighting.

We used this in python to return the list of bones that vertex was weighting. However this was removed recently. Here is the commit:

"""
Revision 1.9 / (as text) / (view) - annotate - [select for diffs] , Thu Aug 11 05:44:32 2005 UTC (5 months ago) by zuster
Branch: MAIN
Changes since 1.8: +1 -2 lines
Diff to previous 1.8

 - couldn't help myself, got distracted working on something else and
   wondered what these silly data pointers in MDeformVert were for.
   Turns out they aren't even need! Just taking up extra memory and
   space and confusing the armature deform algorithm. Naturally I
   had to clean things up. Sorry Ton.
"""

Seems like zr later commented out the code in getVertexInfluences:

"""
/* Disabled this code, it couldn't be correct!
* sweight->data was being set to a posechannel not a bone
* for one thing, and it is not always set for another.
* The only thing safe here is to return the defgroup number. -zr
*/
"""

What we need to do is return the bones that are weighted for a vertex. Will have to look because now the dweight->data pointer is no longer there physically in the MDeformWeight struct.

-----Original Message-----
From: bf-python-bounces at projects.blender.org on behalf of Ken Hughes
Sent: Sat 1/14/2006 6:15 PM
To: Blender Foundation Python list
Subject: Re: [Bf-python] Fixing NMesh.getVertexInfluences
 
Tron:

I talked with Joseph about this briefly on IRC once and I think we both 
agreed we didn't know enough individually about mesh and bones to fix it 
(I can speak for myself anyway).  What would help me to try tracking 
down the fix would be a bug report with a simple sample .blend for 2.37a 
that demonstrates what it should do.

Joseph: other thoughts/suggestions?

Ken

Tron Thomas wrote:
> I have two relatively recent versions of the Blender source code on  my 
> system.  When I build and run from one version, calling the  
> NMesh.getVertexInfluences in Python, will provide information that  can 
> determine how vertices are influenced by bones in the mesh's  parent 
> armature.  When I build and run from the other version,  
> NMesh.getVertexInfluences always returns an empty list for each  vertex 
> in the same mesh.
> 
> I checked the two versions of the function that implements that  Python 
> method, and they are different.  I don't remember making  modifications 
> to the code in the first version.  However, CVS says  that the file  
> (NMesh.c) has been modified.  So at some point in time  I must have 
> hunted down code from another area of the source and  incorporated it in 
> to the function.
> 
> This new code is located in the NMesh_getVertexInfluences function  
> found in NMesh.c that provides influences information.  The code is  
> found inside the for loop, after the block of code that it commented  
> out.  The following is a listing of the added code:
> 
>                 bDeformGroup *defgroup = BLI_findlink(&object->defbase, 
> sweight- >def_nr);
>                 if( defgroup )
>                     PyList_Append( influence_list,
>                         Py_BuildValue( "[sf]",
>                             defgroup->
>                             name,
>                             sweight->
>                             weight ) );
> 
> Without the code listed above, the for loop essentially doesn't do  
> anything and always provide a empty list of vertex influences.  It  
> seems that the code listed above or something like this is necessary  in 
> that for loop, otherwise there is no way that the NMesh object  will be 
> able to provide and vertex influence information.
> 
> What work has been done to fix this method?
> I'm wondering if I should enter a bug against this so it gets  
> attention.  Since the Python scripting code is still in development  and 
> not considered ready as part of the current release, I'm not sure  if it 
> is desired for 3rd party users like myself to be submitting  bugs on 
> stuff that is not typically available to the general public.
> 
> _______________________________________________
> Bf-python mailing list
> Bf-python at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-python
> 

_______________________________________________
Bf-python mailing list
Bf-python at projects.blender.org
http://projects.blender.org/mailman/listinfo/bf-python

-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 4949 bytes
Desc: not available
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20060114/266f1ba3/attachment.bin>


More information about the Bf-python mailing list