[Bf-blender-cvs] [ba046e04170] temp-lineart-contained: LineArt: further fixes.
YimingWu
noreply at git.blender.org
Tue Jun 29 04:52:54 CEST 2021
Commit: ba046e0417023d7061fcd2504612635ca3b618c0
Author: YimingWu
Date: Mon Jun 28 22:29:21 2021 +0800
Branches: temp-lineart-contained
https://developer.blender.org/rBba046e0417023d7061fcd2504612635ca3b618c0
LineArt: further fixes.
===================================================================
M release/scripts/startup/bl_ui/properties_material.py
M source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
M source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
M source/blender/makesdna/DNA_gpencil_modifier_types.h
M source/blender/makesdna/DNA_material_types.h
M source/blender/makesrna/intern/rna_material.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_material.py b/release/scripts/startup/bl_ui/properties_material.py
index 73f767213f4..b217e33de12 100644
--- a/release/scripts/startup/bl_ui/properties_material.py
+++ b/release/scripts/startup/bl_ui/properties_material.py
@@ -298,10 +298,11 @@ class MATERIAL_PT_lineart(MaterialButtonsPanel, Panel):
for i in range(8):
row.prop(lineart, "use_material_mask_bits", text=str(i), index=i, toggle=True)
- row = layout.row(align=True, heading="Custom occlusion effectiveness")
- row.active = lineart.use_occlusion_effectiveness
- row.prop(lineart, "use_occlusion_effectiveness", text="")
- row.prop(lineart, "occlusion_effectiveness", slider=True)
+ row = layout.row(align=True, heading="Custom Occlusion")
+ row.prop(lineart, "use_mat_occlusion", text="")
+ sub = row.row(align=False)
+ sub.active = lineart.use_mat_occlusion
+ sub.prop(lineart, "mat_occlusion", slider=True, text="Levels")
classes = (
diff --git a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
index 03cbdd17558..48f79e9c629 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
+++ b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
@@ -54,7 +54,7 @@ typedef struct LineartTriangle {
unsigned char material_mask_bits;
unsigned char intersection_mask;
- unsigned char occlusion_effectiveness;
+ unsigned char mat_occlusion;
unsigned char flags; /* #eLineartTriangleFlags */
/**
@@ -102,7 +102,7 @@ typedef struct LineartEdgeSegment {
/** Occlusion level after "at" point */
unsigned char occlusion;
- /* Used to filter line art occlusion */
+ /* Used to filter line art occlusion edges */
unsigned char material_mask_bits;
} LineartEdgeSegment;
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
index 45839242c0a..4cb29cfbb62 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
@@ -152,7 +152,7 @@ static void lineart_edge_cut(LineartRenderBuffer *rb,
double start,
double end,
uchar material_mask_bits,
- uchar occlusion_effectiveness)
+ uchar mat_occlusion)
{
LineartEdgeSegment *es, *ies, *next_es, *prev_es;
LineartEdgeSegment *cut_start_before = 0, *cut_end_before = 0;
@@ -287,7 +287,7 @@ static void lineart_edge_cut(LineartRenderBuffer *rb,
/* Register 1 level of occlusion for all touched segments. */
for (es = ns; es && es != ns2; es = es->next) {
- es->occlusion += occlusion_effectiveness;
+ es->occlusion += mat_occlusion;
es->material_mask_bits |= material_mask_bits;
}
@@ -382,7 +382,7 @@ static void lineart_occlusion_single_line(LineartRenderBuffer *rb, LineartEdge *
lineart_occlusion_is_adjacent_intersection(e, (LineartTriangle *)tri) ||
/* Or if this triangle isn't effectively occluding anything nor it's providing a
material flag. */
- ((!tri->base.occlusion_effectiveness) && (!tri->base.material_mask_bits))) {
+ ((!tri->base.mat_occlusion) && (!tri->base.material_mask_bits))) {
continue;
}
tri->testing_e[thread_id] = e;
@@ -398,8 +398,7 @@ static void lineart_occlusion_single_line(LineartRenderBuffer *rb, LineartEdge *
rb->shift_y,
&l,
&r)) {
- lineart_edge_cut(
- rb, e, l, r, tri->base.material_mask_bits, tri->base.occlusion_effectiveness);
+ lineart_edge_cut(rb, e, l, r, tri->base.material_mask_bits, tri->base.mat_occlusion);
if (e->min_occ > rb->max_occlusion_level) {
/* No need to calculate any longer on this line because no level more than set value is
* going to show up in the rendered result. */
@@ -1867,16 +1866,15 @@ static void lineart_geometry_object_load(LineartObjectInfo *obi, LineartRenderBu
loop = loop->next;
tri->v[2] = &orv[BM_elem_index_get(loop->v)];
- /* material mask bits and occlusion effectiveness assignment, */
- /* bits are shifted to higher 6 bits. See MaterialLineArt::material_mask_flags for details. */
+ /* Material mask bits and occlusion effectiveness assignment. */
Material *mat = BKE_object_material_get(orig_ob, f->mat_nr + 1);
tri->material_mask_bits |= ((mat && (mat->lineart.flags & LRT_MATERIAL_MASK_ENABLED)) ?
mat->lineart.material_mask_bits :
0);
- tri->occlusion_effectiveness |= ((mat && (mat->lineart.flags &
- LRT_MATERIAL_CUSTOM_OCCLUSION_EFFECTIVENESS)) ?
- mat->lineart.occlusion_effectiveness :
- 1);
+ tri->mat_occlusion |= ((mat &&
+ (mat->lineart.flags & LRT_MATERIAL_CUSTOM_OCCLUSION_EFFECTIVENESS)) ?
+ mat->lineart.mat_occlusion :
+ 1);
tri->intersection_mask = obi->override_intersection_mask;
diff --git a/source/blender/makesdna/DNA_gpencil_modifier_types.h b/source/blender/makesdna/DNA_gpencil_modifier_types.h
index 8d43bc00fdf..ca2f2947481 100644
--- a/source/blender/makesdna/DNA_gpencil_modifier_types.h
+++ b/source/blender/makesdna/DNA_gpencil_modifier_types.h
@@ -886,7 +886,7 @@ typedef enum eLineArtGPencilModifierFlags {
typedef enum eLineartGpencilMaskSwitches {
LRT_GPENCIL_MATERIAL_MASK_ENABLE = (1 << 0),
- /** Set to true means using "and" instead of "or" logic on mask bits. */
+ /** When set, material mask bit comparisons are done with bit wise "AND" instead of "OR". */
LRT_GPENCIL_MATERIAL_MASK_MATCH = (1 << 1),
LRT_GPENCIL_INTERSECTION_FILTER = (1 << 2),
LRT_GPENCIL_INTERSECTION_MATCH = (1 << 3),
diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h
index 9ce3bcbf1e7..62933d44afd 100644
--- a/source/blender/makesdna/DNA_material_types.h
+++ b/source/blender/makesdna/DNA_material_types.h
@@ -149,11 +149,11 @@ typedef struct MaterialLineArt {
/* eMaterialLineArtFlags */
int flags;
- /* Used to filter line art occlusion */
+ /* Used to filter line art occlusion edges */
unsigned char material_mask_bits;
/** Maximum 255 levels of equavalent occlusion. */
- unsigned char occlusion_effectiveness;
+ unsigned char mat_occlusion;
unsigned char _pad[2];
} MaterialLineArt;
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index 910e0845486..b662f54ed4c 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -702,7 +702,7 @@ static void rna_def_material_lineart(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Mask", "");
RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialLineArt_update");
- prop = RNA_def_property(srna, "use_occlusion_effectiveness", PROP_BOOLEAN, PROP_NONE);
+ prop = RNA_def_property(srna, "use_mat_occlusion", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_default(prop, 0);
RNA_def_property_boolean_sdna(prop, NULL, "flags", LRT_MATERIAL_CUSTOM_OCCLUSION_EFFECTIVENESS);
RNA_def_property_ui_text(prop,
@@ -710,9 +710,9 @@ static void rna_def_material_lineart(BlenderRNA *brna)
"Use custom occlusion effectiveness for this material");
RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialLineArt_update");
- prop = RNA_def_property(srna, "occlusion_effectiveness", PROP_INT, PROP_NONE);
+ prop = RNA_def_property(srna, "mat_occlusion", PROP_INT, PROP_NONE);
RNA_def_property_int_default(prop, 1);
- RNA_def_property_range(prop, 0.0f, 3.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 5.0f, 1.0f, 1);
RNA_def_property_ui_text(
prop,
"Effectiveness",
More information about the Bf-blender-cvs
mailing list