Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Bishop <nicholasbishop@gmail.com>2009-08-16 05:25:53 +0400
committerNicholas Bishop <nicholasbishop@gmail.com>2009-08-16 05:25:53 +0400
commitebf1c5faca86286aa90ab5ab9fc4d3ddb1f51cdf (patch)
tree1e457366adcd664233760e5e17b20aa6c3f8e4a2 /source/blender
parentdb1cab0f3a75562eebf5aea93753e77582a4c3e4 (diff)
2.5/Texture paint
* Made texture paint object-localized too. Note for Brecht: gpu_draw.c had three uses of G_TEXTUREPAINT that I was not able to cleanly fix, so commented out for now. Can you take a look and see what should be done here?
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_global.h1
-rw-r--r--source/blender/blenkernel/intern/brush.c4
-rw-r--r--source/blender/blenkernel/intern/context.c12
-rw-r--r--source/blender/blenkernel/intern/paint.c2
-rw-r--r--source/blender/editors/object/object_edit.c2
-rw-r--r--source/blender/editors/screen/screen_context.c6
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c14
-rw-r--r--source/blender/editors/space_buttons/buttons_context.c18
-rw-r--r--source/blender/editors/space_view3d/drawobject.c8
-rw-r--r--source/blender/editors/space_view3d/view3d_buttons.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c7
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c15
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c6
-rw-r--r--source/blender/editors/transform/transform_manipulator.c5
-rw-r--r--source/blender/editors/transform/transform_orientations.c5
-rw-r--r--source/blender/editors/util/undo.c5
-rw-r--r--source/blender/gpu/intern/gpu_draw.c16
-rw-r--r--source/blender/makesdna/DNA_object_types.h1
19 files changed, 70 insertions, 61 deletions
diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h
index 1b20fe92a0e..65b28b29e45 100644
--- a/source/blender/blenkernel/BKE_global.h
+++ b/source/blender/blenkernel/BKE_global.h
@@ -115,7 +115,6 @@ typedef struct Global {
#define G_DEBUG (1 << 12)
#define G_DOSCRIPTLINKS (1 << 13)
-#define G_TEXTUREPAINT (1 << 16)
/* #define G_NOFROZEN (1 << 17) also removed */
#define G_GREASEPENCIL (1 << 17)
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index e026ccdcec6..ca21345e37f 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -197,9 +197,9 @@ Brush **current_brush_source(Scene *sce)
return &sce->toolsettings->vpaint->brush;
else if(ob->mode & OB_MODE_WEIGHT_PAINT)
return &sce->toolsettings->wpaint->brush;
+ else if(ob->mode & OB_MODE_TEXTURE_PAINT)
+ return &sce->toolsettings->imapaint.brush;
}
- else if(G.f & G_TEXTUREPAINT)
- return &sce->toolsettings->imapaint.brush;
return NULL;
}
diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c
index 3210206e16d..f8374be68bd 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -686,11 +686,13 @@ char *CTX_data_mode_string(const bContext *C)
else {
Object *ob = CTX_data_active_object(C);
- if(ob && (ob->flag & OB_POSEMODE)) return "posemode";
- else if (ob && ob->mode & OB_MODE_SCULPT) return "sculpt_mode";
- else if (ob && ob->mode & OB_MODE_WEIGHT_PAINT) return "weightpaint";
- else if (ob && ob->mode & OB_MODE_VERTEX_PAINT) return "vertexpaint";
- else if (G.f & G_TEXTUREPAINT) return "texturepaint";
+ if(ob) {
+ if(ob->flag & OB_POSEMODE) return "posemode";
+ else if(ob->mode & OB_MODE_SCULPT) return "sculpt_mode";
+ else if(ob->mode & OB_MODE_WEIGHT_PAINT) return "weightpaint";
+ else if(ob->mode & OB_MODE_VERTEX_PAINT) return "vertexpaint";
+ else if(ob->mode & OB_MODE_TEXTURE_PAINT) return "texturepaint";
+ }
else if(G.f & G_PARTICLEEDIT) return "particlemode";
}
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index 4081729ec5e..f47a44aff03 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -32,6 +32,6 @@
int paint_facesel_test(Object *ob)
{
- return (G.f&G_FACESELECT) && ((G.f & G_TEXTUREPAINT) || (ob && (ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT))));
+ return (G.f&G_FACESELECT) && (ob && (ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT)));
}
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index de77b80a29a..3be277d1cc4 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -7046,4 +7046,6 @@ void ED_object_toggle_modes(bContext *C, int mode)
WM_operator_name_call(C, "PAINT_OT_vertex_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL);
if(mode & OB_MODE_WEIGHT_PAINT)
WM_operator_name_call(C, "PAINT_OT_weight_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL);
+ if(mode & OB_MODE_TEXTURE_PAINT)
+ WM_operator_name_call(C, "PAINT_OT_texture_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL);
}
diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c
index 31e301f06bc..1d6235eec18 100644
--- a/source/blender/editors/screen/screen_context.c
+++ b/source/blender/editors/screen/screen_context.c
@@ -129,13 +129,13 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
}
else if(CTX_data_equals(member, "weight_paint_object")) {
if(ob && (ob->mode & OB_MODE_WEIGHT_PAINT))
- CTX_data_id_pointer_set(result, &scene->basact->object->id);
+ CTX_data_id_pointer_set(result, &ob->id);
return 1;
}
else if(CTX_data_equals(member, "texture_paint_object")) {
- if(G.f & G_TEXTUREPAINT && scene->basact)
- CTX_data_id_pointer_set(result, &scene->basact->object->id);
+ if(ob && (ob->mode & OB_MODE_TEXTURE_PAINT))
+ CTX_data_id_pointer_set(result, &ob->id);
return 1;
}
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 48e07b7a489..565ccb2b903 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -4380,10 +4380,12 @@ static Brush *image_paint_brush(bContext *C)
static int image_paint_poll(bContext *C)
{
+ Object *obact = CTX_data_active_object(C);
+
if(!image_paint_brush(C))
return 0;
- if((G.f & G_TEXTUREPAINT) && CTX_wm_region_view3d(C)) {
+ if((obact && obact->mode & OB_MODE_TEXTURE_PAINT) && CTX_wm_region_view3d(C)) {
return 1;
}
else {
@@ -5144,13 +5146,13 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op)
me= get_mesh(ob);
- if(!(G.f & G_TEXTUREPAINT) && !me) {
+ if(!(ob->mode & OB_MODE_TEXTURE_PAINT) && !me) {
BKE_report(op->reports, RPT_ERROR, "Can only enter texture paint mode for mesh objects.");
return OPERATOR_CANCELLED;
}
- if(G.f & G_TEXTUREPAINT) {
- G.f &= ~G_TEXTUREPAINT;
+ if(ob->mode & OB_MODE_TEXTURE_PAINT) {
+ ob->mode &= ~OB_MODE_TEXTURE_PAINT;
if(U.glreslimit != 0)
GPU_free_images();
@@ -5159,7 +5161,7 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op)
toggle_paint_cursor(C, 0);
}
else {
- G.f |= G_TEXTUREPAINT;
+ ob->mode |= OB_MODE_TEXTURE_PAINT;
if(me->mtface==NULL)
me->mtface= CustomData_add_layer(&me->fdata, CD_MTFACE, CD_DEFAULT,
@@ -5216,7 +5218,7 @@ static int texture_paint_radial_control_exec(bContext *C, wmOperator *op)
static int texture_paint_poll(bContext *C)
{
if(texture_paint_toggle_poll(C))
- if(G.f & G_TEXTUREPAINT)
+ if(CTX_data_active_object(C)->mode & OB_MODE_TEXTURE_PAINT)
return 1;
return 0;
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index a1e1c589449..ad65177650f 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -321,14 +321,16 @@ static int buttons_context_path_brush(const bContext *C, ButsContextPath *path)
scene= path->ptr[path->len-1].data;
ts= scene->toolsettings;
- if(obact && obact->mode & OB_MODE_SCULPT)
- br= ts->sculpt->brush;
- else if(obact && obact->mode & OB_MODE_VERTEX_PAINT)
- br= ts->vpaint->brush;
- else if(obact && obact->mode & OB_MODE_WEIGHT_PAINT)
- br= ts->wpaint->brush;
- else if(G.f & G_TEXTUREPAINT)
- br= ts->imapaint.brush;
+ if(obact) {
+ if(obact->mode & OB_MODE_SCULPT)
+ br= ts->sculpt->brush;
+ else if(obact->mode & OB_MODE_VERTEX_PAINT)
+ br= ts->vpaint->brush;
+ else if(obact->mode & OB_MODE_WEIGHT_PAINT)
+ br= ts->wpaint->brush;
+ else if(obact->mode & OB_MODE_TEXTURE_PAINT)
+ br= ts->imapaint.brush;
+ }
if(br) {
RNA_id_pointer_create(&br->id, &path->ptr[path->len]);
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 6a053d6f7da..8670ff50cc3 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -2269,7 +2269,7 @@ static void draw_mesh_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base
else if(dt==OB_WIRE || totface==0) {
draw_wire = 1; /* draw wire only, no depth buffer stuff */
}
- else if( (ob==OBACT && (G.f & G_TEXTUREPAINT || paint_facesel_test(ob))) ||
+ else if( (ob==OBACT && (ob->mode & OB_MODE_TEXTURE_PAINT || paint_facesel_test(ob))) ||
CHECK_OB_DRAWTEXTURE(v3d, dt))
{
int faceselect= (ob==OBACT && paint_facesel_test(ob));
@@ -2348,7 +2348,7 @@ static void draw_mesh_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base
GPU_disable_material();
}
- else if((G.f & G_TEXTUREPAINT || ob->mode & OB_MODE_VERTEX_PAINT)) {
+ else if(ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_TEXTURE_PAINT)) {
if(me->mcol)
dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 1);
else {
@@ -5073,7 +5073,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
dtx= 0;
/* faceselect exception: also draw solid when dt==wire, except in editmode */
- if(ob==OBACT && (G.f & G_TEXTUREPAINT || ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT))) {
+ if(ob==OBACT && (ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT))) {
if(ob->type==OB_MESH) {
if(ob==scene->obedit);
@@ -5711,7 +5711,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
if(G.f & G_RENDER_SHADOW) return;
/* object centers, need to be drawn in viewmat space for speed, but OK for picking select */
- if(ob!=OBACT || ((G.f & G_TEXTUREPAINT)==0) || !(ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT))) {
+ if(ob!=OBACT || !(ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT))) {
int do_draw_center= -1; /* defines below are zero or positive... */
if((scene->basact)==base)
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index 45d49f39642..770c66ba752 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -1058,7 +1058,7 @@ static void view3d_panel_object(const bContext *C, Panel *pa)
// XXX uiSetButLock(object_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
- if(ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT) || G.f & G_TEXTUREPAINT) {
+ if(ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT)) {
}
else {
//bt= uiDefBut(block, TEX, B_IDNAME, "OB: ", 10,180,140,20, ob->id.name+2, 0.0, 21.0, 0, 0, "");
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 54abe9e35ed..03cf81c71bb 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -1105,7 +1105,8 @@ void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
if(base && (base->object->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT) ||
paint_facesel_test(base->object)));
- else if((G.f & G_TEXTUREPAINT) && scene->toolsettings && (scene->toolsettings->imapaint.flag & IMAGEPAINT_PROJECT_DISABLE));
+ else if((base && (base->object->mode & OB_MODE_TEXTURE_PAINT)) &&
+ scene->toolsettings && (scene->toolsettings->imapaint.flag & IMAGEPAINT_PROJECT_DISABLE));
else if((G.f & G_PARTICLEEDIT) && v3d->drawtype>OB_WIRE && (v3d->flag & V3D_ZBUF_SELECT));
else if(scene->obedit && v3d->drawtype>OB_WIRE && (v3d->flag & V3D_ZBUF_SELECT));
else {
@@ -1860,7 +1861,7 @@ static CustomDataMask get_viewedit_datamask(bScreen *screen, Object *ob)
ScrArea *sa;
/* check if we need tfaces & mcols due to face select or texture paint */
- if(paint_facesel_test(ob) || G.f & G_TEXTUREPAINT)
+ if(paint_facesel_test(ob) || (ob && ob->mode & OB_MODE_TEXTURE_PAINT))
mask |= CD_MASK_MTFACE | CD_MASK_MCOL;
/* check if we need tfaces & mcols due to view mode */
@@ -2122,7 +2123,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
/* XXX here was the blockhandlers for floating panels */
- if((ob && ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT)) || G.f & G_TEXTUREPAINT) {
+ if(ob && ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT)) {
v3d->flag |= V3D_NEEDBACKBUFDRAW;
// XXX addafterqueue(ar->win, BACKBUFDRAW, 1);
}
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index 31490dd22cc..86082018834 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -137,9 +137,6 @@ static int retopo_mesh_paint_check() {return 0;}
static void ED_toggle_paint_modes(bContext *C, int mode)
{
- if(mode & G_TEXTUREPAINT)
- WM_operator_name_call(C, "PAINT_OT_texture_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL);
-
if(mode & G_PARTICLEEDIT)
WM_operator_name_call(C, "PARTICLE_OT_particle_edit_toggle", WM_OP_EXEC_REGION_WIN, NULL);
}
@@ -151,7 +148,7 @@ int ED_view3d_exit_paint_modes(bContext *C)
ED_toggle_paint_modes(C, G.f);
- G.f &= ~(G_TEXTUREPAINT+G_PARTICLEEDIT);
+ G.f &= ~G_PARTICLEEDIT;
return restore;
}
@@ -3377,7 +3374,7 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event)
}
}
else if (v3d->modeselect == V3D_TEXTUREPAINTMODE_SEL) {
- if (!(G.f & G_TEXTUREPAINT)) {
+ if (ob && !(ob->mode & OB_MODE_TEXTURE_PAINT)) {
v3d->flag &= ~V3D_MODE;
ED_view3d_exit_paint_modes(C);
ED_object_toggle_modes(C, ob->mode);
@@ -3606,7 +3603,7 @@ static void view3d_header_pulldowns(const bContext *C, uiBlock *block, Object *o
uiDefPulldownBut(block, view3d_vpaintmenu, NULL, "Paint", xco,yco, xmax-3, 20, "");
xco+= xmax;
}
- else if (G.f & G_TEXTUREPAINT) {
+ else if (ob && ob->mode & OB_MODE_TEXTURE_PAINT) {
xmax= GetButStringLength("Paint");
uiDefPulldownBut(block, view3d_tpaintmenu, NULL, "Paint", xco,yco, xmax-3, 20, "");
xco+= xmax;
@@ -3691,7 +3688,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
else if (ob && (ob->mode & OB_MODE_SCULPT)) v3d->modeselect = V3D_SCULPTMODE_SEL;
else if (ob && (ob->mode & OB_MODE_WEIGHT_PAINT)) v3d->modeselect = V3D_WEIGHTPAINTMODE_SEL;
else if (ob && (ob->mode & OB_MODE_VERTEX_PAINT)) v3d->modeselect = V3D_VERTEXPAINTMODE_SEL;
- else if (G.f & G_TEXTUREPAINT) v3d->modeselect = V3D_TEXTUREPAINTMODE_SEL;
+ else if (ob && (ob->mode & OB_MODE_TEXTURE_PAINT)) v3d->modeselect = V3D_TEXTUREPAINTMODE_SEL;
/*else if(G.f & G_FACESELECT) v3d->modeselect = V3D_FACESELECTMODE_SEL;*/
else if(G.f & G_PARTICLEEDIT) v3d->modeselect = V3D_PARTICLEEDITMODE_SEL;
@@ -3702,7 +3699,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
if(ob && (ob->flag & OB_POSEMODE)) v3d->flag |= V3D_POSEMODE;
if(ob && (ob->mode & OB_MODE_VERTEX_PAINT)) v3d->flag |= V3D_VERTEXPAINT;
if(ob && (ob->mode & OB_MODE_WEIGHT_PAINT)) v3d->flag |= V3D_WEIGHTPAINT;
- if (G.f & G_TEXTUREPAINT) v3d->flag |= V3D_TEXTUREPAINT;
+ if(ob && (ob->mode & OB_MODE_TEXTURE_PAINT)) v3d->flag |= V3D_TEXTUREPAINT;
if(paint_facesel_test(ob)) v3d->flag |= V3D_FACESELECT;
uiDefIconTextButS(block, MENU, B_MODESELECT, (v3d->modeselect),view3d_modeselect_pup(scene) ,
@@ -3746,7 +3743,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
uiBlockEndAlign(block);
}
} else {
- if (obedit==NULL && ((ob && ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT)) || G.f & G_TEXTUREPAINT)) {
+ 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)");
header_xco_step(ar, &xco, &yco, &maxco, XIC+10);
} else {
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index e810ea1f882..3c881972c32 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -699,7 +699,7 @@ void view3d_lasso_select(bContext *C, ViewContext *vc, short mcords[][2], short
if(vc->obedit==NULL) {
if(paint_facesel_test(ob))
do_lasso_select_facemode(vc, mcords, moves, select);
- else if(G.f & G_TEXTUREPAINT || (ob && ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT)))
+ else if(ob && ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT))
;
else if(G.f & G_PARTICLEEDIT)
PE_lasso_select(C, mcords, moves, select);
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 20e0a79f0c7..58b7a70a128 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -1389,12 +1389,13 @@ static ListBase queue_back;
static void SaveState(bContext *C)
{
wmWindow *win= CTX_wm_window(C);
+ Object *obact = CTX_data_active_object(C);
glPushAttrib(GL_ALL_ATTRIB_BITS);
GPU_state_init();
- if(G.f & G_TEXTUREPAINT)
+ if(obact && obact->mode & OB_MODE_TEXTURE_PAINT)
GPU_paint_set_mipmap(1);
queue_back= win->queue;
@@ -1407,8 +1408,9 @@ static void SaveState(bContext *C)
static void RestoreState(bContext *C)
{
wmWindow *win= CTX_wm_window(C);
+ Object *obact = CTX_data_active_object(C);
- if(G.f & G_TEXTUREPAINT)
+ if(obact && obact->mode & OB_MODE_TEXTURE_PAINT)
GPU_paint_set_mipmap(0);
//XXX curarea->win_swap = 0;
diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c
index 40966380cca..07ca42ef448 100644
--- a/source/blender/editors/transform/transform_manipulator.c
+++ b/source/blender/editors/transform/transform_manipulator.c
@@ -358,10 +358,7 @@ int calc_manipulator_stats(const bContext *C)
Mat4MulVecfl(ob->obmat, scene->twmax);
}
}
- else if(G.f & G_TEXTUREPAINT) {
- ;
- }
- else if(ob && (ob->mode & (OB_MODE_SCULPT|OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT))) {
+ else if(ob && (ob->mode & (OB_MODE_SCULPT|OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT))) {
;
}
else if(G.f & G_PARTICLEEDIT) {
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index 9c142d2c650..661d9ead799 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -894,10 +894,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
result = ORIENTATION_EDGE;
}
}
- else if(ob && (ob->mode & (OB_MODE_SCULPT|OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT)))
- {
- }
- else if(G.f & G_TEXTUREPAINT)
+ else if(ob && (ob->mode & (OB_MODE_SCULPT|OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT)))
{
}
else if(G.f & G_PARTICLEEDIT)
diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c
index e175f7c1393..1b5f61e77e2 100644
--- a/source/blender/editors/util/undo.c
+++ b/source/blender/editors/util/undo.c
@@ -115,12 +115,13 @@ void ED_undo_push(bContext *C, char *str)
static int ed_undo_step(bContext *C, int step, const char *undoname)
{
Object *obedit= CTX_data_edit_object(C);
+ Object *obact= CTX_data_active_object(C);
ScrArea *sa= CTX_wm_area(C);
if(sa && sa->spacetype==SPACE_IMAGE) {
SpaceImage *sima= (SpaceImage *)sa->spacedata.first;
- if(G.f & G_TEXTUREPAINT || sima->flag & SI_DRAWTOOL) {
+ if((obact && obact->mode & OB_MODE_TEXTURE_PAINT) || sima->flag & SI_DRAWTOOL) {
undo_imagepaint_step(step);
WM_event_add_notifier(C, NC_WINDOW, NULL);
@@ -142,7 +143,7 @@ static int ed_undo_step(bContext *C, int step, const char *undoname)
else {
int do_glob_undo= 0;
- if(G.f & G_TEXTUREPAINT)
+ if(obact && obact->mode & OB_MODE_TEXTURE_PAINT)
undo_imagepaint_step(step);
else if(G.f & G_PARTICLEEDIT) {
if(step==1)
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index eb834abc670..86b39dd483b 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -194,8 +194,11 @@ static int smaller_pow2(int num)
static int is_pow2_limit(int num)
{
/* take texture clamping into account */
- if (G.f & G_TEXTUREPAINT)
- return 1;
+
+ /* XXX: texturepaint not global!
+ if (G.f & G_TEXTUREPAINT)
+ return 1;*/
+
if (U.glreslimit != 0 && num > U.glreslimit)
return 0;
@@ -204,8 +207,9 @@ static int is_pow2_limit(int num)
static int smaller_pow2_limit(int num)
{
- if (G.f & G_TEXTUREPAINT)
- return 1;
+ /* XXX: texturepaint not global!
+ if (G.f & G_TEXTUREPAINT)
+ return 1;*/
/* take texture clamping into account */
if (U.glreslimit != 0 && num > U.glreslimit)
@@ -249,7 +253,9 @@ void GPU_set_linear_mipmap(int linear)
static int gpu_get_mipmap(void)
{
- return GTS.domipmap && (!(G.f & G_TEXTUREPAINT));
+ return GTS.domipmap
+ /* XXX: texturepaint not global!
+ && (!(G.f & G_TEXTUREPAINT))*/;
}
static GLenum gpu_get_mipmap_filter(int mag)
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index 5323514fcc6..60e569172e2 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -516,6 +516,7 @@ extern Object workob;
#define OB_MODE_SCULPT 1
#define OB_MODE_VERTEX_PAINT 2
#define OB_MODE_WEIGHT_PAINT 4
+#define OB_MODE_TEXTURE_PAINT 8
/* ob->softflag in DNA_object_force.h */