diff --git a/examples/qt_aafmodel.py b/examples/qt_aafmodel.py index f9eb818..5f794f6 100644 --- a/examples/qt_aafmodel.py +++ b/examples/qt_aafmodel.py @@ -117,9 +117,9 @@ def setup(self): mob = item.mob if mob: self.extend([mob]) - slot = item.slot - if slot: - self.extend([slot]) + for slot in item.slots(): + if slot: + self.extend([slot]) self.properties['Name'] = self.name() diff --git a/src/aaf2/components.py b/src/aaf2/components.py index 09fa719..46613bb 100644 --- a/src/aaf2/components.py +++ b/src/aaf2/components.py @@ -171,6 +171,28 @@ def slot(self): def slot(self, value): self.slot_id = value.slot_id + def slots(self): + """ + A SourceReference can have multiple MobSlot references + if it contains the 'MonoSourceSlotIDs' property. + Returns a list of the MobSlot objects referenced + by either SourceMobSlotID or MonoSourceSlotIDs properties. + MobSlots that cannot be resolved will have a value of None. + """ + + if 'MonoSourceSlotIDs' in self: + slot_ids = self['MonoSourceSlotIDs'].value + else: + slot_id = self.slot_id + if slot_id is None: + return [None] + slot_ids = [slot_id] + + mob = self.mob + if mob is None: + return [None for _ in slot_ids] + + return [mob.slot_at(slot_id, None) for slot_id in slot_ids] @register_class class SourceClip(SourceReference):