Commit: 3d1ea081cf6e8776eacb7af9aea2099e46dccab4
Author: YimingWu
Date:   Fri Aug 14 15:36:39 2020 +0800
Branches: lanpr-under-gp
https://developer.blender.org/rB3d1ea081cf6e8776eacb7af9aea2099e46dccab4

LineArt: enable/disable duplicated objects in line art.

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

M       release/scripts/startup/bl_ui/properties_render.py
M       source/blender/blenloader/intern/versioning_280.c
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 318deb8093e..8b26fab038f 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -754,6 +754,9 @@ class RENDER_PT_lineart_line_types(RenderButtonsPanel, 
Panel):
         row = layout.row(align=False)
         row.prop(lineart, "fuzzy_everything")
 
+        layout.label(text="Extras:")
+        layout.prop(lineart, "allow_duplication")
+
 
 class RENDER_PT_lineart_baking(RenderButtonsPanel, Panel):
     bl_label = "Baking"
diff --git a/source/blender/blenloader/intern/versioning_280.c 
b/source/blender/blenloader/intern/versioning_280.c
index bee9f51ef58..37cb04531f2 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -5117,6 +5117,7 @@ void blo_do_versions_280(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
         for (Scene *scene = bmain->scenes.first; scene; scene = 
scene->id.next) {
           scene->lineart.crease_threshold = 0.7f;
           scene->lineart.line_types |= LRT_EDGE_FLAG_ALL_TYPE;
+          scene->lineart.flags |= LRT_ALLOW_DUPLI_OBJECTS;
         }
       }
     }
diff --git a/source/blender/editors/lineart/lineart_cpu.c 
b/source/blender/editors/lineart/lineart_cpu.c
index 2546b12854f..f9788b93986 100644
--- a/source/blender/editors/lineart/lineart_cpu.c
+++ b/source/blender/editors/lineart/lineart_cpu.c
@@ -1586,12 +1586,19 @@ static void lineart_main_load_geometries(Depsgraph 
*depsgraph,
   BLI_listbase_clear(&rb->triangle_buffer_pointers);
   BLI_listbase_clear(&rb->vertex_buffer_pointers);
 
-  DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN (depsgraph, ob) {
+  int flags = DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY | 
DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET |
+              DEG_ITER_OBJECT_FLAG_VISIBLE;
+
+  if (scene->lineart.flags & LRT_ALLOW_DUPLI_OBJECTS) {
+    flags |= DEG_ITER_OBJECT_FLAG_DUPLI;
+  }
+
+  DEG_OBJECT_ITER_BEGIN (depsgraph, ob, flags) {
     int usage = 
ED_lineart_object_collection_usage_check(scene->master_collection, ob);
 
     lineart_geometry_object_load(ob, view, proj, rb, usage);
   }
-  DEG_OBJECT_ITER_FOR_RENDER_ENGINE_END;
+  DEG_OBJECT_ITER_END;
 }
 
 #define INTERSECT_SORT_MIN_TO_MAX_3(ia, ib, ic, lst) \
diff --git a/source/blender/makesdna/DNA_scene_types.h 
b/source/blender/makesdna/DNA_scene_types.h
index ed1fd58b57a..e35b355c922 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1665,6 +1665,7 @@ typedef enum eLineartMainFlags {
   LRT_GPENCIL_OVERWRITE = (1 << 6),
   LRT_INTERSECTION_AS_CONTOUR = (1 << 7),
   LRT_EVERYTHING_AS_CONTOUR = (1 << 8),
+  LRT_ALLOW_DUPLI_OBJECTS = (1 << 9),
 } eLineartMainFlags;
 
 typedef struct SceneLineart {
diff --git a/source/blender/makesrna/intern/rna_scene.c 
b/source/blender/makesrna/intern/rna_scene.c
index f2054f1359b..b18826b6d9b 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -7313,7 +7313,7 @@ static void rna_def_scene_lineart(BlenderRNA *brna)
   RNA_def_property_ui_text(
       prop,
       "Intersection As Contour",
-      "Treat intersection lines as contour so those lines can be chained 
together.");
+      "Treat intersection lines as contour so those lines can be chained 
together");
   RNA_def_property_update(prop, NC_SCENE, "rna_lineart_update");
 
   prop = RNA_def_property(srna, "fuzzy_everything", PROP_BOOLEAN, PROP_NONE);
@@ -7321,7 +7321,17 @@ static void rna_def_scene_lineart(BlenderRNA *brna)
   RNA_def_property_boolean_default(prop, 0);
   RNA_def_property_ui_text(prop,
                            "Everything As Contour",
-                           "Treat all lines as contour so those lines can be 
chained together.");
+                           "Treat all lines as contour so those lines can be 
chained together");
+  RNA_def_property_update(prop, NC_SCENE, "rna_lineart_update");
+
+  prop = RNA_def_property(srna, "allow_duplication", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "flags", LRT_ALLOW_DUPLI_OBJECTS);
+  RNA_def_property_boolean_default(prop, 1);
+  RNA_def_property_ui_text(
+      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, "crease_threshold", PROP_FLOAT, PROP_NONE);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to