Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/paint_vertex_proj.c
| Show All 27 Lines | |||||
| #include "BLI_math.h" | #include "BLI_math.h" | ||||
| #include "BLI_listbase.h" | #include "BLI_listbase.h" | ||||
| #include "DNA_mesh_types.h" | #include "DNA_mesh_types.h" | ||||
| #include "DNA_object_types.h" | #include "DNA_object_types.h" | ||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_customdata.h" | |||||
| #include "BKE_mesh_iterators.h" | #include "BKE_mesh_iterators.h" | ||||
| #include "BKE_mesh_runtime.h" | #include "BKE_mesh_runtime.h" | ||||
| #include "DEG_depsgraph.h" | #include "DEG_depsgraph.h" | ||||
| #include "DEG_depsgraph_query.h" | #include "DEG_depsgraph_query.h" | ||||
| #include "ED_screen.h" | #include "ED_screen.h" | ||||
| #include "ED_view3d.h" | #include "ED_view3d.h" | ||||
| ▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | |||||
| static void vpaint_proj_dm_map_cosnos_init( | static void vpaint_proj_dm_map_cosnos_init( | ||||
| struct Depsgraph *depsgraph, Scene *UNUSED(scene), Object *ob, | struct Depsgraph *depsgraph, Scene *UNUSED(scene), Object *ob, | ||||
| struct VertProjHandle *vp_handle) | struct VertProjHandle *vp_handle) | ||||
| { | { | ||||
| Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); | Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); | ||||
| Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob); | Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob); | ||||
| Mesh *me = ob->data; | Mesh *me = ob->data; | ||||
| Mesh *me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, CD_MASK_BAREMESH | CD_MASK_ORIGINDEX); | |||||
| CustomData_Masks cddata_masks = CD_MASK_BAREMESH_ORIGINDEX; | |||||
| Mesh *me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, cddata_masks); | |||||
| memset(vp_handle->vcosnos, 0, sizeof(*vp_handle->vcosnos) * me->totvert); | memset(vp_handle->vcosnos, 0, sizeof(*vp_handle->vcosnos) * me->totvert); | ||||
| BKE_mesh_foreach_mapped_vert(me_eval, vpaint_proj_dm_map_cosnos_init__map_cb, vp_handle, MESH_FOREACH_USE_NORMAL); | BKE_mesh_foreach_mapped_vert(me_eval, vpaint_proj_dm_map_cosnos_init__map_cb, vp_handle, MESH_FOREACH_USE_NORMAL); | ||||
| } | } | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /* Internal Update */ | /* Internal Update */ | ||||
| ▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | static void vpaint_proj_dm_map_cosnos_update( | ||||
| ARegion *ar, const float mval_fl[2]) | ARegion *ar, const float mval_fl[2]) | ||||
| { | { | ||||
| struct VertProjUpdate vp_update = {vp_handle, ar, mval_fl}; | struct VertProjUpdate vp_update = {vp_handle, ar, mval_fl}; | ||||
| Object *ob = vp_handle->ob; | Object *ob = vp_handle->ob; | ||||
| Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); | Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); | ||||
| Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob); | Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob); | ||||
| Mesh *me = ob->data; | Mesh *me = ob->data; | ||||
| Mesh *me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, CD_MASK_BAREMESH | CD_MASK_ORIGINDEX); | |||||
| CustomData_Masks cddata_masks = CD_MASK_BAREMESH_ORIGINDEX; | |||||
| Mesh *me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, cddata_masks); | |||||
| /* quick sanity check - we shouldn't have to run this if there are no modifiers */ | /* quick sanity check - we shouldn't have to run this if there are no modifiers */ | ||||
| BLI_assert(BLI_listbase_is_empty(&ob->modifiers) == false); | BLI_assert(BLI_listbase_is_empty(&ob->modifiers) == false); | ||||
| copy_vn_fl(vp_handle->dists_sq, me->totvert, FLT_MAX); | copy_vn_fl(vp_handle->dists_sq, me->totvert, FLT_MAX); | ||||
| BKE_mesh_foreach_mapped_vert(me_eval, vpaint_proj_dm_map_cosnos_update__map_cb, &vp_update, MESH_FOREACH_USE_NORMAL); | BKE_mesh_foreach_mapped_vert(me_eval, vpaint_proj_dm_map_cosnos_update__map_cb, &vp_update, MESH_FOREACH_USE_NORMAL); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 53 Lines • Show Last 20 Lines | |||||