diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2021-03-04 23:30:17 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2021-03-04 23:32:37 +0300 |
commit | 6a662ffda8360f06888452cf43c44b5507f09164 (patch) | |
tree | 756d7de94b720bb08dda1292982a6fa080e311d2 /source/blender/editors/transform/transform_convert_gpencil.c | |
parent | 1668f883fbe555bebf992bc77fd1c78203b23b14 (diff) |
GPencil: Implement Autokey button for Draw/Edit and Sculpt mode
Now, if the Autokey is not enabled, a new frame is not created and it is used the last active one. If no active frame, a message is displayed and the operation is canceled.
This is a common request for 2D artists.
Also, grease pencil was not working as Blender does in other areas.
Reviewed By: pepeland
Differential Revision: https://developer.blender.org/D10557
Diffstat (limited to 'source/blender/editors/transform/transform_convert_gpencil.c')
-rw-r--r-- | source/blender/editors/transform/transform_convert_gpencil.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/editors/transform/transform_convert_gpencil.c b/source/blender/editors/transform/transform_convert_gpencil.c index 244cd552495..45df0e66691 100644 --- a/source/blender/editors/transform/transform_convert_gpencil.c +++ b/source/blender/editors/transform/transform_convert_gpencil.c @@ -37,6 +37,7 @@ #include "BKE_gpencil_geom.h" #include "ED_gpencil.h" +#include "ED_keyframing.h" #include "transform.h" #include "transform_convert.h" @@ -114,6 +115,7 @@ static void createTransGPencil_curves(bContext *C, #define SEL_F3 (1 << 2) View3D *v3d = t->view; + Scene *scene = CTX_data_scene(C); const bool handle_only_selected_visible = (v3d->overlay.handle_display == CURVE_HANDLE_SELECTED); const bool handle_all_visible = (v3d->overlay.handle_display == CURVE_HANDLE_ALL); @@ -230,7 +232,9 @@ static void createTransGPencil_curves(bContext *C, } if ((gpf->framenum != cfra) && (!is_multiedit)) { - gpf = BKE_gpencil_frame_addcopy(gpl, cfra); + if (IS_AUTOKEY_ON(scene)) { + gpf = BKE_gpencil_frame_addcopy(gpl, cfra); + } /* in some weird situations (framelock enabled) return NULL */ if (gpf == NULL) { continue; @@ -405,6 +409,7 @@ static void createTransGPencil_strokes(bContext *C, const bool is_prop_edit_connected, const bool is_scale_thickness) { + Scene *scene = CTX_data_scene(C); TransData *td = NULL; float mtx[3][3], smtx[3][3]; @@ -517,7 +522,9 @@ static void createTransGPencil_strokes(bContext *C, * spent too much time editing the wrong frame... */ if ((gpf->framenum != cfra) && (!is_multiedit)) { - gpf = BKE_gpencil_frame_addcopy(gpl, cfra); + if (IS_AUTOKEY_ON(scene)) { + gpf = BKE_gpencil_frame_addcopy(gpl, cfra); + } /* in some weird situations (framelock enabled) return NULL */ if (gpf == NULL) { continue; |