Forum: Poser Python Scripting


Subject: Need help with this script: have I nested loops?

Tguyus opened this issue on May 06, 2008 · 8 posts


ockham posted Fri, 09 May 2008 at 1:51 AM

Markschum has caught the problem.

If you're only going to set the value at keyframes, you don't need the
outer loop on range(scene.NumFrames()).  The while loop based
on NextKeyFrame will do the whole job.

This would do well enough in each case:

for parmName in copyParms2:
..... parmTo4 = leftthighTo.Parameter(parmName)
..... parmTo5 = leftbuttockTo.Parameter(parmName)
..... parmTo6 = lefthipTo.Parameter(parmName)
......scene.SetFrame(0)
......while 1:
....... parmTo4.SetValue(leftthighFrom.Parameter("Bend").Value() * -0.01)
....... parmTo5.SetValue(leftthighFrom.Parameter("Bend").Value() * -0.01)
....... parmTo6.SetValue(leftthighFrom.Parameter("Bend").Value() * -0.01)
....... nextKey = parmFrom.NextKeyFrame()
....... if (nextKey == None):
............ break
....... scene.SetFrame(nextKey)

My python page
My ShareCG freebies