[Bf-blender-cvs] [517407108ba] temp-lineart-contained: LineArt: Invert collection option.

YimingWu noreply at git.blender.org
Sun Jan 16 16:29:15 CET 2022


Commit: 517407108ba2c6f2b636bfad7ebb032dbf73cb30
Author: YimingWu
Date:   Sun Jan 16 23:27:21 2022 +0800
Branches: temp-lineart-contained
https://developer.blender.org/rB517407108ba2c6f2b636bfad7ebb032dbf73cb30

LineArt: Invert collection option.

Allows conveniently selecting an inverse of a collection.

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

M	release/datafiles/locale
M	release/scripts/addons
M	source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
M	source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
M	source/blender/makesdna/DNA_gpencil_modifier_types.h
M	source/blender/makesrna/intern/rna_gpencil_modifier.c
M	source/tools

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

diff --git a/release/datafiles/locale b/release/datafiles/locale
index 620b85f16d0..d46eacffd92 160000
--- a/release/datafiles/locale
+++ b/release/datafiles/locale
@@ -1 +1 @@
-Subproject commit 620b85f16d03a6aadd7cae56969c9c29b06b992d
+Subproject commit d46eacffd92496ae9702a71dfc4da235eaf7731b
diff --git a/release/scripts/addons b/release/scripts/addons
index c08568cc376..ee7f95212b9 160000
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit c08568cc376d2e4298710c4172fb0c74f0611de1
+Subproject commit ee7f95212b96c2786a27e4ba4729fff4a504328d
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
index 833456e31e5..614ded19202 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
@@ -316,7 +316,10 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel)
     uiItemR(layout, ptr, "source_object", 0, NULL, ICON_OBJECT_DATA);
   }
   else if (source_type == LRT_SOURCE_COLLECTION) {
-    uiItemR(layout, ptr, "source_collection", 0, NULL, ICON_OUTLINER_COLLECTION);
+    uiLayout *sub = uiLayoutRow(layout, true);
+    uiLayoutSetPropDecorate(sub, false);
+    uiItemR(sub, ptr, "source_collection", 0, NULL, ICON_OUTLINER_COLLECTION);
+    uiItemR(sub, ptr, "use_invert_collection", 0, "", ICON_ARROW_LEFTRIGHT);
   }
   else {
     /* Source is Scene. */
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
index bcee1fee039..1a9a468b02e 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
@@ -4631,8 +4631,15 @@ static void lineart_gpencil_generate(LineartCache *cache,
       continue;
     }
     if (orig_col && ec->object_ref) {
-      if (!BKE_collection_has_object_recursive_instanced(orig_col, (Object *)ec->object_ref)) {
-        continue;
+      if (BKE_collection_has_object_recursive_instanced(orig_col, (Object *)ec->object_ref)) {
+        if (modifier_flags & LRT_GPENCIL_INVERT_COLLECTION) {
+          continue;
+        }
+      }
+      else {
+        if (!(modifier_flags & LRT_GPENCIL_INVERT_COLLECTION)) {
+          continue;
+        }
       }
     }
     if (mask_switches & LRT_GPENCIL_MATERIAL_MASK_ENABLE) {
diff --git a/source/blender/makesdna/DNA_gpencil_modifier_types.h b/source/blender/makesdna/DNA_gpencil_modifier_types.h
index 38c2fc3544d..226bd2032b3 100644
--- a/source/blender/makesdna/DNA_gpencil_modifier_types.h
+++ b/source/blender/makesdna/DNA_gpencil_modifier_types.h
@@ -989,6 +989,7 @@ typedef enum eLineArtGPencilModifierFlags {
   LRT_GPENCIL_IS_BAKED = (1 << 3),
   LRT_GPENCIL_USE_CACHE = (1 << 4),
   LRT_GPENCIL_OFFSET_TOWARDS_CUSTOM_CAMERA = (1 << 5),
+  LRT_GPENCIL_INVERT_COLLECTION = (1 << 6),
 } eLineArtGPencilModifierFlags;
 
 typedef enum eLineartGpencilMaskSwitches {
diff --git a/source/blender/makesrna/intern/rna_gpencil_modifier.c b/source/blender/makesrna/intern/rna_gpencil_modifier.c
index 9dc88c177a2..32606be173d 100644
--- a/source/blender/makesrna/intern/rna_gpencil_modifier.c
+++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c
@@ -3492,6 +3492,13 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna)
       "Internally rotate the camera slightly to comphensate for the precision of the algorithm");
   RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
 
+  prop = RNA_def_property(srna, "use_invert_collection", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "flags", LRT_GPENCIL_INVERT_COLLECTION);
+  RNA_def_property_ui_text(prop,
+                           "Invert collection filtering",
+                           "Select everything except lines from specified collection");
+  RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
   RNA_define_lib_overridable(false);
 }
 
diff --git a/source/tools b/source/tools
index 26bc78162ec..7fd2ed908b4 160000
--- a/source/tools
+++ b/source/tools
@@ -1 +1 @@
-Subproject commit 26bc78162ec89f21453ce3ded7b999bc6649f32b
+Subproject commit 7fd2ed908b4f50140670caf6786e5ed245b79137



More information about the Bf-blender-cvs mailing list