diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-02-26 09:00:54 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-02-26 09:00:54 +0400 |
commit | 081a3412a94705e5a95b08d7b41c1bbb879290d8 (patch) | |
tree | fa980a6b8d9f617c2ee2571f89017ab3f554f389 /source/blender/blenkernel | |
parent | 1dd7e759a0df10b05f23527eb6ba0c8e7377fbea (diff) |
Paint API: add BKE_paint_select_elem_test: to check on paint selection
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_paint.h | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/DerivedMesh.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/paint.c | 14 |
3 files changed, 17 insertions, 6 deletions
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h index 2f166dd2dac..e62bd2b4697 100644 --- a/source/blender/blenkernel/BKE_paint.h +++ b/source/blender/blenkernel/BKE_paint.h @@ -103,8 +103,9 @@ void BKE_paint_brush_set(struct Paint *paint, struct Brush *br); /* testing face select mode * Texture paint could be removed since selected faces are not used * however hiding faces is useful */ -bool paint_facesel_test(struct Object *ob); -bool paint_vertsel_test(struct Object *ob); +bool BKE_paint_select_face_test(struct Object *ob); +bool BKE_paint_select_vert_test(struct Object *ob); +bool BKE_paint_select_elem_test(struct Object *ob); /* partial visibility */ bool paint_is_face_hidden(const struct MFace *f, const struct MVert *mvert); diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index f7a6adc813f..d7bdbb45752 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -2223,7 +2223,7 @@ static void mesh_build_data(Scene *scene, Object *ob, CustomDataMask dataMask, int build_shapekey_layers) { Object *obact = scene->basact ? scene->basact->object : NULL; - int editing = paint_facesel_test(ob); + bool editing = BKE_paint_select_face_test(ob); /* weight paint and face select need original indices because of selection buffer drawing */ int needMapping = (ob == obact) && (editing || (ob->mode & (OB_MODE_WEIGHT_PAINT | OB_MODE_VERTEX_PAINT | OB_MODE_TEXTURE_PAINT))); @@ -2286,7 +2286,7 @@ static CustomDataMask object_get_datamask(Scene *scene, Object *ob) if (ob == actob) { /* check if we need tfaces & mcols due to face select or texture paint */ - if (paint_facesel_test(ob) || (ob->mode & OB_MODE_TEXTURE_PAINT)) { + if (BKE_paint_select_face_test(ob) || (ob->mode & OB_MODE_TEXTURE_PAINT)) { mask |= CD_MASK_MTFACE | CD_MASK_MCOL; } diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index 690217a0779..5a38445ee02 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -265,7 +265,7 @@ void BKE_paint_brush_set(Paint *p, Brush *br) } /* are we in vertex paint or weight pain face select mode? */ -bool paint_facesel_test(Object *ob) +bool BKE_paint_select_face_test(Object *ob) { return ( (ob != NULL) && (ob->type == OB_MESH) && @@ -276,7 +276,7 @@ bool paint_facesel_test(Object *ob) } /* are we in weight paint vertex select mode? */ -bool paint_vertsel_test(Object *ob) +bool BKE_paint_select_vert_test(Object *ob) { return ( (ob != NULL) && (ob->type == OB_MESH) && @@ -286,6 +286,16 @@ bool paint_vertsel_test(Object *ob) ); } +/** + * used to check if selection is possible + * (when we don't care if its face or vert) + */ +bool BKE_paint_select_elem_test(Object *ob) +{ + return (BKE_paint_select_vert_test(ob) || + BKE_paint_select_face_test(ob)); +} + void BKE_paint_init(Paint *p, const char col[3]) { Brush *brush; |