On 17/04/2014 at 15:43, xxxxxxxx wrote:
I was waiting to hear from someone else to confirm my findings.
Niklas has confirmed my findings about the tree GUI.
The only way I could find to get at the joints in the WM is by going through the tag.
Example:
#The Weights Manager is used to access the weight values stored in the Tweights tag on the mesh object
#We can't iterate through the "Joints" list tree gizmo in the WM using GetFirstObject(), GetNext(), etc.. like the OM tree gizmo
#But the Tweights tag has some functions in it that can help us deal with that limitation
import c4d
def main() :
#The Character mesh that has joints deforming it
mesh = doc.SearchObject("Cube")
#The weights tag on the mesh..Which we need to cast to a CAWeightTag type in C++
wtag = mesh.GetTag(c4d.Tweights)
#The number of joints in the Weight Manager's Joints list
#NOTE: Objects other than joints can also be binded and included in this list as well as joints...like the Root nulls
jcount = wtag.GetJointCount()
print jcount
"""This gets an object in the OM using the index# of an object in the Weights Manager's Joints list
This lets you do things like select objects in the OM based on it's WM index value
NOTE: The WM lists things alphabetically...Not how they exist in the OM
NOTE: Objects other than joints can also be binded and included in this list as well as joints...like the Root nulls"""
jnt = wtag.GetJoint(0, doc) # 0 == The first object in the WM Joints list
print jnt.GetName()
#This code returns the Weight Manager's index value for a joint (or other object) in the OM
#REMEMBER:The order they're listed in the WM can be different than the OM
jnt2 = doc.SearchObject("Joint.2")
findWMIndexNum = wtag.FindJoint(jnt2, doc)
print findWMIndexNum
#The total number of weights stored in the specified joint(or object) in the WM Joints list
wtcount = wtag.GetWeightCount(0)
print wtcount
#This code lets us change the weight values for a specific joint and a specific mesh vertice
# 1==The joint object by index# in the WM, 0==The point index# in the mesh
# 0.0 is the weight value we're setting
wtag.SetWeight(1, 0, 0.0)
#This lets us check the weight values for a specific joint and a specific mesh vertice
# 1==The joint object by index# in the WM, 0==The point index# in the mesh
wt = wtag.GetWeight(1, 0)
print wt
c4d.EventAdd()
if __name__=='__main__':
main()
-ScottA