set asset_type on project / assets

pull/5/head
Clément Ducarteron 2023-04-04 12:21:45 +02:00
parent ecde009de1
commit 02f374af55
5 changed files with 21 additions and 11 deletions

View File

@ -3,11 +3,12 @@
In-House Video editing Tools
### Todo
- [ ] Get Set asset_types to project
- [ ] implement clear all casting / or choosing by type (enum en expand ?)
- [ ] implement copy casting by type (all, chars, props etc...)
- [ ] Faire l'operator d'export
### In Progress
### Done ✓
- [x] Get Set asset_types to project
<!-- - [x] Completed task title -->

View File

@ -327,6 +327,10 @@ class VSETB_OT_load_projects(Operator):
for metadata_data in tracker.get_shots_metadata(project_data):
metadata_type = project.metadata_types.add()
metadata_type.name = metadata_data
for asset_type_data in tracker.get_asset_types(project_data):
asset_type = project.asset_types.add()
asset_type.name = asset_type_data['name']
# settings.load_metadata_types()

View File

@ -79,6 +79,9 @@ class AssetCasting(PropertyGroup):
def to_dict(self):
return {k: v for k,v in self.items()}
class AssetTypes(PropertyGroup):
choices : EnumProperty(items=[('NONE', 'None', '', 0)])
class MetaDataTypes(PropertyGroup):
choices : EnumProperty(items=[('NONE', 'None', '', 0)])
@ -126,6 +129,7 @@ class Project(PropertyGroup):
episode_name : EnumProperty(items=get_episodes_items)
episodes : CollectionProperty(type=Episode)
assets : CollectionProperty(type=Asset)
asset_types : CollectionProperty(type=AssetTypes)
metadata_types : CollectionProperty(type=MetaDataTypes)
@ -265,6 +269,7 @@ class VSETB_PGT_strip_settings(PropertyGroup):
classes=(
Asset,
AssetCasting,
AssetTypes,
Episode,
MetaData,
MetaDataTypes,

View File

@ -38,24 +38,24 @@ class Kitsu(Tracker):
return gazu.shot.get_episode_by_name(self.project, name)
def get_asset_types(self, project):
asset_types = gazu.asset.all_asset_types_for_project(project)
return {t['id']:t['name'] for t in asset_types}
return gazu.asset.all_asset_types_for_project(project)
def get_assets(self, project):
asset_types = self.get_asset_types(project)
assets = gazu.asset.all_assets_for_project(project)
for asset in assets:
asset['asset_type'] = asset_types[asset['entity_type_id']]
entity_types = self.get_asset_types(project)
entity_types_ids = {e['id']: e['name'] for e in entity_types}
for asset_data in assets:
asset_data['asset_type'] = entity_types_ids[asset_data.pop('entity_type_id')]
return assets
def get_shots_metadata(self, project):
metadata = []
for md in gazu.project.all_metadata_descriptors(project):
entity_type = md.get('entity_type')
asset_type = md.get('asset_type')
field_name = md.get('field_name')
if entity_type and entity_type.lower() == 'shot' and field_name:
if asset_type and asset_type.lower() == 'shot' and field_name:
metadata.append(field_name)
return metadata

View File

@ -55,9 +55,9 @@ class TrackerTest(Tracker):
def get_shots_metadata(self, project):
metadata = []
for md in gazu.project.all_metadata_descriptors(project):
entity_type = md.get('entity_type')
asset_type = md.get('asset_type')
field_name = md.get('field_name')
if entity_type and entity_type.lower() == 'shot' and field_name:
if asset_type and asset_type.lower() == 'shot' and field_name:
metadata.append(field_name)
return metadata