Skip to content

Commit 67a1b3e

Browse files
committed
Added --remove-effects feature to otiotool.
Signed-off-by: Joshua Minor <[email protected]>
1 parent 639f57c commit 67a1b3e

File tree

3 files changed

+6838
-4
lines changed

3 files changed

+6838
-4
lines changed

src/py-opentimelineio/opentimelineio/console/otiotool.py

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ def main():
6565
if args.remove_transitions:
6666
timelines = filter_transitions(timelines)
6767

68+
if args.remove_effects:
69+
timelines = filter_effects(timelines)
70+
6871
if args.only_tracks_with_name or args.only_tracks_with_index:
6972
timelines = filter_tracks(
7073
args.only_tracks_with_name,
@@ -184,10 +187,10 @@ def parse_arguments():
184187
185188
2. Filtering
186189
Options such as --video-only, --audio-only, --only-tracks-with-name,
187-
-only-tracks-with-index, --only-clips-with-name,
188-
--only-clips-with-name-regex, --remove-transitions, and --trim will remove
189-
content. Only the tracks, clips, etc. that pass all of the filtering options
190-
provided are passed to the next phase.
190+
--only-tracks-with-index, --only-clips-with-name,
191+
--only-clips-with-name-regex, --remove-transitions, --remove-effects and
192+
--trim will remove content. Only the tracks, clips, etc. that pass all of
193+
the filtering options provided are passed to the next phase.
191194
192195
3. Combine
193196
If specified, the --stack, --concat, and --flatten operations are
@@ -295,6 +298,11 @@ def parse_arguments():
295298
action='store_true',
296299
help="Remove all transitions"
297300
)
301+
parser.add_argument(
302+
"--remove-effects",
303+
action='store_true',
304+
help="Remove all effects"
305+
)
298306
parser.add_argument(
299307
"--trim",
300308
"-t",
@@ -501,6 +509,16 @@ def _f(item):
501509
return [otio.algorithms.filtered_composition(t, _f) for t in timelines]
502510

503511

512+
def filter_effects(timelines):
513+
"""Return a copy of the input timelines with all effects removed.
514+
The overall duration of the timelines should not be affected, with
515+
the possible exception of time warp effects, which are also removed."""
516+
for timeline in timelines:
517+
for item in timeline.find_children():
518+
item.effects[:] = []
519+
return timelines
520+
521+
504522
def _filter(item, names, patterns):
505523
"""This is a helper function that returns the input item if
506524
its name matches the list of names given (if any), or matches any of the

0 commit comments

Comments
 (0)