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:
authorHans Goudey <h.goudey@me.com>2022-10-07 07:26:44 +0300
committerHans Goudey <h.goudey@me.com>2022-10-07 07:26:44 +0300
commit2c803124d371bbbd564dd4c5051258f53b799d36 (patch)
tree2fc642f1aa96ed9464483a7a7c57cf82f7531578 /source/blender/blenkernel/intern/mesh_convert.cc
parent846d8ef8568c035cd7d4e1a8168a4ba391de9119 (diff)
parentcafd204af6d9969654bdee5ae14fef220640487c (diff)
Merge branch 'master' into refactor-mesh-position-generic
Diffstat (limited to 'source/blender/blenkernel/intern/mesh_convert.cc')
-rw-r--r--source/blender/blenkernel/intern/mesh_convert.cc25
1 files changed, 14 insertions, 11 deletions
diff --git a/source/blender/blenkernel/intern/mesh_convert.cc b/source/blender/blenkernel/intern/mesh_convert.cc
index b981585f230..482b3a4e7fb 100644
--- a/source/blender/blenkernel/intern/mesh_convert.cc
+++ b/source/blender/blenkernel/intern/mesh_convert.cc
@@ -599,7 +599,7 @@ void BKE_mesh_to_curve_nurblist(const Mesh *me, ListBase *nurblist, const int ed
}
}
-void BKE_mesh_to_curve(Main *bmain, Depsgraph *depsgraph, Scene *UNUSED(scene), Object *ob)
+void BKE_mesh_to_curve(Main *bmain, Depsgraph *depsgraph, Scene * /*scene*/, Object *ob)
{
/* make new mesh data from the original copy */
Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
@@ -649,7 +649,7 @@ void BKE_pointcloud_from_mesh(Mesh *me, PointCloud *pointcloud)
point_positions.finish();
}
-void BKE_mesh_to_pointcloud(Main *bmain, Depsgraph *depsgraph, Scene *UNUSED(scene), Object *ob)
+void BKE_mesh_to_pointcloud(Main *bmain, Depsgraph *depsgraph, Scene * /*scene*/, Object *ob)
{
BLI_assert(ob->type == OB_MESH);
@@ -688,7 +688,7 @@ void BKE_mesh_edges_set_draw_render(Mesh *mesh)
}
}
-void BKE_pointcloud_to_mesh(Main *bmain, Depsgraph *depsgraph, Scene *UNUSED(scene), Object *ob)
+void BKE_pointcloud_to_mesh(Main *bmain, Depsgraph *depsgraph, Scene * /*scene*/, Object *ob)
{
BLI_assert(ob->type == OB_POINTCLOUD);
@@ -1238,12 +1238,15 @@ static int find_object_active_key_uid(const Key &key, const Object &object)
return kb->uid;
}
-static void move_shapekey_layers_to_keyblocks(Mesh &mesh, Key &key_dst, const int actshape_uid)
+static void move_shapekey_layers_to_keyblocks(const Mesh &mesh,
+ CustomData &custom_data,
+ Key &key_dst,
+ const int actshape_uid)
{
using namespace blender::bke;
- for (const int i : IndexRange(CustomData_number_of_layers(&mesh.vdata, CD_SHAPEKEY))) {
- const int layer_index = CustomData_get_layer_index_n(&mesh.vdata, CD_SHAPEKEY, i);
- CustomDataLayer &layer = mesh.vdata.layers[layer_index];
+ for (const int i : IndexRange(CustomData_number_of_layers(&custom_data, CD_SHAPEKEY))) {
+ const int layer_index = CustomData_get_layer_index_n(&custom_data, CD_SHAPEKEY, i);
+ CustomDataLayer &layer = custom_data.layers[layer_index];
KeyBlock *kb = keyblock_ensure_from_uid(key_dst, layer.uid, layer.name);
MEM_SAFE_FREE(kb->data);
@@ -1264,10 +1267,10 @@ static void move_shapekey_layers_to_keyblocks(Mesh &mesh, Key &key_dst, const in
LISTBASE_FOREACH (KeyBlock *, kb, &key_dst.block) {
if (kb->totelem != mesh.totvert) {
MEM_SAFE_FREE(kb->data);
+ kb->totelem = mesh.totvert;
+ kb->data = MEM_cnew_array<float3>(kb->totelem, __func__);
+ CLOG_ERROR(&LOG, "Data for shape key '%s' on mesh missing from evaluated mesh ", kb->name);
}
- kb->totelem = mesh.totvert;
- kb->data = MEM_cnew_array<float3>(kb->totelem, __func__);
- CLOG_ERROR(&LOG, "Data for shape key '%s' on mesh missing from evaluated mesh ", kb->name);
}
}
@@ -1312,7 +1315,7 @@ void BKE_mesh_nomain_to_mesh(Mesh *mesh_src, Mesh *mesh_dst, Object *ob)
if (CustomData_has_layer(&mesh_src->vdata, CD_SHAPEKEY)) {
/* If no object, set to -1 so we don't mess up any shapekey layers. */
const int uid_active = ob ? find_object_active_key_uid(*key_dst, *ob) : -1;
- move_shapekey_layers_to_keyblocks(*mesh_src, *key_dst, uid_active);
+ move_shapekey_layers_to_keyblocks(*mesh_dst, mesh_src->vdata, *key_dst, uid_active);
}
else if (mesh_src->totvert != mesh_dst->totvert) {
CLOG_ERROR(&LOG, "Mesh in Main '%s' lost shape keys", mesh_src->id.name);