[Bf-blender-cvs] [0e6d893d07f] blender-v3.4-release: Fix: Assert, invisible instances with mixed instancing types

Hans Goudey noreply at git.blender.org
Tue Nov 22 22:43:36 CET 2022


Commit: 0e6d893d07f9a8cf7a7050fcd0d6b4d09bf50f00
Author: Hans Goudey
Date:   Tue Nov 22 15:38:19 2022 -0600
Branches: blender-v3.4-release
https://developer.blender.org/rB0e6d893d07f9a8cf7a7050fcd0d6b4d09bf50f00

Fix: Assert, invisible instances with mixed instancing types

When combining the internal geometry component instancing (used when
the original object type doesn't match the evaluated data type) with
the "vertex dupli" instancing could cause the fix from e508de041712cc3
to fail, because the subsequent fix from 864af51d6a88e1 popped from the
"instance generator type" stack even when there was nothing added to it
(for geometry instancing).

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

M	source/blender/blenkernel/intern/object_dupli.cc

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

diff --git a/source/blender/blenkernel/intern/object_dupli.cc b/source/blender/blenkernel/intern/object_dupli.cc
index cca609a2e0d..a8512036566 100644
--- a/source/blender/blenkernel/intern/object_dupli.cc
+++ b/source/blender/blenkernel/intern/object_dupli.cc
@@ -245,6 +245,7 @@ static DupliObject *make_dupli(const DupliContext *ctx,
   dob->ob = ob;
   dob->ob_data = const_cast<ID *>(object_data);
   mul_m4_m4m4(dob->mat, (float(*)[4])ctx->space_mat, mat);
+  std::cout << "Use\n";
   dob->type = ctx->gen == nullptr ? 0 : ctx->dupli_gen_type_stack->last();
   dob->preview_base_geometry = ctx->preview_base_geometry;
   dob->preview_instance_index = ctx->preview_instance_index;
@@ -344,8 +345,10 @@ static void make_recursive_duplis(const DupliContext *ctx,
       ctx->instance_stack->append(ob);
       rctx.gen->make_duplis(&rctx);
       ctx->instance_stack->remove_last();
-      if (!ctx->dupli_gen_type_stack->is_empty()) {
-        ctx->dupli_gen_type_stack->remove_last();
+      if (rctx.gen->type != GEOMETRY_SET_DUPLI_GENERATOR_TYPE) {
+        if (!ctx->dupli_gen_type_stack->is_empty()) {
+          ctx->dupli_gen_type_stack->remove_last();
+        }
       }
     }
   }
@@ -391,8 +394,10 @@ static void make_child_duplis(const DupliContext *ctx,
             ob->flag |= OB_DONE; /* Doesn't render. */
           }
           make_child_duplis_cb(&pctx, userdata, ob);
-          if (!ctx->dupli_gen_type_stack->is_empty()) {
-            ctx->dupli_gen_type_stack->remove_last();
+          if (pctx.gen->type != GEOMETRY_SET_DUPLI_GENERATOR_TYPE) {
+            if (!ctx->dupli_gen_type_stack->is_empty()) {
+              ctx->dupli_gen_type_stack->remove_last();
+            }
           }
         }
       }
@@ -419,8 +424,10 @@ static void make_child_duplis(const DupliContext *ctx,
           }
 
           make_child_duplis_cb(&pctx, userdata, ob);
-          if (!ctx->dupli_gen_type_stack->is_empty()) {
-            ctx->dupli_gen_type_stack->remove_last();
+          if (pctx.gen->type != GEOMETRY_SET_DUPLI_GENERATOR_TYPE) {
+            if (!ctx->dupli_gen_type_stack->is_empty()) {
+              ctx->dupli_gen_type_stack->remove_last();
+            }
           }
         }
       }



More information about the Bf-blender-cvs mailing list