Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/paint_image_proj.c
| Show First 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | |||||
| #include "DNA_node_types.h" | #include "DNA_node_types.h" | ||||
| #include "DNA_object_types.h" | #include "DNA_object_types.h" | ||||
| #include "BKE_brush.h" | #include "BKE_brush.h" | ||||
| #include "BKE_camera.h" | #include "BKE_camera.h" | ||||
| #include "BKE_colorband.h" | #include "BKE_colorband.h" | ||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_colortools.h" | #include "BKE_colortools.h" | ||||
| #include "BKE_customdata.h" | |||||
| #include "BKE_idprop.h" | #include "BKE_idprop.h" | ||||
| #include "BKE_image.h" | #include "BKE_image.h" | ||||
| #include "BKE_library.h" | #include "BKE_library.h" | ||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| #include "BKE_material.h" | #include "BKE_material.h" | ||||
| #include "BKE_mesh.h" | #include "BKE_mesh.h" | ||||
| #include "BKE_mesh_mapping.h" | #include "BKE_mesh_mapping.h" | ||||
| #include "BKE_mesh_runtime.h" | #include "BKE_mesh_runtime.h" | ||||
| ▲ Show 20 Lines • Show All 3,482 Lines • ▼ Show 20 Lines | static bool proj_paint_state_mesh_eval_init(const bContext *C, ProjPaintState *ps) | ||||
| 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); | ||||
| if (scene_eval == NULL || ob_eval == NULL) { | if (scene_eval == NULL || ob_eval == NULL) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| CustomData_Masks cddata_masks = scene_eval->customdata_mask; | |||||
| cddata_masks.fmask |= CD_MASK_MTFACE; | |||||
| cddata_masks.lmask |= CD_MASK_MLOOPUV; | |||||
| /* Workaround for subsurf selection, try the display mesh first */ | /* Workaround for subsurf selection, try the display mesh first */ | ||||
| if (ps->source == PROJ_SRC_IMAGE_CAM) { | if (ps->source == PROJ_SRC_IMAGE_CAM) { | ||||
| /* using render mesh, assume only camera was rendered from */ | /* using render mesh, assume only camera was rendered from */ | ||||
| ps->me_eval = mesh_create_eval_final_render( | ps->me_eval = mesh_create_eval_final_render( | ||||
| depsgraph, scene_eval, ob_eval, scene_eval->customdata_mask | CD_MASK_MLOOPUV | CD_MASK_MTFACE); | depsgraph, scene_eval, ob_eval, &cddata_masks); | ||||
| ps->me_eval_free = true; | ps->me_eval_free = true; | ||||
| } | } | ||||
| else { | else { | ||||
| if (ps->do_face_sel) { | |||||
| cddata_masks.vmask |= CD_MASK_ORIGINDEX; | |||||
| cddata_masks.emask |= CD_MASK_ORIGINDEX; | |||||
| cddata_masks.pmask |= CD_MASK_ORIGINDEX; | |||||
| } | |||||
| ps->me_eval = mesh_get_eval_final( | ps->me_eval = mesh_get_eval_final( | ||||
| depsgraph, scene_eval, ob_eval, | depsgraph, scene_eval, ob_eval, | ||||
| scene_eval->customdata_mask | CD_MASK_MLOOPUV | CD_MASK_MTFACE | (ps->do_face_sel ? CD_MASK_ORIGINDEX : 0)); | &cddata_masks); | ||||
| ps->me_eval_free = false; | ps->me_eval_free = false; | ||||
| } | } | ||||
| if (!CustomData_has_layer(&ps->me_eval->ldata, CD_MLOOPUV)) { | if (!CustomData_has_layer(&ps->me_eval->ldata, CD_MLOOPUV)) { | ||||
| if (ps->me_eval_free) { | if (ps->me_eval_free) { | ||||
| BKE_id_free(NULL, ps->me_eval); | BKE_id_free(NULL, ps->me_eval); | ||||
| } | } | ||||
| ps->me_eval = NULL; | ps->me_eval = NULL; | ||||
| ▲ Show 20 Lines • Show All 2,593 Lines • Show Last 20 Lines | |||||