diff options
author | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2022-04-14 16:11:58 +0300 |
---|---|---|
committer | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2022-04-14 16:11:58 +0300 |
commit | a9b94e5f81ced89381033fd8d13ef6e3489e2665 (patch) | |
tree | a11139ef9eb1e626f2ca7955b3facaae863a2a2a /source/blender | |
parent | 31b2b84b3c788bfae2ced046d05c39c56f8056f0 (diff) |
Fix T95700: Oject Info node does not work with GPU subdivided meshes
When GPU subdivision is enabled the mesh objects remain unsubdivided on
the CPU side, and subdivision should be requested somewhat manually (via
`BKE_object_get_evaluated_mesh`).
When referencing an object, the Object Info node calls
`bke::object_get_evaluated_geometry_set` which first checks if a Geometry
Set is present on the object (unless we have a mesh in edit mode). If so
it will return it, if not, the object type is discriminated, which will
return a properly subdivided mesh object via `add_final_mesh_as_geometry_component`.
The unsubdivided mesh is returned because apparently the check on the
Geometry Set always succeeds (as it is always set in `mesh_build_data`).
However, the mesh inside this Geometry Set is not subdivided.
This adds a check for a MeshComponent in this Geometry Set, and if one
exists, calls `add_final_mesh_as_geometry_component` which will ensure
that the mesh is subdivided on the CPU side as well.
Differential Revision: https://developer.blender.org/D14643
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/geometry_set_instances.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/geometry_set_instances.cc b/source/blender/blenkernel/intern/geometry_set_instances.cc index 44ffd64e475..d3c3f41779a 100644 --- a/source/blender/blenkernel/intern/geometry_set_instances.cc +++ b/source/blender/blenkernel/intern/geometry_set_instances.cc @@ -50,7 +50,12 @@ GeometrySet object_get_evaluated_geometry_set(const Object &object) return geometry_set; } if (object.runtime.geometry_set_eval != nullptr) { - return *object.runtime.geometry_set_eval; + GeometrySet geometry_set = *object.runtime.geometry_set_eval; + /* Ensure that subdivision is performed on the CPU. */ + if (geometry_set.has_mesh()) { + add_final_mesh_as_geometry_component(object, geometry_set); + } + return geometry_set; } /* Otherwise, construct a new geometry set with the component based on the object type. */ |