[Bf-python] returnvertsfromgroup

models at paposo.com models at paposo.com
Mon Sep 29 13:32:48 CEST 2003


Maybe the return is a little complex.  hmm.
How about this:

    In:
        [index, index,....],  (optional) ['group','group',...]
    Out:
      No 2nd parameter (index only) - returns all influences for listed
index
        [(index, weight, group), (index, weight, group), ...]
      or will test the index vs. 'group' - will return index/group
associations if they exist
        [(index, weight, group), (index, weight, group),...]

This would contain the functionality of the current getVertexInfluences:

vertList = [2]
influenceList = mesh.getVertexInfluences(vertList)
print influenceList
    "[(2,1.000,'group1'),(2,.5000,'group2'),(2,.5000,'group3')]"

but you could return a vert list (this might be strange to parse...)

vertList = [2,3,4]
influenceList = mesh.getVertexInfluences(vertList)
print influenceList
    "[(2,1.000,'group1'),(2,.5000,'group2'),(2,.5000,'group3'),
(3,.5000,'group1'),(3,1.000,'group2'),(3,.5000,'group3'),(4,.8000,'group1'),
(4,.5000,'group2'),(4,.5000,'group3'),]"

or by passing a group or groups as a 2nd paramter do a test of list vs.
groups: (you might have to make it a list if you want to do multiples see
below)

vertList = [2,3,4]
groupList = ['group1']
influenceList = mesh.getVertexInfluences(vertList, groupList)
print influenceList
    "[(2,1.000,'group1')(3,.5000,'group1')(4,.8000,'group1')]"

or for multiple lists

vertList = [2,3,4]
groupList = ['group1','group2']
influenceList = mesh.getVertexInfluences(vertList, groupList)
print influenceList
    "[(2,1.000,'group1'),(2,.5000,'group2')
,(3,.5000,'group1'),(3,1.000,'group2'),(4,.8000,'group1'),(4,.5000,'group2')
]"

You could add the bone name too (although i thought it might be better to
have a getBoneFromGroup() function somewhere):

vertList = [2]
influenceList = mesh.getVertexInfluences(vertList)
print influenceList
    "[(2,1.000,'group1', 'bone1'),(2,.5000,'group2',
'bone2'),(2,.5000,'group3', 'bone3')]"

It might be better to to have the option not to need a list:

influenceList = mesh.getVertexInfluences(2)
print influenceList
    "[(2,1.000,'group1', 'bone1'),(2,.5000,'group2',
'bone2'),(2,.5000,'group3', 'bone3')]"

or a group:

influenceList = mesh.getVertexInfluences(2, 'group1')
print influenceList
    "[(2,1.000,'group1', 'bone1')]"

But I'll have to read up on my python to see if that can be done.




More information about the Bf-python mailing list