Exemple #1
0
def _create_track(in_seq, context=None):
    context = context or {}

    new_seq = commands.newNode("RVSequenceGroup", str(in_seq.name or "track"))
    extra_commands.setUIName(new_seq, str(in_seq.name or "track"))

    items_to_serialize = otio.algorithms.track_with_expanded_transitions(
        in_seq)

    with set_context(context, track_kind=in_seq.kind):
        new_inputs = []
        for thing in items_to_serialize:
            if isinstance(thing, tuple):
                result = _create_transition(*thing, context=context)
            elif thing.duration().value == 0:
                continue
            else:
                result = create_rv_node_from_otio(thing, context)

            if result:
                new_inputs.append(result)

        commands.setNodeInputs(new_seq, new_inputs)
        _add_metadata_to_node(in_seq, new_seq)

    return new_seq
Exemple #2
0
def _remove_source_from_views(source_group):
    """
    Remove a source group from all views.
    """
    for view in commands.viewNodes():
        view_inputs = commands.nodeConnections(view)[0]
        if source_group in view_inputs:
            view_inputs.remove(source_group)
            commands.setNodeInputs(view, view_inputs)
Exemple #3
0
	def changeOrder(self):
		"""docstring for changeOrder"""
		sources = []
		for i in range( self.viewLayers_lw.count() ):
			item = self.viewLayers_lw.item( i )
			sourNode = item.data(32)[0]
			assGroup = commands.nodeGroup(sourNode)
			sources.append( str( assGroup ) )
		commands.setNodeInputs("defaultStack", sources)
Exemple #4
0
    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")
Exemple #5
0
def _create_stack(in_stack, context=None):
    new_stack = commands.newNode("RVStackGroup", in_stack.name or "tracks")
    extra_commands.setUIName(new_stack, str(in_stack.name or "tracks"))

    new_inputs = []
    for seq in in_stack:
        result = create_rv_node_from_otio(seq, context)
        if result:
            new_inputs.append(result)

    commands.setNodeInputs(new_stack, new_inputs)
    _add_metadata_to_node(in_stack, new_stack)
    return new_stack
def _create_dissolve(pre_item, in_dissolve, post_item, track_kind=None):
    rv_trx = commands.newNode("CrossDissolve", in_dissolve.name or "dissolve")
    extra_commands.setUIName(rv_trx, str(in_dissolve.name or "dissolve"))

    commands.setFloatProperty(rv_trx + ".parameters.startFrame", [1.0], True)

    num_frames = (in_dissolve.in_offset + in_dissolve.out_offset).rescaled_to(
        pre_item.trimmed_range().duration.rate
    ).value

    commands.setFloatProperty(rv_trx + ".parameters.numFrames",
                              [float(num_frames)],
                              True)

    commands.setFloatProperty(rv_trx + ".output.fps",
                              [float(pre_item.trimmed_range().duration.rate)],
                              True)

    pre_item_rv = create_rv_node_from_otio(pre_item, track_kind)

    post_item_rv = create_rv_node_from_otio(post_item, track_kind)

    node_to_insert = post_item_rv

    if (
        hasattr(pre_item, "media_reference") and
        pre_item.media_reference and
        pre_item.media_reference.available_range and
        hasattr(post_item, "media_reference") and
        post_item.media_reference and
        post_item.media_reference.available_range and
        (
            post_item.media_reference.available_range.start_time.rate !=
            pre_item.media_reference.available_range.start_time.rate
        )
    ):
        # write a retime to make sure post_item is in the timebase of pre_item
        rt_node = commands.newNode("Retime", "transition_retime")
        rt_node.setTargetFps(
            pre_item.media_reference.available_range.start_time.rate
        )

        post_item_rv = create_rv_node_from_otio(post_item, track_kind)

        rt_node.addInput(post_item_rv)
        node_to_insert = rt_node

    commands.setNodeInputs(rv_trx, [pre_item_rv, node_to_insert])
    _add_metadata_to_node(in_dissolve, rv_trx)
    return rv_trx
Exemple #7
0
Fichier : EditUI.py Projet : hdd/ue
    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")
Exemple #8
-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)