Dana_CH_AZ opened this issue on Jun 27, 2010 · 9 posts
Dana_CH_AZ posted Sun, 27 June 2010 at 3:57 PM
I am trying to create a script that randomly put values in bend,twist,side-side. It works except for one slight problem, Twist doesn't seem to want to work. I am currently writing it as:
scene = poser.Scene()
figure = scene.CurrentFigure()
p1 = figure.Actor("Chest").Parameter("Twist").SetValue(2)
I tried this in the PoserPython Shell. If I did bend or side-side, it works. For twisting, it doesn't. Am I writing this wrong?
adp001 posted Sun, 27 June 2010 at 4:34 PM
In the shell try
[ p.Name() for p in figure.Actor("Chest").Parameters() ]
and check the list to be sure you have the right parameter-name.
markok13 posted Sun, 27 June 2010 at 4:59 PM
I've had the same problem with some figures, especially the Millenium ones like Victoria 3 and Michael 3. I never found an explanation or a real solution, but I have an annoying workaround:
I rename all the 'Twist' parameters to something else, and make my scripts use that new parameter name (I use 'Twost'). What's annoying about this is that I can't do the renaming from a Python script. I have to go in and manually rename every Twist parameter. I now keep pre-Twosted figures in my library.
Dizzi posted Sun, 27 June 2010 at 5:07 PM
IIRC eg. V4 has two twist channels in the chest actor, that's why it does not work.
One solution is to do it like this:
for p in figure.Actor("Chest"):
if p.Name=="twist": p.SetValue(2)
adp001 posted Sun, 27 June 2010 at 5:25 PM
Use the parameters InternalName. InternalName() is unique for each parameter.
Dana_CH_AZ posted Sun, 27 June 2010 at 5:27 PM
I must be typing it wrong, because when I do...I get a "nonsequence" error.
Dizzi posted Sun, 27 June 2010 at 5:39 PM
Sorry, it should work like that:
for p in figure.Actor("Chest").Parameters():
if p.InternalName()=="yrot": p.SetValue(2)
markschum posted Sun, 27 June 2010 at 5:44 PM
You are talking about setting the X,Y,Z rotate values for a body part. ?
I use this format after getting the actor object.
parm = actor.ParameterByCode(poser.kParmCodeXROT)
Dana_CH_AZ posted Sun, 27 June 2010 at 6:53 PM
Ok, I need a slap in the head. For a brief moment of insanity..I forgot you have to put an enter after if blah=blah : :) I got it working now. Thanks.:)