diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2009-08-16 01:46:25 +0400 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2009-08-16 01:46:25 +0400 |
commit | b8aff064662d5c89f909c31ffac216286270d185 (patch) | |
tree | a27469c270cabd35a52ce3dbee381e5048c7d220 /source | |
parent | e182d653709a9abd664deaa874f0727ebba83832 (diff) |
2.5/Paint:
* Weightpaint is now object-local like sculpt and vertexpaint.
* Fixed a bug spotted by DingTo, going from editmode to sculptmode didn't fully leave editmode
Diffstat (limited to 'source')
24 files changed, 64 insertions, 62 deletions
diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h index 1d09ff2f2c6..1b20fe92a0e 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_WEIGHTPAINT (1 << 15) #define G_TEXTUREPAINT (1 << 16) /* #define G_NOFROZEN (1 << 17) also removed */ #define G_GREASEPENCIL (1 << 17) diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 3f20d379748..3b7ea6f3fcd 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -226,7 +226,7 @@ static void clear_global(void) G.main= NULL; - G.f &= ~(G_WEIGHTPAINT + G_FACESELECT + G_PARTICLEEDIT); + G.f &= ~(G_FACESELECT + G_PARTICLEEDIT); } /* make sure path names are correct for OS */ diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 392872dafd1..e026ccdcec6 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -195,9 +195,9 @@ Brush **current_brush_source(Scene *sce) return &sce->toolsettings->sculpt->brush; else if(ob->mode & OB_MODE_VERTEX_PAINT) return &sce->toolsettings->vpaint->brush; + else if(ob->mode & OB_MODE_WEIGHT_PAINT) + return &sce->toolsettings->wpaint->brush; } - else if(G.f & G_WEIGHTPAINT) - return &sce->toolsettings->wpaint->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 ba06768b12a..3210206e16d 100644 --- a/source/blender/blenkernel/intern/context.c +++ b/source/blender/blenkernel/intern/context.c @@ -688,7 +688,7 @@ char *CTX_data_mode_string(const bContext *C) if(ob && (ob->flag & OB_POSEMODE)) return "posemode"; else if (ob && ob->mode & OB_MODE_SCULPT) return "sculpt_mode"; - else if (G.f & G_WEIGHTPAINT) return "weightpaint"; + 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"; 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 e945c218217..4081729ec5e 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_WEIGHTPAINT|G_TEXTUREPAINT)) || (ob && (ob->mode & OB_MODE_VERTEX_PAINT))); + return (G.f&G_FACESELECT) && ((G.f & G_TEXTUREPAINT) || (ob && (ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT)))); } diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index f81eba2badf..dcd3fcd2f89 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -3726,7 +3726,7 @@ static void psys_update_path_cache(Scene *scene, Object *ob, ParticleSystemModif if((psys->part->childtype && psys->totchild != get_psys_tot_child(scene, psys)) || psys->recalc&PSYS_RECALC_RESET) alloc=1; - if(alloc || psys->recalc&PSYS_RECALC_CHILD || (psys->vgroup[PSYS_VG_DENSITY] && (G.f & G_WEIGHTPAINT))) + if(alloc || psys->recalc&PSYS_RECALC_CHILD || (psys->vgroup[PSYS_VG_DENSITY] && (ob && ob->mode & OB_MODE_WEIGHT_PAINT))) distr=1; if(distr){ diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index c1b24375b3d..07da42e4cbb 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -4332,7 +4332,7 @@ int ED_do_pose_selectbuffer(Scene *scene, Base *base, unsigned int *buffer, shor } /* in weightpaint we select the associated vertex group too */ - if (G.f & G_WEIGHTPAINT) { + if (ob->mode & OB_MODE_WEIGHT_PAINT) { if (nearBone->flag & BONE_ACTIVE) { vertexgroup_select_by_name(OBACT, nearBone->name); DAG_object_flush_update(scene, OBACT, OB_RECALC_DATA); @@ -4424,7 +4424,7 @@ static int bone_skinnable(Object *ob, Bone *bone, void *datap) int a, segments; struct { Object *armob; void *list; int heat; } *data = datap; - if(!(G.f & G_WEIGHTPAINT) || !(bone->flag & BONE_HIDDEN_P)) { + if(!(ob->mode & OB_MODE_WEIGHT_PAINT) || !(bone->flag & BONE_HIDDEN_P)) { if (!(bone->flag & BONE_NO_DEFORM)) { if (data->heat && data->armob->pose && get_pose_channel(data->armob->pose, bone->name)) segments = bone->segments; @@ -4489,7 +4489,7 @@ static int dgroup_skinnable(Object *ob, Bone *bone, void *datap) int a, segments; struct { Object *armob; void *list; int heat; } *data= datap; - if (!(G.f & G_WEIGHTPAINT) || !(bone->flag & BONE_HIDDEN_P)) { + if (!(ob->mode & OB_MODE_WEIGHT_PAINT) || !(bone->flag & BONE_HIDDEN_P)) { if (!(bone->flag & BONE_NO_DEFORM)) { if (data->heat && data->armob->pose && get_pose_channel(data->armob->pose, bone->name)) segments = bone->segments; @@ -4588,7 +4588,7 @@ void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int m float (*root)[3], (*tip)[3], (*verts)[3]; int *selected; int numbones, vertsfilled = 0, i, j, segments = 0; - int wpmode = (G.f & G_WEIGHTPAINT); + int wpmode = (ob->mode & OB_MODE_WEIGHT_PAINT); struct { Object *armob; void *list; int heat; } looper_data; looper_data.armob = par; diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index 63f18ca6caf..fe723a875a2 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -1647,7 +1647,7 @@ void pose_activate_flipped_bone(Scene *scene) if(ob==NULL) return; - if(G.f & G_WEIGHTPAINT) { + if(ob->mode && OB_MODE_WEIGHT_PAINT) { ob= modifiers_isDeformedByArmature(ob); } if(ob && (ob->flag & OB_POSEMODE)) { @@ -1671,7 +1671,7 @@ void pose_activate_flipped_bone(Scene *scene) pchanf->bone->flag |= (BONE_SELECTED|BONE_ACTIVE); /* in weightpaint we select the associated vertex group too */ - if(G.f & G_WEIGHTPAINT) { + if(ob->mode & OB_MODE_WEIGHT_PAINT) { vertexgroup_select_by_name(OBACT, name); DAG_object_flush_update(scene, OBACT, OB_RECALC_DATA); } diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index f5a93fae8e9..de77b80a29a 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -2247,7 +2247,7 @@ static int object_location_clear_exec(bContext *C, wmOperator *op) int armature_clear= 0; CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { - if((G.f & G_WEIGHTPAINT)==0) { + if(!(ob->mode & OB_MODE_WEIGHT_PAINT)) { if ((ob->protectflag & OB_LOCK_LOCX)==0) ob->loc[0]= ob->dloc[0]= 0.0f; if ((ob->protectflag & OB_LOCK_LOCY)==0) @@ -2290,7 +2290,7 @@ static int object_rotation_clear_exec(bContext *C, wmOperator *op) int armature_clear= 0; CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { - if((G.f & G_WEIGHTPAINT)==0) { + if(!(ob->mode & OB_MODE_WEIGHT_PAINT)) { /* eulers can only get cleared if they are not protected */ if ((ob->protectflag & OB_LOCK_ROTX)==0) ob->rot[0]= ob->drot[0]= 0.0f; @@ -2334,7 +2334,7 @@ static int object_scale_clear_exec(bContext *C, wmOperator *op) int armature_clear= 0; CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { - if((G.f & G_WEIGHTPAINT)==0) { + if(!(ob->mode & OB_MODE_WEIGHT_PAINT)) { if ((ob->protectflag & OB_LOCK_SCALEX)==0) { ob->dsize[0]= 0.0f; ob->size[0]= 1.0f; @@ -3701,7 +3701,7 @@ void ED_object_exit_editmode(bContext *C, int flag) me->edit_mesh= NULL; } - if(G.f & G_WEIGHTPAINT) + if(obedit->restore_mode & OB_MODE_WEIGHT_PAINT) mesh_octree_table(obedit, NULL, NULL, 'e'); } else if (obedit->type==OB_ARMATURE) { @@ -4178,7 +4178,7 @@ void special_editmenu(Scene *scene, View3D *v3d) DAG_object_flush_update(scene, ob, OB_RECALC_DATA); } } - else if(G.f & G_WEIGHTPAINT) { + else if(ob->mode & OB_MODE_WEIGHT_PAINT) { Object *par= modifiers_isDeformedByArmature(ob); if(par && (par->flag & OB_POSEMODE)) { @@ -7043,5 +7043,7 @@ void ED_object_toggle_modes(bContext *C, int mode) if(mode & OB_MODE_SCULPT) WM_operator_name_call(C, "SCULPT_OT_sculptmode_toggle", WM_OP_EXEC_REGION_WIN, NULL); if(mode & OB_MODE_VERTEX_PAINT) - WM_operator_name_call(C, "SCULPT_OT_vertex_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL); + 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); } diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c index 0ac9333aafc..31e301f06bc 100644 --- a/source/blender/editors/screen/screen_context.c +++ b/source/blender/editors/screen/screen_context.c @@ -128,7 +128,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult return 1; } else if(CTX_data_equals(member, "weight_paint_object")) { - if(G.f & G_WEIGHTPAINT && scene->basact) + if(ob && (ob->mode & OB_MODE_WEIGHT_PAINT)) CTX_data_id_pointer_set(result, &scene->basact->object->id); return 1; diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index b8ee2710152..8419c3fd188 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -123,7 +123,9 @@ static int vp_poll(bContext *C) static int wp_poll(bContext *C) { - if(G.f & G_WEIGHTPAINT) { + Object *ob = CTX_data_active_object(C); + + if(ob && ob->mode & OB_MODE_WEIGHT_PAINT) { ScrArea *sa= CTX_wm_area(C); if(sa->spacetype==SPACE_VIEW3D) { ARegion *ar= CTX_wm_region(C); @@ -1094,12 +1096,12 @@ static int set_wpaint(bContext *C, wmOperator *op) /* toggle */ if(me && me->totface>=MAXINDEX) { error("Maximum number of faces: %d", MAXINDEX-1); - G.f &= ~G_WEIGHTPAINT; + ob->mode &= ~OB_MODE_WEIGHT_PAINT; return OPERATOR_CANCELLED; } - if(G.f & G_WEIGHTPAINT) G.f &= ~G_WEIGHTPAINT; - else G.f |= G_WEIGHTPAINT; + if(ob->mode & OB_MODE_WEIGHT_PAINT) ob->mode &= ~OB_MODE_WEIGHT_PAINT; + else ob->mode |= OB_MODE_WEIGHT_PAINT; /* Weightpaint works by overriding colors in mesh, @@ -1109,7 +1111,7 @@ static int set_wpaint(bContext *C, wmOperator *op) /* toggle */ */ DAG_object_flush_update(scene, ob, OB_RECALC_DATA); - if(G.f & G_WEIGHTPAINT) { + if(ob->mode & OB_MODE_WEIGHT_PAINT) { Object *par; if(wp==NULL) @@ -1612,7 +1614,7 @@ static int set_vpaint(bContext *C, wmOperator *op) /* toggle */ ob->mode |= OB_MODE_VERTEX_PAINT; /* Turn off weight painting */ - if (G.f & G_WEIGHTPAINT) + if (ob->mode & OB_MODE_WEIGHT_PAINT) set_wpaint(C, op); if(vp==NULL) diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index d438490ff7e..a1e1c589449 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -325,7 +325,7 @@ static int buttons_context_path_brush(const bContext *C, ButsContextPath *path) br= ts->sculpt->brush; else if(obact && obact->mode & OB_MODE_VERTEX_PAINT) br= ts->vpaint->brush; - else if(G.f & G_WEIGHTPAINT) + else if(obact && obact->mode & OB_MODE_WEIGHT_PAINT) br= ts->wpaint->brush; else if(G.f & G_TEXTUREPAINT) br= ts->imapaint.brush; diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index 5a9790390b7..1f8314f9aae 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -2530,7 +2530,7 @@ int draw_armature(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, int if ((flag & DRAW_SCENESET)==0) { if(ob==OBACT) arm->flag |= ARM_POSEMODE; - else if(G.f & G_WEIGHTPAINT) { + else if(ob->mode & OB_MODE_WEIGHT_PAINT) { if(OBACT && ob==modifiers_isDeformedByArmature(OBACT)) arm->flag |= ARM_POSEMODE; } diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index 294d970b9fd..78ff84906d2 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -563,7 +563,7 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o if(ob == scene->obedit) { dm->drawMappedFacesTex(dm, draw_em_tf_mapped__set_draw, me->edit_mesh); } else if(faceselect) { - if(G.f & G_WEIGHTPAINT) + if(ob->mode & OB_MODE_WEIGHT_PAINT) dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me, 1); else dm->drawMappedFacesTex(dm, draw_tface_mapped__set_draw, me); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 3f3cb401959..6a053d6f7da 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -212,7 +212,7 @@ int draw_glsl_material(Scene *scene, Object *ob, View3D *v3d, int dt) return 0; if(!CHECK_OB_DRAWTEXTURE(v3d, dt)) return 0; - if(ob==OBACT && (G.f & G_WEIGHTPAINT)) + if(ob==OBACT && (ob && ob->mode & OB_MODE_WEIGHT_PAINT)) return 0; return ((G.fileflags & G_FILE_GAME_MAT) && @@ -2328,7 +2328,7 @@ static void draw_mesh_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base if(ob==OBACT) { do_draw= 0; - if( (G.f & G_WEIGHTPAINT)) { + if(ob && ob->mode & OB_MODE_WEIGHT_PAINT) { /* enforce default material settings */ GPU_enable_material(0, NULL); @@ -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+G_WEIGHTPAINT) || ob->mode & OB_MODE_VERTEX_PAINT)) { + if(ob==OBACT && (G.f & G_TEXTUREPAINT || ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_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|G_WEIGHTPAINT))==0) || ob->mode & OB_MODE_VERTEX_PAINT) { + if(ob!=OBACT || ((G.f & G_TEXTUREPAINT)==0) || !(ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_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 8057ed9f819..45d49f39642 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 || G.f & (G_TEXTUREPAINT|G_WEIGHTPAINT)) { + if(ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT) || G.f & G_TEXTUREPAINT) { } 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 c1f02c74460..54abe9e35ed 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1103,9 +1103,8 @@ void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d) int m; #endif - if(G.f & G_WEIGHTPAINT || - (base && (base->object->mode & OB_MODE_VERTEX_PAINT || - paint_facesel_test(base->object)))); + 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((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)); @@ -1884,13 +1883,14 @@ static CustomDataMask get_viewedit_datamask(bScreen *screen, Object *ob) } /* check if we need mcols due to vertex paint or weightpaint */ - if(ob && ob->mode & OB_MODE_VERTEX_PAINT) - mask |= CD_MASK_MCOL; - if(G.f & G_WEIGHTPAINT) - mask |= CD_MASK_WEIGHT_MCOL; - - if(ob && ob->mode & OB_MODE_SCULPT) - mask |= CD_MASK_MDISPS; + if(ob) { + if(ob->mode & OB_MODE_VERTEX_PAINT) + mask |= CD_MASK_MCOL; + if(ob->mode & OB_MODE_WEIGHT_PAINT) + mask |= CD_MASK_WEIGHT_MCOL; + if(ob->mode & OB_MODE_SCULPT) + mask |= CD_MASK_MDISPS; + } return mask; } @@ -2122,7 +2122,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) || G.f & G_WEIGHTPAINT || G.f & G_TEXTUREPAINT) { + if((ob && ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT)) || G.f & G_TEXTUREPAINT) { v3d->flag |= V3D_NEEDBACKBUFDRAW; // XXX addafterqueue(ar->win, BACKBUFDRAW, 1); } diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 64e72399a06..f4b15647459 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -951,7 +951,7 @@ static int viewcenter_exec(bContext *C, wmOperator *op) /* like a localview with INIT_MINMAX(min, max); - if (G.f & G_WEIGHTPAINT) { + if (ob && ob->mode & OB_MODE_WEIGHT_PAINT) { /* hardcoded exception, we look for the one selected armature */ /* this is weak code this way, we should make a generic active/selection callback interface once... */ Base *base; diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index 26e2918c032..20ce252a4a3 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -139,8 +139,6 @@ 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); - else if(mode & G_WEIGHTPAINT) - WM_operator_name_call(C, "PAINT_OT_weight_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); @@ -153,7 +151,7 @@ int ED_view3d_exit_paint_modes(bContext *C) ED_toggle_paint_modes(C, G.f); - G.f &= ~(G_TEXTUREPAINT+G_WEIGHTPAINT+G_PARTICLEEDIT); + G.f &= ~(G_TEXTUREPAINT+G_PARTICLEEDIT); return restore; } @@ -3467,7 +3465,7 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event) v3d->flag &= ~V3D_MODE; ED_view3d_exit_paint_modes(C); ED_object_toggle_modes(C, ob->mode); - if(obedit) ED_object_exit_editmode(C, EM_FREEUNDO|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */ + if(obedit) ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */ WM_operator_name_call(C, "SCULPT_OT_sculptmode_toggle", WM_OP_EXEC_REGION_WIN, NULL); } @@ -3493,7 +3491,7 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event) } } else if (v3d->modeselect == V3D_WEIGHTPAINTMODE_SEL) { - if (!(G.f & G_WEIGHTPAINT) && (ob && ob->type == OB_MESH) ) { + if (ob && ob->type == OB_MESH && !(ob->mode & OB_MODE_WEIGHT_PAINT)) { v3d->flag &= ~V3D_MODE; ED_view3d_exit_paint_modes(C); ED_object_toggle_modes(C, ob->mode); @@ -3702,7 +3700,7 @@ static void view3d_header_pulldowns(const bContext *C, uiBlock *block, Object *o } } - else if (G.f & G_WEIGHTPAINT) { + else if (ob && ob->mode & OB_MODE_WEIGHT_PAINT) { xmax= GetButStringLength("Paint"); uiDefPulldownBut(block, view3d_wpaintmenu, NULL, "Paint", xco,yco, xmax-3, 20, ""); xco+= xmax; @@ -3800,7 +3798,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) if (obedit) v3d->modeselect = V3D_EDITMODE_SEL; else if(ob && (ob->flag & OB_POSEMODE)) v3d->modeselect = V3D_POSEMODE_SEL; else if (ob && (ob->mode & OB_MODE_SCULPT)) v3d->modeselect = V3D_SCULPTMODE_SEL; - else if (G.f & G_WEIGHTPAINT) v3d->modeselect = V3D_WEIGHTPAINTMODE_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(G.f & G_FACESELECT) v3d->modeselect = V3D_FACESELECTMODE_SEL;*/ @@ -3812,7 +3810,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) if(obedit) v3d->flag |= V3D_EDITMODE; if(ob && (ob->flag & OB_POSEMODE)) v3d->flag |= V3D_POSEMODE; if(ob && (ob->mode & OB_MODE_VERTEX_PAINT)) v3d->flag |= V3D_VERTEXPAINT; - if(G.f & G_WEIGHTPAINT) v3d->flag |= V3D_WEIGHTPAINT; + if(ob && (ob->mode & OB_MODE_WEIGHT_PAINT)) v3d->flag |= V3D_WEIGHTPAINT; if (G.f & G_TEXTUREPAINT) v3d->flag |= V3D_TEXTUREPAINT; if(paint_facesel_test(ob)) v3d->flag |= V3D_FACESELECT; @@ -3857,7 +3855,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) uiBlockEndAlign(block); } } else { - if (obedit==NULL && ((ob && ob->mode & OB_MODE_VERTEX_PAINT) || G.f & (G_WEIGHTPAINT|G_TEXTUREPAINT))) { + if (obedit==NULL && ((ob && ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT)) || G.f & G_TEXTUREPAINT)) { 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 a6a42c0ba67..e810ea1f882 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|G_WEIGHTPAINT) || (ob && ob->mode & OB_MODE_VERTEX_PAINT)) + else if(G.f & G_TEXTUREPAINT || (ob && ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT))) ; else if(G.f & G_PARTICLEEDIT) PE_lasso_select(C, mcords, moves, select); @@ -1112,7 +1112,7 @@ static void mouse_select(bContext *C, short *mval, short extend, short obcenter) WM_event_add_notifier(C, NC_OBJECT|ND_BONE_ACTIVE, basact->object); /* in weightpaint, we use selected bone to select vertexgroup, so no switch to new active object */ - if(G.f & G_WEIGHTPAINT) { + if(basact->object->mode & OB_MODE_WEIGHT_PAINT) { /* prevent activating */ basact= NULL; } diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index be677c8523d..eac13245c23 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -5239,7 +5239,7 @@ void createTransData(bContext *C, TransInfo *t) // XXX active-layer checking isn't done as that should probably be checked through context instead createTransPose(C, t, ob); } - else if (G.f & G_WEIGHTPAINT) { + else if (ob && (ob->mode & OB_MODE_WEIGHT_PAINT)) { /* exception, we look for the one selected armature */ CTX_DATA_BEGIN(C, Object*, ob_armature, selected_objects) { diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index be377f6af83..40966380cca 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -358,10 +358,10 @@ int calc_manipulator_stats(const bContext *C) Mat4MulVecfl(ob->obmat, scene->twmax); } } - else if(G.f & (G_TEXTUREPAINT + G_WEIGHTPAINT)) { + else if(G.f & G_TEXTUREPAINT) { ; } - else if(ob && (ob->mode & (OB_MODE_SCULPT|OB_MODE_VERTEX_PAINT))) { + else if(ob && (ob->mode & (OB_MODE_SCULPT|OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_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 6ba67084387..9c142d2c650 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -894,10 +894,10 @@ 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))) + else if(ob && (ob->mode & (OB_MODE_SCULPT|OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT))) { } - else if(G.f & (G_TEXTUREPAINT + G_WEIGHTPAINT)) + else if(G.f & G_TEXTUREPAINT) { } else if(G.f & G_PARTICLEEDIT) diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h index 63037a8efe4..5323514fcc6 100644 --- a/source/blender/makesdna/DNA_object_types.h +++ b/source/blender/makesdna/DNA_object_types.h @@ -515,6 +515,7 @@ extern Object workob; #define OB_MODE_NONE 0 #define OB_MODE_SCULPT 1 #define OB_MODE_VERTEX_PAINT 2 +#define OB_MODE_WEIGHT_PAINT 4 /* ob->softflag in DNA_object_force.h */ |