Forum: Poser - OFFICIAL


Subject: Help with Python scripting

whoopy2k opened this issue on Jan 08, 2008 · 6 posts


whoopy2k posted Tue, 08 January 2008 at 1:44 PM

I do a LOT of work with strand based hair.  It is weak in Poser but I’m always striving for realism.  One of my biggest hang-ups is constantly having to turn visibility on and off for sets of hair groups/props.  Since I usually style different sets of hair for different scenes, I’m stuck with a five minute click fest.  It is even worse to turn them back on!  Do any of the python script writers out there have time to lend a hand? 

I’m enough of a programmer to know it would be possible to write a short script to either turn on or off groups but I’ve never touched Python.  I’m hoping someone has time to bang out a quick script to hide a hard coded list of hair groups.  Something like this:




.
.
.

Then I could hack that into custom scripts to both turn on and off each set of hair groups I create for present and future projects.  If anyone has any interest in helping me out please let me know.  I would greatly appreciate it.


PhilC posted Tue, 08 January 2008 at 2:15 PM

Is the hair parented to a skullcap?

Open the Hierarchy Window Alt+Click the eye icon next to the skullcap and it will make it invisible PLUS all of its children. Alt+ Click to make all visible again.

No scripting required :)


whoopy2k posted Tue, 08 January 2008 at 3:08 PM

Cool trick!  That would require me to create each hair style (really all the same hair in a diffrent place in the timeline) on a diff. skull cap but that would still be much quicker than doing each by hand.  Much thanks Phil!  Still though, i think i need to start learning some scripting before too much longer if i am going to keep growing.


svdl posted Tue, 08 January 2008 at 4:51 PM

Mmy Hair Visibility scripts might also be useful for switching between ShowPopulated On and ShowPopulated Off, especially when you have a lot of hair groups.: www.svdlinden.nl/webposerstuff/downloads/ShowPopulatedOnOff.zip 

The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter

My gallery   My freestuff


PhilC posted Tue, 08 January 2008 at 5:52 PM

Make similarly named actors invisible.

import poser
scene = poser.Scene()

if actors are named hair1,hair2,hair3 etc then text = "hair"

text = "hair"

the number of letters that need to match eg 4 for "hair"

letters = 4

1 = vizible 0 = invizible.

viz = 0

for actor in scene.Actors():
 if actor.Name()[:letters] == text:
  actor.SetOnOff(viz)

You can pretty this up by using Poser dialog text input but the above bear bones will work.


whoopy2k posted Thu, 10 January 2008 at 4:38 PM

I will take a look Phil.  Thanks very much for the kick-start.  And I've been using your show pop on/off script for a week or so svdl.  It is useful as well, though i never really notice the diff once rendered (as the original thread suggested).  I just use it to look for missing patches.