diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2017-01-19 15:04:56 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2017-01-19 15:05:23 +0300 |
commit | 446ed355a56441de3031e3bcc756ec462a874439 (patch) | |
tree | f12da560fd4054c16e25524ca62de0edbe9fcdf0 | |
parent | 666cb5ddd9a11e88853e012bf57ba05fca09c60f (diff) |
GPencil: Add option to create blank frame in active layer only
Now it is possible to select if the blank frame is created in active
layer only or in all layers.
-rw-r--r-- | source/blender/editors/gpencil/gpencil_edit.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index ccccd6381b2..5b011b679a6 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -703,12 +703,14 @@ static int UNUSED_FUNCTION(gp_blank_frame_add_poll)(bContext *C) return 0; } -static int gp_blank_frame_add_exec(bContext *C, wmOperator *UNUSED(op)) +static int gp_blank_frame_add_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); bGPdata *gpd = ED_gpencil_data_get_active(C); bGPDlayer *active_gpl = BKE_gpencil_layer_getactive(gpd); - + + const bool all_layers = RNA_boolean_get(op->ptr, "all_layers"); + /* Initialise datablock and an active layer if nothing exists yet */ if (ELEM(NULL, gpd, active_gpl)) { /* let's just be lazy, and call the "Add New Layer" operator, which sets everything up as required */ @@ -720,6 +722,10 @@ static int gp_blank_frame_add_exec(bContext *C, wmOperator *UNUSED(op)) */ CTX_DATA_BEGIN(C, bGPDlayer *, gpl, editable_gpencil_layers) { + if ((all_layers == false) && (gpl != active_gpl)) { + continue; + } + /* 1) Check for an existing frame on the current frame */ bGPDframe *gpf = BKE_gpencil_layer_find_frame(gpl, CFRA); if (gpf) { @@ -754,6 +760,7 @@ void GPENCIL_OT_blank_frame_add(wmOperatorType *ot) /* properties */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + RNA_def_boolean(ot->srna, "all_layers", false, "All Layers", "Create blank frame in all layers, not only active"); } /* ******************* Delete Active Frame ************************ */ |