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)
This commit is contained in:
Pullusb
2021-03-31 01:38:17 +02:00
parent 5e876f360b
commit b9dd1196ca
4 changed files with 61 additions and 8 deletions
+33
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():