Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/mesh.c
| Show First 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | static void mesh_init_data(ID *id) | ||||
| MEMCPY_STRUCT_AFTER(mesh, DNA_struct_default_get(Mesh), id); | MEMCPY_STRUCT_AFTER(mesh, DNA_struct_default_get(Mesh), id); | ||||
| CustomData_reset(&mesh->vdata); | CustomData_reset(&mesh->vdata); | ||||
| CustomData_reset(&mesh->edata); | CustomData_reset(&mesh->edata); | ||||
| CustomData_reset(&mesh->fdata); | CustomData_reset(&mesh->fdata); | ||||
| CustomData_reset(&mesh->pdata); | CustomData_reset(&mesh->pdata); | ||||
| CustomData_reset(&mesh->ldata); | CustomData_reset(&mesh->ldata); | ||||
| BKE_mesh_runtime_reset(mesh); | BKE_mesh_runtime_init_data(mesh); | ||||
| mesh->face_sets_color_seed = BLI_hash_int(PIL_check_seconds_timer_i() & UINT_MAX); | mesh->face_sets_color_seed = BLI_hash_int(PIL_check_seconds_timer_i() & UINT_MAX); | ||||
| } | } | ||||
| static void mesh_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int flag) | static void mesh_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int flag) | ||||
| { | { | ||||
| Mesh *mesh_dst = (Mesh *)id_dst; | Mesh *mesh_dst = (Mesh *)id_dst; | ||||
| const Mesh *mesh_src = (const Mesh *)id_src; | const Mesh *mesh_src = (const Mesh *)id_src; | ||||
| ▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | static void mesh_free_data(ID *id) | ||||
| if (mesh->edit_mesh) { | if (mesh->edit_mesh) { | ||||
| if (mesh->edit_mesh->is_shallow_copy == false) { | if (mesh->edit_mesh->is_shallow_copy == false) { | ||||
| BKE_editmesh_free_data(mesh->edit_mesh); | BKE_editmesh_free_data(mesh->edit_mesh); | ||||
| } | } | ||||
| MEM_freeN(mesh->edit_mesh); | MEM_freeN(mesh->edit_mesh); | ||||
| mesh->edit_mesh = NULL; | mesh->edit_mesh = NULL; | ||||
| } | } | ||||
| BKE_mesh_runtime_clear_cache(mesh); | BKE_mesh_runtime_free_data(mesh); | ||||
jbakker: Can be removed. Is also called from within `BKE_mesh_runtime_free_data` | |||||
| mesh_clear_geometry(mesh); | mesh_clear_geometry(mesh); | ||||
| MEM_SAFE_FREE(mesh->mat); | MEM_SAFE_FREE(mesh->mat); | ||||
| } | } | ||||
| static void mesh_foreach_id(ID *id, LibraryForeachIDData *data) | static void mesh_foreach_id(ID *id, LibraryForeachIDData *data) | ||||
| { | { | ||||
| Mesh *mesh = (Mesh *)id; | Mesh *mesh = (Mesh *)id; | ||||
| BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, mesh->texcomesh, IDWALK_CB_NEVER_SELF); | BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, mesh->texcomesh, IDWALK_CB_NEVER_SELF); | ||||
| ▲ Show 20 Lines • Show All 123 Lines • ▼ Show 20 Lines | static void mesh_blend_read_data(BlendDataReader *reader, ID *id) | ||||
| CustomData_blend_read(reader, &mesh->vdata, mesh->totvert); | CustomData_blend_read(reader, &mesh->vdata, mesh->totvert); | ||||
| CustomData_blend_read(reader, &mesh->edata, mesh->totedge); | CustomData_blend_read(reader, &mesh->edata, mesh->totedge); | ||||
| CustomData_blend_read(reader, &mesh->fdata, mesh->totface); | CustomData_blend_read(reader, &mesh->fdata, mesh->totface); | ||||
| CustomData_blend_read(reader, &mesh->ldata, mesh->totloop); | CustomData_blend_read(reader, &mesh->ldata, mesh->totloop); | ||||
| CustomData_blend_read(reader, &mesh->pdata, mesh->totpoly); | CustomData_blend_read(reader, &mesh->pdata, mesh->totpoly); | ||||
| mesh->texflag &= ~ME_AUTOSPACE_EVALUATED; | mesh->texflag &= ~ME_AUTOSPACE_EVALUATED; | ||||
| mesh->edit_mesh = NULL; | mesh->edit_mesh = NULL; | ||||
| BKE_mesh_runtime_reset(mesh); | |||||
| memset(&mesh->runtime, 0, sizeof(mesh->runtime)); | |||||
| BKE_mesh_runtime_init_data(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; | ||||
| ▲ Show 20 Lines • Show All 1,947 Lines • Show Last 20 Lines | |||||
Can be removed. Is also called from within BKE_mesh_runtime_free_data