def addChan(self, chan_file, channels, start_frame = 1): ''' channels = 'tx ty tz rx ry rz focal' for camera ''' self.node.parm('start_frame').set(start_frame) if hcore.job() in chan_file: chan_file = chan_file.replace(hcore.job(), '$JOB') chop = self.node.createNode('chopnet') chop.moveToGoodPosition() # Create file node to load .chan file file_node = chop.createNode('file') file_node.parm('file').set(chan_file) # file_node.setUnloadFlag(True) # Create rename node to change the chan channels to camera channels choprename = chop.createNode('rename') choprename.moveToGoodPosition() choprename.parm('renameto').set(channels) choprename.setFirstInput(file_node) chopshift = chop.createNode('shift') chopshift.moveToGoodPosition() chopshift.parm('start').setExpression('(ch("../../start_frame") - 1)/$FPS') chopshift.setFirstInput(choprename) # Create export node to export channels to camera chopexport = chop.createNode('export') chopexport.moveToGoodPosition() chopexport.parm('nodepath').set('../../../%s' % self.node.name()) chopexport.parm('path').set(channels) chopexport.setFirstInput(chopshift) chopexport.setExportFlag(True)
def addGeo(self, geo_file): if hcore.job() in geo_file: geo_file = geo_file.replace(hcore.job(), '$JOB') geo_file.replace('\\', '/') fileNode = self.node.createNode('file') fileNode.parm('file').set(geo_file) fileNode.setDisplayFlag(True) fileNode.setRenderFlag(True)
def addMDD(self, mdd_file, start_frame = None): if hcore.job() in mdd_file: mdd_file = mdd_file.replace(hcore.job(), '$JOB') mdd_file.replace('\\', '/') file_node = self.node.displayNode() mdd_node = self.node.createNode('mdd') mdd_node.setFirstInput(file_node) mdd_node.moveToGoodPosition() mdd_node.parm('file').set(mdd_file) mdd_node.parm('coordsys').set(0) if start_frame != None: mdd_node.parm('frame').setExpression('$FF - %d' % (start_frame - 1)) facet_node = self.node.createNode('facet') facet_node.setFirstInput(mdd_node) facet_node.moveToGoodPosition() facet_node.parm('postnml').set(1) facet_node.setDisplayFlag(True) facet_node.setRenderFlag(True) return True