fix metadta when changing project

pull/5/head
Christophe SEUX 2023-04-14 19:02:50 +02:00
parent 08885f8c59
commit 0a8e5f9c79
2 changed files with 14 additions and 2 deletions

View File

@ -338,7 +338,8 @@ class VSETB_OT_load_projects(Operator):
asset_type = project.asset_types.add()
asset_type.name = asset_type_data['name']
project.set_strip_metadata()
if settings.active_project:
settings.active_project.set_strip_metadata()
bpy.ops.vse_toolbox.load_assets()

View File

@ -44,6 +44,9 @@ def on_project_updated(self, context):
print('Update active Project')
bpy.ops.vse_toolbox.load_assets()
if settings.active_project:
settings.active_project.set_strip_metadata()
def get_tracker_items(self, context):
return [(norm_str(a.name, format=str.upper), a.name, "", i) for i, a in enumerate(TRACKERS)]
@ -135,7 +138,15 @@ class Project(PropertyGroup):
metadata_types : CollectionProperty(type=MetadataType)
type : StringProperty()
def set_strip_metadata(self):
def set_strip_metadata(self):
# Clear Metadatas
for attr in list(Metadata.__annotations__.keys()):
if hasattr(Metadata, attr):
delattr(Metadata, attr)
del Metadata.__annotations__[attr]
for metadata_type in self.metadata_types:
prop_name = metadata_type.name
if metadata_type['choices']: