def buildScript(self): """ Override the default buildScript functionality to also output a temp movie file if needed for uploading to Shotgun """ # Build the usual script FnTranscodeExporter.TranscodeExporter.buildScript(self) # If we are not creating a version then we do not need the extra node if not self._preset.properties()['create_version']: return if self._preset.properties()['file_type'] in ["mov", "ffmpeg"]: # already outputting a mov file, use that for upload self._quicktime_path = self.resolvedExportPath() self._temp_quicktime = False return self._quicktime_path = os.path.join(tempfile.mkdtemp(), 'preview.mov') self._temp_quicktime = True nodeName = "Shotgun Screening Room Media" framerate = None if self._sequence: framerate = self._sequence.framerate() if self._clip.framerate().isValid(): framerate = self._clip.framerate() preset = FnTranscodeExporter.TranscodePreset("Qt Write", self._preset.properties()) # insert the write node to generate the quicktime file_type, properties = self.app.execute_hook( "hook_get_quicktime_settings", for_shotgun=True) preset.properties().update({ "file_type": file_type, file_type: properties, }) mov_write_node = FnExternalRender.createWriteNode( self._quicktime_path, preset, nodeName, framerate=framerate, projectsettings=self._projectSettings) self._script.addNode(mov_write_node)
def buildScript(self): """ Override the default buildScript functionality to also output a temp movie file if needed for uploading to Shotgun """ # Build the usual script FnTranscodeExporter.TranscodeExporter.buildScript(self) if self._preset.properties()['file_type'] == 'mov': # already outputting a mov file, use that for upload self._quicktime_path = self.resolvedExportPath() self._temp_quicktime = False return self._quicktime_path = os.path.join(tempfile.mkdtemp(), 'preview.mov') self._temp_quicktime = True nodeName = "Shotgun Screening Room Media" framerate = None if self._sequence: framerate = self._sequence.framerate() if self._clip.framerate().isValid(): framerate = self._clip.framerate() preset = FnTranscodeExporter.TranscodePreset("Qt Write", self._preset.properties()) preset.properties().update({ 'file_type': u'mov', 'mov': { 'codec': 'avc1\tH.264', 'quality': 3, 'settingsString': 'H.264, High Quality', 'keyframerate': 1, } }) movWriteNode = FnExternalRender.createWriteNode( self._quicktime_path, preset, nodeName, framerate=framerate, projectsettings=self._projectSettings) self._script.addNode(movWriteNode)
def buildScript(self): """ Override the default buildScript functionality to also output a temp movie file if needed for uploading to Shotgun """ # Build the usual script FnTranscodeExporter.TranscodeExporter.buildScript(self) # If we are not creating a version then we do not need the extra node if not self._preset.properties()['create_version']: return if self._preset.properties()['file_type'] in ["mov", "ffmpeg"]: # already outputting a mov file, use that for upload self._quicktime_path = self.resolvedExportPath() self._temp_quicktime = False return self._quicktime_path = os.path.join(tempfile.mkdtemp(), 'preview.mov') self._temp_quicktime = True nodeName = "Shotgun Screening Room Media" framerate = None if self._sequence: framerate = self._sequence.framerate() if self._clip.framerate().isValid(): framerate = self._clip.framerate() preset = FnTranscodeExporter.TranscodePreset("Qt Write", self._preset.properties()) # insert the write node to generate the quicktime file_type, properties = self.app.execute_hook("hook_get_quicktime_settings", for_shotgun=True) preset.properties().update({ "file_type": file_type, file_type: properties, }) mov_write_node = FnExternalRender.createWriteNode(self._quicktime_path, preset, nodeName, framerate=framerate, projectsettings=self._projectSettings) self._script.addNode(mov_write_node)
def buildScript(self): """ Override the default buildScript functionality to also output a temp movie file if needed for uploading to Shotgun """ # Build the usual script FnTranscodeExporter.TranscodeExporter.buildScript(self) if self._preset.properties()['file_type'] == 'mov': # already outputting a mov file, use that for upload self._quicktime_path = self.resolvedExportPath() self._temp_quicktime = False return self._quicktime_path = os.path.join(tempfile.mkdtemp(), 'preview.mov') self._temp_quicktime = True nodeName = "Shotgun Screening Room Media" framerate = None if self._sequence: framerate = self._sequence.framerate() if self._clip.framerate().isValid(): framerate = self._clip.framerate() preset = FnTranscodeExporter.TranscodePreset("Qt Write", self._preset.properties()) preset.properties().update({ 'file_type': u'mov', 'mov': { 'codec': 'avc1\tH.264', 'quality': 3, 'settingsString': 'H.264, High Quality', 'keyframerate': 1, } }) movWriteNode = FnExternalRender.createWriteNode(self._quicktime_path, preset, nodeName, framerate=framerate, projectsettings=self._projectSettings) self._script.addNode(movWriteNode)
def buildScript(self): """ Override the default buildScript functionality to also output a temp movie file if needed for uploading to Shotgun """ # This is a bit of a hack to account for some changes to the # transcode exporter that ships with Nuke/Hiero 9.0 compared # to earlier versions of Hiero. file_type = self._preset.properties()['file_type'] if file_type in ["mov", "ffmpeg"]: if not self._preset.properties()[file_type].get("encoder"): encoder_name = self.app.get_default_encoder_name() self._preset.properties()[file_type]["encoder"] = encoder_name # Build the usual script FnTranscodeExporter.TranscodeExporter.buildScript(self) # If we are not creating a version then we do not need the extra node if not self._preset.properties()['create_version']: return if file_type in ["mov", "ffmpeg"]: # already outputting a mov file, use that for upload self._quicktime_path = self.resolvedExportPath() self._temp_quicktime = False return self._quicktime_path = os.path.join(tempfile.mkdtemp(), 'preview.mov') self._temp_quicktime = True nodeName = "Shotgun Screening Room Media" framerate = None if self._sequence: framerate = self._sequence.framerate() if self._clip.framerate().isValid(): framerate = self._clip.framerate() preset = FnTranscodeExporter.TranscodePreset("Qt Write", self._preset.properties()) # insert the write node to generate the quicktime file_type, properties = self.app.execute_hook( "hook_get_quicktime_settings", for_shotgun=True) self.app.log_info("Transcode quicktime settings: %s" % (properties, )) preset.properties().update({ "file_type": file_type, file_type: properties, }) # Sadly Foundry has a habit of changing the interfaces of # their Python classes out from under us, so now we're going # to have to handle this the ugly way, via introspecting the # arguments expected by the createWriteNode method. arg_spec = inspect.getargspec(FnExternalRender.createWriteNode) if "projectsettings" in arg_spec.args: kwargs = dict( path=self._quicktime_path, preset=preset, nodeName=nodeName, framerate=framerate, projectsettings=self._projectSettings, ) elif "ctx" in arg_spec.args: kwargs = dict( ctx=self, path=self._quicktime_path, preset=preset, nodeName=nodeName, framerate=framerate, project=self._project, ) else: kwargs = dict( path=self._quicktime_path, preset=preset, nodeName=nodeName, framerate=framerate, project=self._project, ) mov_write_node = FnExternalRender.createWriteNode(**kwargs) self._script.addNode(mov_write_node)
def buildScript(self): """ Override the default buildScript functionality to also output a temp movie file if needed for uploading to Shotgun """ # This is a bit of a hack to account for some changes to the # transcode exporter that ships with Nuke/Hiero 9.0 compared # to earlier versions of Hiero. file_type = self._preset.properties()['file_type'] self.app.log_debug("Transcode export file_type: %s" % file_type) if file_type in ["mov", "ffmpeg"]: if not self._preset.properties()[file_type].get("encoder"): encoder_name = self.app.get_default_encoder_name() self._preset.properties()[file_type]["encoder"] = encoder_name # Build the usual script using the base code FnTranscodeExporter.TranscodeExporter.buildScript(self) self.app.log_debug("Transcode base script built") # If we are not creating a version then we do not need the extra node if not self._preset.properties()['create_version']: return if file_type in ["mov", "ffmpeg"]: # already outputting a mov file, use that for upload self._quicktime_path = self.resolvedExportPath() self._temp_quicktime = False return self._quicktime_path = os.path.join(tempfile.mkdtemp(), 'preview.mov') self._temp_quicktime = True nodeName = "Shotgun Screening Room Media" framerate = None if self._sequence: framerate = self._sequence.framerate() if self._clip.framerate().isValid(): framerate = self._clip.framerate() preset = FnTranscodeExporter.TranscodePreset("Qt Write", self._preset.properties()) # insert the write node to generate the quicktime file_type, properties = self.app.execute_hook( "hook_get_quicktime_settings", for_shotgun=True, base_class=HieroGetQuicktimeSettings, ) self.app.log_info("Transcode quicktime settings: %s" % (properties,)) preset.properties().update({ "file_type": file_type, file_type: properties, }) # Sadly Foundry has a habit of changing the interfaces of # their Python classes out from under us, so now we're going # to have to handle this the ugly way, via introspecting the # arguments expected by the createWriteNode method. arg_spec = inspect.getargspec(FnExternalRender.createWriteNode) if "projectsettings" in arg_spec.args: kwargs = dict( path=self._quicktime_path, preset=preset, nodeName=nodeName, framerate=framerate, projectsettings=self._projectSettings, ) elif "ctx" in arg_spec.args: kwargs = dict( ctx=self, path=self._quicktime_path, preset=preset, nodeName=nodeName, framerate=framerate, project=self._project, ) else: kwargs = dict( path=self._quicktime_path, preset=preset, nodeName=nodeName, framerate=framerate, project=self._project, ) mov_write_node = FnExternalRender.createWriteNode(**kwargs) # We create a push node and connect it to the set node we created just before the base write node was created # This means that our write node will parent to the same node the base write node gets parented to. push_command = nuke.PushNode(self._write_set_node_label) self._script.addNode(push_command) self._script.addNode(mov_write_node)
def buildScript(self): """ Override the default buildScript functionality to also output a temp movie file if needed for uploading to Shotgun """ # This is a bit of a hack to account for some changes to the # transcode exporter that ships with Nuke/Hiero 9.0 compared # to earlier versions of Hiero. file_type = self._preset.properties()['file_type'] if file_type in ["mov", "ffmpeg"]: self._preset.properties()[file_type]["encoder"] = "mov32" # Build the usual script FnTranscodeExporter.TranscodeExporter.buildScript(self) # If we are not creating a version then we do not need the extra node if not self._preset.properties()['create_version']: return if file_type in ["mov", "ffmpeg"]: # already outputting a mov file, use that for upload self._quicktime_path = self.resolvedExportPath() self._temp_quicktime = False return self._quicktime_path = os.path.join(tempfile.mkdtemp(), 'preview.mov') self._temp_quicktime = True #KOJO removing extra write node, using ffmpeg as a post render script nodeName = "Shotgun Screening Room Media" framerate = None if self._sequence: framerate = self._sequence.framerate() if self._clip.framerate().isValid(): framerate = self._clip.framerate() preset = FnTranscodeExporter.TranscodePreset("Qt Write", self._preset.properties()) # insert the write node to generate the quicktime file_type, properties = self.app.execute_hook("hook_get_quicktime_settings", for_shotgun=True) preset.properties().update({ "file_type": file_type, file_type: properties, }) # Sadly Foundry has a habit of changing the interfaces of # their Python classes out from under us, so now we're going # to have to handle this the ugly way, via introspecting the # arguments expected by the createWriteNode method. arg_spec = inspect.getargspec(FnExternalRender.createWriteNode) if "projectsettings" in arg_spec.args: kwargs = dict( path=self._quicktime_path, preset=preset, nodeName=nodeName, framerate=framerate, projectsettings=self._projectSettings, ) elif "ctx" in arg_spec.args: kwargs = dict( ctx=self, path=self._quicktime_path, preset=preset, nodeName=nodeName, framerate=framerate, project=self._project, ) else: kwargs = dict( path=self._quicktime_path, preset=preset, nodeName=nodeName, framerate=framerate, project=self._project, ) mov_write_node = FnExternalRender.createWriteNode(**kwargs) #self._script.addNode(mov_write_node) #Kojo: using ffmpeg as a post render script self.app.log_debug(dir(mov_write_node)) nodes = self._script.getNodes() for x in nodes: if x.type() == 'Write': x.setKnob('afterRender',"sendToFFmpeg('%s')" %(self._quicktime_path.replace('\\','/')))