Skip to content

Commit be445f3

Browse files
jminorcato-o
andcommitted
otiotool --remove-effects no longer fails when it encounters a Transition.
Signed-off-by: Joshua Minor <[email protected]> Co-authored-by: Yingjie Wang <[email protected]>
1 parent a1300b3 commit be445f3

File tree

2 files changed

+33
-4
lines changed

2 files changed

+33
-4
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -510,11 +510,13 @@ def _f(item):
510510

511511

512512
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."""
513+
"""Remove all effects from the input timelines. The inputs are modified
514+
in place, and also returned."""
516515
for timeline in timelines:
517-
for item in timeline.find_children():
516+
# Items have an effects attribute, but other Composables do not.
517+
# (e.g. Transitions) so we need to find only Items.
518+
for item in timeline.find_children(descended_from_type=otio.core.Item):
519+
# Clear the effects list contents
518520
item.effects[:] = []
519521
return timelines
520522

tests/sample_data/effects.otio

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,33 @@
362362
},
363363
"active_media_reference_key": "DEFAULT_MEDIA"
364364
},
365+
{
366+
"OTIO_SCHEMA": "Transition.1",
367+
"metadata": {
368+
"Resolve_OTIO": {
369+
"Effects": {
370+
"Effect Name": "Cross Fade 0 dB",
371+
"Enabled": true,
372+
"Name": "Cross Fade",
373+
"Parameters": [],
374+
"Type": 40
375+
},
376+
"Transition Type": "Cross Fade 0DB"
377+
}
378+
},
379+
"name": "Cross Fade 0 dB",
380+
"in_offset": {
381+
"OTIO_SCHEMA": "RationalTime.1",
382+
"rate": 24.0,
383+
"value": 30.0
384+
},
385+
"out_offset": {
386+
"OTIO_SCHEMA": "RationalTime.1",
387+
"rate": 24.0,
388+
"value": 30.0
389+
},
390+
"transition_type": "SMPTE_Dissolve"
391+
},
365392
{
366393
"OTIO_SCHEMA": "Clip.2",
367394
"metadata": {

0 commit comments

Comments
 (0)