def load_sculptie(filename): time1 = Blender.sys.time() Blender.SaveUndoState("Import Sculptie") #print "--------------------------------" print 'Importing "%s"' % filename scene = Blender.Scene.GetCurrent() for ob in scene.objects.selected: ob.sel = False in_editmode = Blender.Window.EditMode() # MUST leave edit mode before changing an active mesh: if in_editmode: Blender.Window.EditMode(0) else: try: in_editmode = Blender.Get('add_editmode') except: pass f, e = Blender.sys.splitext(filename) e = e.lower() if e == '.dae': import_collada(filename) elif e == '.obj': import_obj(filename) else: try: ob = sculpty.open(filename) except: Blender.Draw.PupBlock("Sculptie Import Error", ["Unsupported file type", "Use .dae or an image file"]) if in_editmode: Blender.Window.EditMode(1) Blender.Redraw() print 'Loaded Sculptmap "%s" in %.4f sec.' % ( filename, (Blender.sys.time() - time1))
def load_sculptie(filename): time1 = Blender.sys.time() Blender.SaveUndoState("Import Sculptie") #print "--------------------------------" print 'Importing "%s"' % filename scene = Blender.Scene.GetCurrent() for ob in scene.objects.selected: ob.sel = False in_editmode = Blender.Window.EditMode() # MUST leave edit mode before changing an active mesh: if in_editmode: Blender.Window.EditMode(0) else: try: in_editmode = Blender.Get('add_editmode') except: pass f, e = Blender.sys.splitext(filename) e = e.lower() if e == '.dae': import_collada(filename) elif e == '.obj': import_obj(filename) else: try: ob = sculpty.open(filename) except: Blender.Draw.PupBlock( "Sculptie Import Error", ["Unsupported file type", "Use .dae or an image file"]) if in_editmode: Blender.Window.EditMode(1) Blender.Redraw() print 'Loaded Sculptmap "%s" in %.4f sec.' % (filename, (Blender.sys.time() - time1))
def load_sculptie(filename): time1 = Blender.sys.time() Blender.SaveUndoState( "Import Sculptie" ) print "--------------------------------" print 'Importing "%s"' % filename in_editmode = Blender.Window.EditMode() # MUST leave edit mode before changing an active mesh: if in_editmode: Blender.Window.EditMode(0) else: try: in_editmode = Blender.Get('add_editmode') except: pass ob = sculpty.open( filename ) if in_editmode: Blender.Window.EditMode(1) Blender.Redraw() print 'finished importing: "%s" in %.4f sec.' % (filename, (Blender.sys.time()-time1))