Export Csv
This commit is contained in:
@@ -6,6 +6,7 @@ import urllib3
|
||||
import traceback
|
||||
import time
|
||||
import uuid
|
||||
from pprint import pprint
|
||||
|
||||
from bpy.props import PointerProperty, StringProperty
|
||||
from pathlib import Path
|
||||
@@ -176,6 +177,20 @@ class Kitsu(Tracker):
|
||||
|
||||
return gazu.shot.get_shot_by_name(sequence, shot)
|
||||
|
||||
def get_asset(self, asset, asset_type=None, project=None):
|
||||
#print('get_asset', "name", name, 'asset_type', asset_type)
|
||||
|
||||
asset_id = self.get_id(asset)
|
||||
if asset_id:
|
||||
return asset_id
|
||||
|
||||
project = self.get_project(project)
|
||||
asset_type = self.get_id(asset_type)
|
||||
|
||||
asset = gazu.asset.get_asset_by_name(project, asset, asset_type)
|
||||
|
||||
return asset
|
||||
|
||||
def get_assets(self, project=None):
|
||||
project = self.get_project(project)
|
||||
assets = gazu.asset.all_assets_for_project(project)
|
||||
@@ -327,10 +342,41 @@ class Kitsu(Tracker):
|
||||
else:
|
||||
entity['data'].update(data)
|
||||
|
||||
#pprint(entity)
|
||||
entity_data = gazu.client.put(f"data/entities/{entity_id}", entity)
|
||||
|
||||
|
||||
return entity_data['data']
|
||||
|
||||
def get_casting(self, shot, project=None):
|
||||
project = self.get_project(project)
|
||||
project_id = self.get_id(project)
|
||||
return gazu.casting.get_shot_casting({'id': self.get_id(shot), 'project_id': project_id})
|
||||
|
||||
def update_casting(self, shot, casting, clear=True, project=None):
|
||||
project = self.get_project(project)
|
||||
shot_id = self.get_id(shot)
|
||||
|
||||
norm_casting = []
|
||||
if clear is False:
|
||||
norm_casting += self.get_casting(shot, project)
|
||||
|
||||
for asset in casting:
|
||||
if isinstance(asset, dict) and 'asset_id' in asset: # It's an asset instance
|
||||
asset_id = asset['asset_id']
|
||||
nb_occurences = asset['nb_occurences']
|
||||
else: # It's an asset
|
||||
asset = self.get_asset(asset)
|
||||
nb_occurences = 1
|
||||
|
||||
cast = next((c for c in norm_casting if c['asset_id'] == asset_id), None)
|
||||
if cast:
|
||||
cast['nb_occurences'] += 1
|
||||
else:
|
||||
norm_casting.append({'asset_id': asset_id, 'nb_occurences': nb_occurences})
|
||||
|
||||
return gazu.casting.update_shot_casting(project, shot_id, norm_casting)
|
||||
|
||||
def draw_prefs(self, layout):
|
||||
layout.prop(self, 'url', text='Url')
|
||||
layout.prop(self, 'login', text='Login')
|
||||
|
||||
Reference in New Issue
Block a user