diff options
author | Joshua Leung <aligorith@gmail.com> | 2014-10-23 10:30:41 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2014-10-23 10:30:41 +0400 |
commit | 86749a5f7c4749302a2bc9e2a2a29cf61bea7a8e (patch) | |
tree | 2a7e6c70c4767eceec811253569b4a4f8dc26e68 | |
parent | 23bbab6bdcebaa8a4637204552098b14f93bec43 (diff) |
Tweaks for Delete Active Frame in GPencil UI
* Expose "delete active frame" directly in GP UI (alongside frame locking)
instead of hiding in a submenu
* Deleting the active frame immediately makes the one before it active
-rw-r--r-- | release/scripts/startup/bl_ui/properties_grease_pencil_common.py | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/gpencil.c | 15 |
2 files changed, 14 insertions, 6 deletions
diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py index e46f7858362..5ca2300bfae 100644 --- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py +++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py @@ -307,8 +307,8 @@ class GreasePencilDataPanel(): layout.separator() - # Full-Row - Frame Locking - row = layout.row() + # Full-Row - Frame Locking (and Delete Frame) + row = layout.row(align=True) row.active = not gpl.lock if gpl.active_frame: @@ -317,6 +317,7 @@ class GreasePencilDataPanel(): else: lock_label = "Lock Frame" row.prop(gpl, "lock_frame", text=lock_label, icon='UNLOCKED') + row.operator("gpencil.active_frame_delete", text="", icon='X') layout.separator() diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index fc094006856..b1234cbfd71 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -493,16 +493,23 @@ bGPDframe *gpencil_layer_getframe(bGPDlayer *gpl, int cframe, short addnew) bool gpencil_layer_delframe(bGPDlayer *gpl, bGPDframe *gpf) { bool changed = false; - + /* error checking */ if (ELEM(NULL, gpl, gpf)) return false; - + + /* if this frame was active, make the previous frame active instead + * since it's tricky to set active frame otherwise + */ + if (gpl->actframe == gpf) + gpl->actframe = gpf->prev; + else + gpl->actframe = NULL; + /* free the frame and its data */ changed = free_gpencil_strokes(gpf); BLI_freelinkN(&gpl->frames, gpf); - gpl->actframe = NULL; - + return changed; } |