Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--intern/cycles/blender/object.cpp17
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.cc4
-rw-r--r--source/blender/blenkernel/intern/displist.cc9
-rw-r--r--source/blender/blenkernel/intern/object.cc23
4 files changed, 31 insertions, 22 deletions
diff --git a/intern/cycles/blender/object.cpp b/intern/cycles/blender/object.cpp
index 3800ea0ecd2..698800f9957 100644
--- a/intern/cycles/blender/object.cpp
+++ b/intern/cycles/blender/object.cpp
@@ -76,18 +76,15 @@ bool BlenderSync::object_is_geometry(BL::Object &b_ob)
/* Will be exported attached to mesh. */
return true;
}
- else if (type == BL::Object::type_CURVE) {
- /* Skip exporting curves without faces, overhead can be
- * significant if there are many for path animation. */
- BL::Curve b_curve(b_ob_data);
- return (b_curve.bevel_object() || b_curve.extrude() != 0.0f || b_curve.bevel_depth() != 0.0f ||
- b_curve.dimensions() == BL::Curve::dimensions_2D || b_ob.modifiers.length());
- }
- else {
- return (b_ob_data.is_a(&RNA_Mesh) || b_ob_data.is_a(&RNA_Curve) ||
- b_ob_data.is_a(&RNA_MetaBall));
+ /* Other object types that are not meshes but evaluate to meshes are presented to render engines
+ * as separate instance objects. Metaballs and surface objects have not been affected by that
+ * change yet. */
+ if (type == BL::Object::type_SURFACE || type == BL::Object::type_META) {
+ return true;
}
+
+ return b_ob_data.is_a(&RNA_Mesh);
}
bool BlenderSync::object_is_light(BL::Object &b_ob)
diff --git a/source/blender/blenkernel/intern/DerivedMesh.cc b/source/blender/blenkernel/intern/DerivedMesh.cc
index 4b1332d5b84..ced9076bbfd 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.cc
+++ b/source/blender/blenkernel/intern/DerivedMesh.cc
@@ -1896,9 +1896,9 @@ static void mesh_build_data(struct Depsgraph *depsgraph,
const bool is_mesh_eval_owned = (mesh_eval != mesh->runtime.mesh_eval);
BKE_object_eval_assign_data(ob, &mesh_eval->id, is_mesh_eval_owned);
- /* Add the final mesh as read-only non-owning component to the geometry set. */
+ /* Add the final mesh as a non-owning component to the geometry set. */
MeshComponent &mesh_component = geometry_set_eval->get_component_for_write<MeshComponent>();
- mesh_component.replace(mesh_eval, GeometryOwnershipType::ReadOnly);
+ mesh_component.replace(mesh_eval, GeometryOwnershipType::Editable);
ob->runtime.geometry_set_eval = geometry_set_eval;
ob->runtime.mesh_deform_eval = mesh_deform_eval;
diff --git a/source/blender/blenkernel/intern/displist.cc b/source/blender/blenkernel/intern/displist.cc
index ebe00531e65..0bf436aa8b2 100644
--- a/source/blender/blenkernel/intern/displist.cc
+++ b/source/blender/blenkernel/intern/displist.cc
@@ -1524,15 +1524,6 @@ void BKE_displist_make_curveTypes(Depsgraph *depsgraph,
cow_curve.curve_eval = curve_component.get_for_write();
BKE_object_eval_assign_data(ob, &cow_curve.id, false);
}
- else if (geometry.has_mesh()) {
- /* Most areas of Blender don't yet know how to look in #geometry_set_eval for evaluated mesh
- * data, and look in #data_eval instead. When the object evaluates to a curve, that field
- * must be used for the evaluated curve data, but otherwise we can use the field to store a
- * pointer to the mesh, so more areas can retrieve the mesh. */
- MeshComponent &mesh_component = geometry.get_component_for_write<MeshComponent>();
- Mesh *mesh_eval = mesh_component.get_for_write();
- BKE_object_eval_assign_data(ob, &mesh_eval->id, false);
- }
ob->runtime.geometry_set_eval = new GeometrySet(std::move(geometry));
}
diff --git a/source/blender/blenkernel/intern/object.cc b/source/blender/blenkernel/intern/object.cc
index 75d204a46e4..e0785d405f9 100644
--- a/source/blender/blenkernel/intern/object.cc
+++ b/source/blender/blenkernel/intern/object.cc
@@ -96,6 +96,7 @@
#include "BKE_fcurve.h"
#include "BKE_fcurve_driver.h"
#include "BKE_geometry_set.h"
+#include "BKE_geometry_set.hh"
#include "BKE_global.h"
#include "BKE_gpencil.h"
#include "BKE_gpencil_geom.h"
@@ -4578,8 +4579,28 @@ bool BKE_object_obdata_texspace_get(Object *ob, short **r_texflag, float **r_loc
/** Get evaluated mesh for given object. */
Mesh *BKE_object_get_evaluated_mesh(const Object *object)
{
+ /* First attempt to retrieve the evaluated mesh from the evaluated geometry set. Most
+ * object types either store it there or add a reference to it if it's owned elsewhere. */
+ GeometrySet *geometry_set_eval = object->runtime.geometry_set_eval;
+ if (geometry_set_eval) {
+ /* Some areas expect to be able to modify the evaluated mesh. Theoretically this should be
+ * avoided, or at least protected with a lock, so a const mesh could be returned from this
+ * function. */
+ Mesh *mesh = geometry_set_eval->get_mesh_for_write();
+ if (mesh) {
+ return mesh;
+ }
+ }
+
+ /* Some object types do not yet add the evaluated mesh to an evaluated geometry set, if they do
+ * not support evaluating to multiple data types. Eventually this should be removed, when all
+ * object types use #geometry_set_eval. */
ID *data_eval = object->runtime.data_eval;
- return (data_eval && GS(data_eval->name) == ID_ME) ? (Mesh *)data_eval : nullptr;
+ if (data_eval && GS(data_eval->name) == ID_ME) {
+ return reinterpret_cast<Mesh *>(data_eval);
+ }
+
+ return nullptr;
}
/**