Forum Coordinators: RedPhantom
Poser - OFFICIAL F.A.Q (Last Updated: 2024 Dec 02 5:01 am)
import poser
import random
scene = poser.Scene()
def main():
for actor in scene.Actors():
# ues try/except to avoid trying to rotating actors that can not.
try:
if actor.IsProp():
print actor.Name()
actor.ParameterByCode(poser.kParmCodeXROT).SetValue(rnd())
actor.ParameterByCode(poser.kParmCodeYROT).SetValue(rnd())
actor.ParameterByCode(poser.kParmCodeZROT).SetValue(rnd())
except:
pass
def rnd():
value = random.uniform(-360,360)
print "t%f" % value
return value
main()
scene.DrawAll()
print "done"
You are the best!
It works great!
Is it possible to make it work on the selected prop only? In case there are other props on the scene?
the line "for actor in scene.Actors():" is going to go through every prop, light, camera etxc in the scene.
def main():<br></br><br></br> actor = scene.CurrentActor()<br></br><br></br> # ues try/except to avoid trying to rotating actors that can not.<br></br><br></br> try:<br></br><br></br> if actor.IsProp():<br></br><br></br> print actor.Name()<br></br><br></br> actor.ParameterByCode(poser.kParmCodeXROT).SetValue(rnd())<br></br><br></br> actor.ParameterByCode(poser.kParmCodeYROT).SetValue(rnd())<br></br><br></br> actor.ParameterByCode(poser.kParmCodeZROT).SetValue(rnd())<br></br><br></br> except:<br></br><br></br> pass<br></br><br></br>make the change and get the indentations right and it will do only the selected actor (prop)<br></br><br></br><br></br>
Perfection! Thank you markschum!
Python seams like magic to me, I assumed the spell should be changed a little to work :biggrin:
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 want to randomize various props as if those were thrown on air
don't want to move them around just randomize their rotation values
Is there a python script like that?
My FreeStuff