Skip to content

Commit e4d9e09

Browse files
committed
Add slots method that resolves MobSlots for either
SourceMobSlotID or MonoSourceSlotIDs properties
1 parent 4656580 commit e4d9e09

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

examples/qt_aafmodel.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ def setup(self):
117117
mob = item.mob
118118
if mob:
119119
self.extend([mob])
120-
slot = item.slot
121-
if slot:
122-
self.extend([slot])
120+
for slot in item.slots():
121+
if slot:
122+
self.extend([slot])
123123

124124

125125
self.properties['Name'] = self.name()

src/aaf2/components.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,28 @@ def slot(self):
171171
def slot(self, value):
172172
self.slot_id = value.slot_id
173173

174+
def slots(self):
175+
"""
176+
A SourceReference can have multiple MobSlot references
177+
if it contains the 'MonoSourceSlotIDs' property.
178+
Returns a list of the MobSlot objects referenced
179+
by either SourceMobSlotID or MonoSourceSlotIDs properties.
180+
MobSlots that cannot be resolved will have a value of None.
181+
"""
182+
183+
if 'MonoSourceSlotIDs' in self:
184+
slot_ids = self['MonoSourceSlotIDs'].value
185+
else:
186+
slot_id = self.slot_id
187+
if slot_id is None:
188+
return [None]
189+
slot_ids = [slot_id]
190+
191+
mob = self.mob
192+
if mob is None:
193+
return [None for _ in slot_ids]
194+
195+
return [mob.slot_at(slot_id, None) for slot_id in slot_ids]
174196

175197
@register_class
176198
class SourceClip(SourceReference):

0 commit comments

Comments
 (0)