[Blender_Kitsu] Publish VSE Edit as Revision on Kitsu #7
@ -9,6 +9,7 @@ def new_edit(
|
|||||||
project,
|
project,
|
||||||
name=None,
|
name=None,
|
||||||
description = "",
|
description = "",
|
||||||
|
rendered_filepath = None,
|
||||||
data={},
|
data={},
|
||||||
client=default,
|
client=default,
|
||||||
):
|
):
|
||||||
@ -29,4 +30,7 @@ def new_edit(
|
|||||||
project = normalize_model_parameter(project)
|
project = normalize_model_parameter(project)
|
||||||
path = f"data/projects/{project['id']}/edits"
|
path = f"data/projects/{project['id']}/edits"
|
||||||
data = {"name": name, "description": description,}
|
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
|
@ -40,6 +40,8 @@ from blender_kitsu.types import (
|
|||||||
Task,
|
Task,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from blender_kitsu.playblast.core import override_render_settings
|
||||||
|
|
||||||
logger = LoggerFactory.getLogger()
|
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]:
|
def execute(self, context: bpy.types.Context) -> Set[str]:
|
||||||
project_active = cache.project_active_get()
|
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(
|
gazu.edit.new_edit(
|
||||||
project_active.id,
|
project_active.id,
|
||||||
self.name,
|
self.name,
|
||||||
self.description,
|
self.description,
|
||||||
|
Path(render_path),
|
||||||
context.scene.frame_start,
|
context.scene.frame_start,
|
||||||
) #TODO Pass actual render file to this function
|
) #TODO This fails to upload returns 500 Code
|
||||||
self.report(
|
self.report(
|
||||||
{"INFO"},
|
{"INFO"},
|
||||||
f"Submitted new edit '{self.name}'"
|
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")
|
logger.info("-END- Pushing Sequence Editor Render")
|
||||||
return {"FINISHED"}
|
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
|
@contextlib.contextmanager
|
||||||
def override_render_settings(self, context, thumbnail_width=256):
|
def override_render_settings(self, context, thumbnail_width=256):
|
||||||
|
Loading…
Reference in New Issue
Block a user