casting on selection

pull/5/head
“christopheseux” 2023-05-09 18:25:41 +02:00
parent f5284d18b1
commit 95e5610ff9
2 changed files with 45 additions and 29 deletions

View File

@ -101,10 +101,16 @@ class VSETB_OT_casting_add(Operator):
def execute(self, context):
scn = context.scene
active_strip = scn.sequence_editor.active_strip
item = get_strip_settings().active_casting
label = item.asset.label if item.asset.label else 'Empty'
strips = get_strips('Shots', selected_only=True)
for strip in strips:
#active_strip = scn.sequence_editor.active_strip
settings = get_scene_settings()
strip_settings = get_strip_settings()
strip_settings = strip.vsetb_strip_settings
project = settings.active_project
@ -122,6 +128,8 @@ class VSETB_OT_casting_add(Operator):
strip_settings.casting.update()
self.report({"INFO"}, f'Item {label} added in {len(strips)} shots')
return {"FINISHED"}
@ -140,25 +148,30 @@ class VSETB_OT_casting_remove(Operator):
def invoke(self, context, event):
scn = context.scene
strip_settings = get_strip_settings()
item = get_strip_settings().active_casting
label = item.asset.label if item.asset.label else 'Empty'
strips = get_strips('Shots', selected_only=True)
strips_modified = 0
for strip in strips:
strip_settings = strip.vsetb_strip_settings
idx = strip_settings.casting_index
try:
item = strip_settings.casting[idx]
except IndexError:
pass
continue
else:
item = strip_settings.casting[strip_settings.casting_index]
label = item.asset.label if item.asset.label else 'Empty'
info = f"Item {label} removed from casting"
strip_settings.casting.remove(idx)
if strip_settings.casting_index == 0:
strip_settings.casting_index = 0
else:
if strip_settings.casting_index != 0:
strip_settings.casting_index -= 1
self.report({'INFO'}, info)
strips_modified += 1
self.report({"INFO"}, f'Item {label} removed in {strips_modified} shots')
return {"FINISHED"}

View File

@ -499,6 +499,9 @@ class VSETB_PGT_strip_settings(PropertyGroup):
metadata : PointerProperty(type=Metadata)
description : StringProperty()
@property
def active_casting(self):
return self.casting[self.casting_index]
classes = (
Asset,