diff options
author | YimingWu <xp8110@outlook.com> | 2022-01-17 12:20:47 +0300 |
---|---|---|
committer | YimingWu <xp8110@outlook.com> | 2022-01-17 12:22:09 +0300 |
commit | 40c8e23d481cbee683ea890a6bf49129e7fcf5df (patch) | |
tree | 1935ed569bb14592375f6de8e6524f7468ebc0a2 /source/blender | |
parent | e1e3043a51a6f88b3a79b935678464a06c2e469f (diff) |
LineArt: Invert collection option.
Allows conveniently selecting an inverse of a collection.
Reviewed By: Antonio Vazquez (antoniov)
Differential Revision: https://developer.blender.org/D13846
Diffstat (limited to 'source/blender')
4 files changed, 20 insertions, 3 deletions
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c index b35ebd4be9a..59937bb0757 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c @@ -314,7 +314,9 @@ 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); + 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 f08d35891ce..5461b80cad1 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c +++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c @@ -4363,8 +4363,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 0f69a256f56..b361372ff8b 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 e06aac31124..086da4c31ba 100644 --- a/source/blender/makesrna/intern/rna_gpencil_modifier.c +++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c @@ -3446,6 +3446,13 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna) "Trim all edges right at the boundary of image(including overscan region)"); 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); } |