Forum: Poser Python Scripting


Subject: Any idea how enable Animation Toggle option via script ?

andygraph opened this issue on Feb 10, 2014 · 55 posts


andygraph posted Sun, 30 March 2014 at 9:15 AM

error here:

line 7
scn.SetFrame(frame)
^
IndentationError: expected an indented block

 

the script:

obj series importer

import poser, os

scn = poser.Scene()
def ActVisible(act,toggle,frame):
scn.SetFrame(frame)
act.SetVisible(toggle)
fig = scn.CurrentFigure()

sdir = "C:Users"

frame = 0
myfiles = os.listdir(sdir)
print myfiles
for myfile in myfiles:
if myfile[-3:] == "obj":
cfile = os.path.join(sdir, myfile)
try:
print cfile
imex = scn.ImExporter()
options = imex.ImportOptions("obj", None)
options[poser.kImOptCodeMAKEPOLYNORMSCONSISTENT] = 0
options[poser.kImOptCodeOFFSETZ] = 0.0
options[poser.kImOptCodeOFFSETY] = 0.0
options[poser.kImOptCodeOFFSETX] = 0.0
options[poser.kImOptCodeFLIPUTEXTCOORDS] = 0
options[poser.kImOptCodeWELDIDENTICALVERTS] = 0
options[poser.kImOptCodeCENTERED] = 0
options[poser.kImOptCodePERCENTFIGSIZE] = 0
options[poser.kImOptCodeFLIPVTEXTCOORDS] = 0
options[poser.kImOptCodeFLIPNORMS] = 0
options[poser.kImOptCodePLACEONFLOOR] = 0
imex.Import('obj', 'File Format Wavefront', cfile, options)
act = scn.CurrentActor()
act.SetName(myfile[:-4])
ActVisible(act,1,0)
frame = frame + 1
scn.SetFrame(frame)
ActVisible(act,1,frame)
if frame > 2:
scn.SetFrame(frame - 2)
ActVisible(act,0,frame)
scn.SetFrame(frame)
except:
print "t error on ",myfile
print "Done"