def exportAnimPackage(self, palName, shotName): """doc""" # get version info from [xgDogTag] version = self.getAnimBranch(palName) if not version: pm.error('[XGen Hub] : Couldn\'t get ANIM branch name. Export process stop.') return None self.clearPreview() # add shotName attribute to xgen and save in xgen delta later if not xg.attrExists(self.xgShotAttr, palName): xg.addCustomAttr(self.xgShotAttr, palName) xg.setAttr(self.xgShotAttr, shotName, palName) # add nucleus startFrame attribute to xgen and save in xgen delta later if not xg.attrExists(self.xgRefFrame, palName): xg.addCustomAttr(self.xgRefFrame, palName) xg.setAttr(self.xgRefFrame, str(int(pm.PyNode('nucleus1').startFrame.get())), palName) # get resolved repo shotName path deltaPath = self.paletteDeltaDir(palName, version, shotName) if not os.path.exists(deltaPath): os.mkdir(deltaPath) deltaFile = '/'.join([deltaPath, palName + '.xgd']) # export delta xg.createDelta(palName, deltaFile) # get curves and export for desc in xg.descriptions(palName): curvesGrp = pm.ls(desc + '_hairSystemOutputCurves', type= 'transform') if curvesGrp and curvesGrp[0].listRelatives(): curves = curvesGrp[0].listRelatives() # cache curves, export as alembic if not pm.pluginInfo('AbcExport', q= 1, l= 1): pm.loadPlugin('AbcExport') start, end = self.getTimeSliderMinMax() abcCmds = '-frameRange %d %d -uvWrite -worldSpace -dataFormat ogawa ' % (start, end) abcRoot = '-root ' + ' -root '.join([cur.longName() for cur in pm.ls(curves)]) abcPath = '/'.join([deltaPath, desc + '.abc']) pm.mel.AbcExport(j= abcCmds + abcRoot + ' -file ' + abcPath) # export snapshot for i in range(5): tmpPath = self.snapshotTmp % (i+1) if os.path.isfile(tmpPath): imgPath = self.snapshotImgPath(palName, version, str(i+1), shotName) if not os.path.exists(os.path.dirname(imgPath)): os.mkdir(os.path.dirname(imgPath)) shutil.move(tmpPath, imgPath) self.refresh('Full') self.notifyMsg('Anim Result Export Complete !', 0) return True
def disable_in_camera_only(palette): """ Args: palette (str): XGen Legacy palette name """ palette = str(palette) for description in list_descriptions(palette): prev = xg.getActive(palette, description, "Previewer") if xg.attrExists("inCameraOnly", palette, description, prev): xg.setAttr("inCameraOnly", "false", palette, description, prev)
def disable_tube_shade(palette): """ Args: palette (str): XGen Legacy palette name """ palette = str(palette) for description in list_descriptions(palette): prim = xg.getActive(palette, description, "Primitive") if xg.attrExists("tubeShade", palette, description, prim): xg.setAttr("tubeShade", "false", palette, description, prim)