I’ve been working on a way to enable animation export for the existing wavefront export script, and with some alterations to the newFName function, removal of the file selector function, and the addition of a while loop I got the initial one to work (saved under a different name so I didn’t ruin the default one).
I’ve decided to add a GUI so I can choose to export a single frame or an entire animation, and I keep running into errors with the animation export:
import Blender from Blender import * from Blender import Draw from Blender.Draw import * from Blender.BGL import * from OBJExport import * anim = 0 mystr = "Still" desc = "Export single frame" sFrame = Get('curframe') eFrame = Get('endframe') def event(evt,val): """if evt == ESCKEY: Exit()""" def button_event(evt): global anim, mystr,sFrame,eFrame if evt == 1: anim = 1 - anim Redraw(1) if evt == 2: if anim: while sFrame <= eFrame: print "Saving file ", sFrame, " of ",eFrame save_obj(newFName('.obj')) sFrame = Set('curframe',sFrame+1) else: print "Saving file" save_obj(newFName('.obj')) if evt == 3: Exit() def gui(): global anim, mystr,sFrame if anim: mystr = "Animate" desc = "Export animation" else: mystr = "Still" desc = "Export single frame" Toggle(str(mystr),1,32,730,64,32,anim,desc) PushButton("Export",2,98,730,64,32) PushButton("Exit",3,162,730,64,32) Register(gui,event,button_event)
The problem is in the Set(‘curtime’) function. I can’t remember exactly what it says, and I can’t reproduce it since I’m not on my development computer, but it’s something about type being none. I had the Set(curframe) function working earlier, but I lost it when I reverted it to the original file.