Commit: a326688c69983908fa5e958662e6bbc8db07312a
Author: YimingWu
Date: Sun Aug 16 12:05:45 2020 +0800
Branches: lanpr-under-gp
https://developer.blender.org/rBa326688c69983908fa5e958662e6bbc8db07312a
LineArt: Transparency mask data in Material.
===================================================================
M release/scripts/startup/bl_ui/properties_material.py
M source/blender/editors/include/ED_lineart.h
M source/blender/editors/lineart/lineart_chain.c
M source/blender/editors/lineart/lineart_cpu.c
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 6aaec9940e8..6d76b53b167 100644
--- a/release/scripts/startup/bl_ui/properties_material.py
+++ b/release/scripts/startup/bl_ui/properties_material.py
@@ -111,7 +111,8 @@ class
EEVEE_MATERIAL_PT_context_material(MaterialButtonsPanel, Panel):
row = layout.row()
- row.template_list("MATERIAL_UL_matslots", "", ob,
"material_slots", ob, "active_material_index", rows=rows)
+ row.template_list("MATERIAL_UL_matslots", "", ob,
+ "material_slots", ob, "active_material_index",
rows=rows)
col = row.column(align=True)
col.operator("object.material_slot_add", icon='ADD', text="")
@@ -124,8 +125,10 @@ class
EEVEE_MATERIAL_PT_context_material(MaterialButtonsPanel, Panel):
if is_sortable:
col.separator()
- col.operator("object.material_slot_move", icon='TRIA_UP',
text="").direction = 'UP'
- col.operator("object.material_slot_move", icon='TRIA_DOWN',
text="").direction = 'DOWN'
+ col.operator("object.material_slot_move",
+ icon='TRIA_UP', text="").direction = 'UP'
+ col.operator("object.material_slot_move",
+ icon='TRIA_DOWN', text="").direction = 'DOWN'
row = layout.row()
@@ -175,7 +178,8 @@ class EEVEE_MATERIAL_PT_surface(MaterialButtonsPanel,
Panel):
layout.use_property_split = True
if mat.use_nodes:
- panel_node_draw(layout, mat.node_tree, 'OUTPUT_MATERIAL',
"Surface")
+ panel_node_draw(layout, mat.node_tree,
+ 'OUTPUT_MATERIAL', "Surface")
else:
layout.prop(mat, "diffuse_color", text="Base Color")
layout.prop(mat, "metallic")
@@ -217,7 +221,8 @@ def draw_material_settings(self, context):
layout.prop(mat, "shadow_method")
row = layout.row()
- row.active = ((mat.blend_method == 'CLIP') or (mat.shadow_method ==
'CLIP'))
+ row.active = ((mat.blend_method == 'CLIP')
+ or (mat.shadow_method == 'CLIP'))
row.prop(mat, "alpha_threshold")
if mat.blend_method not in {'OPAQUE', 'CLIP', 'HASHED'}:
@@ -271,6 +276,34 @@ class MATERIAL_PT_viewport(MaterialButtonsPanel, Panel):
col.prop(mat, "roughness")
+class MATERIAL_PT_lineart(MaterialButtonsPanel, Panel):
+ bl_label = "Line Art"
+ bl_context = "material"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ mat = context.material
+ lineart = mat.lineart
+
+ layout.prop(lineart, "use_transparency")
+
+ if lineart.use_transparency:
+
+ layout.label(text="Transparency Masks:")
+
+ row = layout.row(align=True)
+ row.prop(lineart, "transparency_mask_0", text="0", toggle=True)
+ row.prop(lineart, "transparency_mask_1", text="1", toggle=True)
+ row.prop(lineart, "transparency_mask_2", text="2", toggle=True)
+ row.prop(lineart, "transparency_mask_3", text="3", toggle=True)
+ row.prop(lineart, "transparency_mask_4", text="4", toggle=True)
+ row.prop(lineart, "transparency_mask_5", text="5", toggle=True)
+ row.prop(lineart, "transparency_mask_6", text="6", toggle=True)
+ row.prop(lineart, "transparency_mask_7", text="7", toggle=True)
+
+
classes = (
MATERIAL_MT_context_menu,
MATERIAL_UL_matslots,
@@ -282,6 +315,7 @@ classes = (
MATERIAL_PT_viewport,
EEVEE_MATERIAL_PT_viewport_settings,
MATERIAL_PT_custom_props,
+ MATERIAL_PT_lineart,
)
diff --git a/source/blender/editors/include/ED_lineart.h
b/source/blender/editors/include/ED_lineart.h
index f48de24a487..8daaacabfba 100644
--- a/source/blender/editors/include/ED_lineart.h
+++ b/source/blender/editors/include/ED_lineart.h
@@ -59,6 +59,7 @@ typedef struct LineartRenderTriangle {
/* struct BMFace *F; */
short material_id;
ListBase intersecting_verts;
+ unsigned char transparency_mask;
char cull_status;
} LineartRenderTriangle;
@@ -92,12 +93,12 @@ typedef struct LineartRenderLineSegment {
/** Occlusion level after "at" point */
unsigned char occlusion;
- /** For determining lines beind a glass window material. (TODO: implement
this)
+ /** For determining lines beind a glass window material.
* the size of this variable should also be dynamically decided, 1 byte to
8 byte,
* allows 8 to 64 materials for "transparent mask". 1 byte (8 materials)
should be
* enought for most cases.
*/
- /* short material_mask_mark; */
+ unsigned char transparency_mask;
} LineartRenderLineSegment;
typedef struct LineartRenderVert {
@@ -141,6 +142,8 @@ typedef struct LineartRenderLineChain {
/** Chain now only contains one type of segments */
int type;
+ unsigned char transparency_mask;
+
struct Object *object_ref;
} LineartRenderLineChain;
@@ -153,6 +156,7 @@ typedef struct LineartRenderLineChainItem {
float normal[3];
char line_type;
char occlusion;
+ unsigned char transparency_mask;
} LineartRenderLineChainItem;
typedef struct LineartChainRegisterEntry {
diff --git a/source/blender/editors/lineart/lineart_chain.c
b/source/blender/editors/lineart/lineart_chain.c
index 2492a3109ee..55c1ec3ab4e 100644
--- a/source/blender/editors/lineart/lineart_chain.c
+++ b/source/blender/editors/lineart/lineart_chain.c
@@ -125,7 +125,8 @@ static LineartRenderLineChainItem
*lineart_chain_append_point(LineartRenderBuffe
float gz,
float *normal,
char type,
- int level)
+ int level,
+ unsigned char
transparency_mask)
{
LineartRenderLineChainItem *rlci;
@@ -148,6 +149,7 @@ static LineartRenderLineChainItem
*lineart_chain_append_point(LineartRenderBuffe
copy_v3_v3(rlci->normal, normal);
rlci->line_type = type & LRT_EDGE_FLAG_ALL_TYPE;
rlci->occlusion = level;
+ rlci->transparency_mask = transparency_mask;
BLI_addtail(&rlc->chain, rlci);
/* printf("a %f,%f %d\n", x, y, level); */
@@ -164,7 +166,8 @@ static LineartRenderLineChainItem
*lineart_chain_push_point(LineartRenderBuffer
float gz,
float *normal,
char type,
- int level)
+ int level,
+ unsigned char
transparency_mask)
{
LineartRenderLineChainItem *rlci;
@@ -182,6 +185,7 @@ static LineartRenderLineChainItem
*lineart_chain_push_point(LineartRenderBuffer
copy_v3_v3(rlci->normal, normal);
rlci->line_type = type & LRT_EDGE_FLAG_ALL_TYPE;
rlci->occlusion = level;
+ rlci->transparency_mask = transparency_mask;
BLI_addhead(&rlc->chain, rlci);
/* printf("data %f,%f %d\n", x, y, level); */
@@ -196,6 +200,7 @@ void ED_lineart_chain_feature_lines(LineartRenderBuffer *rb)
LineartBoundingArea *ba;
LineartRenderLineSegment *rls;
int last_occlusion;
+ unsigned char last_transparency;
LISTBASE_FOREACH (LineartRenderLine *, rl, &rb->all_render_lines) {
@@ -240,7 +245,8 @@ void ED_lineart_chain_feature_lines(LineartRenderBuffer *rb)
new_rv->gloc[2],
N,
rl->flags,
- rls->occlusion);
+ rls->occlusion,
+ rls->transparency_mask);
while (ba && (new_rl = lineart_line_get_connected(ba, new_rv, &new_rv,
rl->flags))) {
new_rl->flags |= LRT_EDGE_FLAG_CHAIN_PICKED;
@@ -275,13 +281,16 @@ void ED_lineart_chain_feature_lines(LineartRenderBuffer
*rb)
gpos[2],
N,
new_rl->flags,
- rls->occlusion);
+ rls->occlusion,
+ rls->transparency_mask);
last_occlusion = rls->occlusion;
+ last_transparency = rls->transparency_mask;
}
}
else if (new_rv == new_rl->r) {
rls = new_rl->segments.first;
last_occlusion = rls->occlusion;
+ last_transparency = rls->transparency_mask;
rls = rls->next;
for (; rls; rls = rls->next) {
double gpos[3], lpos[3];
@@ -298,8 +307,10 @@ void ED_lineart_chain_feature_lines(LineartRenderBuffer
*rb)
gpos[2],
N,
new_rl->flags,
- last_occlusion);
+ last_occlusion,
+ last_transparency);
last_occlusion = rls->occlusion;
+ last_transparency = rls->transparency_mask;
}
lineart_chain_push_point(rb,
rlc,
@@ -310,7 +321,8 @@ void ED_lineart_chain_feature_lines(LineartRenderBuffer *rb)
new_rl->r->gloc[2],
N,
new_rl->flags,
- last_occlusion);
+ last_occlusion,
+ last_transparency);
}
ba = ED_lineart_get_point_bounding_area_deep(rb, new_rv->fbcoord[0],
new_rv->fbcoord[1]);
}
@@ -333,14 +345,24 @@ void ED_lineart_chain_feature_lines(LineartRenderBuffer
*rb)
/* step 2: this line */
rls = rl->segmen
@@ Diff output truncated at 10240 characters. @@
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs