Beispiel #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)
Beispiel #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)
Beispiel #3
0
 def changeSat(self):
     property = 'saturation'
     values = [self.saturation.value()]
     try:
         commands.setFloatProperty("%s.color.%s" % (self.node,property), values, True)
     except Exception, e:
         print e
Beispiel #4
0
 def changeRvColorFromSpinBox(self, property):
     change = getattr(self, property)
     rgb = self.getValuesFromList(change)
     try:
         commands.setFloatProperty("%s.color.%s" % (self.node,property), rgb, True)
     except Exception, e:
         print e
Beispiel #5
0
def _create_item(it, context=None):
    context = context or {}
    range_to_read = it.trimmed_range()

    if not range_to_read:
        raise otio.exceptions.OTIOError("No valid range on clip: {0}.".format(
            str(it)))

    new_media = _create_media_reference(it, context)
    if not new_media:
        kind = "smptebars"
        if isinstance(it, otio.schema.Gap):
            kind = "blank"
        new_media = [_create_movieproc(range_to_read, kind)]

    try:
        src = commands.addSourceVerbose(new_media)
    except Exception as e:
        # Perhaps the media was missing, if so, lets load an error
        # source
        print('ERROR: {}'.format(e))
        error_media = _create_movieproc(range_to_read, 'smptebars')
        src = commands.addSourceVerbose([error_media])

    src_group = commands.nodeGroup(src)

    extra_commands.setUIName(src_group, str(it.name or "clip"))

    # Add otio metadata to this group and the source
    _add_metadata_to_node(it, src_group)
    if hasattr(it, "media_reference") and it.media_reference:
        _add_metadata_to_node(it.media_reference, src)

    in_frame = out_frame = None
    if hasattr(it, "media_reference") and it.media_reference:
        if isinstance(it.media_reference, otio.schema.ImageSequenceReference):
            in_frame, out_frame = \
                it.media_reference.frame_range_for_time_range(
                    range_to_read
                )

        _add_source_bounds(it.media_reference, src, context)

    if not in_frame and not out_frame:
        # because OTIO has no global concept of FPS, the rate of the duration
        # is used as the rate for the range of the source.
        in_frame = otio.opentime.to_frames(range_to_read.start_time,
                                           rate=range_to_read.duration.rate)
        out_frame = otio.opentime.to_frames(range_to_read.end_time_inclusive(),
                                            rate=range_to_read.duration.rate)

    commands.setIntProperty(src + ".cut.in", [in_frame])
    commands.setIntProperty(src + ".cut.out", [out_frame])

    commands.setFloatProperty(src + ".group.fps",
                              [float(range_to_read.duration.rate)])

    return src_group
Beispiel #6
0
	def changeLayerVis(self, item):
		"""docstring for changeLayerVis(self, item"""
		sourNode = item.data(32)[0]
		sourceMedia = commands.getStringProperty( sourNode + '.media.movie' )
		trf = extra_commands.associatedNode( 'RVTransform2D', sourNode )
		if item.checkState() == QtCore.Qt.Checked: #TURN ON LAYER
			commands.setFloatProperty( trf + '.transform.scale', [1.0,1.0] )
		else: #TURN OFF LAYER
			commands.setFloatProperty( trf + '.transform.scale', [0.0,0.0] )
Beispiel #7
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")
def _create_item(it, track_kind=None):
    range_to_read = it.trimmed_range()

    if not range_to_read:
        raise otio.exceptions.OTIOError(
            "No valid range on clip: {0}.".format(
                str(it)
            )
        )

    new_media = _create_media_reference(it, track_kind)
    if not new_media:
        kind = "smptebars"
        if isinstance(it, otio.schema.Gap):
            kind = "blank"
        new_media = [_create_movieproc(range_to_read, kind)]

    try:
        src = commands.addSourceVerbose(new_media)
    except Exception as e:
        # Perhaps the media was missing, if so, lets load an error
        # source
        print('ERROR: {}'.format(e))
        error_media = _create_movieproc(range_to_read, 'smptebars')
        src = commands.addSourceVerbose([error_media])

    src_group = commands.nodeGroup(src)

    extra_commands.setUIName(src_group, str(it.name or "clip"))

    # Add otio metadata to this group and the source
    _add_metadata_to_node(it, src_group)
    if hasattr(it, "media_reference") and it.media_reference:
        _add_metadata_to_node(it.media_reference, src)

    # because OTIO has no global concept of FPS, the rate of the duration is
    # used as the rate for the range of the source.
    # RationalTime.value_rescaled_to returns the time value of the object in
    # time rate of the argument.
    cut_in = range_to_read.start_time.value_rescaled_to(
        range_to_read.duration
    )
    commands.setIntProperty(src + ".cut.in", [int(cut_in)])

    cut_out = range_to_read.end_time_inclusive().value_rescaled_to(
        range_to_read.duration
    )
    commands.setIntProperty(src + ".cut.out", [int(cut_out)])

    commands.setFloatProperty(src + ".group.fps",
                              [float(range_to_read.duration.rate)])

    return src_group
 def on_exposure_master(self, *args):
     sender = self.sender()
     if isinstance(sender, QtGui.QSlider):
         val = float(self.gainMasterHorizontalSlider.value())
         self.gainMasterDoubleSpinBox.setValue(val)
         values = [val, val, val]
         commands.setFloatProperty('#RVColor.color.exposure', values)
     elif isinstance(sender, QtGui.QDoubleSpinBox):
         val = self.gainMasterDoubleSpinBox.value()
         self.gainMasterHorizontalSlider.setValue(val)
         values = [val, val, val]
         commands.setFloatProperty('#RVColor.color.exposure', values)
     commands.redraw()
Beispiel #10
0
 def changeRvColor(self, values):
     '''
     changes the rv color node coming from the colorwheels
     @param values: list [float,float,float,string,Bool]
     '''
     property = values[-2]
     updateSpinBoxes = values[-1]
     if property in ('exposure','offset'):
         rgb = [x-1.0 for x in values[:-2]]
     else:
         rgb = values[:-2]
     try:
         commands.setFloatProperty("%s.color.%s" % (self.node,property), rgb, True)
     except Exception, e:
         print e
Beispiel #11
0
 def propagateToAllRvColor(self):
     '''
     sets the current settings to all rvcolor nodes found 
     '''
     nodes = commands.nodesOfType('RVColor')
     propList = ['gamma','scale','offset','exposure','saturation']
     for node in nodes:
         for prop in propList:
             correction = getattr(self,prop)
             if prop == 'saturation':
                 values =  [self.saturation.value()]
             else:
                 values = self.getValuesFromList(correction)
             try:
                 commands.setFloatProperty("%s.color.%s" % (node,prop), values, True)
             except Exception, e:
                 print e
Beispiel #12
0
Datei: EditUI.py Projekt: 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")
Beispiel #13
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)
Beispiel #14
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 _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
Beispiel #16
0
def _add_source_bounds(media_ref, src, context):
    bounds = media_ref.available_image_bounds
    if not bounds:
        return

    global_scale = context.get('global_scale')
    global_translate = context.get('global_translate')
    if global_scale is None or global_translate is None:
        return

    # A width of 1.0 in RV means draw to the aspect ratio, so scale the
    # width by the inverse of the aspect ratio
    #
    media_info = commands.sourceMediaInfo(src)
    height = media_info['height']
    aspect_ratio = 1.0 if height == 0 else media_info['width'] / height

    translate = bounds.center() * global_scale - global_translate
    scale = (bounds.max - bounds.min) * global_scale

    transform_node = extra_commands.associatedNode('RVTransform2D', src)

    commands.setFloatProperty("{}.transform.scale".format(transform_node),
                              [scale.x / aspect_ratio, scale.y])
    commands.setFloatProperty("{}.transform.translate".format(transform_node),
                              [translate.x, translate.y])

    # write the bounds global_scale and global_translate to the node so we can
    # preserve the original values if we round-trip
    commands.newProperty("{}.otio.global_scale".format(transform_node),
                         commands.FloatType, 2)
    commands.newProperty("{}.otio.global_translate".format(transform_node),
                         commands.FloatType, 2)
    commands.setFloatProperty("{}.otio.global_scale".format(transform_node),
                              [global_scale.x, global_scale.y], True)
    commands.setFloatProperty(
        "{}.otio.global_translate".format(transform_node),
        [global_translate.x, global_translate.y], True)