Skip to content

Commit

Permalink
Merge pull request #92 from ynput/bugfix/OP-8273_Resolve-missing-GetC…
Browse files Browse the repository at this point in the history
…lipProperty

Resolve: avoiding clips without mediapoolitems
  • Loading branch information
jakubjezek001 authored Mar 18, 2024
2 parents 7052038 + b3c7d74 commit 02fe605
Showing 1 changed file with 13 additions and 7 deletions.
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

0 comments on commit 02fe605

Please sign in to comment.