diff options
author | Brecht Van Lommel <brecht@blender.org> | 2021-09-27 19:52:09 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-09-27 20:49:43 +0300 |
commit | e6aabcae143299893aeacc00ec0c865fc72e9dcf (patch) | |
tree | 7095f9fe35dab560cfef54cc1b1c7814c0862562 | |
parent | 50b7253257302a7bcae179962456ff4cd01576d0 (diff) |
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.
-rw-r--r-- | intern/cycles/blender/blender_geometry.cpp | 6 | ||||
-rw-r--r-- | intern/cycles/blender/blender_util.h | 31 |
2 files changed, 20 insertions, 17 deletions
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 |