[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
2 changed files with 14 additions and 8 deletions
Showing only changes of commit 63991eaaa4 - Show all commits

View File

@ -9,6 +9,7 @@ def new_edit(
project,
name=None,
description = "",
rendered_filepath = None,
data={},
client=default,
):
@ -25,8 +26,11 @@ def new_edit(
Returns:
Created edit.
"""
project = normalize_model_parameter(project)
path = f"data/projects/{project['id']}/edits"
data = {"name": name, "description": description,}
return raw.post(path, data, client=client)
new_edit = raw.post(path, data, client=client)
upload_path = f"{path}/{new_edit['id']}"
raw.upload(upload_path, rendered_filepath, client=client)
return new_edit

View File

@ -40,6 +40,8 @@ from blender_kitsu.types import (
Task,
)
from blender_kitsu.playblast.core import override_render_settings
logger = LoggerFactory.getLogger()
@ -333,12 +335,16 @@ class KITSU_OT_sqe_push_new_edit(bpy.types.Operator):
def execute(self, context: bpy.types.Context) -> Set[str]:
project_active = cache.project_active_get()
render_path = f"{context.scene.kitsu.playblast_dir}{self.name}.mp4" # TODO FIX SAVES RENDER NEXT TO SHOT FILE
with override_render_settings(self, context, render_path):
bpy.ops.render.opengl(animation=True, sequencer=True)
gazu.edit.new_edit(
project_active.id,
self.name,
self.description,
Path(render_path),
context.scene.frame_start,
) #TODO Pass actual render file to this function
) #TODO This fails to upload returns 500 Code
self.report(
{"INFO"},
f"Submitted new edit '{self.name}'"
@ -1442,11 +1448,7 @@ class KITSU_OT_sqe_push_render(bpy.types.Operator):
logger.info("-END- Pushing Sequence Editor Render")
return {"FINISHED"}
def _gen_output_path(self, strip: bpy.types.Sequence, task_type: TaskType) -> Path:
addon_prefs = prefs.addon_prefs_get(bpy.context)
folder_name = addon_prefs.sqe_render_dir
file_name = f"{strip.kitsu.shot_id}_{strip.kitsu.shot_name}.{(task_type.name).lower()}.mp4"
return Path(folder_name).absolute().joinpath(file_name)
@contextlib.contextmanager
def override_render_settings(self, context, thumbnail_width=256):