Blender Kitsu: Set Custom Thumbnail during Playblast #77
@ -65,6 +65,7 @@ class KITSU_OT_playblast_create(bpy.types.Operator):
|
||||
|
||||
use_user_shading: bpy.props.BoolProperty(
|
||||
name="Use Current Viewport Shading", default=True)
|
||||
frame_number: bpy.props.IntProperty(name="Thumbnail Frame")
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context: bpy.types.Context) -> bool:
|
||||
@ -191,6 +192,7 @@ class KITSU_OT_playblast_create(bpy.types.Operator):
|
||||
def invoke(self, context, event):
|
||||
# Initialize comment and playblast task status variable.
|
||||
self.comment = ""
|
||||
self.frame_number = context.scene.frame_current
|
||||
|
||||
prev_task_status_id = context.scene.kitsu.playblast_task_status_id
|
||||
if prev_task_status_id:
|
||||
@ -211,6 +213,7 @@ class KITSU_OT_playblast_create(bpy.types.Operator):
|
||||
row.prop(self, "comment")
|
||||
row = layout.row(align=True)
|
||||
row.prop(self, "use_user_shading")
|
||||
row.prop(self, "frame_number")
|
||||
|
||||
def _upload_playblast(self, context: bpy.types.Context, filepath: Path) -> None:
|
||||
# Get shot.
|
||||
@ -241,7 +244,7 @@ class KITSU_OT_playblast_create(bpy.types.Operator):
|
||||
)
|
||||
|
||||
# Add_preview_to_comment
|
||||
task.add_preview_to_comment(comment, filepath.as_posix())
|
||||
task.add_preview_to_comment(comment, filepath.as_posix(), frame_number=self.frame_number)
|
||||
|
||||
# Preview.set_main_preview()
|
||||
logger.info(f"Uploaded playblast for shot: {shot.name} under: {task_type.name}")
|
||||
|
@ -874,11 +874,12 @@ class Task(Entity):
|
||||
return comment_obj
|
||||
|
||||
def add_preview_to_comment(
|
||||
self, comment: Comment, preview_file_path: str
|
||||
) -> Preview:
|
||||
self, comment: Comment, preview_file_path: str,
|
||||
frame_number:int) -> Preview:
|
||||
preview_dict = gazu.task.add_preview(
|
||||
asdict(self), asdict(comment), preview_file_path
|
||||
)
|
||||
gazu.task.set_main_preview(preview_dict["id"], frame_number)
|
||||
return Preview.from_dict(preview_dict)
|
||||
|
||||
def __bool__(self) -> bool:
|
||||
|
Loading…
Reference in New Issue
Block a user