[Bf-blender-cvs] [19f36e16e8c] greasepencil-object: GPencil: Fix wrong order when Append layers to Object

Antonio Vazquez noreply at git.blender.org
Fri May 7 16:34:43 CEST 2021


Commit: 19f36e16e8c69b17c9be291dc72532da8ef344e7
Author: Antonio Vazquez
Date:   Fri May 7 16:34:38 2021 +0200
Branches: greasepencil-object
https://developer.blender.org/rB19f36e16e8c69b17c9be291dc72532da8ef344e7

GPencil: Fix wrong order when Append layers to Object

The operator was using the active layer as position to add new layer. Now the operator verify is using the last layer to make it at end.

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

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

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

diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c
index 4a47ed99c1a..c5f094e030a 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -577,6 +577,10 @@ static int gpencil_layer_duplicate_object_exec(bContext *C, wmOperator *op)
   }
 
   bGPdata *gpd_dst = (bGPdata *)ob_dst->data;
+  /* Disable destination active layer to keep order. */
+  LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd_dst->layers) {
+    gpl->flag &= ~GP_LAYER_ACTIVE;
+  }
 
   LISTBASE_FOREACH (bGPDlayer *, gpl_src, &gpd_src->layers) {
     if ((only_active) && (gpl_src != gpl_active)) {



More information about the Bf-blender-cvs mailing list