andygraph opened this issue on Feb 10, 2014 · 55 posts
structure posted Sun, 30 March 2014 at 9:18 AM Forum Coordinator
this is how I would write it - all the indentations are correct
import poser, os,os.path
scn = poser.Scene()
fig = scn.CurrentFigure()
def ActVisible(act,toggle,frame):
scn.SetFrame(frame)
act.SetVisible(toggle)
def ImportObj(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)
sdir = os.path.join('c:', os.sep , 'users')
frame = 0
myfiles = os.listdir(sdir)
print myfiles
for myfile in myfiles:
if myfile.endswith('.obj'):
cfile = os.path.join(sdir, myfile)
try:
ImportObj(cfile)
act = scn.CurrentActor()
act.SetName(myfile[:-4])
ActVisible(act,1,0)
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 'error on ', myfile
print 'done'
Locked Out