Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/mesh.c
| Show First 20 Lines • Show All 306 Lines • ▼ Show 20 Lines | static void mesh_blend_read_data(BlendDataReader *reader, ID *id) | ||||
| mesh->edit_mesh = NULL; | mesh->edit_mesh = NULL; | ||||
| BKE_mesh_runtime_reset(mesh); | BKE_mesh_runtime_reset(mesh); | ||||
| /* happens with old files */ | /* happens with old files */ | ||||
| if (mesh->mselect == NULL) { | if (mesh->mselect == NULL) { | ||||
| mesh->totselect = 0; | mesh->totselect = 0; | ||||
| } | } | ||||
| if ((BLO_read_requires_endian_switch(reader)) && mesh->tface) { | if (BLO_read_requires_endian_switch(reader) && mesh->tface) { | ||||
| TFace *tf = mesh->tface; | TFace *tf = mesh->tface; | ||||
| for (int i = 0; i < mesh->totface; i++, tf++) { | for (int i = 0; i < mesh->totface; i++, tf++) { | ||||
| BLI_endian_switch_uint32_array(tf->col, 4); | BLI_endian_switch_uint32_array(tf->col, 4); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| static void mesh_blend_read_lib(BlendLibReader *reader, ID *id) | static void mesh_blend_read_lib(BlendLibReader *reader, ID *id) | ||||
| ▲ Show 20 Lines • Show All 603 Lines • ▼ Show 20 Lines | void BKE_mesh_copy_parameters(Mesh *me_dst, const Mesh *me_src) | ||||
| me_dst->face_sets_color_seed = me_src->face_sets_color_seed; | me_dst->face_sets_color_seed = me_src->face_sets_color_seed; | ||||
| me_dst->face_sets_color_default = me_src->face_sets_color_default; | me_dst->face_sets_color_default = me_src->face_sets_color_default; | ||||
| /* Copy texture space. */ | /* Copy texture space. */ | ||||
| me_dst->texflag = me_src->texflag; | me_dst->texflag = me_src->texflag; | ||||
| copy_v3_v3(me_dst->loc, me_src->loc); | copy_v3_v3(me_dst->loc, me_src->loc); | ||||
| copy_v3_v3(me_dst->size, me_src->size); | copy_v3_v3(me_dst->size, me_src->size); | ||||
| /* Some callers call this on existing meshes, so free the existing vertex groups first. */ | |||||
| BLI_freelistN(&me_dst->vertex_group_names); | |||||
| BKE_defgroup_copy_list(&me_dst->vertex_group_names, &me_src->vertex_group_names); | |||||
| me_dst->vertex_group_active_index = me_src->vertex_group_active_index; | me_dst->vertex_group_active_index = me_src->vertex_group_active_index; | ||||
| } | } | ||||
| /** | /** | ||||
| * A version of #BKE_mesh_copy_parameters that is intended for evaluated output | * A version of #BKE_mesh_copy_parameters that is intended for evaluated output | ||||
| * (the modifier stack for example). | * (the modifier stack for example). | ||||
| * | * | ||||
| * \warning User counts are not handled for ID's. | * \warning User counts are not handled for ID's. | ||||
| */ | */ | ||||
| void BKE_mesh_copy_parameters_for_eval(Mesh *me_dst, const Mesh *me_src) | void BKE_mesh_copy_parameters_for_eval(Mesh *me_dst, const Mesh *me_src) | ||||
| { | { | ||||
| /* User counts aren't handled, don't copy into a mesh from #G_MAIN. */ | /* User counts aren't handled, don't copy into a mesh from #G_MAIN. */ | ||||
| BLI_assert(me_dst->id.tag & (LIB_TAG_NO_MAIN | LIB_TAG_COPIED_ON_WRITE)); | BLI_assert(me_dst->id.tag & (LIB_TAG_NO_MAIN | LIB_TAG_COPIED_ON_WRITE)); | ||||
| BKE_mesh_copy_parameters(me_dst, me_src); | BKE_mesh_copy_parameters(me_dst, me_src); | ||||
| /* Copy vertex group names. */ | |||||
| BLI_assert(BLI_listbase_is_empty(&me_dst->vertex_group_names)); | |||||
| BKE_defgroup_copy_list(&me_dst->vertex_group_names, &me_src->vertex_group_names); | |||||
| /* Copy materials. */ | /* Copy materials. */ | ||||
| if (me_dst->mat != NULL) { | if (me_dst->mat != NULL) { | ||||
| MEM_freeN(me_dst->mat); | MEM_freeN(me_dst->mat); | ||||
| } | } | ||||
| me_dst->mat = MEM_dupallocN(me_src->mat); | me_dst->mat = MEM_dupallocN(me_src->mat); | ||||
| me_dst->totcol = me_src->totcol; | me_dst->totcol = me_src->totcol; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 906 Lines • ▼ Show 20 Lines | BKE_mesh_normals_loop_split(mesh->mvert, | ||||
| clnors, | clnors, | ||||
| NULL); | NULL); | ||||
| if (free_polynors) { | if (free_polynors) { | ||||
| MEM_freeN(polynors); | MEM_freeN(polynors); | ||||
| } | } | ||||
| mesh->runtime.cd_dirty_vert &= ~CD_MASK_NORMAL; | mesh->runtime.cd_dirty_vert &= ~CD_MASK_NORMAL; | ||||
| mesh->runtime.cd_dirty_poly &= ~CD_MASK_NORMAL; | |||||
| mesh->runtime.cd_dirty_loop &= ~CD_MASK_NORMAL; | |||||
| } | } | ||||
| void BKE_mesh_calc_normals_split(Mesh *mesh) | void BKE_mesh_calc_normals_split(Mesh *mesh) | ||||
| { | { | ||||
| BKE_mesh_calc_normals_split_ex(mesh, NULL); | BKE_mesh_calc_normals_split_ex(mesh, NULL); | ||||
| } | } | ||||
| /* Split faces helper functions. */ | /* Split faces helper functions. */ | ||||
| ▲ Show 20 Lines • Show All 296 Lines • Show Last 20 Lines | |||||