diff --git a/operators/operators.py b/operators/operators.py index da298bf..e0fd8ac 100644 --- a/operators/operators.py +++ b/operators/operators.py @@ -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() diff --git a/properties.py b/properties.py index 98879c0..330f918 100644 --- a/properties.py +++ b/properties.py @@ -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']: