def load(self): nodes = [] for sequence in self.parent.edit["sequences"]: for shot in self.parent.edit[sequence]["shots"]: editShot = self.parent.edit[sequence][shot] storyboard = [] animatic = [] spec = ueSpec.Spec(os.getenv("PROJ"), sequence, shot, "sb", "storyboard", "master") storyboard = ueAssetUtils.getVersions(spec) if storyboard: path = os.path.join(storyboard[-1]["path"], storyboard[-1]["file_name"] + ".jpg") spec.eltype = "animatic" spec.elclass = "an" animatic = ueAssetUtils.getVersions(spec) if animatic: path = os.path.join( animatic[-1]["path"], animatic[-1]["file_name"] + ".####.jpeg") elif shot == "black": path = os.path.join(os.getenv("UE_PATH"), "lib", "placeholders", "black.png") elif shot == "white": path = os.path.join(os.getenv("UE_PATH"), "lib", "placeholders", "white.png") else: path = os.path.join(os.getenv("UE_PATH"), "lib", "placeholders", "nuke.png") commands.addSource(path, None) sourceNode = commands.nodesOfType("RVSourceGroup")[-1] if storyboard and not animatic: retimeNode = commands.newNode( "RVRetimeGroup", "%s_%sRetime" % (sequence, shot)) commands.setNodeInputs(retimeNode, [sourceNode]) time = float(editShot["endFrame"]) - float( editShot["startFrame"]) + 1 commands.setFloatProperty( "%s_retime.visual.scale" % retimeNode, [float(time)], False) node = retimeNode else: node = sourceNode nodes.append(node) commands.setNodeInputs("defaultSequence", nodes) commands.setViewNode("defaultSequence")
def addLayer(self): """docstring for fname""" stacks = commands.nodesOfType("RVStackGroup") commands.setViewNode( stacks[0] ) layer = self._selectedRender version = self._selectedVersion sqfFil = sqf.sequenceFile( layer + '/' + version + '/' + self._selectedLayer + '.exr' ) asd = commands.addSourceVerbose( [layer + '/' + version + '/' + self._selectedLayer + '.' + str(sqfFil.start) + '-' + str(sqfFil.end) + '#.exr'], None ) assGroup = commands.nodeGroup(asd) commands.setStringProperty(assGroup + '.ui.name', [self._selectedShot.name + ' - ' + self._selectedLayer + ' - ' + version]) item = QtGui.QListWidgetItem(self._selectedShot.name + ' - ' + self._selectedLayer + ' - ' + version ) item.setCheckState( QtCore.Qt.Checked ) item.setData(32, [asd, [sqfFil, self._selectedShot, self._selectedLayer, version ]] ) self.viewLayers_lw.addItem( item )
def load(self): nodes = [] for sequence in self.parent.edit["sequences"]: for shot in self.parent.edit[sequence]["shots"]: editShot = self.parent.edit[sequence][shot] storyboard = [] animatic = [] spec = ueSpec.Spec(os.getenv("PROJ"), sequence, shot, "sb", "storyboard", "master") storyboard = ueAssetUtils.getVersions(spec) if storyboard: path = os.path.join(storyboard[-1]["path"], storyboard[-1]["file_name"]+".jpg") spec.eltype = "animatic" spec.elclass = "an" animatic = ueAssetUtils.getVersions(spec) if animatic: path = os.path.join(animatic[-1]["path"], animatic[-1]["file_name"]+".####.jpeg") elif shot == "black": path = os.path.join(os.getenv("UE_PATH"), "lib", "placeholders", "black.png") elif shot == "white": path = os.path.join(os.getenv("UE_PATH"), "lib", "placeholders", "white.png") else: path = os.path.join(os.getenv("UE_PATH"), "lib", "placeholders", "nuke.png") commands.addSource(path, None) sourceNode = commands.nodesOfType("RVSourceGroup")[-1] if storyboard and not animatic: retimeNode = commands.newNode("RVRetimeGroup", "%s_%sRetime" % (sequence, shot)) commands.setNodeInputs(retimeNode, [sourceNode]) time = float(editShot["endFrame"])-float(editShot["startFrame"])+1 commands.setFloatProperty("%s_retime.visual.scale" % retimeNode, [float(time)], False) node = retimeNode else: node = sourceNode nodes.append(node) commands.setNodeInputs("defaultSequence", nodes) commands.setViewNode("defaultSequence")
def expand_sources(self): """ Expand any movie movieproc otioFile sources. """ # disable caching for load speed cache_mode = commands.cacheMode() commands.setCacheMode(commands.CacheOff) try: # find sources with a movieproc with an otioFile=foo.otio tag default_inputs, _ = commands.nodeConnections('defaultSequence') for src in commands.nodesOfType('RVSource'): src_group = commands.nodeGroup(src) if src_group not in default_inputs: # not in default sequence, already processed continue # get the source file name paths = [ info['file'] for info in commands.sourceMediaInfoList(src) if 'file' in info ] for info_path in paths: # Looking for: 'blank,otioFile=/foo.otio.movieproc' parts = info_path.split("=", 1) itype = parts[0] if not itype.startswith('blank,otioFile'): continue # remove the .movieproc extension path, _ = os.path.splitext(parts[1]) # remove temp movieproc source from current view, and all # the default views _remove_source_from_views(src_group) result = otio_reader.read_otio_file(path) commands.setViewNode(result) break finally: # turn cache mode back on and go back to sleep commands.setCacheMode(cache_mode) self.mode = Mode.sleeping
def toggle_wipes(self, var): """ If there is multiple media sources, then toggle both over mode and wipes on/off, otherwise default back to standard wipe toggling behavior. """ if len(commands.sources()) > 1: wipe_shown = runtime.eval("rvui.wipeShown();", ["rvui"]) wipe_shown = int(str(wipe_shown)) # if Wipes are on, turn them off and vice versa if wipe_shown == commands.CheckedMenuState: # turn wipes off runtime.eval("rvui.toggleWipe();", ["rvui"]) # make sure we're in "Sequence" mode commands.setViewNode("defaultSequence") extra_commands.displayFeedback("Wipes OFF", 5.0) else: # make sure we're in "Over" mode commands.setViewNode("defaultStack") # turn wipes on runtime.eval("rvui.toggleWipe();", ["rvui"]) extra_commands.displayFeedback("Wipes ON", 5.0) else: extra_commands.displayFeedback("Can't wipe, only one source", 5.0)
def add_audio(self, event): """Ask the user for a file and add it as audio to the currently selected sequences.""" # The idea here is to use RVs stack to create two "tracks". The first input will be a # sequence of all the current sources, and the second the selected audio file. selected_files = commands.openMediaFileDialog(False, commands.OneExistingFile, "", "", "") # Find all the sources connected to the current sequence, and save them for later. current_sources = [] current_sequence = commands.viewNode() inputs, _ = commands.nodeConnections(current_sequence, False) for node in inputs: if commands.nodeType(node) == "RVSourceGroup": current_sources.append(node) # Create a new source for the selected file. We'll do this here to fail early # and not leave junk nodes laying around. audio_source = commands.addSourceVerbose([selected_files[0]], "") audio_group = commands.nodeGroup(audio_source) # Create a new sequence and connect the sources. We're assuming here that the current sequence # is the default sequence, which always contains all sources known to RV. We'll need our own copy # since we want to keep the audio out of our "video track". sequence = commands.newNode("RVSequenceGroup", "SequenceForAudioStack") commands.setNodeInputs(sequence, current_sources) # Create the stack and connect the two sources. stack = commands.newNode("RVStackGroup", "StackWithAudio") commands.setNodeInputs(stack, [sequence, audio_group]) # Find the actual stack node and configure it to to use the topmost # source (no compositing) and only the audio we just loaded. This should mean # that if the user selects a file containing both audio and video as the audio # source, they will still get the expected result. for node in commands.nodesInGroup(stack): if commands.nodeType(node) == "RVStack": commands.setStringProperty("%s.composite.type" % (node), ["topmost"], False) commands.setStringProperty("%s.output.chosenAudioInput" % (node), [audio_group], False) break commands.setViewNode(stack)