Blender Kitsu: Set Custom Thumbnail during Playblast #77
@ -69,7 +69,12 @@ class KITSU_OT_playblast_create(bpy.types.Operator):
|
|||||||
use_user_shading: bpy.props.BoolProperty(
|
use_user_shading: bpy.props.BoolProperty(
|
||||||
name="Use Current Viewport Shading", default=True
|
name="Use Current Viewport Shading", default=True
|
||||||
)
|
)
|
||||||
frame_number: bpy.props.IntProperty(name="Thumbnail Frame")
|
thumbnail_frame: bpy.props.IntProperty(
|
||||||
|
name="Thumbnail Frame",
|
||||||
|
description="Frame to use as the thumbnail on Kitsu",
|
||||||
|
min=0,
|
||||||
|
)
|
||||||
|
thumbnail_frame_final: bpy.props.IntProperty(name="Thumbnail Frame Final")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context: bpy.types.Context) -> bool:
|
def poll(cls, context: bpy.types.Context) -> bool:
|
||||||
@ -87,6 +92,19 @@ class KITSU_OT_playblast_create(bpy.types.Operator):
|
|||||||
self.report({"ERROR"}, "Failed to create playblast. Missing task status")
|
self.report({"ERROR"}, "Failed to create playblast. Missing task status")
|
||||||
return {"CANCELLED"}
|
return {"CANCELLED"}
|
||||||
|
|
||||||
|
# Playblast file always starts at frame 0, account for this in thumbnail frame selection
|
||||||
|
self.thumbnail_frame_final = self.thumbnail_frame - context.scene.frame_start
|
||||||
|
|
||||||
|
# Ensure thumbnail frame is not outside of rendered frame range
|
||||||
|
if self.thumbnail_frame_final not in range(
|
||||||
|
0, context.scene.frame_start - context.scene.frame_end
|
||||||
|
):
|
||||||
|
self.report(
|
||||||
|
{"ERROR"},
|
||||||
|
f"Thumbnail frame '{self.thumbnail_frame}' is outside of rendered frame range ",
|
||||||
|
)
|
||||||
|
return {"CANCELLED"}
|
||||||
|
|
||||||
shot_active = cache.shot_active_get()
|
shot_active = cache.shot_active_get()
|
||||||
|
|
||||||
# Save playblast task status id for next time.
|
# Save playblast task status id for next time.
|
||||||
@ -199,7 +217,7 @@ class KITSU_OT_playblast_create(bpy.types.Operator):
|
|||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
# Initialize comment and playblast task status variable.
|
# Initialize comment and playblast task status variable.
|
||||||
self.comment = ""
|
self.comment = ""
|
||||||
self.frame_number = context.scene.frame_current
|
self.thumbnail_frame = context.scene.frame_current
|
||||||
|
|
||||||
prev_task_status_id = context.scene.kitsu.playblast_task_status_id
|
prev_task_status_id = context.scene.kitsu.playblast_task_status_id
|
||||||
if prev_task_status_id:
|
if prev_task_status_id:
|
||||||
@ -220,7 +238,7 @@ class KITSU_OT_playblast_create(bpy.types.Operator):
|
|||||||
row.prop(self, "comment")
|
row.prop(self, "comment")
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
row.prop(self, "use_user_shading")
|
row.prop(self, "use_user_shading")
|
||||||
row.prop(self, "frame_number")
|
row.prop(self, "thumbnail_frame")
|
||||||
|
|
||||||
def _upload_playblast(self, context: bpy.types.Context, filepath: Path) -> None:
|
def _upload_playblast(self, context: bpy.types.Context, filepath: Path) -> None:
|
||||||
# Get shot.
|
# Get shot.
|
||||||
@ -251,11 +269,10 @@ class KITSU_OT_playblast_create(bpy.types.Operator):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Add_preview_to_comment
|
# Add_preview_to_comment
|
||||||
# Playblast file always starts at frame 0, account for this in thumbnail frame selection
|
|
||||||
task.add_preview_to_comment(
|
task.add_preview_to_comment(
|
||||||
comment,
|
comment,
|
||||||
filepath.as_posix(),
|
filepath.as_posix(),
|
||||||
frame_number=self.frame_number - context.scene.frame_start,
|
self.thumbnail_frame_final,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Preview.set_main_preview()
|
# Preview.set_main_preview()
|
||||||
|
Loading…
Reference in New Issue
Block a user