casting on selection
parent
f5284d18b1
commit
95e5610ff9
|
@ -101,26 +101,34 @@ class VSETB_OT_casting_add(Operator):
|
|||
|
||||
def execute(self, context):
|
||||
scn = context.scene
|
||||
active_strip = scn.sequence_editor.active_strip
|
||||
|
||||
settings = get_scene_settings()
|
||||
strip_settings = get_strip_settings()
|
||||
item = get_strip_settings().active_casting
|
||||
label = item.asset.label if item.asset.label else 'Empty'
|
||||
|
||||
project = settings.active_project
|
||||
strips = get_strips('Shots', selected_only=True)
|
||||
for strip in strips:
|
||||
#active_strip = scn.sequence_editor.active_strip
|
||||
|
||||
if strip_settings.casting.get(self.asset_name):
|
||||
settings = get_scene_settings()
|
||||
strip_settings = strip.vsetb_strip_settings
|
||||
|
||||
project = settings.active_project
|
||||
|
||||
if strip_settings.casting.get(self.asset_name):
|
||||
asset = project.assets[self.asset_name]
|
||||
self.report({'WARNING'}, f"Asset {asset.label} already casted.")
|
||||
return {"CANCELLED"}
|
||||
|
||||
item = strip_settings.casting.add()
|
||||
asset = project.assets[self.asset_name]
|
||||
self.report({'WARNING'}, f"Asset {asset.label} already casted.")
|
||||
return {"CANCELLED"}
|
||||
|
||||
item = strip_settings.casting.add()
|
||||
asset = project.assets[self.asset_name]
|
||||
item.name = asset.name
|
||||
item.id = project.assets[self.asset_name].id
|
||||
item['_name'] = asset.label
|
||||
|
||||
item.name = asset.name
|
||||
item.id = project.assets[self.asset_name].id
|
||||
item['_name'] = asset.label
|
||||
strip_settings.casting.update()
|
||||
|
||||
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()
|
||||
idx = strip_settings.casting_index
|
||||
item = get_strip_settings().active_casting
|
||||
label = item.asset.label if item.asset.label else 'Empty'
|
||||
|
||||
try:
|
||||
item = strip_settings.casting[idx]
|
||||
except IndexError:
|
||||
pass
|
||||
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)
|
||||
strips = get_strips('Shots', selected_only=True)
|
||||
strips_modified = 0
|
||||
for strip in strips:
|
||||
|
||||
if strip_settings.casting_index == 0:
|
||||
strip_settings.casting_index = 0
|
||||
strip_settings = strip.vsetb_strip_settings
|
||||
idx = strip_settings.casting_index
|
||||
|
||||
try:
|
||||
item = strip_settings.casting[idx]
|
||||
except IndexError:
|
||||
continue
|
||||
else:
|
||||
strip_settings.casting_index -= 1
|
||||
|
||||
self.report({'INFO'}, info)
|
||||
strip_settings.casting.remove(idx)
|
||||
|
||||
if strip_settings.casting_index != 0:
|
||||
strip_settings.casting_index -= 1
|
||||
|
||||
strips_modified += 1
|
||||
|
||||
self.report({"INFO"}, f'Item {label} removed in {strips_modified} shots')
|
||||
|
||||
return {"FINISHED"}
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue