[Blender_Kitsu] Publish VSE Edit as Revision on Kitsu #7

Merged
Nick Alberelli merged 28 commits from :feature/upload_render_to_kitsu into master 2023-04-17 19:02:15 +02:00
Showing only changes of commit ebcbf29688 - Show all commits

View File

@ -40,7 +40,7 @@ from blender_kitsu.types import (
Task, Task,
) )
from blender_kitsu.playblast.core import override_render_settings from blender_kitsu.playblast.core import override_render_path
logger = LoggerFactory.getLogger() logger = LoggerFactory.getLogger()
@ -315,11 +315,17 @@ class KITSU_OT_sqe_push_new_edit(bpy.types.Operator):
bl_label = "Submit New Kitsu Edit Comment" bl_label = "Submit New Kitsu Edit Comment"
bl_description = "Creates a new edit comment on Edit task via ID." bl_description = "Creates a new edit comment on Edit task via ID."
def get_edit_entry_enum(self: Any, context: bpy.types.Context) -> List[Tuple[str, str, str]]:
edits = gazu.edit.get_all_edits()
return [(item.get("id"), item.get("name"), f'Created at: "{item.get("created_at")}" {item.get("description")}') for item in edits]
def get_edit_task_items(self: Any, context: bpy.types.Context) -> List[Tuple[str, str, str]]:
tasks = gazu.task.all_tasks_for_edit(self.edit_entry)
return [(item.get("id"), item.get("name"), f'Created at: "{item.get("created_at")}" {item.get("description")}') for item in tasks]
comment: bpy.props.StringProperty(name="comment") comment: bpy.props.StringProperty(name="comment")
task_id: bpy.props.StringProperty( #TODO Make an Enum (allow user to select both [Edit>Task]) edit_entry: bpy.props.EnumProperty(name="Edit Entry", items=get_edit_entry_enum)
name="Task ID", task: bpy.props.EnumProperty(name="Edit Tasks", items=get_edit_task_items)
default='6dec9e11-34c0-408a-b828-6a3c638e191f' #TODO Remove temporary default for testing
)
@classmethod @classmethod
def poll(cls, context: bpy.types.Context) -> bool: def poll(cls, context: bpy.types.Context) -> bool:
@ -333,16 +339,16 @@ class KITSU_OT_sqe_push_new_edit(bpy.types.Operator):
def draw(self, context: bpy.types.Context) -> None: def draw(self, context: bpy.types.Context) -> None:
layout = self.layout layout = self.layout
layout.prop(self, "task_id") layout.prop(self, "edit_entry")
layout.prop(self, "task")
layout.prop(self, "comment") layout.prop(self, "comment")
def execute(self, context: bpy.types.Context) -> Set[str]: def execute(self, context: bpy.types.Context) -> Set[str]:
render_path = f"{context.scene.kitsu.playblast_dir}{self.name}.mp4" # TODO FIX RENDER PATH/FILENAME render_path = f"{context.scene.kitsu.playblast_dir}{self.name}.mp4" # TODO FIX RENDER PATH/FILENAME
with override_render_settings(self, context, render_path): with override_render_path(self, context, render_path):
bpy.ops.render.opengl(animation=True, sequencer=True) bpy.ops.render.opengl(animation=True, sequencer=True)
gazu.edit.add_comment_on_edit_task( gazu.edit.add_comment_on_edit_task(
self.task_id, self.task,
render_path, render_path,
self.comment self.comment
) )