Forum: Poser Python Scripting


Subject: JointVertexWeights and TwistVertexWeights

kuroyume0161 opened this issue on Nov 13, 2004 ยท 18 posts


kuroyume0161 posted Sat, 13 November 2004 at 3:45 PM

Right, that's what I was expecting. Most likely, the values are between 0.0 and 1.0. Actually, you're close. They indicate the amount of influence of the joint on the vertex. 1.0 means move with the joint, 0.0 means don't move at all, inbetween (blend zone) means move with a percentage of joint movement.

But, since my Python experience is very limited, how did you go through the list. Here's my untested code for printing them out:

<br></br>
# --------------------------------------<br></br>
# VertexWeight Info<br></br>
# --------------------------------------<br></br>
def printWeights(weights):<br></br>
i = 0<br></br>
for wgt in weights:<br></br>
print " ", i, ": =", wgt<br></br>
i = i + 1<br></br><br></br><br></br>
# --------------------------------------<br></br>
# Hierarchy Info<br></br>
# --------------------------------------<br></br>
def printHier(actor, numTabs):<br></br>
if(not actor):<br></br>
return<br></br>
tab = ' ' + ' __ '*(numTabs-1) + '_'<br></br>
print tab, actor.Name()<br></br>
children = actor.Children()<br></br>
if(children):<br></br>
for child in children:<br></br>
printHier(child, numTabs+1)<br></br><br></br><br></br>
# --------------------------------------<br></br>
# Define a function to print out the vertex weights of a Poser
Actor.<br></br>
# Use some globals so the we can tally them as we go<br></br>
# --------------------------------------<br></br>
def printActorWeights(iActor):<br></br>
maxName = 20<br></br>
print " ", iActor.Name(), ' '*(maxName - len(iActor.Name())),<br></br><br></br>
# --------------------------------------<br></br>
# Returns<br></br>
# --------------------------------------<br></br>
axis = ["x", "y", "z"]<br></br>
for a in axis:<br></br>
weights = iActor.JointVertexWeights(a)<br></br>
if (weights):<br></br>
printWeights(weights)<br></br>
else:<br></br>
weights = iActor.TwistVertexWeights(a)<br></br>
if (weights):<br></br>
printWeights(weights)<br></br>
else:<br></br>
print "No Weights for axis ",a<br></br><br></br><br></br><br></br>
# --------------------------------------<br></br>
# Get the Poser scene object...<br></br>
# --------------------------------------<br></br>
scene = poser.Scene()<br></br><br></br>
# --------------------------------------<br></br>
# For every figure in the scene,<br></br>
# print out how many polygons it has (if it has geometry)<br></br>
# and keep a total as we go<br></br>
# --------------------------------------<br></br>
figs = scene.Figures()<br></br>
for fig in figs:<br></br>
print fig.Name()<br></br>
body = fig.Actor('Body')<br></br>
print " Hierarchy:"<br></br>
printHier(body, 0)<br></br>
print<br></br>
print " Actor info:"<br></br>
actors = fig.Actors()<br></br>
for actor in actors:<br></br>
printActorWeights(actor)<br></br>

C makes it easy to shoot yourself in the foot. C++ makes it harder, but when you do, you blow your whole leg off.

 -- Bjarne Stroustrup

Contact Me | Kuroyume's DevelopmentZone