[Bf-blender-cvs] [6b255bd9bba] lanpr-under-gp: LineArt: Support for edge split.
YimingWu
noreply at git.blender.org
Thu Aug 20 09:03:24 CEST 2020
Commit: 6b255bd9bba63c4b7256605b9eaae1bcb25d500f
Author: YimingWu
Date: Thu Aug 20 15:03:02 2020 +0800
Branches: lanpr-under-gp
https://developer.blender.org/rB6b255bd9bba63c4b7256605b9eaae1bcb25d500f
LineArt: Support for edge split.
===================================================================
M release/scripts/startup/bl_ui/properties_render.py
M source/blender/editors/include/ED_lineart.h
M source/blender/editors/lineart/lineart_cpu.c
M source/blender/makesdna/DNA_scene_types.h
M source/blender/makesrna/intern/rna_scene.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_render.py b/release/scripts/startup/bl_ui/properties_render.py
index 8b26fab038f..0bd9d10b6ac 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -756,6 +756,7 @@ class RENDER_PT_lineart_line_types(RenderButtonsPanel, Panel):
layout.label(text="Extras:")
layout.prop(lineart, "allow_duplication")
+ layout.prop(lineart, "allow_overlapping_edges")
class RENDER_PT_lineart_baking(RenderButtonsPanel, Panel):
diff --git a/source/blender/editors/include/ED_lineart.h b/source/blender/editors/include/ED_lineart.h
index 0d1dab89ee5..20c7c497324 100644
--- a/source/blender/editors/include/ED_lineart.h
+++ b/source/blender/editors/include/ED_lineart.h
@@ -288,6 +288,10 @@ typedef struct LineartSharedResource {
/* We only allocate once for all */
LineartRenderBuffer *render_buffer_shared;
+ /* Don't put this in render buffer as the checker function doesn't have rb pointer, this design
+ * is for performance. */
+ char allow_overlapping_edges;
+
/* cache */
struct BLI_mempool *mp_sample;
struct BLI_mempool *mp_line_strip;
diff --git a/source/blender/editors/lineart/lineart_cpu.c b/source/blender/editors/lineart/lineart_cpu.c
index b1eebcb0f9a..a9b39bf46c2 100644
--- a/source/blender/editors/lineart/lineart_cpu.c
+++ b/source/blender/editors/lineart/lineart_cpu.c
@@ -1678,6 +1678,22 @@ static int lineart_triangle_has_edge(const LineartRenderTriangle *rt, const Line
if (rt->rl[0] == rl || rt->rl[1] == rl || rt->rl[2] == rl) {
return 1;
}
+ if (lineart_share.allow_overlapping_edges) {
+#define LRT_TRI_SAME_POINT(rt, i, pt) \
+ ((LRT_DOUBLE_CLOSE_ENOUGH(rt->rl[i]->l->gloc[0], pt->gloc[0]) && \
+ LRT_DOUBLE_CLOSE_ENOUGH(rt->rl[i]->l->gloc[1], pt->gloc[1]) && \
+ LRT_DOUBLE_CLOSE_ENOUGH(rt->rl[i]->l->gloc[2], pt->gloc[2])) || \
+ (LRT_DOUBLE_CLOSE_ENOUGH(rt->rl[i]->r->gloc[0], pt->gloc[0]) && \
+ LRT_DOUBLE_CLOSE_ENOUGH(rt->rl[i]->r->gloc[1], pt->gloc[1]) && \
+ LRT_DOUBLE_CLOSE_ENOUGH(rt->rl[i]->r->gloc[2], pt->gloc[2])))
+ if ((LRT_TRI_SAME_POINT(rt, 0, rl->l) || LRT_TRI_SAME_POINT(rt, 1, rl->l) ||
+ LRT_TRI_SAME_POINT(rt, 2, rl->l)) &&
+ (LRT_TRI_SAME_POINT(rt, 0, rl->r) || LRT_TRI_SAME_POINT(rt, 1, rl->r) ||
+ LRT_TRI_SAME_POINT(rt, 2, rl->r))) {
+ return 1;
+ }
+#undef LRT_TRI_SAME_POINT
+ }
return 0;
}
@@ -2453,6 +2469,8 @@ LineartRenderBuffer *ED_lineart_create_render_buffer(Scene *scene)
BLI_spin_init(&rb->lock_task);
BLI_spin_init(&rb->render_data_pool.lock_mem);
+ lineart_share.allow_overlapping_edges = (scene->lineart.flags & LRT_ALLOW_OVERLAPPING_EDGES) !=
+ 0;
return rb;
}
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index e35b355c922..d148b1c620a 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1666,6 +1666,7 @@ typedef enum eLineartMainFlags {
LRT_INTERSECTION_AS_CONTOUR = (1 << 7),
LRT_EVERYTHING_AS_CONTOUR = (1 << 8),
LRT_ALLOW_DUPLI_OBJECTS = (1 << 9),
+ LRT_ALLOW_OVERLAPPING_EDGES = (1 << 10),
} eLineartMainFlags;
typedef struct SceneLineart {
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 5cff37c5494..d76056b3c24 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -7348,7 +7348,14 @@ static void rna_def_scene_lineart(BlenderRNA *brna)
prop,
"Duplicated Objects",
"Allow particle objects and face/vertiex duplication to show in line art");
- /* Also use this update callback to trigger the modifier to clear the frame */
+ RNA_def_property_update(prop, NC_SCENE, "rna_lineart_update");
+
+ prop = RNA_def_property(srna, "allow_overlapping_edges", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", LRT_ALLOW_OVERLAPPING_EDGES);
+ RNA_def_property_boolean_default(prop, 1);
+ RNA_def_property_ui_text(prop,
+ "Allow Overlapping Edges",
+ "Allow lines from edge split to show properly, may run slower.");
RNA_def_property_update(prop, NC_SCENE, "rna_lineart_update");
prop = RNA_def_property(srna, "crease_threshold", PROP_FLOAT, PROP_NONE);
More information about the Bf-blender-cvs
mailing list