[Bf-blender-cvs] [f3cb11ea7a9] greasepencil-object: GPencil: Fix Array modifier order and remove Keep on Top

Antonio Vazquez noreply at git.blender.org
Tue Feb 25 18:00:23 CET 2020


Commit: f3cb11ea7a923ee7e92fd3deed6aefa2837c8ae3
Author: Antonio Vazquez
Date:   Tue Feb 25 17:52:13 2020 +0100
Branches: greasepencil-object
https://developer.blender.org/rBf3cb11ea7a923ee7e92fd3deed6aefa2837c8ae3

GPencil: Fix Array modifier order and remove Keep on Top

There is one limitation in the order. As the Layer position is on top of array element, if the object has several layers, the order is by layer. To keep the full object on back, merge all layers in one of the original object.

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

M	release/scripts/startup/bl_ui/properties_data_modifier.py
M	source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
M	source/blender/makesdna/DNA_gpencil_modifier_types.h
M	source/blender/makesrna/intern/rna_gpencil_modifier.c

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

diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 5110df2d52e..a69b927c98b 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -1995,7 +1995,6 @@ class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, Panel):
         col = layout.column()
         col.separator()
         col.prop(md, "replace_material", text="Material Override")
-        col.prop(md, "keep_on_top", text="Keep original stroke on top")
 
         self.gpencil_masking(layout, ob, md, False)
 
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
index 35652cee93a..f5eb15a54dc 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
@@ -158,6 +158,7 @@ static void generate_geometry(GpencilModifierData *md,
   /* Load the strokes to be duplicated. */
   bGPdata *gpd = (bGPdata *)ob->data;
   bool found = false;
+
   LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
     bGPDframe *gpf = BKE_gpencil_frame_retime_get(depsgraph, scene, ob, gpl);
     if (gpf == NULL) {
@@ -216,7 +217,7 @@ static void generate_geometry(GpencilModifierData *md,
       madd_v3_v3fl(current_offset[3], mmd->shift, x);
 
       /* Duplicate original strokes to create this instance. */
-      LISTBASE_FOREACH (tmpStrokes *, iter, &stroke_cache) {
+      LISTBASE_FOREACH_BACKWARD (tmpStrokes *, iter, &stroke_cache) {
         /* Duplicate stroke */
         bGPDstroke *gps_dst = BKE_gpencil_stroke_duplicate(iter->gps, true);
 
@@ -233,20 +234,18 @@ static void generate_geometry(GpencilModifierData *md,
           add_v3_v3(&pt->x, current_offset[3]);
         }
 
-        /* if replace material, use new one */
+        /* If replace material, use new one. */
         if ((mmd->mat_rpl > 0) && (mmd->mat_rpl <= ob->totcol)) {
           gps_dst->mat_nr = mmd->mat_rpl - 1;
         }
 
         /* Add new stroke. */
-        BLI_addtail(&iter->gpf->strokes, gps_dst);
+        BLI_addhead(&iter->gpf->strokes, gps_dst);
       }
     }
 
     /* Free temp data. */
-    tmpStrokes *tmp_next = NULL;
-    for (tmpStrokes *tmp = stroke_cache.first; tmp; tmp = tmp_next) {
-      tmp_next = tmp->next;
+    LISTBASE_FOREACH_MUTABLE (tmpStrokes *, tmp, &stroke_cache) {
       BLI_freelinkN(&stroke_cache, tmp);
     }
   }
diff --git a/source/blender/makesdna/DNA_gpencil_modifier_types.h b/source/blender/makesdna/DNA_gpencil_modifier_types.h
index 477ee8da734..017af2173dd 100644
--- a/source/blender/makesdna/DNA_gpencil_modifier_types.h
+++ b/source/blender/makesdna/DNA_gpencil_modifier_types.h
@@ -340,7 +340,6 @@ typedef enum eArrayGpencil_Flag {
   GP_ARRAY_RANDOM_ROT = (1 << 1),
   GP_ARRAY_INVERT_LAYER = (1 << 2),
   GP_ARRAY_INVERT_PASS = (1 << 3),
-  GP_ARRAY_KEEP_ONTOP = (1 << 4),
   GP_ARRAY_INVERT_LAYERPASS = (1 << 5),
   GP_ARRAY_INVERT_MATERIAL = (1 << 6),
 } eArrayGpencil_Flag;
diff --git a/source/blender/makesrna/intern/rna_gpencil_modifier.c b/source/blender/makesrna/intern/rna_gpencil_modifier.c
index 1f72a6247e1..0bd012ab700 100644
--- a/source/blender/makesrna/intern/rna_gpencil_modifier.c
+++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c
@@ -1370,14 +1370,6 @@ static void rna_def_modifier_gpencilinstance(BlenderRNA *brna)
   RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_ARRAY_INVERT_LAYERPASS);
   RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
   RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
-  prop = RNA_def_property(srna, "keep_on_top", PROP_BOOLEAN, PROP_NONE);
-  RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_ARRAY_KEEP_ONTOP);
-  RNA_def_property_ui_text(
-      prop,
-      "Keep on Top",
-      "Keep the original stroke in front of new instances (only affect by layer)");
-  RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
 }
 
 static void rna_def_modifier_gpencilbuild(BlenderRNA *brna)



More information about the Bf-blender-cvs mailing list