[Bf-blender-cvs] [8c6e93b0bd2] temp-npr-gpencil-modifiers: Gpencil: layer/material influence for multistroke modifier.

YimingWu noreply at git.blender.org
Sun Sep 15 16:04:46 CEST 2019


Commit: 8c6e93b0bd254c4865e20f6a3e83c3f0510e895b
Author: YimingWu
Date:   Sun Sep 15 22:04:20 2019 +0800
Branches: temp-npr-gpencil-modifiers
https://developer.blender.org/rB8c6e93b0bd254c4865e20f6a3e83c3f0510e895b

Gpencil: layer/material influence for multistroke modifier.

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

M	release/scripts/startup/bl_ui/properties_data_modifier.py
M	source/blender/gpencil_modifiers/intern/MOD_gpencillength.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencilmultiply.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 5acbba691ec..322833518cc 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -2368,8 +2368,8 @@ class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, Panel):
         row.prop(md, "invert_layer_pass", text="", icon='ARROW_LEFTRIGHT')
     
     def GP_MULTIPLY(self, layout, ob, md):
+        gpd = ob.data
         sp = layout.split(factor = 0.5)
-
         col = sp.column()
         col.prop(md, "enable_duplication")
         if md.enable_duplication:
@@ -2388,6 +2388,28 @@ class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, Panel):
         col.prop(md, "enable_angle_splitting")
         if md.enable_angle_splitting:
             col.prop(md,"split_angle")
+
+        col = layout.column()
+        col.separator()
+
+        col.label(text="Material:")
+        row = col.row(align=True)
+        row.prop_search(md, "material", gpd, "materials", text="", icon='SHADING_TEXTURE')
+        row.prop(md, "invert_materials", text="", icon='ARROW_LEFTRIGHT')
+        row = layout.row(align=True)
+        row.prop(md, "pass_index", text="Pass")
+        row.prop(md, "invert_material_pass", text="", icon='ARROW_LEFTRIGHT')
+
+        col = layout.column()
+        col.separator()
+
+        col.label(text="Layer:")
+        row = col.row(align=True)
+        row.prop_search(md, "layer", gpd, "layers", text="", icon='GREASEPENCIL')
+        row.prop(md, "invert_layers", text="", icon='ARROW_LEFTRIGHT')
+        row = layout.row(align=True)
+        row.prop(md, "layer_pass", text="Pass")
+        row.prop(md, "invert_layer_pass", text="", icon='ARROW_LEFTRIGHT')
             
 classes = (
     DATA_PT_modifiers,
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillength.c b/source/blender/gpencil_modifiers/intern/MOD_gpencillength.c
index 3bf7383000b..81d736f43d2 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillength.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillength.c
@@ -119,7 +119,7 @@ static void bakeModifier(Main *UNUSED(bmain),
                                            lmd->flag & GP_MIRROR_INVERT_LAYER,
                                            lmd->flag & GP_MIRROR_INVERT_PASS,
                                            lmd->flag & GP_MIRROR_INVERT_LAYERPASS,
-                                           lmd->flag & GP_MIRROR_INVERT_MATERIAL)){
+                                           lmd->flag & GP_MIRROR_INVERT_MATERIAL)) {
           applyLength(gps, lmd->length, lmd->percentage);
         }
       }
@@ -140,17 +140,17 @@ static void deformStroke(GpencilModifierData *md,
 {
   LengthGpencilModifierData *lmd = (LengthGpencilModifierData *)md;
   if (is_stroke_affected_by_modifier(ob,
-                                      lmd->layername,
-                                      lmd->materialname,
-                                      lmd->pass_index,
-                                      lmd->layer_pass,
-                                      1,
-                                      gpl,
-                                      gps,
-                                      lmd->flag & GP_MIRROR_INVERT_LAYER,
-                                      lmd->flag & GP_MIRROR_INVERT_PASS,
-                                      lmd->flag & GP_MIRROR_INVERT_LAYERPASS,
-                                      lmd->flag & GP_MIRROR_INVERT_MATERIAL)){
+                                     lmd->layername,
+                                     lmd->materialname,
+                                     lmd->pass_index,
+                                     lmd->layer_pass,
+                                     1,
+                                     gpl,
+                                     gps,
+                                     lmd->flag & GP_MIRROR_INVERT_LAYER,
+                                     lmd->flag & GP_MIRROR_INVERT_PASS,
+                                     lmd->flag & GP_MIRROR_INVERT_LAYERPASS,
+                                     lmd->flag & GP_MIRROR_INVERT_MATERIAL)) {
     applyLength(gps, lmd->length, lmd->percentage);
   }
 }
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilmultiply.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilmultiply.c
index 941d454272c..c564e7177b3 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilmultiply.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilmultiply.c
@@ -238,6 +238,20 @@ static void bakeModifier(Main *UNUSED(bmain),
       MultiplyGpencilModifierData *mmd = (MultiplyGpencilModifierData *)md;
       bGPDstroke *gps;
       for (gps = gpf->strokes.first; gps; gps = gps->next) {
+        if (!is_stroke_affected_by_modifier(ob,
+                                            mmd->layername,
+                                            mmd->materialname,
+                                            mmd->pass_index,
+                                            mmd->layer_pass,
+                                            1,
+                                            gpl,
+                                            gps,
+                                            mmd->flag & GP_MIRROR_INVERT_LAYER,
+                                            mmd->flag & GP_MIRROR_INVERT_PASS,
+                                            mmd->flag & GP_MIRROR_INVERT_LAYERPASS,
+                                            mmd->flag & GP_MIRROR_INVERT_MATERIAL)) {
+          continue;
+        }
         if (mmd->flags & GP_MULTIPLY_ENABLE_ANGLE_SPLITTING) {
           splitStroke(gpf, gps, mmd->split_angle);
         }
@@ -273,6 +287,20 @@ static void generateStrokes(
   bGPDstroke *gps;
   ListBase duplicates = {0};
   for (gps = gpf->strokes.first; gps; gps = gps->next) {
+    if (!is_stroke_affected_by_modifier(ob,
+                                        mmd->layername,
+                                        mmd->materialname,
+                                        mmd->pass_index,
+                                        mmd->layer_pass,
+                                        1,
+                                        gpl,
+                                        gps,
+                                        mmd->flag & GP_MIRROR_INVERT_LAYER,
+                                        mmd->flag & GP_MIRROR_INVERT_PASS,
+                                        mmd->flag & GP_MIRROR_INVERT_LAYERPASS,
+                                        mmd->flag & GP_MIRROR_INVERT_MATERIAL)) {
+      continue;
+    }
     if (mmd->flags & GP_MULTIPLY_ENABLE_ANGLE_SPLITTING) {
       splitStroke(gpf, gps, mmd->split_angle);
     }
diff --git a/source/blender/makesdna/DNA_gpencil_modifier_types.h b/source/blender/makesdna/DNA_gpencil_modifier_types.h
index 12c776fac2b..c240e335f74 100644
--- a/source/blender/makesdna/DNA_gpencil_modifier_types.h
+++ b/source/blender/makesdna/DNA_gpencil_modifier_types.h
@@ -647,8 +647,6 @@ typedef struct ArmatureGpencilModifierData {
 
 typedef struct LengthGpencilModifierData {
   GpencilModifierData modifier;
-  /* What's this object for ? */
-  struct Object *object;
   /** Layer name. */
   char layername[64];
   /** Material name. */
@@ -666,6 +664,18 @@ typedef struct LengthGpencilModifierData {
 
 typedef struct MultiplyGpencilModifierData {
   GpencilModifierData modifier;
+  /** Layer name. */
+  char layername[64];
+  /** Material name. */
+  char materialname[64];
+  /** Custom index for passes. */
+  int pass_index;
+  /** Flags. */
+  int flag;
+  /** Custom index for passes. */
+  int layer_pass;
+  char _pad[4];
+
   int flags;
 
   int duplications;
diff --git a/source/blender/makesrna/intern/rna_gpencil_modifier.c b/source/blender/makesrna/intern/rna_gpencil_modifier.c
index 2bbe3176208..5be61f7f5f4 100644
--- a/source/blender/makesrna/intern/rna_gpencil_modifier.c
+++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c
@@ -1932,13 +1932,6 @@ static void rna_def_modifier_gpencillength(BlenderRNA *brna)
   RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
   RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
 
-  prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
-  RNA_def_property_ui_text(prop, "Object", "Object used as center");
-  RNA_def_property_pointer_funcs(prop, NULL, "rna_MirrorGpencilModifier_object_set", NULL, NULL);
-  RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
-  RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
-  RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
-
   prop = RNA_def_property(srna, "length", PROP_FLOAT, PROP_NONE);
   RNA_def_property_range(prop, -10.0f, 10.0f);
   RNA_def_property_ui_text(prop, "Length", "Length of each segment");
@@ -1960,6 +1953,48 @@ static void rna_def_modifier_gpencilmultiply(BlenderRNA *brna)
   RNA_def_struct_sdna(srna, "MultiplyGpencilModifierData");
   RNA_def_struct_ui_icon(srna, ICON_GP_MULTIFRAME_EDITING);
 
+  prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
+  RNA_def_property_string_sdna(prop, NULL, "layername");
+  RNA_def_property_ui_text(prop, "Layer", "Layer name");
+  RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+  prop = RNA_def_property(srna, "material", PROP_STRING, PROP_NONE);
+  RNA_def_property_string_sdna(prop, NULL, "materialname");
+  RNA_def_property_ui_text(prop, "Material", "Material name");
+  RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+  prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE);
+  RNA_def_property_int_sdna(prop, NULL, "pass_index");
+  RNA_def_property_range(prop, 0, 100);
+  RNA_def_property_ui_text(prop, "Pass", "Pass index");
+  RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+  prop = RNA_def_property(srna, "invert_layers", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_MIRROR_INVERT_LAYER);
+  RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter");
+  RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list