Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYimingWu <xp8110@outlook.com>2021-03-17 12:43:29 +0300
committerSebastian Parborg <darkdefende@gmail.com>2021-03-17 17:23:48 +0300
commit0bae3002cf4b8928834feb3a5783944b922096be (patch)
tree72d410ed34e855f51f7615daba5ec5c410688cb9 /source/blender/gpencil_modifiers
parent7f769567d085ef5c13d99a34bb7af7a7b147f523 (diff)
LineArt: Fix transparency flag error during cutting and chaining.
Diffstat (limited to 'source/blender/gpencil_modifiers')
-rw-r--r--source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c6
-rw-r--r--source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c12
2 files changed, 15 insertions, 3 deletions
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c
index 7b6ad05f7ce..10a028d94cc 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c
@@ -128,6 +128,7 @@ static LineartLineChainItem *lineart_chain_append_point(LineartRenderBuffer *rb,
LineartLineChainItem *old_rlci = rlc->chain.last;
old_rlci->line_type = type;
old_rlci->occlusion = level;
+ old_rlci->transparency_mask = transparency_mask;
return old_rlci;
}
@@ -356,6 +357,7 @@ void MOD_lineart_chain_feature_lines(LineartRenderBuffer *rb)
rls->transparency_mask,
rl->l_obindex);
last_occlusion = rls->occlusion;
+ last_transparency = rls->transparency_mask;
}
VERT_COORD_TO_FLOAT(rl->r)
lineart_chain_append_point(rb,
@@ -399,6 +401,7 @@ void MOD_lineart_chain_feature_lines(LineartRenderBuffer *rb)
last_transparency = rls->transparency_mask;
/* Fix leading vertex occlusion. */
rlci->occlusion = last_occlusion;
+ rlci->transparency_mask = last_transparency;
for (rls = new_rl->segments.last; rls; rls = rls->prev) {
double gpos[3], lpos[3];
double *lfb = new_rl->l->fbcoord, *rfb = new_rl->r->fbcoord;
@@ -406,6 +409,7 @@ void MOD_lineart_chain_feature_lines(LineartRenderBuffer *rb)
interp_v3_v3v3_db(lpos, new_rl->l->fbcoord, new_rl->r->fbcoord, rls->at);
interp_v3_v3v3_db(gpos, new_rl->l->gloc, new_rl->r->gloc, global_at);
last_occlusion = rls->prev ? rls->prev->occlusion : last_occlusion;
+ last_transparency = rls->prev ? rls->prev->transparency_mask : last_transparency;
POS_TO_FLOAT(lpos, gpos)
lineart_chain_append_point(rb,
rlc,
@@ -423,6 +427,7 @@ void MOD_lineart_chain_feature_lines(LineartRenderBuffer *rb)
last_occlusion = rls->occlusion;
last_transparency = rls->transparency_mask;
rlci->occlusion = last_occlusion;
+ rlci->transparency_mask = last_transparency;
rls = rls->next;
for (; rls; rls = rls->next) {
double gpos[3], lpos[3];
@@ -595,6 +600,7 @@ void MOD_lineart_chain_split_for_fixed_occlusion(LineartRenderBuffer *rb)
/* Set the same occlusion level for the end vertex, so when further connection is needed
* the backwards occlusion info is also correct. */
rlci->occlusion = fixed_occ;
+ rlci->transparency_mask = fixed_mask;
/* No need to split at the last point anyway. */
break;
}
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
index 612da60b098..31cffad5a7e 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
@@ -260,18 +260,24 @@ static void lineart_line_cut(LineartRenderBuffer *rb,
else {
/* We have yet to reach a existing cutting point even after we searched the whole line, so we
* append the new cut to the end. */
- ns->occlusion = (irls = rl->segments.last)->occlusion;
+ irls = rl->segments.last;
+ ns->occlusion = irls->occlusion;
+ ns->transparency_mask = irls->transparency_mask;
BLI_addtail(&rl->segments, ns);
}
if (cut_end_before) {
/* The same manipulation as on "cut_start_before". */
if (cut_end_before != ns2) {
- ns2->occlusion = cut_end_before->prev ? (irls = cut_end_before->prev)->occlusion : 0;
+ irls = cut_end_before->prev ? cut_end_before->prev : NULL;
+ ns2->occlusion = irls ? irls->occlusion : 0;
+ ns2->transparency_mask = irls ? irls->transparency_mask : 0;
BLI_insertlinkbefore(&rl->segments, (void *)cut_end_before, (void *)ns2);
}
}
else {
- ns2->occlusion = (irls = rl->segments.last)->occlusion;
+ irls = rl->segments.last;
+ ns2->occlusion = irls->occlusion;
+ ns2->transparency_mask = irls->transparency_mask;
BLI_addtail(&rl->segments, ns2);
}