Draw cam passepartout and UI changes

This commit is contained in:
Pullusb
2021-06-05 01:20:35 +02:00
parent 2754ebf89b
commit d8f71e3356
6 changed files with 197 additions and 335 deletions
+42 -31
View File
@@ -81,10 +81,13 @@ class GPTB_PT_sidebar_panel(bpy.types.Panel):
if context.scene.camera:
row = layout.row(align=True)# .split(factor=0.5)
row.label(text='Passepartout')
row.prop(context.scene.camera.data, 'show_passepartout',text='', icon ='OBJECT_HIDDEN' )
if context.scene.camera.name == 'draw_cam':
row.prop(context.scene.gptoolprops, 'drawcam_passepartout', text='', icon ='OBJECT_HIDDEN')
else:
row.prop(context.scene.camera.data, 'show_passepartout', text='', icon ='OBJECT_HIDDEN')
row.prop(context.scene.camera.data, 'passepartout_alpha', text='')
row = layout.row(align=True)
row.operator('view3d.zoom_camera_1_to_1', text = 'Zoom 1:1', icon = 'ZOOM_PREVIOUS')# FULLSCREEN_EXIT
row.operator('view3d.zoom_camera_1_to_1', text = 'Zoom 1:1', icon = 'ZOOM_PREVIOUS') # FULLSCREEN_EXIT
row.operator('view3d.view_center_camera', text = 'Zoom fit', icon = 'FULLSCREEN_ENTER')
## background images/videos
@@ -112,23 +115,15 @@ class GPTB_PT_sidebar_panel(bpy.types.Panel):
# row.label(icon='FILE_MOVIE')
# icon = 'HIDE_OFF' if bg_img.show_background_image else 'HIDE_ON'
# row.prop(bg_img, 'show_background_image', text='', icon=icon)
## playblast params
layout.separator()
layout.label(text = 'Playblast:')
row = layout.row(align=False)#split(factor=0.6)
row.label(text = f'{rd.resolution_x * context.scene.gptoolprops.resolution_percentage // 100} x {rd.resolution_y * context.scene.gptoolprops.resolution_percentage // 100}')
row.prop(context.scene.gptoolprops, 'resolution_percentage', text='')
# row.prop(rd, 'resolution_percentage', text='')#real percent scene percentage
row = layout.row(align=True)
row.operator('render.thread_playblast', text = 'Playblast', icon = 'RENDER_ANIMATION')# non blocking background render playblast
# row.operator('render.playblast_anim', text = 'Playblast', icon = 'RENDER_ANIMATION').use_view = False # old (but robust) blocking playblast
row.operator('render.playblast_anim', text = 'Viewport').use_view = True
else:
layout.label(text='No camera !', icon = 'ERROR')
## Straight line ops from official greasepencil_tools addon if enabled.
# if any(x in context.preferences.addons.keys() for x in ('greasepencil_tools', 'greasepencil-addon')): # check enabled addons
if hasattr(bpy.types, bpy.ops.gp.straight_stroke.idname()): # check if operator exists
layout.operator('gp.straight_stroke', icon ="CURVE_PATH")
## Options
layout.separator()
layout.label(text = 'Options:')
@@ -136,18 +131,12 @@ class GPTB_PT_sidebar_panel(bpy.types.Panel):
## Kf Jump filter
layout.prop(context.scene.gptoolprops, 'keyframe_type', text='Jump On') # Keyframe Jump
# row = layout.row(align=False)
## maybe remove cursor_follow icon that look like
text, icon = ('Cursor Follow On', 'PIVOT_CURSOR') if context.scene.gptoolprops.cursor_follow else ('Cursor Follow Off', 'CURSOR')
layout.prop(context.scene.gptoolprops, 'cursor_follow', text=text, icon=icon)
col = layout.column()
col.prop(context.space_data.overlay, 'use_gpencil_onion_skin')
# col.prop(context.space_data.overlay, 'use_gpencil_onion_skin') # not often used
if context.object and context.object.type == 'GPENCIL':
col.prop(context.object.data, 'use_autolock_layers')
col.prop(context.object, 'show_in_front', text='X-ray')#default text "In Front"
# col.prop(context.object.data, 'use_autolock_layers') # not often used
col.prop(context.object, 'show_in_front', text='X-ray') # default text "In Front"
## rename datablock temporary layout
if context.object.name != context.object.data.name:
@@ -184,6 +173,9 @@ class GPTB_PT_sidebar_panel(bpy.types.Panel):
row.operator('gp.file_checker', text = 'Check file', icon = 'SCENE_DATA')
row.operator('gp.links_checker', text = 'Check links', icon = 'UNLINKED')
text, icon = ('Cursor Follow On', 'PIVOT_CURSOR') if context.scene.gptoolprops.cursor_follow else ('Cursor Follow Off', 'CURSOR')
col.prop(context.scene.gptoolprops, 'cursor_follow', text=text, icon=icon)
# Mention update as notice
addon_updater_ops.update_notice_box_ui(self, context)
@@ -235,6 +227,28 @@ class GPTB_PT_anim_manager(bpy.types.Panel):
ops.skip_obj = True
ops.mute = True
class GPTB_PT_toolbox_playblast(bpy.types.Panel):
bl_label = "Playblast"
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
bl_category = "Gpencil"
bl_parent_id = "GPTB_PT_sidebar_panel"
bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
layout = self.layout
rd = context.scene.render
row = layout.row(align=False) # split(factor=0.6)
percent = context.scene.gptoolprops.resolution_percentage
row.label(text = f'{rd.resolution_x * percent // 100} x {rd.resolution_y * percent // 100}')
row.prop(context.scene.gptoolprops, 'resolution_percentage', text='')
# row.prop(rd, 'resolution_percentage', text='') # real percent scene percentage
row = layout.row(align=True)
row.operator('render.thread_playblast', text = 'Playblast', icon = 'RENDER_ANIMATION')# non blocking background render playblast
# row.operator('render.playblast_anim', text = 'Playblast', icon = 'RENDER_ANIMATION').use_view = False # old (but robust) blocking playblast
row.operator('render.playblast_anim', text = 'Viewport').use_view = True
class GPTB_PT_tint_layers(bpy.types.Panel):
bl_label = "Tint layers"
bl_space_type = "VIEW_3D"
@@ -293,8 +307,7 @@ class GPTB_PT_render(bpy.types.Panel):
blend = Path(bpy.data.filepath)
out = blend.parents[1] / "compo" / "base"
layout.operator("wm.path_open", text='Open render folder', icon='FILE_FOLDER').filepath = str(out)
"""
@@ -343,6 +356,7 @@ def palette_manager_menu(self, context):
classes = (
GPTB_PT_sidebar_panel,
GPTB_PT_anim_manager,
GPTB_PT_toolbox_playblast,
GPTB_PT_tint_layers,
GPTB_PT_render,
## GPTB_PT_cam_ref_panel,
@@ -403,8 +417,5 @@ def GPdata_toolbox_panel(self, context):
row.label("Extra tools")
if settings.extra_tools :
layout.operator_menu_enum("gpencil.stroke_arrange", text="Arrange Strokes...", property="direction") """
layout.operator_menu_enum("gpencil.stroke_arrange", text="Arrange Strokes...", property="direction")
"""