Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve: avoiding clips without mediapoolitems #92

Merged
merged 8 commits into from
Mar 18, 2024
20 changes: 13 additions & 7 deletions client/ayon_core/hosts/resolve/api/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,19 +330,25 @@ def get_timeline_item(media_pool_item: object,
Returns:
object: resolve.TimelineItem
"""
_clip_property = media_pool_item.GetClipProperty
clip_name = _clip_property("File Name")
clip_name = media_pool_item.GetClipProperty("File Name")
output_timeline_item = None
timeline = timeline or get_current_timeline()

with maintain_current_timeline(timeline):
# search the timeline for the added clip

for _ti_data in get_current_timeline_items():
_ti_clip = _ti_data["clip"]["item"]
_ti_clip_property = _ti_clip.GetMediaPoolItem().GetClipProperty
if clip_name in _ti_clip_property("File Name"):
output_timeline_item = _ti_clip
for ti_data in get_current_timeline_items():
ti_clip_item = ti_data["clip"]["item"]
ti_media_pool_item = ti_clip_item.GetMediaPoolItem()

# Skip items that do not have a media pool item, like for example
# an "Adjustment Clip" or a "Fusion Composition" from the effects
# toolbox
if not ti_media_pool_item:
continue

if clip_name in ti_media_pool_item.GetClipProperty("File Name"):
output_timeline_item = ti_clip_item

return output_timeline_item

Expand Down