From a113aca633f0ada36f12c920b42258739a5ba93a Mon Sep 17 00:00:00 2001 From: ChristopheSeux Date: Mon, 2 Oct 2023 14:56:40 +0200 Subject: [PATCH] fix remove casting for removed asset --- operators/casting.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/operators/casting.py b/operators/casting.py index 9c130f0..4f322c2 100644 --- a/operators/casting.py +++ b/operators/casting.py @@ -143,7 +143,7 @@ class VSETB_OT_casting_remove(Operator): scn = context.scene settings = get_strip_settings() - asset = settings.active_casting.asset + asset_id = settings.active_casting.id strips = get_strips('Shots', selected_only=True) strips_modified = 0 @@ -151,7 +151,7 @@ class VSETB_OT_casting_remove(Operator): strip_settings = strip.vsetb_strip_settings for i, asset_casting in enumerate(list(strip_settings.casting)): - if asset_casting.asset == asset: + if asset_casting.id == asset_id: strip_settings.casting.remove(i) @@ -161,9 +161,14 @@ class VSETB_OT_casting_remove(Operator): strips_modified += 1 continue - + + if asset := settings.active_casting.asset: + name = asset.label + else: + name = settings.active_casting.get('_name', '') - self.report({"INFO"}, f'Item {asset.label} removed in {strips_modified} shots') + + self.report({"INFO"}, f'Item {name} removed in {strips_modified} shots') return {"FINISHED"}