Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/mesh_convert.cc
| Show First 20 Lines • Show All 1,031 Lines • ▼ Show 20 Lines | static Mesh *mesh_new_from_mball_object(Object *object) | ||||
| return mesh_result; | return mesh_result; | ||||
| } | } | ||||
| static Mesh *mesh_new_from_mesh(Object *object, Mesh *mesh) | static Mesh *mesh_new_from_mesh(Object *object, Mesh *mesh) | ||||
| { | { | ||||
| /* While we could copy this into the new mesh, | /* While we could copy this into the new mesh, | ||||
| * add the data to 'mesh' so future calls to this function don't need to re-convert the data. */ | * add the data to 'mesh' so future calls to this function don't need to re-convert the data. */ | ||||
| if (mesh->runtime.wrapper_type == ME_WRAPPER_TYPE_BMESH) { | |||||
| BKE_mesh_wrapper_ensure_mdata(mesh); | BKE_mesh_wrapper_ensure_mdata(mesh); | ||||
| } | |||||
| else { | |||||
| BKE_mesh_wrapper_ensure_subdivision(object, mesh); | |||||
| } | |||||
| Mesh *mesh_result = (Mesh *)BKE_id_copy_ex( | Mesh *mesh_result = (Mesh *)BKE_id_copy_ex( | ||||
| nullptr, &mesh->id, nullptr, LIB_ID_CREATE_NO_MAIN | LIB_ID_CREATE_NO_USER_REFCOUNT); | nullptr, &mesh->id, nullptr, LIB_ID_CREATE_NO_MAIN | LIB_ID_CREATE_NO_USER_REFCOUNT); | ||||
| /* NOTE: Materials should already be copied. */ | /* NOTE: Materials should already be copied. */ | ||||
| /* Copy original mesh name. This is because edit meshes might not have one properly set name. */ | /* Copy original mesh name. This is because edit meshes might not have one properly set name. */ | ||||
| BLI_strncpy(mesh_result->id.name, ((ID *)object->data)->name, sizeof(mesh_result->id.name)); | BLI_strncpy(mesh_result->id.name, ((ID *)object->data)->name, sizeof(mesh_result->id.name)); | ||||
| return mesh_result; | return mesh_result; | ||||
| } | } | ||||
| Show All 20 Lines | static Mesh *mesh_new_from_mesh_object_with_layers(Depsgraph *depsgraph, | ||||
| CustomData_MeshMasks mask = CD_MASK_MESH; | CustomData_MeshMasks mask = CD_MASK_MESH; | ||||
| if (preserve_origindex) { | if (preserve_origindex) { | ||||
| mask.vmask |= CD_MASK_ORIGINDEX; | mask.vmask |= CD_MASK_ORIGINDEX; | ||||
| mask.emask |= CD_MASK_ORIGINDEX; | mask.emask |= CD_MASK_ORIGINDEX; | ||||
| mask.lmask |= CD_MASK_ORIGINDEX; | mask.lmask |= CD_MASK_ORIGINDEX; | ||||
| mask.pmask |= CD_MASK_ORIGINDEX; | mask.pmask |= CD_MASK_ORIGINDEX; | ||||
| } | } | ||||
| Mesh *result = mesh_create_eval_final(depsgraph, scene, &object_for_eval, &mask); | Mesh *result = mesh_create_eval_final(depsgraph, scene, &object_for_eval, &mask); | ||||
| BKE_mesh_wrapper_ensure_subdivision(object, result); | |||||
| return result; | return result; | ||||
| } | } | ||||
| static Mesh *mesh_new_from_mesh_object(Depsgraph *depsgraph, | static Mesh *mesh_new_from_mesh_object(Depsgraph *depsgraph, | ||||
| Object *object, | Object *object, | ||||
| const bool preserve_all_data_layers, | const bool preserve_all_data_layers, | ||||
| const bool preserve_origindex) | const bool preserve_origindex) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 555 Lines • Show Last 20 Lines | |||||