Forum Moderators: Staff
Poser Python Scripting F.A.Q (Last Updated: 2024 Sep 18 2:50 am)
Hmm... I can get this to work, but it's not additive. When I apply it a second time, nothing happens, so it's just applying pose values.
import poser
scene = poser.Scene()
JumpSize=0.6971784 # in PU
actor= poser.Scene().CurrentActor()
actor.ParameterByCode(poser.kParmCodeXTRAN).SetValue(+JumpSize)
actor.ParameterByCode(poser.kParmCodeYTRAN).SetValue(-JumpSize)
actor.ParameterByCode(poser.kParmCodeZTRAN).SetValue(0)
poser.Scene().DrawAll()
mac
Thanks for replying everyone. I now have this.
import poser
scene = poser.Scene()
JumpSize=0.6971784 # in PU
actor= poser.Scene().CurrentActor()
param=actor.ParameterByCode(poser.kParmCodeXTRAN)
param.SetValue(param.Value+JumpSize)
param=actor.ParameterByCode(poser.kParmCodeYTRAN)
param.SetValue(param.Value+JumpSize)
param=actor.ParameterByCode(poser.kParmCodeZTRAN)
param.SetValue(param.Value+JumpSize)
poser.Scene().DrawAll()
Which gives me this error message.
Traceback (most recent call last):
File "", line 7, in ?
TypeError: unsupported operand types for +: 'builtin_function_or_method' and 'float
Line 7 is 'param.SetValue(param.Value+JumpSize) '
Have I got this right or not?
mac
In case anyone else might need this in future, here's my final code including rotations. Tested and working.
X channels - positive value
Y channels - negative value
Z channels - no change
JumpSize = 0.6971784 or 170cm - change value to suit.
import poser
scene = poser.Scene()
JumpSize=0.6971784 # in PU
RotValue=90
actor= poser.Scene().CurrentActor()
param=actor.ParameterByCode(poser.kParmCodeXTRAN)
param.SetValue(param.Value()+JumpSize)
param=actor.ParameterByCode(poser.kParmCodeYTRAN)
param.SetValue(param.Value()-JumpSize)
param=actor.ParameterByCode(poser.kParmCodeZTRAN)
param.SetValue(param.Value())
param=actor.ParameterByCode(poser.kParmCodeXROT)
param.SetValue(param.Value()+RotValue)
param=actor.ParameterByCode(poser.kParmCodeYROT)
param.SetValue(param.Value()-RotValue)
param=actor.ParameterByCode(poser.kParmCodeZROT)
param.SetValue(param.Value())
poser.Scene().DrawAll()
Thanks again to everyone!
mac
This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.
I've searched this forum back to 2004, but can't find an answer.
Problem - I'm making a corridor kit (mostly props) in which pieces need to be moved in increments of 600cm and/or rotated +/- 90 degrees. The problem is that normal pose files are no good because I need the pieces to move 600cm each time the pose is applied (additive) - rather than have them simply moved to that position.
The Daz Studio version uses a set of simple pose scripts for this, but I imagine this can only be done in Poser through python. However, Ockham made a python dialog for me several years ago with a 'Jump' function, so I know it can be done. What I don't know is how to generate a script which can be applied to any prop, BODY or body part with this Jump in it. I also know I can use a .pz2 to call the python script, and that would probably be the best way for the user, rather than have them open the scripts.
Can anyone help out here? A free copy of the product is yours, when it comes out later this month.
TIA
mac