Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/mesh_wrapper.c
| Show All 34 Lines | |||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "DNA_mesh_types.h" | #include "DNA_mesh_types.h" | ||||
| #include "DNA_meshdata_types.h" | #include "DNA_meshdata_types.h" | ||||
| #include "DNA_object_types.h" | #include "DNA_object_types.h" | ||||
| #include "BLI_ghash.h" | #include "BLI_ghash.h" | ||||
| #include "BLI_math.h" | #include "BLI_math.h" | ||||
| #include "BLI_threads.h" | |||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BKE_editmesh.h" | #include "BKE_editmesh.h" | ||||
| #include "BKE_editmesh_cache.h" | #include "BKE_editmesh_cache.h" | ||||
| #include "BKE_lib_id.h" | #include "BKE_lib_id.h" | ||||
| #include "BKE_mesh.h" | #include "BKE_mesh.h" | ||||
| #include "BKE_mesh_runtime.h" | #include "BKE_mesh_runtime.h" | ||||
| #include "BKE_mesh_wrapper.h" | #include "BKE_mesh_wrapper.h" | ||||
| Show All 40 Lines | Mesh *BKE_mesh_wrapper_from_editmesh(BMEditMesh *em, | ||||
| const CustomData_MeshMasks *cd_mask_extra, | const CustomData_MeshMasks *cd_mask_extra, | ||||
| const Mesh *me_settings) | const Mesh *me_settings) | ||||
| { | { | ||||
| return BKE_mesh_wrapper_from_editmesh_with_coords(em, cd_mask_extra, NULL, me_settings); | return BKE_mesh_wrapper_from_editmesh_with_coords(em, cd_mask_extra, NULL, me_settings); | ||||
| } | } | ||||
| void BKE_mesh_wrapper_ensure_mdata(Mesh *me) | void BKE_mesh_wrapper_ensure_mdata(Mesh *me) | ||||
| { | { | ||||
| ThreadMutex *mesh_eval_mutex = (ThreadMutex *)me->runtime.eval_mutex; | |||||
| BLI_mutex_lock(mesh_eval_mutex); | |||||
| if (me->runtime.wrapper_type == ME_WRAPPER_TYPE_MDATA) { | if (me->runtime.wrapper_type == ME_WRAPPER_TYPE_MDATA) { | ||||
| BLI_mutex_unlock(mesh_eval_mutex); | |||||
| return; | return; | ||||
| } | } | ||||
| const eMeshWrapperType geom_type_orig = me->runtime.wrapper_type; | const eMeshWrapperType geom_type_orig = me->runtime.wrapper_type; | ||||
| me->runtime.wrapper_type = ME_WRAPPER_TYPE_MDATA; | me->runtime.wrapper_type = ME_WRAPPER_TYPE_MDATA; | ||||
| switch (geom_type_orig) { | switch (geom_type_orig) { | ||||
| case ME_WRAPPER_TYPE_MDATA: { | case ME_WRAPPER_TYPE_MDATA: { | ||||
| break; /* Quiet warning. */ | break; /* Quiet warning. */ | ||||
| } | } | ||||
| case ME_WRAPPER_TYPE_BMESH: { | case ME_WRAPPER_TYPE_BMESH: { | ||||
| Show All 15 Lines | case ME_WRAPPER_TYPE_BMESH: { | ||||
| } | } | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| if (me->runtime.wrapper_type_finalize) { | if (me->runtime.wrapper_type_finalize) { | ||||
| BKE_mesh_wrapper_deferred_finalize(me, &me->runtime.cd_mask_extra); | BKE_mesh_wrapper_deferred_finalize(me, &me->runtime.cd_mask_extra); | ||||
| } | } | ||||
| BLI_mutex_unlock(mesh_eval_mutex); | |||||
| } | } | ||||
| bool BKE_mesh_wrapper_minmax(const Mesh *me, float min[3], float max[3]) | bool BKE_mesh_wrapper_minmax(const Mesh *me, float min[3], float max[3]) | ||||
| { | { | ||||
| switch ((eMeshWrapperType)me->runtime.wrapper_type) { | switch ((eMeshWrapperType)me->runtime.wrapper_type) { | ||||
| case ME_WRAPPER_TYPE_BMESH: | case ME_WRAPPER_TYPE_BMESH: | ||||
| return BKE_editmesh_cache_calc_minmax(me->edit_mesh, me->runtime.edit_data, min, max); | return BKE_editmesh_cache_calc_minmax(me->edit_mesh, me->runtime.edit_data, min, max); | ||||
| case ME_WRAPPER_TYPE_MDATA: | case ME_WRAPPER_TYPE_MDATA: | ||||
| ▲ Show 20 Lines • Show All 138 Lines • Show Last 20 Lines | |||||