Merge branch 'blender-v4.2-release'

This commit is contained in:
Jacques Lucke
2024-06-21 15:54:41 +02:00
3 changed files with 25 additions and 8 deletions

View File

@@ -506,6 +506,12 @@ bool BKE_object_obdata_texspace_get(Object *ob,
Mesh *BKE_object_get_evaluated_mesh_no_subsurf(const Object *object);
/** Get evaluated mesh for given object. */
Mesh *BKE_object_get_evaluated_mesh(const Object *object);
/**
* Same as above, but does not check if the object's geometry is fully evaluated already.
* This should barely ever be used.
*/
Mesh *BKE_object_get_evaluated_mesh_no_subsurf_unchecked(const Object *object);
Mesh *BKE_object_get_evaluated_mesh_unchecked(const Object *object);
/**
* Get mesh which is not affected by modifiers:
* - For original objects it will be same as `object->data`, and it is a mesh

View File

@@ -4136,12 +4136,8 @@ bool BKE_object_obdata_texspace_get(Object *ob,
return true;
}
Mesh *BKE_object_get_evaluated_mesh_no_subsurf(const Object *object)
Mesh *BKE_object_get_evaluated_mesh_no_subsurf_unchecked(const Object *object)
{
if (!DEG_object_geometry_is_evaluated(*object)) {
return nullptr;
}
/* 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. */
blender::bke::GeometrySet *geometry_set_eval = object->runtime->geometry_set_eval;
@@ -4167,13 +4163,17 @@ Mesh *BKE_object_get_evaluated_mesh_no_subsurf(const Object *object)
return nullptr;
}
Mesh *BKE_object_get_evaluated_mesh(const Object *object)
Mesh *BKE_object_get_evaluated_mesh_no_subsurf(const Object *object)
{
if (!DEG_object_geometry_is_evaluated(*object)) {
return nullptr;
}
return BKE_object_get_evaluated_mesh_no_subsurf_unchecked(object);
}
Mesh *mesh = BKE_object_get_evaluated_mesh_no_subsurf(object);
Mesh *BKE_object_get_evaluated_mesh_unchecked(const Object *object)
{
Mesh *mesh = BKE_object_get_evaluated_mesh_no_subsurf_unchecked(object);
if (!mesh) {
return nullptr;
}
@@ -4185,6 +4185,14 @@ Mesh *BKE_object_get_evaluated_mesh(const Object *object)
return mesh;
}
Mesh *BKE_object_get_evaluated_mesh(const Object *object)
{
if (!DEG_object_geometry_is_evaluated(*object)) {
return nullptr;
}
return BKE_object_get_evaluated_mesh_unchecked(object);
}
Mesh *BKE_object_get_pre_modified_mesh(const Object *object)
{
if (object->type == OB_MESH && object->runtime->data_orig != nullptr) {

View File

@@ -1643,7 +1643,10 @@ static void sculpt_update_object(Depsgraph *depsgraph,
Sculpt *sd = scene->toolsettings->sculpt;
SculptSession &ss = *ob->sculpt;
Mesh *mesh_orig = BKE_object_get_original_mesh(ob);
Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob_eval);
/* Use the "unchecked" function, because this code also runs as part of the depsgraph node that
* evaluates the object's geometry. So from perspective of the depsgraph, the mesh is not fully
* evaluated yet. */
Mesh *mesh_eval = BKE_object_get_evaluated_mesh_unchecked(ob_eval);
MultiresModifierData *mmd = sculpt_multires_modifier_get(scene, ob, true);
const bool use_face_sets = (ob->mode & OB_MODE_SCULPT) != 0;