Forum: Poser Python Scripting


Subject: Script for setting U/V_Scale of image maps in current figure/actor (nearly done)

3dcheapskate opened this issue on Mar 01, 2012 · 18 posts


3dcheapskate posted Sat, 03 March 2012 at 8:04 PM

No joy, tried that already - same problem! Just to be sure I edited the cut-down script from the previous post...

import poser
fig = poser.Scene().CurrentFigure()
act = poser.Scene().CurrentActor()
mat = poser.Scene().CurrentMaterial()
mats=[]     # It was picking up previous mats?
if act and not fig:
    yn = poser.DialogSimple.YesNo(" Current Actor: "+str(act.Name())+"nnChange all materials for this actor?")
    if yn == 0:
        act = None
    else:
        try:
**            mats = act.Materials()**
**        except poser.error:**
**            poser.DialogSimple.MessageBox("error")**
**            mats = None**
    
poser.DialogSimple.MessageBox("Check if mats is None")
if mats is None:
    poser.DialogSimple.MessageBox("mats is None")
else:
    poser.DialogSimple.MessageBox("mats isn't None")

...sure enough, same problem. Note: the 'except' doesn't catch it either - I don't get the "error" message box. Curiouser and curiouser.

But like I said before, I can work round the problem with this:

if not act.IsCamera():
        mats = act.Materials()
else:
        mats = None

That works. What puzzles me most is that the error doesn't show up until the end of the script. It would be nice (but not essential) to know what the heck is going on here!

(by the way, I'm using Poser 6. Is this just a Poser 6 issue? Can Somebody check the problem in Poser 7/8/9? Just run the cut-down script from my previous posts with no figure in the scene and the Main Camera selected.)


The 3Dcheapskate* occasionally posts sensible stuff. Usually by accident.
And it usually uses Poser 11, with units set to inches. Except when it's using Poser 6 or PP2014, or when its units are set to PNU.

*also available in ShareCG, DAZ, and HiveWire3D flavours (the DeviantArt and CGBytes flavour have been discontinued).