From c0b944f11454262efadc5fce99bf7ac93f3cf935 Mon Sep 17 00:00:00 2001 From: "florentin.luce" Date: Thu, 15 Feb 2024 09:52:55 +0100 Subject: [PATCH] upload comments to kitsu --- operators/tracker.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/operators/tracker.py b/operators/tracker.py index 30e2b50..89c2823 100644 --- a/operators/tracker.py +++ b/operators/tracker.py @@ -285,6 +285,7 @@ class VSETB_OT_upload_to_tracker(Operator): set_main_preview : BoolProperty(default=True) casting : BoolProperty(default=True) custom_data : BoolProperty(default=True) + tasks_comment: BoolProperty(default=True) @classmethod def poll(cls, context): @@ -318,6 +319,7 @@ class VSETB_OT_upload_to_tracker(Operator): col.separator() col.prop(self, 'casting', text='Casting') col.prop(self, 'custom_data', text='Custom Data') + col.prop(self, 'tasks_comment', text='Tasks Comment') col.prop(self, 'set_main_preview', text='Set Main Preview') def execute(self, context): @@ -359,9 +361,6 @@ class VSETB_OT_upload_to_tracker(Operator): if not task: task = tracker.new_task(shot, task_type=self.task) - # print('\n', 'task comment') - # print(task['last_comment']) - preview = None if self.add_preview: @@ -378,13 +377,10 @@ class VSETB_OT_upload_to_tracker(Operator): tracker.remove_comment(task['last_comment']) elif self.preview_mode == 'ONLY_NEW': preview = None - - #print(f'{preview=}') - #print(f'{status=}') + if status or preview: tracker.new_comment(task, comment=self.comment, status=status, preview=preview, set_main_preview=self.set_main_preview) - if self.custom_data: metadata = strip_settings.metadata.to_dict() description = strip_settings.description @@ -394,6 +390,14 @@ class VSETB_OT_upload_to_tracker(Operator): casting = [{'asset_id': a.id, 'nb_occurences': a.instance} for a in strip_settings.casting] tracker.update_casting(shot, casting) + if self.tasks_comment: + for task_type in project.task_type: + + task = getattr(strip_settings.tasks, task_type.name) + tracker_task = tracker.get_task(task_type.name, entity=shot) + + if task.comment and tracker_task.get('last_comment') != task.comment: + tracker.new_comment(task, comment=task.comment) return {"FINISHED"}