def export(self, human, filename): reload(mh2md5) cfg = self.getConfig() cfg.setHuman(human) progress = Progress.begin()(0, 1) mh2md5.exportMd5(filename("md5mesh"), cfg)
def export(self, human, filename): reload(mh2md5) cfg = self.getConfig() cfg.setHuman(human) progress = Progress.begin() (0, 1) mh2md5.exportMd5(filename("md5mesh"), cfg)
def onFileSelected(filename): exportPath = mh.getPath('exports') if not os.path.exists(exportPath): os.makedirs(exportPath) if self.wavefrontObj.selected: if self.exportEyebrows.selected and self.exportDiamonds.selected: filter = None elif self.exportEyebrows.selected: filter = lambda fg: not ('joint' in fg.name or 'helper' in fg.name) elif self.exportDiamonds.selected: filter = lambda fg: not 'eyebrown' in fg.name else: filter = lambda fg: not ('joint' in fg.name or 'helper' in fg.name or 'eyebrown' in fg.name) human = gui3d.app.selectedHuman mesh = human.getSubdivisionMesh() if self.exportSmooth.selected else human.getSeedMesh() mh2obj.exportObj(mesh, os.path.join(exportPath, filename + ".obj"), self.exportGroups.selected, filter) options = { "helpers" : self.exportDiamonds.selected, "eyebrows" : self.exportEyebrows.selected, "lashes" : self.exportLashes.selected, "scale": self.getScale(self.objScales), "pngTexture": True, #self.exportPngTexture.selected } mh2obj_proxy.exportProxyObj(gui3d.app.selectedHuman, os.path.join(exportPath, filename), options) if self.exportSkeleton.selected: mh2bvh.exportSkeleton(human.meshData, os.path.join(exportPath, filename + ".bvh")) if self.exportHair.selected and human.hairObj and human.hairObj.mesh and human.hairObj.mesh.verts: mesh = human.hairObj.getSubdivisionMesh() if self.exportSmooth.selected else human.hairObj.getSeedMesh() mh2obj.exportObj(mesh, os.path.join(exportPath, "hair_" + filename+".obj")) texturePath = os.path.join(exportPath, basename(mesh.texture)) if not os.path.isfile(texturePath): copyfile(mesh.texture, texturePath) texturePath = os.path.join(exportPath, basename(mesh.texture)) if not os.path.isfile(texturePath): copyfile(mesh.texture, texturePath) elif self.mhx.selected: if self.mhxConfig.selected: options = None else: mhxversion = [] if self.version24.selected: mhxversion.append('24') if self.version25.selected: mhxversion.append('25') for (button, rig) in self.mhxRigs: if button.selected: break options = { 'mhxversion':mhxversion, 'expressions':False, #self.exportExpressions.selected, 'expressionunits':self.exportExpressionUnits.selected, 'faceshapes':self.exportFaceShapes.selected, 'bodyshapes':self.exportBodyShapes.selected, 'facepanel':self.exportFacePanel.selected, 'clothes':self.exportClothes.selected, 'cage':self.exportCage.selected, 'separatefolder':self.exportSeparateFolder.selected, 'feetonground':self.exportFeetOnGround.selected, 'advancedspine':self.exportAdvancedSpine.selected, 'malerig':self.exportMaleRig.selected, 'skirtrig':False, #self.exportSkirtRig.selected, 'clothesrig':self.exportClothesRig.selected, 'mhxrig': rig, } mh2mhx.exportMhx(gui3d.app.selectedHuman, os.path.join(exportPath, filename + ".mhx"), options) elif self.collada.selected: for (button, rig) in self.daeRigs: if button.selected: break options = { "daerig": rig, "rotate90X" : self.colladaRot90X.selected, "rotate90Z" : self.colladaRot90Z.selected, "eyebrows" : self.colladaEyebrows.selected, "lashes" : self.colladaLashes.selected, "helpers" : self.colladaHelpers.selected, "scale": self.getScale(self.daeScales), "pngTexture": True, #self.colladaPngTexture.selected } mh2collada.exportCollada(gui3d.app.selectedHuman, os.path.join(exportPath, filename), options) elif self.md5.selected: mh2md5.exportMd5(gui3d.app.selectedHuman.meshData, os.path.join(exportPath, filename + ".md5mesh")) elif self.stl.selected: mesh = gui3d.app.selectedHuman.getSubdivisionMesh() if self.exportSmooth.selected else gui3d.app.selectedHuman.meshData if self.stlAscii.selected: mh2stl.exportStlAscii(mesh, os.path.join(exportPath, filename + ".stl")) else: mh2stl.exportStlBinary(mesh, os.path.join(exportPath, filename + ".stl")) elif self.skel.selected: mesh = gui3d.app.selectedHuman.getSubdivisionMesh() if self.exportSmooth.selected else gui3d.app.selectedHuman.meshData mh2skel.exportSkel(mesh, os.path.join(exportPath, filename + ".skel")) gui3d.app.prompt('Info', u'The mesh has been exported to %s.' % os.path.join(mh.getPath(''), u'exports'), 'OK', helpId='exportHelp') gui3d.app.switchCategory('Modelling')
def export(self, human, filename): import mh2md5 mh2md5.exportMd5(human.meshData, filename("md5mesh"))