Blender Kitsu: Set Custom Thumbnail during Playblast #77

Merged
Nick Alberelli merged 12 commits from feature/custom-playblast-thumbnails into main 2023-06-15 21:26:54 +02:00
2 changed files with 7 additions and 3 deletions
Showing only changes of commit ce6c529d19 - Show all commits

View File

@ -65,6 +65,7 @@ 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")
@classmethod @classmethod
def poll(cls, context: bpy.types.Context) -> bool: 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): 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
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:
@ -211,6 +213,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")
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.
@ -241,7 +244,7 @@ class KITSU_OT_playblast_create(bpy.types.Operator):
) )
# Add_preview_to_comment # 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() # Preview.set_main_preview()
logger.info(f"Uploaded playblast for shot: {shot.name} under: {task_type.name}") logger.info(f"Uploaded playblast for shot: {shot.name} under: {task_type.name}")

View File

@ -874,11 +874,12 @@ class Task(Entity):
return comment_obj return comment_obj
def add_preview_to_comment( def add_preview_to_comment(
self, comment: Comment, preview_file_path: str self, comment: Comment, preview_file_path: str,
) -> Preview: frame_number:int) -> Preview:
preview_dict = gazu.task.add_preview( preview_dict = gazu.task.add_preview(
asdict(self), asdict(comment), preview_file_path asdict(self), asdict(comment), preview_file_path
) )
gazu.task.set_main_preview(preview_dict["id"], frame_number)
return Preview.from_dict(preview_dict) return Preview.from_dict(preview_dict)
def __bool__(self) -> bool: def __bool__(self) -> bool: