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
parent
5e876f360b
commit
b9dd1196ca
|
@ -449,6 +449,38 @@ class GPTB_OT_overlay_presets(bpy.types.Operator):
|
||||||
|
|
||||||
return {'FINISHED'}
|
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 = (
|
classes = (
|
||||||
GPTB_OT_copy_text,
|
GPTB_OT_copy_text,
|
||||||
GPTB_OT_flipx_view,
|
GPTB_OT_flipx_view,
|
||||||
|
@ -458,6 +490,7 @@ GPTB_OT_set_view_as_cam,
|
||||||
GPTB_OT_reset_cam_rot,
|
GPTB_OT_reset_cam_rot,
|
||||||
GPTB_OT_toggle_mute_animation,
|
GPTB_OT_toggle_mute_animation,
|
||||||
GPTB_OT_list_disabled_anims,
|
GPTB_OT_list_disabled_anims,
|
||||||
|
GPTB_OT_clear_active_frame,
|
||||||
)
|
)
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
|
|
|
@ -112,6 +112,14 @@ Panel in sidebar : 3D view > sidebar 'N' > Gpencil
|
||||||
|
|
||||||
## Changelog:
|
## 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:
|
1.0.3:
|
||||||
|
|
||||||
- feat: add "Append Materials To Selected" to material submenu. Append materials to other selected GP objects if there aren't there.
|
- feat: add "Append Materials To Selected" to material submenu. Append materials to other selected GP objects if there aren't there.
|
||||||
|
|
17
UI_tools.py
17
UI_tools.py
|
@ -99,14 +99,19 @@ class GPTB_PT_sidebar_panel(bpy.types.Panel):
|
||||||
for bg_img in context.scene.camera.data.background_images:
|
for bg_img in context.scene.camera.data.background_images:
|
||||||
if bg_img.source == 'IMAGE' and bg_img.image:
|
if bg_img.source == 'IMAGE' and bg_img.image:
|
||||||
row = box.row(align=True)
|
row = box.row(align=True)
|
||||||
row.label(text=bg_img.image.name, icon='IMAGE_RGB')# FILE_IMAGE
|
row.prop(bg_img, 'show_background_image', text='', icon='IMAGE_RGB')
|
||||||
# row.prop(bg_img, 'alpha', text='')# options={'HIDDEN'}
|
row.prop(bg_img, 'alpha', text=bg_img.image.name) # options={'HIDDEN'}
|
||||||
row.prop(bg_img, 'show_background_image', text='')# 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:
|
if bg_img.source == 'MOVIE_CLIP' and bg_img.clip:
|
||||||
row = box.row(align=True)
|
row = box.row(align=True)
|
||||||
row.label(text=bg_img.clip.name, icon='FILE_MOVIE')
|
row.prop(bg_img, 'show_background_image', text='', icon='FILE_MOVIE')
|
||||||
# row.prop(bg_img, 'alpha', text='')# options={'HIDDEN'}
|
row.prop(bg_img, 'alpha', text=bg_img.clip.name) # options={'HIDDEN'}
|
||||||
row.prop(bg_img, 'show_background_image', text='')# 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
|
## playblast params
|
||||||
layout.separator()
|
layout.separator()
|
||||||
|
|
11
__init__.py
11
__init__.py
|
@ -15,7 +15,7 @@ bl_info = {
|
||||||
"name": "GP toolbox",
|
"name": "GP toolbox",
|
||||||
"description": "Set of tools for Grease Pencil in animation production",
|
"description": "Set of tools for Grease Pencil in animation production",
|
||||||
"author": "Samuel Bernou",
|
"author": "Samuel Bernou",
|
||||||
"version": (1, 0, 3),
|
"version": (1, 0, 4),
|
||||||
"blender": (2, 91, 0),
|
"blender": (2, 91, 0),
|
||||||
"location": "sidebar (N menu) > Gpencil > Toolbox / Gpencil properties",
|
"location": "sidebar (N menu) > Gpencil > Toolbox / Gpencil properties",
|
||||||
"warning": "",
|
"warning": "",
|
||||||
|
@ -371,7 +371,7 @@ class GPTB_prefs(bpy.types.AddonPreferences):
|
||||||
if self.pref_tabs == 'MAN_OPS':
|
if self.pref_tabs == 'MAN_OPS':
|
||||||
# layout.separator()## notes
|
# layout.separator()## notes
|
||||||
# layout.label(text='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
|
## keyframe jump
|
||||||
box = layout.box()
|
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'
|
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')
|
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
|
## user prefs
|
||||||
box = layout.box()
|
box = layout.box()
|
||||||
box.label(text='Note: You can access user pref file and startup file in config folder')
|
box.label(text='Note: You can access user pref file and startup file in config folder')
|
||||||
|
|
Loading…
Reference in New Issue