static asset items, fix blender freeze

This commit is contained in:
“christopheseux”
2023-05-31 12:52:35 +02:00
parent 70e1def003
commit 472622ff4b
5 changed files with 66 additions and 204 deletions
+5 -9
View File
@@ -5,10 +5,11 @@ import bpy
from bpy.types import Context, Event, PropertyGroup, Operator
from bpy.props import (CollectionProperty, EnumProperty, StringProperty)
from vse_toolbox.constants import CASTING_BUFFER
from vse_toolbox.constants import CASTING_BUFFER, ASSET_ITEMS
from vse_toolbox.sequencer_utils import get_strips
from vse_toolbox.bl_utils import (get_addon_prefs, get_scene_settings, get_strip_settings)
from time import perf_counter
class VSETB_OT_casting_replace(Operator):
bl_idname = "vse_toolbox.casting_replace"
@@ -75,20 +76,15 @@ class VSETB_OT_casting_replace(Operator):
col.prop_search(self, 'new_asset', self, 'assets', text='New Asset', icon='ASSET_MANAGER')
def get_asset_items(self, context):
settings = get_scene_settings()
project = settings.active_project
return [(a.id, a.label, '', i) for i, a in enumerate(project.assets)]
class VSETB_OT_casting_add(Operator):
bl_idname = "vse_toolbox.casting_add"
bl_label = "Casting Add"
bl_description = "Add Asset to Castin"
bl_options = {"REGISTER", "UNDO"}
bl_property = "asset_name"
asset_name : EnumProperty(name='', items=get_asset_items)
asset_name : EnumProperty(name='', items=lambda s,c : ASSET_ITEMS)
#asset_name : EnumProperty(name='', items=get_scene_settings().active_project.get('asset_items', []))
@classmethod
def poll(cls, context):
active_strip = context.scene.sequence_editor.active_strip