[Bf-blender-cvs] [4503af102d3] lanpr-under-gp: LineArt: Fuzzy chaining option and UI.

YimingWu noreply at git.blender.org
Wed Jul 22 13:56:47 CEST 2020


Commit: 4503af102d3420cd088a0150d962086f74af8f2e
Author: YimingWu
Date:   Wed Jul 22 18:48:56 2020 +0800
Branches: lanpr-under-gp
https://developer.blender.org/rB4503af102d3420cd088a0150d962086f74af8f2e

LineArt: Fuzzy chaining option and UI.

===================================================================

M	release/scripts/startup/bl_ui/properties_collection.py
M	release/scripts/startup/bl_ui/properties_lineart.py
M	release/scripts/startup/bl_ui/properties_render.py
M	release/scripts/startup/bl_ui/space_view3d.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/gpencil_modifiers/intern/MOD_gpencillineart.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_collection.py b/release/scripts/startup/bl_ui/properties_collection.py
index e499bc79cc1..8341444dbe4 100644
--- a/release/scripts/startup/bl_ui/properties_collection.py
+++ b/release/scripts/startup/bl_ui/properties_collection.py
@@ -70,10 +70,6 @@ class COLLECTION_PT_lineart_collection(CollectionButtonsPanel, Panel):
     bl_label = "Collection Line Art"
     COMPAT_ENGINES = {'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'CYCLES'}
 
-    @classmethod
-    def poll(cls, context):
-        return context.scene.lineart.enabled
-
     def draw(self, context):
         layout = self.layout
         layout.use_property_split = True
diff --git a/release/scripts/startup/bl_ui/properties_lineart.py b/release/scripts/startup/bl_ui/properties_lineart.py
index 53288305db3..94f58d80ab2 100644
--- a/release/scripts/startup/bl_ui/properties_lineart.py
+++ b/release/scripts/startup/bl_ui/properties_lineart.py
@@ -19,28 +19,26 @@
 # <pep8 compliant>
 from bpy.types import Panel
 
+
 class LineartButtonsPanel:
     bl_space_type = 'PROPERTIES'
     bl_region_type = 'WINDOW'
     bl_context = "lineart"
 
+
 def lineart_make_line_type_entry(col, line_type, text_disp, expand, search_from):
     col.prop(line_type, "use", text=text_disp)
     if line_type.use and expand:
-        col.prop_search(line_type, "layer", search_from, "layers", icon='GREASEPENCIL')
-        col.prop_search(line_type, "material",  search_from, "materials", icon='SHADING_TEXTURE')
+        col.prop_search(line_type, "layer", search_from,
+                        "layers", icon='GREASEPENCIL')
+        col.prop_search(line_type, "material",  search_from,
+                        "materials", icon='SHADING_TEXTURE')
+
 
 class OBJECT_PT_lineart_settings(LineartButtonsPanel, Panel):
     bl_label = "LRT settings"
 
-    @classmethod
-    def poll(cls, context):
-        ob = context.object
-        obl = ob.lineart
-        return context.scene.lineart.enabled and\
-            obl.usage == 'INCLUDE' and obl.target
-
-    def draw(self,context):
+    def draw(self, context):
         collection = context.collection
         lineart = collection.lineart
         ob = context.object
@@ -49,41 +47,41 @@ class OBJECT_PT_lineart_settings(LineartButtonsPanel, Panel):
         layout = self.layout
         layout.use_property_split = True
         layout.use_property_decorate = False
-        
-        layout.prop(obl,'use_multiple_levels', text="Multiple Levels")
+
+        layout.prop(obl, 'use_multiple_levels', text="Multiple Levels")
         if obl.use_multiple_levels:
             col = layout.column(align=True)
-            col.prop(obl,'level_start')
-            col.prop(obl,'level_end', text="End")
+            col.prop(obl, 'level_start')
+            col.prop(obl, 'level_end', text="End")
         else:
-            layout.prop(obl,'level_start', text="Level")
-        
-        layout.prop(obl,'use_same_style')
+            layout.prop(obl, 'level_start', text="Level")
+
+        layout.prop(obl, 'use_same_style')
         if obl.use_same_style:
-            layout.prop_search(obl, 'target_layer', obl.target.data, "layers", icon='GREASEPENCIL')
-            layout.prop_search(obl, 'target_material', obl.target.data, "materials", icon='SHADING_TEXTURE')
-        
+            layout.prop_search(obl, 'target_layer',
+                               obl.target.data, "layers", icon='GREASEPENCIL')
+            layout.prop_search(
+                obl, 'target_material', obl.target.data, "materials", icon='SHADING_TEXTURE')
+
         expand = not obl.use_same_style
-        lineart_make_line_type_entry(layout, obl.contour, "Contour", expand, obl.target.data)
-        lineart_make_line_type_entry(layout, obl.crease, "Crease", expand, obl.target.data)
-        lineart_make_line_type_entry(layout, obl.material, "Material", expand, obl.target.data)
-        lineart_make_line_type_entry(layout, obl.edge_mark, "Edge Mark", expand, obl.target.data)
+        lineart_make_line_type_entry(
+            layout, obl.contour, "Contour", expand, obl.target.data)
+        lineart_make_line_type_entry(
+            layout, obl.crease, "Crease", expand, obl.target.data)
+        lineart_make_line_type_entry(
+            layout, obl.material, "Material", expand, obl.target.data)
+        lineart_make_line_type_entry(
+            layout, obl.edge_mark, "Edge Mark", expand, obl.target.data)
 
 
 class OBJECT_PT_lineart(LineartButtonsPanel, Panel):
     bl_label = "Usage"
 
-    @classmethod
-    def poll(cls, context):
-        return context.scene.lineart.enabled
-
     def draw(self, context):
-        layout=self.layout
+        layout = self.layout
         lineart = context.object.lineart
         if context.object.type == 'MESH':
-            layout.prop(lineart,'usage')
-            if lineart.usage == 'INCLUDE':
-                layout.prop(lineart, "target")
+            layout.prop(lineart, 'usage')
 
 
 classes = (
diff --git a/release/scripts/startup/bl_ui/properties_render.py b/release/scripts/startup/bl_ui/properties_render.py
index 933eba773a9..e50d6a69832 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -728,6 +728,14 @@ class RENDER_PT_lineart(RenderButtonsPanel, Panel):
             layout.prop(lineart, "chaining_image_threshold")
             layout.prop(lineart, "chaining_geometry_threshold")
 
+            if lineart.use_intersections:
+                row = layout.row(align=False)
+                row.active = not lineart.fuzzy_everything
+                row.prop(lineart, "fuzzy_intersections")
+
+            row = layout.row(align=False)
+            row.prop(lineart, "fuzzy_everything")
+
 
 class RENDER_PT_lineart_baking(RenderButtonsPanel, Panel):
     bl_label = "Baking"
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 28e3e443c9d..f3142728108 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -3788,11 +3788,10 @@ class VIEW3D_MT_edit_mesh_context_menu(Menu):
             col.operator("mesh.mark_sharp")
             col.operator("mesh.mark_sharp", text="Clear Sharp").clear = True
 
-            if render.use_freestyle or context.scene.lineart.enabled:
-                col.separator()
+            col.separator()
 
-                col.operator("mesh.mark_freestyle_edge").clear = False
-                col.operator("mesh.mark_freestyle_edge", text="Clear Freestyle Edge").clear = True
+            col.operator("mesh.mark_freestyle_edge").clear = False
+            col.operator("mesh.mark_freestyle_edge", text="Clear Freestyle Edge").clear = True
 
             col.separator()
 
@@ -3987,11 +3986,10 @@ class VIEW3D_MT_edit_mesh_edges_data(Menu):
         props.use_verts = True
         props.clear = True
 
-        if render.use_freestyle or context.scene.lineart.enabled:
-            layout.separator()
+        layout.separator()
 
-            layout.operator("mesh.mark_freestyle_edge").clear = False
-            layout.operator("mesh.mark_freestyle_edge", text="Clear Freestyle Edge").clear = True
+        layout.operator("mesh.mark_freestyle_edge").clear = False
+        layout.operator("mesh.mark_freestyle_edge", text="Clear Freestyle Edge").clear = True
 
 
 class VIEW3D_MT_edit_mesh_edges(Menu):
diff --git a/source/blender/editors/include/ED_lineart.h b/source/blender/editors/include/ED_lineart.h
index 2db81986005..f6ec9ea6db2 100644
--- a/source/blender/editors/include/ED_lineart.h
+++ b/source/blender/editors/include/ED_lineart.h
@@ -232,13 +232,9 @@ typedef struct LineartRenderBuffer {
   int draw_material_preview;
   double material_transparency;
 
-  int show_line;
-  int show_fast;
-  int show_material;
-  int override_display;
-
-  int use_intersections;
-  int _pad;
+  char use_intersections;
+  char fuzzy_intersections;
+  char fuzzy_everything;
 
   /** Keep an copy of these data so the scene can be freed when lineart is runnning. */
   char cam_is_persp;
diff --git a/source/blender/editors/lineart/lineart_chain.c b/source/blender/editors/lineart/lineart_chain.c
index a67f411cbc5..166cf4d6bed 100644
--- a/source/blender/editors/lineart/lineart_chain.c
+++ b/source/blender/editors/lineart/lineart_chain.c
@@ -615,6 +615,14 @@ static void lineart_chain_connect(LineartRenderBuffer *UNUSED(rb),
                                   int reverse_2)
 {
   LineartRenderLineChainItem *rlci;
+  if (onto->object_ref && !sub->object_ref) {
+    sub->object_ref = onto->object_ref;
+    sub->type = onto->type;
+  }
+  else if (sub->object_ref && !onto->object_ref) {
+    onto->object_ref = sub->object_ref;
+    onto->type = sub->type;
+  }
   if (!reverse_1) {  /*  L--R L-R */
     if (reverse_2) { /*  L--R R-L */
       BLI_listbase_reverse(&sub->chain);
@@ -690,17 +698,37 @@ void ED_lineart_chain_connect(LineartRenderBuffer *rb, const int do_geometry_spa
         dist = do_geometry_space ? rb->chaining_geometry_threshold : rb->chaining_image_threshold;
         next_cre = cre->next;
         if (cre->rlc->object_ref != rlc->object_ref) {
-          continue;
+          if (rb->fuzzy_everything || rb->fuzzy_intersections) {
+            /* if both have object_ref, then none is intersection line. */
+            if (cre->rlc->object_ref && rlc->object_ref) {
+              continue; /* We don't want to chain along different objects at the moment. */
+            }
+          }
+          else {
+            continue;
+          }
         }
         if (cre->rlc->picked) {
           BLI_remlink(&ba->linked_chains, cre);
           continue;
         }
-        if (cre->rlc == rlc || (!cre->rlc->chain.first) ||
-            ((LineartRenderLineChainItem *)cre->rlc->chain.first)->occlusion != occlusion ||
-            (cre->rlc->type != rlc->type)) {
+        if (cre->rlc == rlc || (!cre->rlc->chain.first) || (cre->rlc->level != occlusion)) {
           continue;
         }
+        if (!rb->fuzzy_everything) {
+          if (cre->rlc->type != rlc->type) {
+            if (rb->fuzzy_intersections) {
+              if (!(cre->rlc->type == LRT_ED

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list