How to use the opentimelineio.core.serializable_field function in OpenTimelineIO

To help you get started, we’ve selected a few OpenTimelineIO examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PixarAnimationStudios / OpenTimelineIO / opentimelineio / schema / marker.py View on Github external
def __init__(
        self,
        name=None,
        marked_range=None,
        color=MarkerColor.RED,
        metadata=None,
    ):
        core.SerializableObject.__init__(
            self,
        )
        self.name = name
        self.marked_range = marked_range
        self.color = color
        self.metadata = metadata or {}

    name = core.serializable_field("name", doc="Name of this marker.")

    marked_range = core.serializable_field(
        "marked_range",
        opentime.TimeRange,
        "Range this marker applies to, relative to the Item this marker is "
        "attached to (e.g. the Clip or Track that owns this marker)."
    )

    color = core.serializable_field(
        "color",
        required_type=type(MarkerColor.RED),
        doc="Color string for this marker (for example: 'RED'), based on the "
        "otio.schema.marker.MarkerColor enum."
    )

    # old name
github PixarAnimationStudios / OpenTimelineIO / opentimelineio / plugins / manifest.py View on Github external
# hook system stuff
        self.hooks = []
        self.hook_scripts = []

    adapters = core.serializable_field(
        "adapters",
        type([]),
        "Adapters this manifest describes."
    )
    media_linkers = core.serializable_field(
        "media_linkers",
        type([]),
        "Media Linkers this manifest describes."
    )
    hooks = core.serializable_field(
        "hooks",
        type([]),
        "Hooks that hooks scripts can be attached to."
    )
    hook_scripts = core.serializable_field(
        "hook_scripts",
        type([]),
        "Scripts that can be attached to hooks."
    )

    def _update_plugin_source(self, path):
        """Track the source .json for a given adapter."""

        for thing in (self.adapters + self.media_linkers):
            thing._json_path = path
github PixarAnimationStudios / OpenTimelineIO / opentimelineio / schema / marker.py View on Github external
name=None,
        marked_range=None,
        color=MarkerColor.RED,
        metadata=None,
    ):
        core.SerializableObject.__init__(
            self,
        )
        self.name = name
        self.marked_range = marked_range
        self.color = color
        self.metadata = metadata or {}

    name = core.serializable_field("name", doc="Name of this marker.")

    marked_range = core.serializable_field(
        "marked_range",
        opentime.TimeRange,
        "Range this marker applies to, relative to the Item this marker is "
        "attached to (e.g. the Clip or Track that owns this marker)."
    )

    color = core.serializable_field(
        "color",
        required_type=type(MarkerColor.RED),
        doc="Color string for this marker (for example: 'RED'), based on the "
        "otio.schema.marker.MarkerColor enum."
    )

    # old name
    range = core.deprecated_field()
github PixarAnimationStudios / OpenTimelineIO / contrib / opentimelineio_contrib / adapters / xges.py View on Github external
return False
        raise ValueError("Unknown boolean value {!s}".format(read))


@otio.core.register_type
class XgesTrack(otio.core.SerializableObject):
    """
    An OpenTimelineIO Schema for storing a GESTrack.

    Not to be confused with OpenTimelineIO's schema.Track.
    """
    _serializable_label = "XgesTrack.1"

    caps = otio.core.serializable_field(
        "caps", str, "The GstCaps of the track")
    track_type = otio.core.serializable_field(
        "track-type", int, "The GESTrackType of the track")
    properties = otio.core.serializable_field(
        "properties", GstStructure, "The GObject properties of the track")
    metadatas = otio.core.serializable_field(
        "metadatas", GstStructure, "Metadata for the track")

    def __init__(
            self, caps="ANY", track_type=GESTrackType.UNKNOWN,
            properties=None, metadatas=None):
        """
        Initialize the XgesTrack.

        properties and metadatas are passed as the second argument to
        GstStructure.
        """
        otio.core.SerializableObject.__init__(self)
github PixarAnimationStudios / OpenTimelineIO / opentimelineio / schema / effect.py View on Github external
@core.register_type
class Effect(core.SerializableObject):
    _serializable_label = "Effect.1"

    def __init__(
        self,
        name=None,
        effect_name=None,
        metadata=None
    ):
        super(Effect, self).__init__()
        self.name = name
        self.effect_name = effect_name
        self.metadata = copy.deepcopy(metadata) if metadata else {}

    name = core.serializable_field(
        "name",
        doc="Name of this effect object. Example: 'BlurByHalfEffect'."
    )
    effect_name = core.serializable_field(
        "effect_name",
        doc="Name of the kind of effect (example: 'Blur', 'Crop', 'Flip')."
    )
    metadata = core.serializable_field(
        "metadata",
        dict,
        doc="Metadata dictionary."
    )

    def __str__(self):
        return (
            "Effect("
github PixarAnimationStudios / OpenTimelineIO / opentimelineio / schema / track.py View on Github external
markers=None,
        effects=None,
        metadata=None,
    ):
        core.Composition.__init__(
            self,
            name=name,
            children=children,
            source_range=source_range,
            markers=markers,
            effects=effects,
            metadata=metadata
        )
        self.kind = kind

    kind = core.serializable_field(
        "kind",
        doc="Composition kind (Stack, Track)"
    )

    def range_of_child_at_index(self, index):
        child = self[index]

        # sum the durations of all the children leading up to the chosen one
        start_time = sum(
            (
                o_c.duration()
                for o_c in (c for c in self[:index] if not c.overlapping())
            ),
            opentime.RationalTime(value=0, rate=child.duration().rate)
        )
        if isinstance(child, transition.Transition):
github PixarAnimationStudios / OpenTimelineIO / opentimelineio / schema / track.py View on Github external
name=None,
        children=None,
        source_range=None,
        kind=TrackKind.Video,
        metadata=None,
    ):
        core.Composition.__init__(
            self,
            name=name,
            children=children,
            source_range=source_range,
            metadata=metadata
        )
        self.kind = kind

    kind = core.serializable_field(
        "kind",
        doc="Composition kind (Stack, Track)"
    )

    def range_of_child_at_index(self, index):
        child = self[index]

        # sum the durations of all the children leading up to the chosen one
        start_time = sum(
            (
                o_c.duration()
                for o_c in (c for c in self[:index] if not c.overlapping())
            ),
            opentime.RationalTime(value=0, rate=child.duration().rate)
        )
        if isinstance(child, transition.Transition):
github PixarAnimationStudios / OpenTimelineIO / opentimelineio / schema / clip.py View on Github external
metadata=None,
    ):
        core.Item.__init__(
            self,
            name=name,
            source_range=source_range,
            markers=markers,
            effects=effects,
            metadata=metadata
        )

        if not media_reference:
            media_reference = missing_reference.MissingReference()
        self._media_reference = copy.deepcopy(media_reference)

    name = core.serializable_field("name", doc="Name of this clip.")
    transform = core.deprecated_field()
    _media_reference = core.serializable_field(
        "media_reference",
        core.MediaReference,
        "Media reference to the media this clip represents."
    )

    @property
    def media_reference(self):
        if self._media_reference is None:
            self._media_reference = missing_reference.MissingReference()
        return self._media_reference

    @media_reference.setter
    def media_reference(self, val):
        if val is None:
github PixarAnimationStudios / OpenTimelineIO / opentimelineio / schema / timeline.py View on Github external
self.name = name
        self.global_start_time = copy.deepcopy(global_start_time)

        if tracks is None:
            tracks = []
        self.tracks = stack.Stack(name="tracks", children=tracks)

        self.metadata = copy.deepcopy(metadata) if metadata else {}

    name = core.serializable_field("name", doc="Name of this timeline.")
    tracks = core.serializable_field(
        "tracks",
        core.Composition,
        doc="Stack of tracks containing items."
    )
    metadata = core.serializable_field(
        "metadata",
        dict,
        "Metadata dictionary."
    )
    global_start_time = core.serializable_field(
        "global_start_time",
        opentime.RationalTime,
        doc="Global starting time value and rate of the timeline."
    )

    def __str__(self):
        return 'Timeline("{}", {})'.format(str(self.name), str(self.tracks))

    def __repr__(self):
        return (
            "otio.schema.Timeline(name={}, tracks={})".format(
github PixarAnimationStudios / OpenTimelineIO / opentimelineio / schema / timeline.py View on Github external
name=None,
        tracks=None,
        global_start_time=None,
        metadata=None,
    ):
        super(Timeline, self).__init__()
        self.name = name
        self.global_start_time = copy.deepcopy(global_start_time)

        if tracks is None:
            tracks = []
        self.tracks = stack.Stack(name="tracks", children=tracks)

        self.metadata = copy.deepcopy(metadata) if metadata else {}

    name = core.serializable_field("name", doc="Name of this timeline.")
    tracks = core.serializable_field(
        "tracks",
        core.Composition,
        doc="Stack of tracks containing items."
    )
    metadata = core.serializable_field(
        "metadata",
        dict,
        "Metadata dictionary."
    )
    global_start_time = core.serializable_field(
        "global_start_time",
        opentime.RationalTime,
        doc="Global starting time value and rate of the timeline."
    )