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?
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
|
||||
|
||||
@@ -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)));
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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]);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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, "");
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user