Changeset View
Changeset View
Standalone View
Standalone View
source/blender/modifiers/intern/MOD_weightvgproximity.c
| Show All 39 Lines | |||||
| #include "BKE_bvhutils.h" | #include "BKE_bvhutils.h" | ||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_curve.h" | #include "BKE_curve.h" | ||||
| #include "BKE_customdata.h" | #include "BKE_customdata.h" | ||||
| #include "BKE_deform.h" | #include "BKE_deform.h" | ||||
| #include "BKE_lib_id.h" | #include "BKE_lib_id.h" | ||||
| #include "BKE_lib_query.h" | #include "BKE_lib_query.h" | ||||
| #include "BKE_mesh.h" | #include "BKE_mesh.h" | ||||
| #include "BKE_mesh_wrapper.h" | |||||
| #include "BKE_modifier.h" | #include "BKE_modifier.h" | ||||
| #include "BKE_screen.h" | #include "BKE_screen.h" | ||||
| #include "BKE_texture.h" /* Texture masking. */ | #include "BKE_texture.h" /* Texture masking. */ | ||||
| #include "UI_interface.h" | #include "UI_interface.h" | ||||
| #include "UI_resources.h" | #include "UI_resources.h" | ||||
| #include "RNA_access.h" | #include "RNA_access.h" | ||||
| ▲ Show 20 Lines • Show All 491 Lines • ▼ Show 20 Lines | else if (wmd->proximity_mode == MOD_WVG_PROXIMITY_GEOMETRY) { | ||||
| const bool use_trgt_edges = (wmd->proximity_flags & MOD_WVG_PROXIMITY_GEOM_EDGES) != 0; | const bool use_trgt_edges = (wmd->proximity_flags & MOD_WVG_PROXIMITY_GEOM_EDGES) != 0; | ||||
| const bool use_trgt_faces = (wmd->proximity_flags & MOD_WVG_PROXIMITY_GEOM_FACES) != 0; | const bool use_trgt_faces = (wmd->proximity_flags & MOD_WVG_PROXIMITY_GEOM_FACES) != 0; | ||||
| if (use_trgt_verts || use_trgt_edges || use_trgt_faces) { | if (use_trgt_verts || use_trgt_edges || use_trgt_faces) { | ||||
| Mesh *target_mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(obr, false); | Mesh *target_mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(obr, false); | ||||
| /* We must check that we do have a valid target_mesh! */ | /* We must check that we do have a valid target_mesh! */ | ||||
| if (target_mesh != NULL) { | if (target_mesh != NULL) { | ||||
| /* TODO: edit-mode versions of the BVH lookup functions are available so it could be | |||||
campbellbarton: Since this is an expensive operation, I have been adding comments above each use, either… | |||||
| * avoided. */ | |||||
| BKE_mesh_wrapper_ensure_mdata(target_mesh); | |||||
| SpaceTransform loc2trgt; | SpaceTransform loc2trgt; | ||||
| float *dists_v = use_trgt_verts ? MEM_malloc_arrayN(numIdx, sizeof(float), "dists_v") : | float *dists_v = use_trgt_verts ? MEM_malloc_arrayN(numIdx, sizeof(float), "dists_v") : | ||||
| NULL; | NULL; | ||||
| float *dists_e = use_trgt_edges ? MEM_malloc_arrayN(numIdx, sizeof(float), "dists_e") : | float *dists_e = use_trgt_edges ? MEM_malloc_arrayN(numIdx, sizeof(float), "dists_e") : | ||||
| NULL; | NULL; | ||||
| float *dists_f = use_trgt_faces ? MEM_malloc_arrayN(numIdx, sizeof(float), "dists_f") : | float *dists_f = use_trgt_faces ? MEM_malloc_arrayN(numIdx, sizeof(float), "dists_f") : | ||||
| NULL; | NULL; | ||||
| ▲ Show 20 Lines • Show All 183 Lines • Show Last 20 Lines | |||||
Since this is an expensive operation, I have been adding comments above each use, either justifying why the conversion is acceptable, or noting it as a TODO to avoid the conversion. In this case there are edit-mode versions of the BVH lookup functions so it could be avoided, although it's a fairly obscure case so it's not high priority either.
That can noted above this function call, otherwise LGTM.