Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/mesh/editface.c
| Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | |||||
| #include "WM_api.h" | #include "WM_api.h" | ||||
| #include "WM_types.h" | #include "WM_types.h" | ||||
| #include "DEG_depsgraph.h" | #include "DEG_depsgraph.h" | ||||
| #include "DEG_depsgraph_query.h" | #include "DEG_depsgraph_query.h" | ||||
| /* own include */ | /* own include */ | ||||
| /* copy the face flags, most importantly selection from the mesh to the final derived mesh, | |||||
| * use in object mode when selecting faces (while painting) */ | |||||
| void paintface_flush_flags(struct bContext *C, Object *ob, short flag) | void paintface_flush_flags(struct bContext *C, Object *ob, short flag) | ||||
| { | { | ||||
| Mesh *me = BKE_mesh_from_object(ob); | Mesh *me = BKE_mesh_from_object(ob); | ||||
| MPoly *polys, *mp_orig; | MPoly *polys, *mp_orig; | ||||
| const int *index_array = NULL; | const int *index_array = NULL; | ||||
| int totpoly; | int totpoly; | ||||
| BLI_assert((flag & ~(SELECT | ME_HIDE)) == 0); | BLI_assert((flag & ~(SELECT | ME_HIDE)) == 0); | ||||
| ▲ Show 20 Lines • Show All 369 Lines • ▼ Show 20 Lines | bool paintface_mouse_select( | ||||
| /* image window redraw */ | /* image window redraw */ | ||||
| paintface_flush_flags(C, ob, SELECT); | paintface_flush_flags(C, ob, SELECT); | ||||
| ED_region_tag_redraw(CTX_wm_region(C)); /* XXX: should redraw all 3D views. */ | ED_region_tag_redraw(CTX_wm_region(C)); /* XXX: should redraw all 3D views. */ | ||||
| return true; | return true; | ||||
| } | } | ||||
| /* (similar to void paintface_flush_flags(Object *ob)) | |||||
| * copy the vertex flags, most importantly selection from the mesh to the final derived mesh, | |||||
| * use in object mode when selecting vertices (while painting) */ | |||||
| void paintvert_flush_flags(Object *ob) | void paintvert_flush_flags(Object *ob) | ||||
| { | { | ||||
| Mesh *me = BKE_mesh_from_object(ob); | Mesh *me = BKE_mesh_from_object(ob); | ||||
| Mesh *me_eval = BKE_object_get_evaluated_mesh(ob); | Mesh *me_eval = BKE_object_get_evaluated_mesh(ob); | ||||
| MVert *mvert_eval, *mv; | MVert *mvert_eval, *mv; | ||||
| const int *index_array = NULL; | const int *index_array = NULL; | ||||
| int totvert; | int totvert; | ||||
| int i; | int i; | ||||
| Show All 36 Lines | |||||
| } | } | ||||
| void paintvert_tag_select_update(struct bContext *C, struct Object *ob) | void paintvert_tag_select_update(struct bContext *C, struct Object *ob) | ||||
| { | { | ||||
| DEG_id_tag_update(ob->data, ID_RECALC_COPY_ON_WRITE | ID_RECALC_SELECT); | DEG_id_tag_update(ob->data, ID_RECALC_COPY_ON_WRITE | ID_RECALC_SELECT); | ||||
| WM_event_add_notifier(C, NC_GEOM | ND_SELECT, ob->data); | WM_event_add_notifier(C, NC_GEOM | ND_SELECT, ob->data); | ||||
| } | } | ||||
| /** | |||||
| * \note if the caller passes false to flush_flags, | |||||
| * then they will need to run #paintvert_flush_flags(ob) themselves. | |||||
| */ | |||||
| bool paintvert_deselect_all_visible(Object *ob, int action, bool flush_flags) | bool paintvert_deselect_all_visible(Object *ob, int action, bool flush_flags) | ||||
| { | { | ||||
| Mesh *me; | Mesh *me; | ||||
| MVert *mvert; | MVert *mvert; | ||||
| int a; | int a; | ||||
| me = BKE_mesh_from_object(ob); | me = BKE_mesh_from_object(ob); | ||||
| if (me == NULL) { | if (me == NULL) { | ||||
| ▲ Show 20 Lines • Show All 94 Lines • Show Last 20 Lines | |||||