move G_FACESELECT from G.f to mesh->editflag, renamed to ME_EDIT_PAINT_MASK
This commit is contained in:
@@ -110,7 +110,7 @@ typedef struct Global {
|
||||
#define G_BACKBUFSEL (1 << 4)
|
||||
#define G_PICKSEL (1 << 5)
|
||||
|
||||
#define G_FACESELECT (1 << 8)
|
||||
/* #define G_FACESELECT (1 << 8) use mesh mode */
|
||||
|
||||
#define G_DEBUG (1 << 12)
|
||||
#define G_DOSCRIPTLINKS (1 << 13)
|
||||
|
||||
@@ -226,8 +226,6 @@ static void clear_global(void)
|
||||
// free_vertexpaint();
|
||||
|
||||
G.main= NULL;
|
||||
|
||||
G.f &= ~(G_FACESELECT);
|
||||
}
|
||||
|
||||
/* make sure path names are correct for OS */
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include "DNA_brush_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
|
||||
#include "BKE_brush.h"
|
||||
@@ -160,8 +161,7 @@ void paint_brush_slot_remove(Paint *p)
|
||||
|
||||
int paint_facesel_test(Object *ob)
|
||||
{
|
||||
return (G.f&G_FACESELECT) && (ob && (ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT)));
|
||||
|
||||
return (ob && (((Mesh *)ob->data)->editflag & ME_EDIT_PAINT_MASK) && (ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT)));
|
||||
}
|
||||
|
||||
void paint_init(Paint *p, const char col[3])
|
||||
|
||||
@@ -3182,7 +3182,7 @@ static void project_paint_begin(ProjPaintState *ps)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (tf->tpage && ((G.f & G_FACESELECT)==0 || mf->flag & ME_FACE_SEL)) {
|
||||
if (tf->tpage && ((((Mesh *)ps->ob->data)->editflag & ME_EDIT_PAINT_MASK)==0 || mf->flag & ME_FACE_SEL)) {
|
||||
|
||||
float *v1coSS, *v2coSS, *v3coSS, *v4coSS=NULL;
|
||||
|
||||
@@ -4290,7 +4290,7 @@ static int imapaint_paint_stroke(ViewContext *vc, ImagePaintState *s, BrushPaint
|
||||
if (texpaint) {
|
||||
/* pick new face and image */
|
||||
if ( imapaint_pick_face(vc, s->me, mval, &newfaceindex) &&
|
||||
((G.f & G_FACESELECT)==0 || (s->me->mface+newfaceindex)->flag & ME_FACE_SEL)
|
||||
((s->me->editflag & ME_EDIT_PAINT_MASK)==0 || (s->me->mface+newfaceindex)->flag & ME_FACE_SEL)
|
||||
) {
|
||||
ImBuf *ibuf;
|
||||
|
||||
|
||||
@@ -203,7 +203,7 @@ static unsigned int vpaint_get_current_col(VPaint *vp)
|
||||
return rgba_to_mcol(brush->rgb[0], brush->rgb[1], brush->rgb[2], 1.0f);
|
||||
}
|
||||
|
||||
void do_shared_vertexcol(Mesh *me)
|
||||
static void do_shared_vertexcol(Mesh *me)
|
||||
{
|
||||
/* if no mcol: do not do */
|
||||
/* if tface: only the involved faces, otherwise all */
|
||||
@@ -221,7 +221,7 @@ void do_shared_vertexcol(Mesh *me)
|
||||
mface= me->mface;
|
||||
mcol= (char *)me->mcol;
|
||||
for(a=me->totface; a>0; a--, mface++, mcol+=16) {
|
||||
if((tface && tface->mode & TF_SHAREDCOL) || (G.f & G_FACESELECT)==0) {
|
||||
if((tface && tface->mode & TF_SHAREDCOL) || (me->editflag & ME_EDIT_PAINT_MASK)==0) {
|
||||
scol= scolmain+4*mface->v1;
|
||||
scol[0]++; scol[1]+= mcol[1]; scol[2]+= mcol[2]; scol[3]+= mcol[3];
|
||||
scol= scolmain+4*mface->v2;
|
||||
@@ -251,7 +251,7 @@ void do_shared_vertexcol(Mesh *me)
|
||||
mface= me->mface;
|
||||
mcol= (char *)me->mcol;
|
||||
for(a=me->totface; a>0; a--, mface++, mcol+=16) {
|
||||
if((tface && tface->mode & TF_SHAREDCOL) || (G.f & G_FACESELECT)==0) {
|
||||
if((tface && tface->mode & TF_SHAREDCOL) || (me->editflag & ME_EDIT_PAINT_MASK)==0) {
|
||||
scol= scolmain+4*mface->v1;
|
||||
mcol[1]= scol[1]; mcol[2]= scol[2]; mcol[3]= scol[3];
|
||||
scol= scolmain+4*mface->v2;
|
||||
@@ -1361,7 +1361,7 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
|
||||
}
|
||||
}
|
||||
|
||||
if((G.f & G_FACESELECT) && me->mface) {
|
||||
if((me->editflag & ME_EDIT_PAINT_MASK) && me->mface) {
|
||||
for(index=0; index<totindex; index++) {
|
||||
if(indexar[index] && indexar[index]<=me->totface) {
|
||||
MFace *mface= ((MFace *)me->mface) + (indexar[index]-1);
|
||||
@@ -1675,7 +1675,7 @@ static void vpaint_paint_face(VPaint *vp, VPaintData *vpd, Object *ob, int index
|
||||
int alpha, i;
|
||||
|
||||
if((vp->flag & VP_COLINDEX && mface->mat_nr!=ob->actcol-1) ||
|
||||
(G.f & G_FACESELECT && !(mface->flag & ME_FACE_SEL)))
|
||||
((me->editflag & ME_EDIT_PAINT_MASK) && !(mface->flag & ME_FACE_SEL)))
|
||||
return;
|
||||
|
||||
if(vp->mode==VP_BLUR) {
|
||||
|
||||
@@ -6121,7 +6121,7 @@ static void bbs_mesh_solid(Scene *scene, View3D *v3d, Object *ob)
|
||||
Mesh *me = (Mesh*)ob->data;
|
||||
MCol *colors;
|
||||
int i,j;
|
||||
int face_sel_mode = (G.f & G_FACESELECT) ? 1:0;
|
||||
int face_sel_mode = (me->flag & ME_EDIT_PAINT_MASK) ? 1:0;
|
||||
|
||||
glColor3ub(0, 0, 0);
|
||||
|
||||
|
||||
@@ -1818,6 +1818,7 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event)
|
||||
ED_area_tag_redraw(sa);
|
||||
break;
|
||||
case B_VIEW_BUTSEDIT:
|
||||
ED_area_tag_redraw(sa);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -2031,7 +2032,8 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
|
||||
}
|
||||
} else {
|
||||
if (obedit==NULL && ((ob && ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT)))) {
|
||||
uiDefIconButBitI(block, TOG, G_FACESELECT, B_VIEW_BUTSEDIT, ICON_FACESEL_HLT,xco,yco,XIC,YIC, &G.f, 0, 0, 0, 0, "Painting Mask (FKey)");
|
||||
Mesh *me= ob->data;
|
||||
uiDefIconButBitS(block, TOG, ME_EDIT_PAINT_MASK, B_VIEW_BUTSEDIT, ICON_FACESEL_HLT,xco,yco,XIC,YIC, &me->editflag, 0, 0, 0, 0, "Painting Mask (FKey)");
|
||||
header_xco_step(ar, &xco, &yco, &maxco, XIC+10);
|
||||
} else {
|
||||
/* Manipulators aren't used in weight paint mode */
|
||||
|
||||
@@ -121,6 +121,8 @@ typedef struct TFace {
|
||||
#define ME_EDIT_MIRROR_Y (1 << 1) // unused so far
|
||||
#define ME_EDIT_MIRROR_Z (1 << 2) // unused so far
|
||||
|
||||
#define ME_EDIT_PAINT_MASK (1 << 3)
|
||||
|
||||
/* me->flag */
|
||||
#define ME_ISDONE 1
|
||||
#define ME_NOPUNOFLIP 2
|
||||
|
||||
@@ -1615,6 +1615,12 @@ static void rna_def_mesh(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "Z Mirror", "Z Axis mirror editing");
|
||||
*/
|
||||
|
||||
prop= RNA_def_property(srna, "use_paint_mask", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_PAINT_MASK);
|
||||
RNA_def_property_ui_text(prop, "Paint Mask", "Face selection masking for painting");
|
||||
|
||||
|
||||
|
||||
rna_def_texmat_common(srna, "rna_Mesh_texspace_editable");
|
||||
|
||||
RNA_api_mesh(srna);
|
||||
|
||||
Reference in New Issue
Block a user