[Bf-blender-cvs] [2cb28836bca] lineart-shadow: LineArt: Fix(unreported): Child object respect collection visibility.

YimingWu noreply at git.blender.org
Sat Jul 31 04:04:32 CEST 2021


Commit: 2cb28836bca6fe1e348eb41158014017413b54c6
Author: YimingWu
Date:   Sat Jul 31 09:39:42 2021 +0800
Branches: lineart-shadow
https://developer.blender.org/rB2cb28836bca6fe1e348eb41158014017413b54c6

LineArt: Fix(unreported): Child object respect collection visibility.

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

M	source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c

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

diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
index 470e118daaa..9699b959e9c 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
@@ -2079,7 +2079,7 @@ static uchar lineart_intersection_mask_check(Collection *c, Object *ob)
  * See if this object in such collection is used for generating line art,
  * Disabling a collection for line art will doable all objects inside.
  */
-static int lineart_usage_check(Collection *c, Object *ob)
+static int lineart_usage_check(Collection *c, Object *ob, bool is_render)
 {
 
   if (!c) {
@@ -2092,8 +2092,12 @@ static int lineart_usage_check(Collection *c, Object *ob)
     return ob->lineart.usage;
   }
 
-  if (c->children.first == NULL) {
+  if (c->gobject.first) {
     if (BKE_collection_has_object(c, (Object *)(ob->id.orig_id))) {
+      if ((is_render && (c->flag & COLLECTION_RESTRICT_RENDER)) ||
+          ((!is_render) && (c->flag & COLLECTION_RESTRICT_VIEWPORT))) {
+        return OBJECT_LRT_EXCLUDE;
+      }
       if (ob->lineart.usage == OBJECT_LRT_INHERIT) {
         switch (c->lineart_usage) {
           case COLLECTION_LRT_OCCLUSION_ONLY:
@@ -2112,7 +2116,7 @@ static int lineart_usage_check(Collection *c, Object *ob)
   }
 
   LISTBASE_FOREACH (CollectionChild *, cc, &c->children) {
-    int result = lineart_usage_check(cc->collection, ob);
+    int result = lineart_usage_check(cc->collection, ob, is_render);
     if (result > OBJECT_LRT_INHERIT) {
       return result;
     }
@@ -2244,13 +2248,15 @@ static void lineart_main_load_geometries(
   LineartObjectLoadTaskInfo *olti = lineart_mem_acquire(
       &rb->render_data_pool, sizeof(LineartObjectLoadTaskInfo) * thread_count);
 
+  bool is_render = DEG_get_mode(depsgraph) == DAG_EVAL_RENDER;
+
   DEG_OBJECT_ITER_BEGIN (depsgraph, ob, flags) {
     /* Do the increment even for discarded objects, so that in different culling conditions we can
      * get the same reference to the same object. */
     obindex++;
 
     LineartObjectInfo *obi = lineart_mem_acquire(&rb->render_data_pool, sizeof(LineartObjectInfo));
-    obi->usage = lineart_usage_check(scene->master_collection, ob);
+    obi->usage = lineart_usage_check(scene->master_collection, ob, is_render);
     obi->override_intersection_mask = lineart_intersection_mask_check(scene->master_collection,
                                                                       ob);
     Object *use_ob = DEG_get_evaluated_object(depsgraph, ob);



More information about the Bf-blender-cvs mailing list