better cam ref UI and clear keyframe ops

1.0.4:

- UI: Better cam ref exposition in Toolbox panel
  - Access to opacity
  - merge activation bool with source type icon
- feat: Added a clear active frame operator (`gp.clear_active_frame` to add manually in keymaps)
gpv2
Pullusb 2021-03-31 01:38:17 +02:00
parent 5e876f360b
commit b9dd1196ca
4 changed files with 61 additions and 8 deletions

View File

@ -449,6 +449,38 @@ class GPTB_OT_overlay_presets(bpy.types.Operator):
return {'FINISHED'}
class GPTB_OT_clear_active_frame(bpy.types.Operator):
bl_idname = "gp.clear_active_frame"
bl_label = "Clear Active Frame"
bl_description = "Delete all strokes in active frames"
bl_options = {"REGISTER"}
@classmethod
def poll(cls, context):
return context.object and context.object.type == 'GPENCIL'
def execute(self, context):
obj = context.object
l = obj.data.layers.active
if not l:
self.report({'ERROR'}, 'No layers')
return {'CANCELLED'}
f = l.active_frame
if not f:
self.report({'ERROR'}, 'No active frame')
return {'CANCELLED'}
ct = len(f.strokes)
if not ct:
self.report({'ERROR'}, 'Active frame already empty')
return {'CANCELLED'}
for s in reversed(f.strokes):
f.strokes.remove(s)
self.report({'INFO'}, f'Cleared active frame ({ct} strokes removed)')
return {'FINISHED'}
classes = (
GPTB_OT_copy_text,
GPTB_OT_flipx_view,
@ -458,6 +490,7 @@ GPTB_OT_set_view_as_cam,
GPTB_OT_reset_cam_rot,
GPTB_OT_toggle_mute_animation,
GPTB_OT_list_disabled_anims,
GPTB_OT_clear_active_frame,
)
def register():

View File

@ -112,6 +112,14 @@ Panel in sidebar : 3D view > sidebar 'N' > Gpencil
## Changelog:
1.0.4:
- UI: Better cam ref exposition in Toolbox panel
- Access to opacity
- merge activation bool with source type icon
- feat: Added a clear active frame operator (`gp.clear_active_frame` to add manually in keymaps)
1.0.3:
- feat: add "Append Materials To Selected" to material submenu. Append materials to other selected GP objects if there aren't there.

View File

@ -99,14 +99,19 @@ class GPTB_PT_sidebar_panel(bpy.types.Panel):
for bg_img in context.scene.camera.data.background_images:
if bg_img.source == 'IMAGE' and bg_img.image:
row = box.row(align=True)
row.label(text=bg_img.image.name, icon='IMAGE_RGB')# FILE_IMAGE
# row.prop(bg_img, 'alpha', text='')# options={'HIDDEN'}
row.prop(bg_img, 'show_background_image', text='')# options={'HIDDEN'}
row.prop(bg_img, 'show_background_image', text='', icon='IMAGE_RGB')
row.prop(bg_img, 'alpha', text=bg_img.image.name) # options={'HIDDEN'}
# row.label(icon='IMAGE_RGB')
# icon = 'HIDE_OFF' if bg_img.show_background_image else 'HIDE_ON'
# row.prop(bg_img, 'show_background_image', text='', icon=icon)
if bg_img.source == 'MOVIE_CLIP' and bg_img.clip:
row = box.row(align=True)
row.label(text=bg_img.clip.name, icon='FILE_MOVIE')
# row.prop(bg_img, 'alpha', text='')# options={'HIDDEN'}
row.prop(bg_img, 'show_background_image', text='')# options={'HIDDEN'}
row.prop(bg_img, 'show_background_image', text='', icon='FILE_MOVIE')
row.prop(bg_img, 'alpha', text=bg_img.clip.name) # options={'HIDDEN'}
# 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()

View File

@ -15,7 +15,7 @@ bl_info = {
"name": "GP toolbox",
"description": "Set of tools for Grease Pencil in animation production",
"author": "Samuel Bernou",
"version": (1, 0, 3),
"version": (1, 0, 4),
"blender": (2, 91, 0),
"location": "sidebar (N menu) > Gpencil > Toolbox / Gpencil properties",
"warning": "",
@ -371,7 +371,7 @@ class GPTB_prefs(bpy.types.AddonPreferences):
if self.pref_tabs == 'MAN_OPS':
# layout.separator()## notes
# layout.label(text='Notes:')
layout.label(text='Following operators ID have to be set manually :')
layout.label(text='Following operators ID have to be set manually in keymap if needed :')
## keyframe jump
box = layout.box()
@ -392,6 +392,13 @@ class GPTB_prefs(bpy.types.AddonPreferences):
row.operator('wm.copytext', text='Copy "view3d.cusor_snap"', icon='COPYDOWN').text = 'view3d.cusor_snap'
box.label(text='Or just create a new shortcut using cursor_snap')
## Clear keyframe
box = layout.box()
box.label(text='Clear active frame (delete all strokes without deleting the frame)')
row = box.row()
row.label(text='gp.clear_active_frame')
row.operator('wm.copytext', icon='COPYDOWN').text = 'gp.clear_active_frame'
## user prefs
box = layout.box()
box.label(text='Note: You can access user pref file and startup file in config folder')