[Bf-blender-cvs] [213f704b761] temp-lineart-contained: LineArt: Data for intersection_flag

YimingWu noreply at git.blender.org
Sun May 9 05:12:36 CEST 2021


Commit: 213f704b761d77e881b8dd504de4130c7d025446
Author: YimingWu
Date:   Sun May 9 09:55:10 2021 +0800
Branches: temp-lineart-contained
https://developer.blender.org/rB213f704b761d77e881b8dd504de4130c7d025446

LineArt: Data for intersection_flag

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

M	source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
M	source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
M	source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
M	source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c
M	source/blender/makesdna/DNA_collection_types.h
M	source/blender/makesdna/DNA_gpencil_modifier_types.h
M	source/blender/makesrna/intern/rna_gpencil_modifier.c

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

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
index 18a3d680ef0..d9263770372 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
@@ -101,7 +101,7 @@ static void generate_strokes_actual(
       lmd->use_multiple_levels ? lmd->level_end : lmd->level_start,
       lmd->target_material ? BKE_gpencil_object_material_index_get(ob, lmd->target_material) : 0,
       lmd->edge_types,
-      lmd->transparency_flags,
+      lmd->mask_switches,
       lmd->transparency_mask,
       lmd->thickness,
       lmd->opacity,
diff --git a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
index 48641192982..9ef29245e20 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
+++ b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
@@ -635,7 +635,7 @@ void MOD_lineart_gpencil_generate(LineartCache *cache,
                                   int level_end,
                                   int mat_nr,
                                   short edge_types,
-                                  unsigned char transparency_flags,
+                                  unsigned char mask_switches,
                                   unsigned char transparency_mask,
                                   short thickness,
                                   float opacity,
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
index 54451235421..60a10cd921d 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
@@ -1871,7 +1871,10 @@ static bool _lineart_object_not_in_source_collection(Collection *source, Object
  * `_rb` is used to provide source selection info.
  * See the definition of `rb->_source_type` for details.
  */
-static int lineart_usage_check(Collection *c, Object *ob, LineartRenderBuffer *_rb)
+static int lineart_usage_check(Collection *c,
+                               Object *ob,
+                               unsigned char *r_intersection_mask,
+                               LineartRenderBuffer *_rb)
 {
 
   if (!c) {
@@ -4091,7 +4094,7 @@ static void lineart_gpencil_generate(LineartCache *cache,
                                      Object *source_object,
                                      Collection *source_collection,
                                      int types,
-                                     uchar transparency_flags,
+                                     uchar mask_switches,
                                      uchar transparency_mask,
                                      short thickness,
                                      float opacity,
@@ -4151,8 +4154,8 @@ static void lineart_gpencil_generate(LineartCache *cache,
         continue;
       }
     }
-    if (transparency_flags & LRT_GPENCIL_TRANSPARENCY_ENABLE) {
-      if (transparency_flags & LRT_GPENCIL_TRANSPARENCY_MATCH) {
+    if (mask_switches & LRT_GPENCIL_TRANSPARENCY_ENABLE) {
+      if (mask_switches & LRT_GPENCIL_TRANSPARENCY_MATCH) {
         if (rlc->transparency_mask != transparency_mask) {
           continue;
         }
@@ -4257,7 +4260,7 @@ void MOD_lineart_gpencil_generate(LineartCache *cache,
                                   int level_end,
                                   int mat_nr,
                                   short edge_types,
-                                  uchar transparency_flags,
+                                  uchar mask_switches,
                                   uchar transparency_mask,
                                   short thickness,
                                   float opacity,
@@ -4306,7 +4309,7 @@ void MOD_lineart_gpencil_generate(LineartCache *cache,
                            source_object,
                            source_collection,
                            use_types,
-                           transparency_flags,
+                           mask_switches,
                            transparency_mask,
                            thickness,
                            opacity,
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c
index c3b482b8907..38aa361dac7 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c
@@ -139,7 +139,7 @@ static bool bake_strokes(
       lmd->use_multiple_levels ? lmd->level_end : lmd->level_start,
       lmd->target_material ? BKE_gpencil_object_material_index_get(ob, lmd->target_material) : 0,
       lmd->edge_types,
-      lmd->transparency_flags,
+      lmd->mask_switches,
       lmd->transparency_mask,
       lmd->thickness,
       lmd->opacity,
diff --git a/source/blender/makesdna/DNA_collection_types.h b/source/blender/makesdna/DNA_collection_types.h
index aa91699ae40..1defa8b782b 100644
--- a/source/blender/makesdna/DNA_collection_types.h
+++ b/source/blender/makesdna/DNA_collection_types.h
@@ -46,9 +46,6 @@ typedef struct CollectionChild {
   struct Collection *collection;
 } CollectionChild;
 
-/**
- * \warning while the values seem to be flags, they aren't treated as flags.
- */
 enum eCollectionLineArt_Usage {
   COLLECTION_LRT_INCLUDE = 0,
   COLLECTION_LRT_OCCLUSION_ONLY = (1 << 0),
@@ -57,6 +54,10 @@ enum eCollectionLineArt_Usage {
   COLLECTION_LRT_NO_INTERSECTION = (1 << 3),
 };
 
+enum eCollectionLineArt_Flags {
+  COLLECTION_LRT_USE_INTERSECTION_MASK = (1 << 0),
+};
+
 typedef struct Collection {
   ID id;
 
@@ -74,8 +75,10 @@ typedef struct Collection {
   /* Runtime-only, always cleared on file load. */
   short tag;
 
-  /** Line Art engine specific */
-  short lineart_usage;
+  short lineart_usage;         /* eCollectionLineArt_Usage */
+  unsigned char lineart_flags; /* eCollectionLineArt_Flags */
+  unsigned char lineart_intersection_mask;
+  char _pad[6];
 
   int16_t color_tag;
 
diff --git a/source/blender/makesdna/DNA_gpencil_modifier_types.h b/source/blender/makesdna/DNA_gpencil_modifier_types.h
index b982c336a4f..876b24db6e5 100644
--- a/source/blender/makesdna/DNA_gpencil_modifier_types.h
+++ b/source/blender/makesdna/DNA_gpencil_modifier_types.h
@@ -847,11 +847,11 @@ typedef enum eLineArtGPencilModifierFlags {
   LRT_GPENCIL_USE_CACHE = (1 << 4),
 } eLineArtGPencilModifierFlags;
 
-typedef enum eLineartGpencilTransparencyFlags {
+typedef enum eLineartGpencilMaskSwitches {
   LRT_GPENCIL_TRANSPARENCY_ENABLE = (1 << 0),
   /** Set to true means using "and" instead of "or" logic on mask bits. */
   LRT_GPENCIL_TRANSPARENCY_MATCH = (1 << 1),
-} eLineartGpencilTransparencyFlags;
+} eLineartGpencilMaskSwitches;
 
 struct LineartCache;
 
@@ -882,8 +882,11 @@ typedef struct LineartGpencilModifierData {
   float opacity;
   short thickness;
 
-  unsigned char transparency_flags; /* eLineartGpencilTransparencyFlags */
+  unsigned char mask_switches; /* eLineartGpencilMaskSwitches */
   unsigned char transparency_mask;
+  unsigned char intersection_mask;
+
+  char _pad[7];
 
   /** `0..1` range for cosine angle */
   float crease_threshold;
@@ -897,10 +900,10 @@ typedef struct LineartGpencilModifierData {
   /* CPU mode */
   float chaining_image_threshold;
 
-  /* Ported from SceneLineArt flags. */
+  /* eLineartMainFlags, for one time calculation. */
   int calculation_flags;
 
-  /* Additional Switches. */
+  /* eLineArtGPencilModifierFlags, for stroke selection in each modifier. */
   int flags;
 
   /* Move strokes towards camera to avoid clipping while preserve depth for the viewport. */
diff --git a/source/blender/makesrna/intern/rna_gpencil_modifier.c b/source/blender/makesrna/intern/rna_gpencil_modifier.c
index e6d8576082b..d9d44d53c6e 100644
--- a/source/blender/makesrna/intern/rna_gpencil_modifier.c
+++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c
@@ -2917,13 +2917,13 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna)
   RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
 
   prop = RNA_def_property(srna, "use_transparency", PROP_BOOLEAN, PROP_NONE);
-  RNA_def_property_boolean_sdna(prop, NULL, "transparency_flags", LRT_GPENCIL_TRANSPARENCY_ENABLE);
+  RNA_def_property_boolean_sdna(prop, NULL, "mask_switches", LRT_GPENCIL_TRANSPARENCY_ENABLE);
   RNA_def_property_ui_text(
       prop, "Use Transparency", "Use transparency mask from this material in line art");
   RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
 
   prop = RNA_def_property(srna, "use_transparency_match", PROP_BOOLEAN, PROP_NONE);
-  RNA_def_property_boolean_sdna(prop, NULL, "transparency_flags", LRT_GPENCIL_TRANSPARENCY_MATCH);
+  RNA_def_property_boolean_sdna(prop, NULL, "mask_switches", LRT_GPENCIL_TRANSPARENCY_MATCH);
   RNA_def_property_ui_text(
       prop, "Match Transparency", "Require matching all transparency masks instead of just one");
   RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");



More information about the Bf-blender-cvs mailing list