forked from blender/blender
index-of-nearest-104619 #2
@ -28,7 +28,7 @@ bool BKE_curves_attribute_required(const struct Curves *curves, const char *name
|
|||||||
|
|
||||||
/* Depsgraph */
|
/* Depsgraph */
|
||||||
|
|
||||||
struct Curves *BKE_curves_copy_for_eval(struct Curves *curves_src, bool reference);
|
struct Curves *BKE_curves_copy_for_eval(struct Curves *curves_src);
|
||||||
|
|
||||||
void BKE_curves_data_update(struct Depsgraph *depsgraph,
|
void BKE_curves_data_update(struct Depsgraph *depsgraph,
|
||||||
struct Scene *scene,
|
struct Scene *scene,
|
||||||
|
@ -152,8 +152,6 @@ enum {
|
|||||||
LIB_ID_COPY_CACHES = 1 << 18,
|
LIB_ID_COPY_CACHES = 1 << 18,
|
||||||
/** Don't copy `id->adt`, used by ID data-block localization routines. */
|
/** Don't copy `id->adt`, used by ID data-block localization routines. */
|
||||||
LIB_ID_COPY_NO_ANIMDATA = 1 << 19,
|
LIB_ID_COPY_NO_ANIMDATA = 1 << 19,
|
||||||
/** Mesh: Reference CD data layers instead of doing real copy - USE WITH CAUTION! */
|
|
||||||
LIB_ID_COPY_CD_REFERENCE = 1 << 20,
|
|
||||||
/** Do not copy id->override_library, used by ID data-block override routines. */
|
/** Do not copy id->override_library, used by ID data-block override routines. */
|
||||||
LIB_ID_COPY_NO_LIB_OVERRIDE = 1 << 21,
|
LIB_ID_COPY_NO_LIB_OVERRIDE = 1 << 21,
|
||||||
/** When copying local sub-data (like constraints or modifiers), do not set their "library
|
/** When copying local sub-data (like constraints or modifiers), do not set their "library
|
||||||
|
@ -175,7 +175,7 @@ void BKE_mesh_eval_delete(struct Mesh *mesh_eval);
|
|||||||
* Performs copy for use during evaluation,
|
* Performs copy for use during evaluation,
|
||||||
* optional referencing original arrays to reduce memory.
|
* optional referencing original arrays to reduce memory.
|
||||||
*/
|
*/
|
||||||
struct Mesh *BKE_mesh_copy_for_eval(const struct Mesh *source, bool reference);
|
struct Mesh *BKE_mesh_copy_for_eval(const struct Mesh *source);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* These functions construct a new Mesh,
|
* These functions construct a new Mesh,
|
||||||
|
@ -79,7 +79,7 @@ bool BKE_pointcloud_attribute_required(const struct PointCloud *pointcloud, cons
|
|||||||
|
|
||||||
/* Dependency Graph */
|
/* Dependency Graph */
|
||||||
|
|
||||||
struct PointCloud *BKE_pointcloud_copy_for_eval(struct PointCloud *pointcloud_src, bool reference);
|
struct PointCloud *BKE_pointcloud_copy_for_eval(struct PointCloud *pointcloud_src);
|
||||||
|
|
||||||
void BKE_pointcloud_data_update(struct Depsgraph *depsgraph,
|
void BKE_pointcloud_data_update(struct Depsgraph *depsgraph,
|
||||||
struct Scene *scene,
|
struct Scene *scene,
|
||||||
|
@ -130,7 +130,7 @@ void BKE_volume_grid_transform_matrix_set(const struct Volume *volume,
|
|||||||
* file path. Grids are shared with the source data-block, not copied. */
|
* file path. Grids are shared with the source data-block, not copied. */
|
||||||
|
|
||||||
struct Volume *BKE_volume_new_for_eval(const struct Volume *volume_src);
|
struct Volume *BKE_volume_new_for_eval(const struct Volume *volume_src);
|
||||||
struct Volume *BKE_volume_copy_for_eval(struct Volume *volume_src, bool reference);
|
struct Volume *BKE_volume_copy_for_eval(struct Volume *volume_src);
|
||||||
|
|
||||||
struct VolumeGrid *BKE_volume_grid_add(struct Volume *volume,
|
struct VolumeGrid *BKE_volume_grid_add(struct Volume *volume,
|
||||||
const char *name,
|
const char *name,
|
||||||
|
@ -380,7 +380,7 @@ static Mesh *create_orco_mesh(Object *ob, Mesh *me, BMEditMesh *em, int layer)
|
|||||||
BKE_mesh_ensure_default_orig_index_customdata(mesh);
|
BKE_mesh_ensure_default_orig_index_customdata(mesh);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mesh = BKE_mesh_copy_for_eval(me, true);
|
mesh = BKE_mesh_copy_for_eval(me);
|
||||||
}
|
}
|
||||||
|
|
||||||
orco = get_orco_coords(ob, em, layer, &free);
|
orco = get_orco_coords(ob, em, layer, &free);
|
||||||
@ -654,7 +654,7 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph,
|
|||||||
|
|
||||||
if (ob->modifier_flag & OB_MODIFIER_FLAG_ADD_REST_POSITION) {
|
if (ob->modifier_flag & OB_MODIFIER_FLAG_ADD_REST_POSITION) {
|
||||||
if (mesh_final == nullptr) {
|
if (mesh_final == nullptr) {
|
||||||
mesh_final = BKE_mesh_copy_for_eval(mesh_input, true);
|
mesh_final = BKE_mesh_copy_for_eval(mesh_input);
|
||||||
ASSERT_IS_VALID_MESH(mesh_final);
|
ASSERT_IS_VALID_MESH(mesh_final);
|
||||||
}
|
}
|
||||||
MutableAttributeAccessor attributes = mesh_final->attributes_for_write();
|
MutableAttributeAccessor attributes = mesh_final->attributes_for_write();
|
||||||
@ -685,7 +685,7 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph,
|
|||||||
if (mti->type == eModifierTypeType_OnlyDeform && !sculpt_dyntopo) {
|
if (mti->type == eModifierTypeType_OnlyDeform && !sculpt_dyntopo) {
|
||||||
blender::bke::ScopedModifierTimer modifier_timer{*md};
|
blender::bke::ScopedModifierTimer modifier_timer{*md};
|
||||||
if (!mesh_final) {
|
if (!mesh_final) {
|
||||||
mesh_final = BKE_mesh_copy_for_eval(mesh_input, true);
|
mesh_final = BKE_mesh_copy_for_eval(mesh_input);
|
||||||
ASSERT_IS_VALID_MESH(mesh_final);
|
ASSERT_IS_VALID_MESH(mesh_final);
|
||||||
}
|
}
|
||||||
BKE_modifier_deform_verts(md,
|
BKE_modifier_deform_verts(md,
|
||||||
@ -703,12 +703,7 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph,
|
|||||||
* places that wish to use the original mesh but with deformed
|
* places that wish to use the original mesh but with deformed
|
||||||
* coordinates (like vertex paint). */
|
* coordinates (like vertex paint). */
|
||||||
if (r_deform) {
|
if (r_deform) {
|
||||||
if (mesh_final) {
|
mesh_deform = BKE_mesh_copy_for_eval(mesh_final ? mesh_final : mesh_input);
|
||||||
mesh_deform = BKE_mesh_copy_for_eval(mesh_final, false);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
mesh_deform = BKE_mesh_copy_for_eval(mesh_input, false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -779,7 +774,7 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph,
|
|||||||
|
|
||||||
if (mti->type == eModifierTypeType_OnlyDeform) {
|
if (mti->type == eModifierTypeType_OnlyDeform) {
|
||||||
if (!mesh_final) {
|
if (!mesh_final) {
|
||||||
mesh_final = BKE_mesh_copy_for_eval(mesh_input, true);
|
mesh_final = BKE_mesh_copy_for_eval(mesh_input);
|
||||||
ASSERT_IS_VALID_MESH(mesh_final);
|
ASSERT_IS_VALID_MESH(mesh_final);
|
||||||
}
|
}
|
||||||
BKE_modifier_deform_verts(md,
|
BKE_modifier_deform_verts(md,
|
||||||
@ -798,7 +793,7 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mesh_final = BKE_mesh_copy_for_eval(mesh_input, true);
|
mesh_final = BKE_mesh_copy_for_eval(mesh_input);
|
||||||
ASSERT_IS_VALID_MESH(mesh_final);
|
ASSERT_IS_VALID_MESH(mesh_final);
|
||||||
check_for_needs_mapping = true;
|
check_for_needs_mapping = true;
|
||||||
}
|
}
|
||||||
@ -966,7 +961,7 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph,
|
|||||||
mesh_final = mesh_input;
|
mesh_final = mesh_input;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mesh_final = BKE_mesh_copy_for_eval(mesh_input, true);
|
mesh_final = BKE_mesh_copy_for_eval(mesh_input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1011,7 +1006,7 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph,
|
|||||||
/* Not yet finalized by any instance, do it now
|
/* Not yet finalized by any instance, do it now
|
||||||
* Isolate since computing normals is multithreaded and we are holding a lock. */
|
* Isolate since computing normals is multithreaded and we are holding a lock. */
|
||||||
blender::threading::isolate_task([&] {
|
blender::threading::isolate_task([&] {
|
||||||
mesh_final = BKE_mesh_copy_for_eval(mesh_input, true);
|
mesh_final = BKE_mesh_copy_for_eval(mesh_input);
|
||||||
mesh_calc_modifier_final_normals(
|
mesh_calc_modifier_final_normals(
|
||||||
mesh_input, &final_datamask, sculpt_dyntopo, mesh_final);
|
mesh_input, &final_datamask, sculpt_dyntopo, mesh_final);
|
||||||
mesh_calc_finalize(mesh_input, mesh_final);
|
mesh_calc_finalize(mesh_input, mesh_final);
|
||||||
@ -1026,7 +1021,7 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph,
|
|||||||
else if (!mesh_has_modifier_final_normals(mesh_input, &final_datamask, runtime->mesh_eval)) {
|
else if (!mesh_has_modifier_final_normals(mesh_input, &final_datamask, runtime->mesh_eval)) {
|
||||||
/* Modifier stack was (re-)evaluated with a request for additional normals
|
/* Modifier stack was (re-)evaluated with a request for additional normals
|
||||||
* different than the instanced mesh, can't instance anymore now. */
|
* different than the instanced mesh, can't instance anymore now. */
|
||||||
mesh_final = BKE_mesh_copy_for_eval(mesh_input, true);
|
mesh_final = BKE_mesh_copy_for_eval(mesh_input);
|
||||||
mesh_calc_modifier_final_normals(mesh_input, &final_datamask, sculpt_dyntopo, mesh_final);
|
mesh_calc_modifier_final_normals(mesh_input, &final_datamask, sculpt_dyntopo, mesh_final);
|
||||||
mesh_calc_finalize(mesh_input, mesh_final);
|
mesh_calc_finalize(mesh_input, mesh_final);
|
||||||
}
|
}
|
||||||
@ -1255,7 +1250,7 @@ static void editbmesh_calc_modifiers(struct Depsgraph *depsgraph,
|
|||||||
/* apply vertex coordinates or build a DerivedMesh as necessary */
|
/* apply vertex coordinates or build a DerivedMesh as necessary */
|
||||||
if (mesh_final) {
|
if (mesh_final) {
|
||||||
if (deformed_verts) {
|
if (deformed_verts) {
|
||||||
Mesh *mesh_tmp = BKE_mesh_copy_for_eval(mesh_final, false);
|
Mesh *mesh_tmp = BKE_mesh_copy_for_eval(mesh_final);
|
||||||
if (mesh_final != mesh_cage) {
|
if (mesh_final != mesh_cage) {
|
||||||
BKE_id_free(nullptr, mesh_final);
|
BKE_id_free(nullptr, mesh_final);
|
||||||
}
|
}
|
||||||
@ -1264,7 +1259,7 @@ static void editbmesh_calc_modifiers(struct Depsgraph *depsgraph,
|
|||||||
}
|
}
|
||||||
else if (mesh_final == mesh_cage) {
|
else if (mesh_final == mesh_cage) {
|
||||||
/* 'me' may be changed by this modifier, so we need to copy it. */
|
/* 'me' may be changed by this modifier, so we need to copy it. */
|
||||||
mesh_final = BKE_mesh_copy_for_eval(mesh_final, false);
|
mesh_final = BKE_mesh_copy_for_eval(mesh_final);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1337,7 +1332,7 @@ static void editbmesh_calc_modifiers(struct Depsgraph *depsgraph,
|
|||||||
|
|
||||||
if (r_cage && i == cageIndex) {
|
if (r_cage && i == cageIndex) {
|
||||||
if (mesh_final && deformed_verts) {
|
if (mesh_final && deformed_verts) {
|
||||||
mesh_cage = BKE_mesh_copy_for_eval(mesh_final, false);
|
mesh_cage = BKE_mesh_copy_for_eval(mesh_final);
|
||||||
BKE_mesh_vert_coords_apply(mesh_cage, deformed_verts);
|
BKE_mesh_vert_coords_apply(mesh_cage, deformed_verts);
|
||||||
}
|
}
|
||||||
else if (mesh_final) {
|
else if (mesh_final) {
|
||||||
@ -1373,7 +1368,7 @@ static void editbmesh_calc_modifiers(struct Depsgraph *depsgraph,
|
|||||||
if (mesh_final) {
|
if (mesh_final) {
|
||||||
if (deformed_verts) {
|
if (deformed_verts) {
|
||||||
if (mesh_final == mesh_cage) {
|
if (mesh_final == mesh_cage) {
|
||||||
mesh_final = BKE_mesh_copy_for_eval(mesh_final, false);
|
mesh_final = BKE_mesh_copy_for_eval(mesh_final);
|
||||||
}
|
}
|
||||||
BKE_mesh_vert_coords_apply(mesh_final, deformed_verts);
|
BKE_mesh_vert_coords_apply(mesh_final, deformed_verts);
|
||||||
}
|
}
|
||||||
|
@ -1176,7 +1176,7 @@ static void cloth_update_verts(Object *ob, ClothModifierData *clmd, Mesh *mesh)
|
|||||||
static Mesh *cloth_make_rest_mesh(ClothModifierData *clmd, Mesh *mesh)
|
static Mesh *cloth_make_rest_mesh(ClothModifierData *clmd, Mesh *mesh)
|
||||||
{
|
{
|
||||||
using namespace blender;
|
using namespace blender;
|
||||||
Mesh *new_mesh = BKE_mesh_copy_for_eval(mesh, false);
|
Mesh *new_mesh = BKE_mesh_copy_for_eval(mesh);
|
||||||
ClothVertex *verts = clmd->clothObject->verts;
|
ClothVertex *verts = clmd->clothObject->verts;
|
||||||
MutableSpan<float3> positions = mesh->vert_positions_for_write();
|
MutableSpan<float3> positions = mesh->vert_positions_for_write();
|
||||||
|
|
||||||
|
@ -389,7 +389,7 @@ int BKE_sculpt_get_first_deform_matrices(struct Depsgraph *depsgraph,
|
|||||||
if (defmats == nullptr) {
|
if (defmats == nullptr) {
|
||||||
/* NOTE: Evaluated object is re-set to its original un-deformed state. */
|
/* NOTE: Evaluated object is re-set to its original un-deformed state. */
|
||||||
Mesh *me = static_cast<Mesh *>(object_eval.data);
|
Mesh *me = static_cast<Mesh *>(object_eval.data);
|
||||||
me_eval = BKE_mesh_copy_for_eval(me, true);
|
me_eval = BKE_mesh_copy_for_eval(me);
|
||||||
crazyspace_init_verts_and_matrices(me_eval, &defmats, &deformedVerts);
|
crazyspace_init_verts_and_matrices(me_eval, &defmats, &deformedVerts);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -470,7 +470,7 @@ void BKE_crazyspace_build_sculpt(struct Depsgraph *depsgraph,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mesh_eval == nullptr) {
|
if (mesh_eval == nullptr) {
|
||||||
mesh_eval = BKE_mesh_copy_for_eval(mesh, true);
|
mesh_eval = BKE_mesh_copy_for_eval(mesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
mti->deformVerts(md, &mectx, mesh_eval, deformedVerts, mesh_eval->totvert);
|
mti->deformVerts(md, &mectx, mesh_eval, deformedVerts, mesh_eval->totvert);
|
||||||
|
@ -220,16 +220,10 @@ bool BKE_curves_attribute_required(const Curves * /*curves*/, const char *name)
|
|||||||
return STREQ(name, ATTR_POSITION);
|
return STREQ(name, ATTR_POSITION);
|
||||||
}
|
}
|
||||||
|
|
||||||
Curves *BKE_curves_copy_for_eval(Curves *curves_src, bool reference)
|
Curves *BKE_curves_copy_for_eval(Curves *curves_src)
|
||||||
{
|
{
|
||||||
int flags = LIB_ID_COPY_LOCALIZE;
|
return reinterpret_cast<Curves *>(
|
||||||
|
BKE_id_copy_ex(nullptr, &curves_src->id, nullptr, LIB_ID_COPY_LOCALIZE));
|
||||||
if (reference) {
|
|
||||||
flags |= LIB_ID_COPY_CD_REFERENCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
Curves *result = (Curves *)BKE_id_copy_ex(nullptr, &curves_src->id, nullptr, flags);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void curves_evaluate_modifiers(struct Depsgraph *depsgraph,
|
static void curves_evaluate_modifiers(struct Depsgraph *depsgraph,
|
||||||
|
@ -1904,7 +1904,7 @@ static void dynamic_paint_apply_surface_wave_cb(void *__restrict userdata,
|
|||||||
*/
|
*/
|
||||||
static Mesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData *pmd, Object *ob, Mesh *mesh)
|
static Mesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData *pmd, Object *ob, Mesh *mesh)
|
||||||
{
|
{
|
||||||
Mesh *result = BKE_mesh_copy_for_eval(mesh, false);
|
Mesh *result = BKE_mesh_copy_for_eval(mesh);
|
||||||
|
|
||||||
if (pmd->canvas && !(pmd->canvas->flags & MOD_DPAINT_BAKING) &&
|
if (pmd->canvas && !(pmd->canvas->flags & MOD_DPAINT_BAKING) &&
|
||||||
pmd->type == MOD_DYNAMICPAINT_TYPE_CANVAS) {
|
pmd->type == MOD_DYNAMICPAINT_TYPE_CANVAS) {
|
||||||
@ -2049,7 +2049,7 @@ static Mesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData *pmd, Object *
|
|||||||
if (runtime_data->brush_mesh != nullptr) {
|
if (runtime_data->brush_mesh != nullptr) {
|
||||||
BKE_id_free(nullptr, runtime_data->brush_mesh);
|
BKE_id_free(nullptr, runtime_data->brush_mesh);
|
||||||
}
|
}
|
||||||
runtime_data->brush_mesh = BKE_mesh_copy_for_eval(result, false);
|
runtime_data->brush_mesh = BKE_mesh_copy_for_eval(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@ -2070,7 +2070,7 @@ static void canvas_copyMesh(DynamicPaintCanvasSettings *canvas, Mesh *mesh)
|
|||||||
BKE_id_free(nullptr, runtime->canvas_mesh);
|
BKE_id_free(nullptr, runtime->canvas_mesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
runtime->canvas_mesh = BKE_mesh_copy_for_eval(mesh, false);
|
runtime->canvas_mesh = BKE_mesh_copy_for_eval(mesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -3796,7 +3796,7 @@ static void dynamicPaint_brushMeshCalculateVelocity(Depsgraph *depsgraph,
|
|||||||
SUBFRAME_RECURSION,
|
SUBFRAME_RECURSION,
|
||||||
BKE_scene_ctime_get(scene),
|
BKE_scene_ctime_get(scene),
|
||||||
eModifierType_DynamicPaint);
|
eModifierType_DynamicPaint);
|
||||||
mesh_p = BKE_mesh_copy_for_eval(dynamicPaint_brush_mesh_get(brush), false);
|
mesh_p = BKE_mesh_copy_for_eval(dynamicPaint_brush_mesh_get(brush));
|
||||||
numOfVerts_p = mesh_p->totvert;
|
numOfVerts_p = mesh_p->totvert;
|
||||||
|
|
||||||
float(*positions_p)[3] = BKE_mesh_vert_positions_for_write(mesh_p);
|
float(*positions_p)[3] = BKE_mesh_vert_positions_for_write(mesh_p);
|
||||||
@ -4282,7 +4282,7 @@ static bool dynamicPaint_paintMesh(Depsgraph *depsgraph,
|
|||||||
Bounds3D mesh_bb = {{0}};
|
Bounds3D mesh_bb = {{0}};
|
||||||
VolumeGrid *grid = bData->grid;
|
VolumeGrid *grid = bData->grid;
|
||||||
|
|
||||||
mesh = BKE_mesh_copy_for_eval(brush_mesh, false);
|
mesh = BKE_mesh_copy_for_eval(brush_mesh);
|
||||||
float(*positions)[3] = BKE_mesh_vert_positions_for_write(mesh);
|
float(*positions)[3] = BKE_mesh_vert_positions_for_write(mesh);
|
||||||
const blender::Span<blender::float3> vert_normals = mesh->vert_normals();
|
const blender::Span<blender::float3> vert_normals = mesh->vert_normals();
|
||||||
const blender::Span<int> corner_verts = mesh->corner_verts();
|
const blender::Span<int> corner_verts = mesh->corner_verts();
|
||||||
|
@ -1003,7 +1003,7 @@ static void obstacles_from_mesh(Object *coll_ob,
|
|||||||
float *vert_vel = nullptr;
|
float *vert_vel = nullptr;
|
||||||
bool has_velocity = false;
|
bool has_velocity = false;
|
||||||
|
|
||||||
Mesh *me = BKE_mesh_copy_for_eval(fes->mesh, false);
|
Mesh *me = BKE_mesh_copy_for_eval(fes->mesh);
|
||||||
float(*positions)[3] = BKE_mesh_vert_positions_for_write(me);
|
float(*positions)[3] = BKE_mesh_vert_positions_for_write(me);
|
||||||
|
|
||||||
int min[3], max[3], res[3];
|
int min[3], max[3], res[3];
|
||||||
@ -2062,7 +2062,7 @@ static void emit_from_mesh(
|
|||||||
|
|
||||||
/* Copy mesh for thread safety as we modify it.
|
/* Copy mesh for thread safety as we modify it.
|
||||||
* Main issue is its VertArray being modified, then replaced and freed. */
|
* Main issue is its VertArray being modified, then replaced and freed. */
|
||||||
Mesh *me = BKE_mesh_copy_for_eval(ffs->mesh, false);
|
Mesh *me = BKE_mesh_copy_for_eval(ffs->mesh);
|
||||||
float(*positions)[3] = BKE_mesh_vert_positions_for_write(me);
|
float(*positions)[3] = BKE_mesh_vert_positions_for_write(me);
|
||||||
|
|
||||||
const blender::Span<int> corner_verts = me->corner_verts();
|
const blender::Span<int> corner_verts = me->corner_verts();
|
||||||
@ -3364,7 +3364,7 @@ static Mesh *create_smoke_geometry(FluidDomainSettings *fds, Mesh *orgmesh, Obje
|
|||||||
|
|
||||||
/* Just copy existing mesh if there is no content or if the adaptive domain is not being used. */
|
/* Just copy existing mesh if there is no content or if the adaptive domain is not being used. */
|
||||||
if (fds->total_cells <= 1 || (fds->flags & FLUID_DOMAIN_USE_ADAPTIVE_DOMAIN) == 0) {
|
if (fds->total_cells <= 1 || (fds->flags & FLUID_DOMAIN_USE_ADAPTIVE_DOMAIN) == 0) {
|
||||||
return BKE_mesh_copy_for_eval(orgmesh, false);
|
return BKE_mesh_copy_for_eval(orgmesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
result = BKE_mesh_new_nomain(num_verts, 0, num_faces, num_faces * 4);
|
result = BKE_mesh_new_nomain(num_verts, 0, num_faces, num_faces * 4);
|
||||||
@ -3590,7 +3590,7 @@ static void fluid_modifier_processFlow(FluidModifierData *fmd,
|
|||||||
if (fmd->flow->mesh) {
|
if (fmd->flow->mesh) {
|
||||||
BKE_id_free(nullptr, fmd->flow->mesh);
|
BKE_id_free(nullptr, fmd->flow->mesh);
|
||||||
}
|
}
|
||||||
fmd->flow->mesh = BKE_mesh_copy_for_eval(me, false);
|
fmd->flow->mesh = BKE_mesh_copy_for_eval(me);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scene_framenr > fmd->time) {
|
if (scene_framenr > fmd->time) {
|
||||||
@ -3617,7 +3617,7 @@ static void fluid_modifier_processEffector(FluidModifierData *fmd,
|
|||||||
if (fmd->effector->mesh) {
|
if (fmd->effector->mesh) {
|
||||||
BKE_id_free(nullptr, fmd->effector->mesh);
|
BKE_id_free(nullptr, fmd->effector->mesh);
|
||||||
}
|
}
|
||||||
fmd->effector->mesh = BKE_mesh_copy_for_eval(me, false);
|
fmd->effector->mesh = BKE_mesh_copy_for_eval(me);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scene_framenr > fmd->time) {
|
if (scene_framenr > fmd->time) {
|
||||||
@ -4125,7 +4125,7 @@ Mesh *BKE_fluid_modifier_do(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
result = BKE_mesh_copy_for_eval(me, false);
|
result = BKE_mesh_copy_for_eval(me);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
BKE_mesh_copy_parameters_for_eval(result, me);
|
BKE_mesh_copy_parameters_for_eval(result, me);
|
||||||
|
@ -33,7 +33,7 @@ GeometryComponent *CurveComponent::copy() const
|
|||||||
{
|
{
|
||||||
CurveComponent *new_component = new CurveComponent();
|
CurveComponent *new_component = new CurveComponent();
|
||||||
if (curves_ != nullptr) {
|
if (curves_ != nullptr) {
|
||||||
new_component->curves_ = BKE_curves_copy_for_eval(curves_, false);
|
new_component->curves_ = BKE_curves_copy_for_eval(curves_);
|
||||||
new_component->ownership_ = GeometryOwnershipType::Owned;
|
new_component->ownership_ = GeometryOwnershipType::Owned;
|
||||||
}
|
}
|
||||||
return new_component;
|
return new_component;
|
||||||
@ -87,7 +87,7 @@ Curves *CurveComponent::get_for_write()
|
|||||||
{
|
{
|
||||||
BLI_assert(this->is_mutable());
|
BLI_assert(this->is_mutable());
|
||||||
if (ownership_ == GeometryOwnershipType::ReadOnly) {
|
if (ownership_ == GeometryOwnershipType::ReadOnly) {
|
||||||
curves_ = BKE_curves_copy_for_eval(curves_, false);
|
curves_ = BKE_curves_copy_for_eval(curves_);
|
||||||
ownership_ = GeometryOwnershipType::Owned;
|
ownership_ = GeometryOwnershipType::Owned;
|
||||||
}
|
}
|
||||||
return curves_;
|
return curves_;
|
||||||
@ -107,7 +107,7 @@ void CurveComponent::ensure_owns_direct_data()
|
|||||||
{
|
{
|
||||||
BLI_assert(this->is_mutable());
|
BLI_assert(this->is_mutable());
|
||||||
if (ownership_ != GeometryOwnershipType::Owned) {
|
if (ownership_ != GeometryOwnershipType::Owned) {
|
||||||
curves_ = BKE_curves_copy_for_eval(curves_, false);
|
curves_ = BKE_curves_copy_for_eval(curves_);
|
||||||
ownership_ = GeometryOwnershipType::Owned;
|
ownership_ = GeometryOwnershipType::Owned;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ GeometryComponent *MeshComponent::copy() const
|
|||||||
{
|
{
|
||||||
MeshComponent *new_component = new MeshComponent();
|
MeshComponent *new_component = new MeshComponent();
|
||||||
if (mesh_ != nullptr) {
|
if (mesh_ != nullptr) {
|
||||||
new_component->mesh_ = BKE_mesh_copy_for_eval(mesh_, false);
|
new_component->mesh_ = BKE_mesh_copy_for_eval(mesh_);
|
||||||
new_component->ownership_ = GeometryOwnershipType::Owned;
|
new_component->ownership_ = GeometryOwnershipType::Owned;
|
||||||
}
|
}
|
||||||
return new_component;
|
return new_component;
|
||||||
@ -83,7 +83,7 @@ Mesh *MeshComponent::get_for_write()
|
|||||||
{
|
{
|
||||||
BLI_assert(this->is_mutable());
|
BLI_assert(this->is_mutable());
|
||||||
if (ownership_ == GeometryOwnershipType::ReadOnly) {
|
if (ownership_ == GeometryOwnershipType::ReadOnly) {
|
||||||
mesh_ = BKE_mesh_copy_for_eval(mesh_, false);
|
mesh_ = BKE_mesh_copy_for_eval(mesh_);
|
||||||
ownership_ = GeometryOwnershipType::Owned;
|
ownership_ = GeometryOwnershipType::Owned;
|
||||||
}
|
}
|
||||||
return mesh_;
|
return mesh_;
|
||||||
@ -103,7 +103,7 @@ void MeshComponent::ensure_owns_direct_data()
|
|||||||
{
|
{
|
||||||
BLI_assert(this->is_mutable());
|
BLI_assert(this->is_mutable());
|
||||||
if (ownership_ != GeometryOwnershipType::Owned) {
|
if (ownership_ != GeometryOwnershipType::Owned) {
|
||||||
mesh_ = BKE_mesh_copy_for_eval(mesh_, false);
|
mesh_ = BKE_mesh_copy_for_eval(mesh_);
|
||||||
ownership_ = GeometryOwnershipType::Owned;
|
ownership_ = GeometryOwnershipType::Owned;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ GeometryComponent *PointCloudComponent::copy() const
|
|||||||
{
|
{
|
||||||
PointCloudComponent *new_component = new PointCloudComponent();
|
PointCloudComponent *new_component = new PointCloudComponent();
|
||||||
if (pointcloud_ != nullptr) {
|
if (pointcloud_ != nullptr) {
|
||||||
new_component->pointcloud_ = BKE_pointcloud_copy_for_eval(pointcloud_, false);
|
new_component->pointcloud_ = BKE_pointcloud_copy_for_eval(pointcloud_);
|
||||||
new_component->ownership_ = GeometryOwnershipType::Owned;
|
new_component->ownership_ = GeometryOwnershipType::Owned;
|
||||||
}
|
}
|
||||||
return new_component;
|
return new_component;
|
||||||
@ -70,7 +70,7 @@ PointCloud *PointCloudComponent::get_for_write()
|
|||||||
{
|
{
|
||||||
BLI_assert(this->is_mutable());
|
BLI_assert(this->is_mutable());
|
||||||
if (ownership_ == GeometryOwnershipType::ReadOnly) {
|
if (ownership_ == GeometryOwnershipType::ReadOnly) {
|
||||||
pointcloud_ = BKE_pointcloud_copy_for_eval(pointcloud_, false);
|
pointcloud_ = BKE_pointcloud_copy_for_eval(pointcloud_);
|
||||||
ownership_ = GeometryOwnershipType::Owned;
|
ownership_ = GeometryOwnershipType::Owned;
|
||||||
}
|
}
|
||||||
return pointcloud_;
|
return pointcloud_;
|
||||||
@ -90,7 +90,7 @@ void PointCloudComponent::ensure_owns_direct_data()
|
|||||||
{
|
{
|
||||||
BLI_assert(this->is_mutable());
|
BLI_assert(this->is_mutable());
|
||||||
if (ownership_ != GeometryOwnershipType::Owned) {
|
if (ownership_ != GeometryOwnershipType::Owned) {
|
||||||
pointcloud_ = BKE_pointcloud_copy_for_eval(pointcloud_, false);
|
pointcloud_ = BKE_pointcloud_copy_for_eval(pointcloud_);
|
||||||
ownership_ = GeometryOwnershipType::Owned;
|
ownership_ = GeometryOwnershipType::Owned;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ GeometryComponent *VolumeComponent::copy() const
|
|||||||
{
|
{
|
||||||
VolumeComponent *new_component = new VolumeComponent();
|
VolumeComponent *new_component = new VolumeComponent();
|
||||||
if (volume_ != nullptr) {
|
if (volume_ != nullptr) {
|
||||||
new_component->volume_ = BKE_volume_copy_for_eval(volume_, false);
|
new_component->volume_ = BKE_volume_copy_for_eval(volume_);
|
||||||
new_component->ownership_ = GeometryOwnershipType::Owned;
|
new_component->ownership_ = GeometryOwnershipType::Owned;
|
||||||
}
|
}
|
||||||
return new_component;
|
return new_component;
|
||||||
@ -68,7 +68,7 @@ Volume *VolumeComponent::get_for_write()
|
|||||||
{
|
{
|
||||||
BLI_assert(this->is_mutable());
|
BLI_assert(this->is_mutable());
|
||||||
if (ownership_ == GeometryOwnershipType::ReadOnly) {
|
if (ownership_ == GeometryOwnershipType::ReadOnly) {
|
||||||
volume_ = BKE_volume_copy_for_eval(volume_, false);
|
volume_ = BKE_volume_copy_for_eval(volume_);
|
||||||
ownership_ = GeometryOwnershipType::Owned;
|
ownership_ = GeometryOwnershipType::Owned;
|
||||||
}
|
}
|
||||||
return volume_;
|
return volume_;
|
||||||
@ -83,7 +83,7 @@ void VolumeComponent::ensure_owns_direct_data()
|
|||||||
{
|
{
|
||||||
BLI_assert(this->is_mutable());
|
BLI_assert(this->is_mutable());
|
||||||
if (ownership_ != GeometryOwnershipType::Owned) {
|
if (ownership_ != GeometryOwnershipType::Owned) {
|
||||||
volume_ = BKE_volume_copy_for_eval(volume_, false);
|
volume_ = BKE_volume_copy_for_eval(volume_);
|
||||||
ownership_ = GeometryOwnershipType::Owned;
|
ownership_ = GeometryOwnershipType::Owned;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1182,16 +1182,10 @@ void BKE_mesh_eval_delete(struct Mesh *mesh_eval)
|
|||||||
MEM_freeN(mesh_eval);
|
MEM_freeN(mesh_eval);
|
||||||
}
|
}
|
||||||
|
|
||||||
Mesh *BKE_mesh_copy_for_eval(const Mesh *source, bool reference)
|
Mesh *BKE_mesh_copy_for_eval(const Mesh *source)
|
||||||
{
|
{
|
||||||
int flags = LIB_ID_COPY_LOCALIZE;
|
return reinterpret_cast<Mesh *>(
|
||||||
|
BKE_id_copy_ex(nullptr, &source->id, nullptr, LIB_ID_COPY_LOCALIZE));
|
||||||
if (reference) {
|
|
||||||
flags |= LIB_ID_COPY_CD_REFERENCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
Mesh *result = (Mesh *)BKE_id_copy_ex(nullptr, &source->id, nullptr, flags);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BMesh *BKE_mesh_to_bmesh_ex(const Mesh *me,
|
BMesh *BKE_mesh_to_bmesh_ex(const Mesh *me,
|
||||||
|
@ -693,7 +693,7 @@ static const Curves *get_evaluated_curves_from_object(const Object *object)
|
|||||||
static Mesh *mesh_new_from_evaluated_curve_type_object(const Object *evaluated_object)
|
static Mesh *mesh_new_from_evaluated_curve_type_object(const Object *evaluated_object)
|
||||||
{
|
{
|
||||||
if (const Mesh *mesh = BKE_object_get_evaluated_mesh(evaluated_object)) {
|
if (const Mesh *mesh = BKE_object_get_evaluated_mesh(evaluated_object)) {
|
||||||
return BKE_mesh_copy_for_eval(mesh, false);
|
return BKE_mesh_copy_for_eval(mesh);
|
||||||
}
|
}
|
||||||
if (const Curves *curves = get_evaluated_curves_from_object(evaluated_object)) {
|
if (const Curves *curves = get_evaluated_curves_from_object(evaluated_object)) {
|
||||||
const blender::bke::AnonymousAttributePropagationInfo propagation_info;
|
const blender::bke::AnonymousAttributePropagationInfo propagation_info;
|
||||||
@ -752,7 +752,7 @@ static Mesh *mesh_new_from_mball_object(Object *object)
|
|||||||
return (Mesh *)BKE_id_new_nomain(ID_ME, ((ID *)object->data)->name + 2);
|
return (Mesh *)BKE_id_new_nomain(ID_ME, ((ID *)object->data)->name + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
return BKE_mesh_copy_for_eval(mesh_eval, false);
|
return BKE_mesh_copy_for_eval(mesh_eval);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Mesh *mesh_new_from_mesh(Object *object, Mesh *mesh)
|
static Mesh *mesh_new_from_mesh(Object *object, Mesh *mesh)
|
||||||
|
@ -241,7 +241,7 @@ Mesh *BKE_multires_create_mesh(struct Depsgraph *depsgraph,
|
|||||||
Mesh *result = mti->modifyMesh(&mmd->modifier, &modifier_ctx, deformed_mesh);
|
Mesh *result = mti->modifyMesh(&mmd->modifier, &modifier_ctx, deformed_mesh);
|
||||||
|
|
||||||
if (result == deformed_mesh) {
|
if (result == deformed_mesh) {
|
||||||
result = BKE_mesh_copy_for_eval(deformed_mesh, true);
|
result = BKE_mesh_copy_for_eval(deformed_mesh);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -322,16 +322,10 @@ bool BKE_pointcloud_attribute_required(const PointCloud * /*pointcloud*/, const
|
|||||||
|
|
||||||
/* Dependency Graph */
|
/* Dependency Graph */
|
||||||
|
|
||||||
PointCloud *BKE_pointcloud_copy_for_eval(struct PointCloud *pointcloud_src, bool reference)
|
PointCloud *BKE_pointcloud_copy_for_eval(struct PointCloud *pointcloud_src)
|
||||||
{
|
{
|
||||||
int flags = LIB_ID_COPY_LOCALIZE;
|
return reinterpret_cast<PointCloud *>(
|
||||||
|
BKE_id_copy_ex(nullptr, &pointcloud_src->id, nullptr, LIB_ID_COPY_LOCALIZE));
|
||||||
if (reference) {
|
|
||||||
flags |= LIB_ID_COPY_CD_REFERENCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
PointCloud *result = (PointCloud *)BKE_id_copy_ex(nullptr, &pointcloud_src->id, nullptr, flags);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pointcloud_evaluate_modifiers(struct Depsgraph *depsgraph,
|
static void pointcloud_evaluate_modifiers(struct Depsgraph *depsgraph,
|
||||||
|
@ -1523,17 +1523,10 @@ Volume *BKE_volume_new_for_eval(const Volume *volume_src)
|
|||||||
return volume_dst;
|
return volume_dst;
|
||||||
}
|
}
|
||||||
|
|
||||||
Volume *BKE_volume_copy_for_eval(Volume *volume_src, bool reference)
|
Volume *BKE_volume_copy_for_eval(Volume *volume_src)
|
||||||
{
|
{
|
||||||
int flags = LIB_ID_COPY_LOCALIZE;
|
return reinterpret_cast<Volume *>(
|
||||||
|
BKE_id_copy_ex(nullptr, &volume_src->id, nullptr, LIB_ID_COPY_LOCALIZE));
|
||||||
if (reference) {
|
|
||||||
flags |= LIB_ID_COPY_CD_REFERENCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
Volume *result = (Volume *)BKE_id_copy_ex(nullptr, &volume_src->id, nullptr, flags);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_OPENVDB
|
#ifdef WITH_OPENVDB
|
||||||
|
@ -3156,7 +3156,7 @@ static int object_convert_exec(bContext *C, wmOperator *op)
|
|||||||
Scene *scene_eval = (Scene *)DEG_get_evaluated_id(depsgraph, &scene->id);
|
Scene *scene_eval = (Scene *)DEG_get_evaluated_id(depsgraph, &scene->id);
|
||||||
Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
|
Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
|
||||||
Mesh *me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, &CD_MASK_MESH);
|
Mesh *me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, &CD_MASK_MESH);
|
||||||
me_eval = BKE_mesh_copy_for_eval(me_eval, false);
|
me_eval = BKE_mesh_copy_for_eval(me_eval);
|
||||||
BKE_object_material_from_eval_data(bmain, newob, &me_eval->id);
|
BKE_object_material_from_eval_data(bmain, newob, &me_eval->id);
|
||||||
Mesh *new_mesh = (Mesh *)newob->data;
|
Mesh *new_mesh = (Mesh *)newob->data;
|
||||||
BKE_mesh_nomain_to_mesh(me_eval, new_mesh, newob);
|
BKE_mesh_nomain_to_mesh(me_eval, new_mesh, newob);
|
||||||
@ -3388,7 +3388,7 @@ static int object_convert_exec(bContext *C, wmOperator *op)
|
|||||||
newob->type = OB_MESH;
|
newob->type = OB_MESH;
|
||||||
|
|
||||||
if (const Mesh *mesh_eval = geometry.get_mesh_for_read()) {
|
if (const Mesh *mesh_eval = geometry.get_mesh_for_read()) {
|
||||||
BKE_mesh_nomain_to_mesh(BKE_mesh_copy_for_eval(mesh_eval, false), new_mesh, newob);
|
BKE_mesh_nomain_to_mesh(BKE_mesh_copy_for_eval(mesh_eval), new_mesh, newob);
|
||||||
BKE_object_material_from_eval_data(bmain, newob, &mesh_eval->id);
|
BKE_object_material_from_eval_data(bmain, newob, &mesh_eval->id);
|
||||||
new_mesh->attributes_for_write().remove_anonymous();
|
new_mesh->attributes_for_write().remove_anonymous();
|
||||||
}
|
}
|
||||||
|
@ -778,7 +778,7 @@ static Mesh *remesh_symmetry_bisect(Mesh *mesh, eSymmetryAxes symmetry_axes)
|
|||||||
mmd.tolerance = QUADRIFLOW_MIRROR_BISECT_TOLERANCE;
|
mmd.tolerance = QUADRIFLOW_MIRROR_BISECT_TOLERANCE;
|
||||||
|
|
||||||
Mesh *mesh_bisect, *mesh_bisect_temp;
|
Mesh *mesh_bisect, *mesh_bisect_temp;
|
||||||
mesh_bisect = BKE_mesh_copy_for_eval(mesh, false);
|
mesh_bisect = BKE_mesh_copy_for_eval(mesh);
|
||||||
|
|
||||||
int axis;
|
int axis;
|
||||||
float plane_co[3], plane_no[3];
|
float plane_co[3], plane_no[3];
|
||||||
@ -860,7 +860,7 @@ static void quadriflow_start_job(void *customdata, bool *stop, bool *do_update,
|
|||||||
|
|
||||||
/* Run Quadriflow bisect operations on a copy of the mesh to keep the code readable without
|
/* Run Quadriflow bisect operations on a copy of the mesh to keep the code readable without
|
||||||
* freeing the original ID */
|
* freeing the original ID */
|
||||||
bisect_mesh = BKE_mesh_copy_for_eval(mesh, false);
|
bisect_mesh = BKE_mesh_copy_for_eval(mesh);
|
||||||
|
|
||||||
/* Bisect the input mesh using the paint symmetry settings */
|
/* Bisect the input mesh using the paint symmetry settings */
|
||||||
bisect_mesh = remesh_symmetry_bisect(bisect_mesh, qj->symmetry_axes);
|
bisect_mesh = remesh_symmetry_bisect(bisect_mesh, qj->symmetry_axes);
|
||||||
|
@ -154,7 +154,7 @@ static void deformVerts(ModifierData *md,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* make new mesh */
|
/* make new mesh */
|
||||||
psmd->mesh_final = BKE_mesh_copy_for_eval(mesh_src, false);
|
psmd->mesh_final = BKE_mesh_copy_for_eval(mesh_src);
|
||||||
BKE_mesh_vert_coords_apply(psmd->mesh_final, vertexCos);
|
BKE_mesh_vert_coords_apply(psmd->mesh_final, vertexCos);
|
||||||
|
|
||||||
BKE_mesh_tessface_ensure(psmd->mesh_final);
|
BKE_mesh_tessface_ensure(psmd->mesh_final);
|
||||||
@ -185,7 +185,7 @@ static void deformVerts(ModifierData *md,
|
|||||||
/* Make a persistent copy of the mesh. We don't actually need
|
/* Make a persistent copy of the mesh. We don't actually need
|
||||||
* all this data, just some topology for remapping. Could be
|
* all this data, just some topology for remapping. Could be
|
||||||
* optimized once. */
|
* optimized once. */
|
||||||
psmd->mesh_original = BKE_mesh_copy_for_eval(mesh_original, false);
|
psmd->mesh_original = BKE_mesh_copy_for_eval(mesh_original);
|
||||||
}
|
}
|
||||||
|
|
||||||
BKE_mesh_tessface_ensure(psmd->mesh_original);
|
BKE_mesh_tessface_ensure(psmd->mesh_original);
|
||||||
|
@ -182,10 +182,8 @@ Mesh *MOD_deform_mesh_eval_get(Object *ob,
|
|||||||
/* TODO(sybren): after modifier conversion of DM to Mesh is done, check whether
|
/* TODO(sybren): after modifier conversion of DM to Mesh is done, check whether
|
||||||
* we really need a copy here. Maybe the CoW ob->data can be directly used. */
|
* we really need a copy here. Maybe the CoW ob->data can be directly used. */
|
||||||
Mesh *mesh_prior_modifiers = BKE_object_get_pre_modified_mesh(ob);
|
Mesh *mesh_prior_modifiers = BKE_object_get_pre_modified_mesh(ob);
|
||||||
mesh = (Mesh *)BKE_id_copy_ex(nullptr,
|
mesh = (Mesh *)BKE_id_copy_ex(
|
||||||
&mesh_prior_modifiers->id,
|
nullptr, &mesh_prior_modifiers->id, nullptr, LIB_ID_COPY_LOCALIZE);
|
||||||
nullptr,
|
|
||||||
(LIB_ID_COPY_LOCALIZE | LIB_ID_COPY_CD_REFERENCE));
|
|
||||||
mesh->runtime->deformed_only = true;
|
mesh->runtime->deformed_only = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -579,7 +579,7 @@ bool RE_bake_pixels_populate_from_objects(Mesh *me_low,
|
|||||||
treeData = MEM_cnew_array<BVHTreeFromMesh>(tot_highpoly, "Highpoly BVH Trees");
|
treeData = MEM_cnew_array<BVHTreeFromMesh>(tot_highpoly, "Highpoly BVH Trees");
|
||||||
|
|
||||||
if (!is_cage) {
|
if (!is_cage) {
|
||||||
me_eval_low = BKE_mesh_copy_for_eval(me_low, false);
|
me_eval_low = BKE_mesh_copy_for_eval(me_low);
|
||||||
tris_low = mesh_calc_tri_tessface(me_low, true, me_eval_low);
|
tris_low = mesh_calc_tri_tessface(me_low, true, me_eval_low);
|
||||||
}
|
}
|
||||||
else if (is_custom_cage) {
|
else if (is_custom_cage) {
|
||||||
@ -854,7 +854,7 @@ void RE_bake_normal_world_to_tangent(const BakePixel pixel_array[],
|
|||||||
|
|
||||||
TriTessFace *triangles;
|
TriTessFace *triangles;
|
||||||
|
|
||||||
Mesh *me_eval = BKE_mesh_copy_for_eval(me, false);
|
Mesh *me_eval = BKE_mesh_copy_for_eval(me);
|
||||||
|
|
||||||
triangles = mesh_calc_tri_tessface(me, true, me_eval);
|
triangles = mesh_calc_tri_tessface(me, true, me_eval);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user