[Bf-blender-cvs] [56183da9481] lanpr-under-gp: LineArt: Global line type selection.

YimingWu noreply at git.blender.org
Sun Jul 26 05:07:30 CEST 2020


Commit: 56183da948154892d204902dc436540be024da86
Author: YimingWu
Date:   Sun Jul 26 11:07:06 2020 +0800
Branches: lanpr-under-gp
https://developer.blender.org/rB56183da948154892d204902dc436540be024da86

LineArt: Global line type selection.

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

M	release/scripts/startup/bl_ui/properties_render.py
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 e50d6a69832..3e600f57fcb 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -715,7 +715,6 @@ class RENDER_PT_lineart(RenderButtonsPanel, Panel):
         layout = self.layout
         layout.active = lineart.auto_update
         layout.use_property_split = True
-        layout.use_property_decorate = False  # No animation.
 
         if not scene.camera:
             col.label(text="No active camera.")
@@ -728,13 +727,35 @@ 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")
 
+class RENDER_PT_lineart(RenderButtonsPanel, Panel):
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
+    bl_label = "Line Types"
+    bl_options = {'DEFAULT_CLOSED'}
+
+    def draw(self, context):
+        scene = context.scene
+        lineart = scene.lineart
+
+        layout = self.layout
+        layout.active = lineart.auto_update
+        layout.use_property_split = True
+
+        layout.prop(lineart, "use_contour", text='Contour')
+        layout.prop(lineart, "use_crease", text='Crease')
+        layout.prop(lineart, "use_material", text='Material Separation')
+        layout.prop(lineart, "use_edge_mark", text='Edge Marks')
+        layout.prop(lineart, "use_intersections", text='Intersections')
+
+        layout.label(text="Fuzzy chaining:")
+
+        if lineart.use_intersections:
             row = layout.row(align=False)
-            row.prop(lineart, "fuzzy_everything")
+            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):
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index bf56f840400..877f8341133 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -38,6 +38,7 @@ extern "C" {
 #include "DNA_customdata_types.h" /* Scene's runtime cddata masks. */
 #include "DNA_freestyle_types.h"
 #include "DNA_layer_types.h"
+#include "DNA_lineart_types.h"
 #include "DNA_listBase.h"
 #include "DNA_material_types.h"
 #include "DNA_userdef_types.h"
@@ -1714,9 +1715,12 @@ typedef enum eLineartMainFlags {
 } eLineartMainFlags;
 
 typedef struct SceneLineart {
-
   int flags;
-  int _pad;
+
+  /* line_types is used to select line types in global scope, especially when Fuzzy chaining is
+   * enabled. See DNA_lineart_types.h for edge flags.
+   */
+  int line_types;
 
   /* shared */
 
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index fc41684345e..c63cd04de44 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -7321,8 +7321,30 @@ static void rna_def_scene_lineart(BlenderRNA *brna)
   RNA_def_property_flag(prop, PROP_EDITABLE);
   RNA_def_property_update(prop, NC_SCENE, "rna_lineart_update");
 
+  /* types */
+  prop = RNA_def_property(srna, "use_contour", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "line_types", LRT_EDGE_FLAG_CONTOUR);
+  RNA_def_property_ui_text(prop, "Use Contour", "Include contour lines in the result");
+  RNA_def_property_update(prop, 0, "rna_lineart_update");
+
+  prop = RNA_def_property(srna, "use_crease", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "line_types", LRT_EDGE_FLAG_CREASE);
+  RNA_def_property_ui_text(prop, "Use Crease", "Include crease lines in the result");
+  RNA_def_property_update(prop, 0, "rna_lineart_update");
+
+  prop = RNA_def_property(srna, "use_material", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "line_types", LRT_EDGE_FLAG_MATERIAL);
+  RNA_def_property_ui_text(
+      prop, "Use Material", "Include material separation lines in the result");
+  RNA_def_property_update(prop, 0, "rna_lineart_update");
+
+  prop = RNA_def_property(srna, "use_edge_mark", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "line_types", LRT_EDGE_FLAG_EDGE_MARK);
+  RNA_def_property_ui_text(prop, "Use Edge Mark", "Include freestyle edge marks in the result");
+  RNA_def_property_update(prop, 0, "rna_lineart_update");
+
   prop = RNA_def_property(srna, "use_intersections", PROP_BOOLEAN, PROP_NONE);
-  RNA_def_property_boolean_sdna(prop, NULL, "flags", LRT_USE_INTERSECTIONS);
+  RNA_def_property_boolean_sdna(prop, NULL, "line_types", LRT_USE_INTERSECTIONS);
   RNA_def_property_boolean_default(prop, 1);
   RNA_def_property_ui_text(prop, "Calculate Intersections", "Calculate Intersections or not");
   RNA_def_property_update(prop, NC_SCENE, "rna_lineart_update");



More information about the Bf-blender-cvs mailing list