[Bf-blender-cvs] [22c73b36af1] blender-v3.3-release: Fix T100999: GPencil Copy paste stroke(s) does not respect autokeying

Antonio Vazquez noreply at git.blender.org
Wed Sep 21 14:27:09 CEST 2022


Commit: 22c73b36af1ac9820a8b49aebbcc72849596ea0d
Author: Antonio Vazquez
Date:   Mon Sep 12 12:13:07 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rB22c73b36af1ac9820a8b49aebbcc72849596ea0d

Fix T100999: GPencil Copy paste stroke(s) does not respect autokeying

The operator was not checking the status of the 
Autokey button.

===================================================================

M	source/blender/editors/gpencil/gpencil_edit.c

===================================================================

diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index e6ab6d061ea..1e666f8c1dd 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -67,6 +67,7 @@
 
 #include "ED_armature.h"
 #include "ED_gpencil.h"
+#include "ED_keyframing.h"
 #include "ED_object.h"
 #include "ED_outliner.h"
 #include "ED_screen.h"
@@ -1715,10 +1716,15 @@ static int gpencil_strokes_paste_exec(bContext *C, wmOperator *op)
 
         /* Ensure we have a frame to draw into
          * NOTE: Since this is an op which creates strokes,
-         *       we are obliged to add a new frame if one
-         *       doesn't exist already
+         *       we resuse active frame or add a new frame if one
+         *       doesn't exist already depending on REC button status.
          */
-        gpf = BKE_gpencil_layer_frame_get(gpl, scene->r.cfra, GP_GETFRAME_ADD_NEW);
+        if (IS_AUTOKEY_ON(scene) || (gpl->actframe == NULL)) {
+          gpf = BKE_gpencil_layer_frame_get(gpl, scene->r.cfra, GP_GETFRAME_ADD_NEW);
+        }
+        else {
+          gpf = BKE_gpencil_layer_frame_get(gpl, scene->r.cfra, GP_GETFRAME_USE_PREV);
+        }
         if (gpf) {
           /* Create new stroke */
           bGPDstroke *new_stroke = BKE_gpencil_stroke_duplicate(gps, true, true);



More information about the Bf-blender-cvs mailing list