Example #1
0
def _set_lut_1d(proc, nodename, size = 1024):
    # TODO: Use allocation vars also

    # Make noop ramp
    def gen_noop_ramp(size):
        size_minus_one = float(size-1)
        for x in range(size):
            val = x/size_minus_one
            for i in range(3):
                yield val

    ramp_raw = gen_noop_ramp(size = size)

    # Apply transform
    # TODO: Make applyRGB accept an iterable, rather than requiring a
    # list, to avoid making the intermediate list
    ramp_transformed = proc.applyRGB(ramp_raw)

    # Set LUT type and size, then LUT values
    setStringProperty("%s.lut.type" % nodename, ["RGB"], False)
    setIntProperty("%s.lut.size" % nodename, [size], False)
    setFloatProperty("%s.lut.lut" % nodename, ramp_transformed, True)

    # Activate
    setIntProperty("%s.lut.active" % nodename, [1], False)
Example #2
0
def _set_lut_1d(proc, nodename, size=1024):
    # TODO: Use allocation vars also

    # Make noop ramp
    def gen_noop_ramp(size):
        size_minus_one = float(size - 1)
        for x in range(size):
            val = x / size_minus_one
            for i in range(3):
                yield val

    ramp_raw = gen_noop_ramp(size=size)

    # Apply transform
    # TODO: Make applyRGB accept an iterable, rather than requiring a
    # list, to avoid making the intermediate list
    ramp_transformed = proc.applyRGB(ramp_raw)

    # Set LUT type and size, then LUT values
    setStringProperty("%s.lut.type" % nodename, ["RGB"], False)
    setIntProperty("%s.lut.size" % nodename, [size], False)
    setFloatProperty("%s.lut.lut" % nodename, ramp_transformed, True)

    # Activate
    setIntProperty("%s.lut.active" % nodename, [1], False)
Example #3
0
def _add_metadata_to_node(item, rv_node):
    """
    Add metadata from otio "item" to rv_node
    """
    if item.metadata:
        otio_metatada_property = rv_node + ".otio.metadata"
        commands.newProperty(otio_metatada_property, commands.StringType, 1)
        commands.setStringProperty(otio_metatada_property,
                                   [str(item.metadata)], True)
Example #4
0
def _add_metadata_to_node(item, rv_node):
    """
    Add metadata from otio "item" to rv_node
    """
    if item.metadata:
        otio_metadata_property = rv_node + ".otio.metadata"
        otio_metadata = otio.core.serialize_json_to_string(item.metadata,
                                                           indent=-1)
        commands.newProperty(otio_metadata_property, commands.StringType, 1)
        commands.setStringProperty(otio_metadata_property, [otio_metadata],
                                   True)
Example #5
0
	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 )
Example #6
0
def _set_lut_3d(proc, nodename, size = 32):
    # FIXME: This clips with >1 scene-linear values, use allocation
    # vars

    # Make noop cube
    size_minus_one = float(size-1)
    one_axis = (x/size_minus_one for x in range(size))
    cube_raw = itertools.product(one_axis, repeat=3)

    # Unpack and fix ordering, by turning [(0, 0, 0), (0, 0, 1), ...]
    # into [0, 0, 0, 1, 0, 0] as generator
    cube_raw = (item for sublist in cube_raw for item in sublist[::-1])

    # Apply transform
    cube_processed = proc.applyRGB(cube_raw)

    # Set LUT type and size, then LUT values
    setStringProperty("%s.lut.type" % nodename, ["RGB"], False)
    setIntProperty("%s.lut.size" % nodename, [size, size, size], False)
    setFloatProperty("%s.lut.lut" % nodename, cube_processed, True)

    # Activate
    setIntProperty("%s.lut.active" % nodename, [1], False)
Example #7
0
def _set_lut_3d(proc, nodename, size=32):
    # FIXME: This clips with >1 scene-linear values, use allocation
    # vars

    # Make noop cube
    size_minus_one = float(size - 1)
    one_axis = (x / size_minus_one for x in range(size))
    cube_raw = itertools.product(one_axis, repeat=3)

    # Unpack and fix ordering, by turning [(0, 0, 0), (0, 0, 1), ...]
    # into [0, 0, 0, 1, 0, 0] as generator
    cube_raw = (item for sublist in cube_raw for item in sublist[::-1])

    # Apply transform
    cube_processed = proc.applyRGB(cube_raw)

    # Set LUT type and size, then LUT values
    setStringProperty("%s.lut.type" % nodename, ["RGB"], False)
    setIntProperty("%s.lut.size" % nodename, [size, size, size], False)
    setFloatProperty("%s.lut.lut" % nodename, cube_processed, True)

    # Activate
    setIntProperty("%s.lut.active" % nodename, [1], False)
    def source_setup_romeo(self, event, noColorChanges=False):
        """
        Finds all the RV nodes we need to operate on, and does the bulk of the color setup
        dependant on file type.  Also handles finding the default file paths for luts and
        CDLs and storing them in a preferences file so they only have to be picked once.
        
        :param event: event passed in from RV
        :param noColorChanges: 
        """
        #  event.reject() is done to allow other functions bound to
        #  this event to get a chance to modify the state as well. If
        #  its not rejected, the event will be eaten and no other call
        #  backs will occur.

        event.reject()
        
        args             = event.contents().split(";;")
        group            = args[0]
        action           = args[-1]
        file_source      = group_member_of_type(group, "RVFileSource")
        image_source     = group_member_of_type(group, "RVImageSource")
        source           = file_source if image_source == None else image_source
        lin_pipe_node    = group_member_of_type(group, "RVLinearizePipelineGroup")
        lin_node         = group_member_of_type(lin_pipe_node, "RVLinearize")
        look_pipe_node   = group_member_of_type(group, "RVLookPipelineGroup") 
        file_names       = commands.getStringProperty("%s.media.movie" % source)
        
        # make sure our Display is forced to "No Correction"
        self._set_display_to_no_correction(event)
        
        # Modify the Look Pipeline to account for both EXR and QT handling. We put the
        # EXR nodes in the QT pipe and vice versa because there are menu items that depend
        # on the nodes existing that will throw errors if they don't exist.  So we just
        # manage which nodes are active for the particular source types rather than
        # keeping them out of the pipe.
        commands.setStringProperty(
            "%s.pipeline.nodes" % look_pipe_node, 
            ["LinearToAlexaLogC", "RVLookLUT", "LinearToRec709"],
            True
        )
        alexa_node = group_member_of_type(look_pipe_node, "LinearToAlexaLogC")
        look_node = group_member_of_type(look_pipe_node, "RVLookLUT")
        rec709_node = group_member_of_type(look_pipe_node, "LinearToRec709")
        
        for file_name in file_names:
            # if the file is an exr or dpx, handle it accordingly,
            # anything else we don't need to monkey with aside from
            # making sure we force it to sRGB to account for
            # "No Correction" in the display profile
            if os.path.splitext(file_name)[-1].lower() in [".exr", ".dpx"]:
                # check prefs to see if there's a saved directory to 
                # look for shot cdls
                # Use a dictionary instead of a string
                lcl_file_base = os.path.basename(file_name).split('.')[0]
                lcl_lut_path = None
                try:
                    lcl_lut_path = self._look_lut_dict[lcl_file_base]
                except KeyError:
                    lcl_lut_path = self._retrieve_csp_path(file_name)
                    self._look_lut_dict[lcl_file_base] = lcl_lut_path

                # now disable our LinearToSRGB node since that's only
                # in the pipeline for non-EXR files
                commands.setIntProperty("%s.node.active" % rec709_node, [0], True)
                self.do_exr_linearization(lin_node)
                self.do_exr_look_setup(look_node, lcl_lut_path)
            else:
                # if we're not dealing with an EXR just make sure we
                # convert to sRGB to account for the forced display
                # profile
                commands.setIntProperty("%s.node.active" % alexa_node, [0], True)
                commands.setIntProperty("%s.lut.active" % look_node, [0], True)
                commands.setIntProperty("%s.node.active" % rec709_node, [0], True)
Example #9
-1
    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)