Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions src/py-opentimelineio/opentimelineio/console/otiotool.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ def main():
if args.remove_transitions:
timelines = filter_transitions(timelines)

if args.remove_effects:
timelines = filter_effects(timelines)

if args.only_tracks_with_name or args.only_tracks_with_index:
timelines = filter_tracks(
args.only_tracks_with_name,
Expand Down Expand Up @@ -184,10 +187,10 @@ def parse_arguments():
2. Filtering
Options such as --video-only, --audio-only, --only-tracks-with-name,
-only-tracks-with-index, --only-clips-with-name,
--only-clips-with-name-regex, --remove-transitions, and --trim will remove
content. Only the tracks, clips, etc. that pass all of the filtering options
provided are passed to the next phase.
--only-tracks-with-index, --only-clips-with-name,
--only-clips-with-name-regex, --remove-transitions, --remove-effects and
--trim will remove content. Only the tracks, clips, etc. that pass all of
the filtering options provided are passed to the next phase.
3. Combine
If specified, the --stack, --concat, and --flatten operations are
Expand Down Expand Up @@ -295,6 +298,11 @@ def parse_arguments():
action='store_true',
help="Remove all transitions"
)
parser.add_argument(
"--remove-effects",
action='store_true',
help="Remove all effects"
)
parser.add_argument(
"--trim",
"-t",
Expand Down Expand Up @@ -501,6 +509,18 @@ def _f(item):
return [otio.algorithms.filtered_composition(t, _f) for t in timelines]


def filter_effects(timelines):
"""Remove all effects from the input timelines. The inputs are modified
in place, and also returned."""
for timeline in timelines:
# Items have an effects attribute, but other Composables do not.
# (e.g. Transitions) so we need to find only Items.
for item in timeline.find_children(descended_from_type=otio.core.Item):
# Clear the effects list contents
item.effects[:] = []
return timelines


def _filter(item, names, patterns):
"""This is a helper function that returns the input item if
its name matches the list of names given (if any), or matches any of the
Expand Down
Loading
Loading