[Bf-blender-cvs] [e6aabcae143] master: Fix part of T91516: Cycles not rendering geometry nodes instances

Brecht Van Lommel noreply at git.blender.org
Mon Sep 27 19:52:42 CEST 2021


Commit: e6aabcae143299893aeacc00ec0c865fc72e9dcf
Author: Brecht Van Lommel
Date:   Mon Sep 27 18:52:09 2021 +0200
Branches: master
https://developer.blender.org/rBe6aabcae143299893aeacc00ec0c865fc72e9dcf

Fix part of T91516: Cycles not rendering geometry nodes instances

Part of the fix is by Jacques. This fixes the most obvious case, but it's
still not clear how to deal with non-mesh geometry instances or how to handle
motion blur for such instances.

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

M	intern/cycles/blender/blender_geometry.cpp
M	intern/cycles/blender/blender_util.h

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

diff --git a/intern/cycles/blender/blender_geometry.cpp b/intern/cycles/blender/blender_geometry.cpp
index fca8cb9eda3..7b49bb7fbb7 100644
--- a/intern/cycles/blender/blender_geometry.cpp
+++ b/intern/cycles/blender/blender_geometry.cpp
@@ -80,8 +80,10 @@ Geometry *BlenderSync::sync_geometry(BL::Depsgraph &b_depsgraph,
 {
   /* Test if we can instance or if the object is modified. */
   Geometry::Type geom_type = determine_geom_type(b_ob_info, use_particle_hair);
-  BL::ID b_key_id = (BKE_object_is_modified(b_ob_info.real_object)) ? b_ob_info.real_object :
-                                                                      b_ob_info.object_data;
+  BL::ID b_key_id = (b_ob_info.is_real_object_data() &&
+                     BKE_object_is_modified(b_ob_info.real_object)) ?
+                        b_ob_info.real_object :
+                        b_ob_info.object_data;
   GeometryKey key(b_key_id.ptr.data, geom_type);
 
   /* Find shader indices. */
diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h
index 04008d77d89..128fcbd7055 100644
--- a/intern/cycles/blender/blender_util.h
+++ b/intern/cycles/blender/blender_util.h
@@ -90,26 +90,27 @@ static inline BL::Mesh object_to_mesh(BL::BlendData & /*data*/,
   }
 #endif
 
-  BL::Mesh mesh(PointerRNA_NULL);
-  if (b_ob_info.object_data.is_a(&RNA_Mesh)) {
-    /* TODO: calc_undeformed is not used. */
-    mesh = BL::Mesh(b_ob_info.object_data);
-
-    /* Make a copy to split faces if we use autosmooth, otherwise not needed.
-     * Also in edit mode do we need to make a copy, to ensure data layers like
-     * UV are not empty. */
-    if (mesh.is_editmode() ||
-        (mesh.use_auto_smooth() && subdivision_type == Mesh::SUBDIVISION_NONE)) {
+  BL::Mesh mesh = (b_ob_info.object_data.is_a(&RNA_Mesh)) ? BL::Mesh(b_ob_info.object_data) :
+                                                            BL::Mesh(PointerRNA_NULL);
+
+  if (b_ob_info.is_real_object_data()) {
+    if (mesh) {
+      /* Make a copy to split faces if we use autosmooth, otherwise not needed.
+       * Also in edit mode do we need to make a copy, to ensure data layers like
+       * UV are not empty. */
+      if (mesh.is_editmode() ||
+          (mesh.use_auto_smooth() && subdivision_type == Mesh::SUBDIVISION_NONE)) {
+        BL::Depsgraph depsgraph(PointerRNA_NULL);
+        mesh = b_ob_info.real_object.to_mesh(false, depsgraph);
+      }
+    }
+    else {
       BL::Depsgraph depsgraph(PointerRNA_NULL);
-      assert(b_ob_info.is_real_object_data());
       mesh = b_ob_info.real_object.to_mesh(false, depsgraph);
     }
   }
   else {
-    BL::Depsgraph depsgraph(PointerRNA_NULL);
-    if (b_ob_info.is_real_object_data()) {
-      mesh = b_ob_info.real_object.to_mesh(false, depsgraph);
-    }
+    /* TODO: what to do about non-mesh geometry instances? */
   }
 
 #if 0



More information about the Bf-blender-cvs mailing list