diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2009-08-16 06:35:44 +0400 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2009-08-16 06:35:44 +0400 |
commit | 88294d7fa2a590674ec006da7fd9e8bd7a733fc3 (patch) | |
tree | bcec98791b71af0abbbb29a76a86fa3dbe8d7c40 /source/blender/editors | |
parent | b257acfed11e8d98eb7c86e0908acf80fb9e27af (diff) |
2.5/Particle edit:
* Made particle edit object-localized.
Diffstat (limited to 'source/blender/editors')
19 files changed, 48 insertions, 99 deletions
diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index fe723a875a2..af419664ffc 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -135,7 +135,7 @@ void ED_armature_enter_posemode(bContext *C, Base *base) default: return; } - ED_view3d_exit_paint_modes(C); + ED_object_toggle_modes(C, ob->mode); } diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index aecf8976fa1..07aa44cadd8 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -130,9 +130,6 @@ int edge_inside_circle(short centx, short centy, short rad, short x1, short y1, int lasso_inside(short mcords[][2], short moves, short sx, short sy); int lasso_inside_edge(short mcords[][2], short moves, int x0, int y0, int x1, int y1); -/* modes */ -int ED_view3d_exit_paint_modes(struct bContext *C); -void ED_view3d_restore_paint_modes(struct bContext *C, int); /* get 3d region from context, also if mouse is in header or toolbar */ struct RegionView3D *ED_view3d_context_rv3d(struct bContext *C); diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index cdd6e3eaa1a..08a8fab42e9 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -483,7 +483,7 @@ static uiLayout *draw_modifier(uiLayout *layout, Object *ob, ModifierData *md, i if(md->type==eModifierType_ParticleSystem) { ParticleSystem *psys= ((ParticleSystemModifierData *)md)->psys; - if(!(G.f & G_PARTICLEEDIT)) + if(!(ob->mode & OB_MODE_PARTICLE_EDIT)) if(ELEM3(psys->part->ren_as, PART_DRAW_PATH, PART_DRAW_GR, PART_DRAW_OB) && psys->pathcache) uiItemO(row, "Convert", 0, "OBJECT_OT_modifier_convert"); } diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 3be277d1cc4..b849d57cc7d 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -178,10 +178,6 @@ void ED_base_object_activate(bContext *C, Base *base) Scene *scene= CTX_data_scene(C); Base *tbase; - /* activating a non-mesh, should end a couple of modes... */ - if(base && base->object->type!=OB_MESH) - ED_view3d_exit_paint_modes(C); - /* sets scene->basact */ BASACT= base; @@ -273,9 +269,6 @@ static Object *object_add_type(bContext *C, int type) Scene *scene= CTX_data_scene(C); Object *ob; - /* XXX hrms, this is editor level operator, remove? */ - ED_view3d_exit_paint_modes(C); - /* for as long scene has editmode... */ if (CTX_data_edit_object(C)) ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* freedata, and undo */ @@ -752,8 +745,6 @@ static int object_delete_exec(bContext *C, wmOperator *op) if(CTX_data_edit_object(C)) return OPERATOR_CANCELLED; - ED_view3d_exit_paint_modes(C); - CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) { if(base->object->type==OB_LAMP) islamp= 1; @@ -3776,7 +3767,6 @@ void ED_object_enter_editmode(bContext *C, int flag) if(flag & EM_WAITCURSOR) waitcursor(1); ob->restore_mode = ob->mode; - ED_view3d_exit_paint_modes(C); ED_object_toggle_modes(C, ob->mode); if(ob->type==OB_MESH) { @@ -4188,7 +4178,7 @@ void special_editmenu(Scene *scene, View3D *v3d) // XXX pose_adds_vgroups(ob, (nr == 2)); } } - else if(G.f & G_PARTICLEEDIT) { + else if(ob->mode & OB_MODE_PARTICLE_EDIT) { #if 0 // XXX ParticleSystem *psys = PE_get_current(ob); @@ -7048,4 +7038,6 @@ void ED_object_toggle_modes(bContext *C, int mode) 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); + if(mode & OB_MODE_PARTICLE_EDIT) + WM_operator_name_call(C, "PARTICLE_OT_particle_edit_toggle", WM_OP_EXEC_REGION_WIN, NULL); } diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 1742e1d1279..9983e24f2c9 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -226,7 +226,7 @@ int ED_object_modifier_convert(ReportList *reports, Scene *scene, Object *ob, Mo int totpart=0, totchild=0; if(md->type != eModifierType_ParticleSystem) return 0; - if(G.f & G_PARTICLEEDIT) return 0; + if(ob && ob->mode & OB_MODE_PARTICLE_EDIT) return 0; psys=((ParticleSystemModifierData *)md)->psys; part= psys->part; diff --git a/source/blender/editors/physics/editparticle.c b/source/blender/editors/physics/editparticle.c index 20033c747f9..83bf12d651e 100644 --- a/source/blender/editors/physics/editparticle.c +++ b/source/blender/editors/physics/editparticle.c @@ -104,21 +104,12 @@ static int PE_poll(bContext *C) psys= PE_get_current(scene, ob); - return (psys && psys->edit && (G.f & G_PARTICLEEDIT)); + return (psys && psys->edit && (ob && ob->mode & OB_MODE_PARTICLE_EDIT)); } static int PE_poll_3dview(bContext *C) { - Scene *scene= CTX_data_scene(C); - Object *ob= CTX_data_active_object(C); - ParticleSystem *psys; - - if(!scene || !ob || !CTX_wm_region_view3d(C)) - return 0; - - psys= PE_get_current(scene, ob); - - return (psys && psys->edit && (G.f & G_PARTICLEEDIT)); + return PE_poll(C) && CTX_wm_region_view3d(C); } static void PE_free_particle_edit(ParticleSystem *psys) @@ -164,7 +155,7 @@ static void PE_free_particle_edit(ParticleSystem *psys) int PE_can_edit(ParticleSystem *psys) { - return (psys && psys->edit && (G.f & G_PARTICLEEDIT)); + return (psys && psys->edit); } ParticleEditSettings *PE_settings(Scene *scene) @@ -194,7 +185,7 @@ ParticleSystem *PE_get_current(Scene *scene, Object *ob) /* this happens when Blender is started with particle * edit mode enabled XXX there's a draw error then? */ - if(psys && psys_check_enabled(ob, psys) && (ob == OBACT) && (G.f & G_PARTICLEEDIT)) + if(psys && psys_check_enabled(ob, psys) && (ob == OBACT) && (ob->mode & OB_MODE_PARTICLE_EDIT)) if(psys->part->type == PART_HAIR && psys->flag & PSYS_EDITED) if(psys->edit == NULL) PE_create_particle_edit(scene, ob, psys); @@ -3710,7 +3701,7 @@ static int particle_edit_toggle_exec(bContext *C, wmOperator *op) psys->flag |= PSYS_CURRENT; } - if(!(G.f & G_PARTICLEEDIT)) { + if(!(ob->mode & OB_MODE_PARTICLE_EDIT)) { if(psys && psys->part->type == PART_HAIR && psys->flag & PSYS_EDITED) { if(psys_check_enabled(ob, psys)) { if(psys->edit==NULL) @@ -3720,12 +3711,12 @@ static int particle_edit_toggle_exec(bContext *C, wmOperator *op) } } - G.f |= G_PARTICLEEDIT; + ob->mode |= OB_MODE_PARTICLE_EDIT; toggle_particle_cursor(C, 1); WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_PARTICLE, NULL); } else { - G.f &= ~G_PARTICLEEDIT; + ob->mode &= ~OB_MODE_PARTICLE_EDIT; toggle_particle_cursor(C, 0); WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, NULL); } @@ -3773,7 +3764,7 @@ static int set_editable_exec(bContext *C, wmOperator *op) if(psys_check_enabled(ob, psys)) { psys->flag |= PSYS_EDITED; - if(G.f & G_PARTICLEEDIT) + if(ob->mode & OB_MODE_PARTICLE_EDIT) PE_create_particle_edit(scene, ob, psys); } else @@ -3814,7 +3805,7 @@ void PE_change_act(void *ob_v, void *act_v) psys->flag |= PSYS_CURRENT; if(psys_check_enabled(ob, psys)) { - if(G.f & G_PARTICLEEDIT && !psys->edit) + if(ob->mode & OB_MODE_PARTICLE_EDIT && !psys->edit) PE_create_particle_edit(scene, ob, psys); psys_update_world_cos(ob, psys); } @@ -3832,7 +3823,7 @@ void PE_change_act_psys(Scene *scene, Object *ob, ParticleSystem *psys) psys->flag |= PSYS_CURRENT; if(psys_check_enabled(ob, psys)) { - if(G.f & G_PARTICLEEDIT && !psys->edit) + if(ob->mode & OB_MODE_PARTICLE_EDIT && !psys->edit) PE_create_particle_edit(scene, ob, psys); psys_update_world_cos(ob, psys); diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c index 1d6235eec18..1e36a32b9e1 100644 --- a/source/blender/editors/screen/screen_context.c +++ b/source/blender/editors/screen/screen_context.c @@ -140,8 +140,8 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult return 1; } else if(CTX_data_equals(member, "particle_edit_object")) { - if(G.f & G_PARTICLEEDIT && scene->basact) - CTX_data_id_pointer_set(result, &scene->basact->object->id); + if(ob && (ob->mode & OB_MODE_PARTICLE_EDIT)) + CTX_data_id_pointer_set(result, &ob->id); return 1; } diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c index 3c2e36cc20a..de4d6f90bcd 100644 --- a/source/blender/editors/space_outliner/outliner.c +++ b/source/blender/editors/space_outliner/outliner.c @@ -3061,10 +3061,6 @@ static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeSto if(scene->obedit==base->object) ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); - if(base==BASACT) { - ED_view3d_exit_paint_modes(C); - } - ED_base_object_free_and_unlink(scene, base); te->directdata= NULL; tselem->id= NULL; diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 8670ff50cc3..3b1a689872a 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -4927,7 +4927,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) /* xray delay? */ if((flag & DRAW_PICKING)==0 && (base->flag & OB_FROMDUPLI)==0) { /* don't do xray in particle mode, need the z-buffer */ - if(!(G.f & G_PARTICLEEDIT)) { + if(!(ob->mode & OB_MODE_PARTICLE_EDIT)) { /* xray and transp are set when it is drawing the 2nd/3rd pass */ if(!v3d->xray && !v3d->transp && (ob->dtx & OB_DRAWXRAY) && !(ob->dtx & OB_DRAWTRANSP)) { add_view3d_after(v3d, base, V3D_XRAY, flag); @@ -5286,7 +5286,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) for(psys=ob->particlesystem.first; psys; psys=psys->next) draw_new_particle_system(scene, v3d, rv3d, base, psys, dt); - if(G.f & G_PARTICLEEDIT && ob==OBACT) { + if(ob->mode & OB_MODE_PARTICLE_EDIT && ob==OBACT) { psys= PE_get_current(scene, ob); if(psys && !scene->obedit && psys_in_edit_mode(scene, psys)) draw_particle_edit(scene, v3d, rv3d, ob, psys, dt); diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 770c66ba752..cecb99eb72b 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -1064,7 +1064,7 @@ static void view3d_panel_object(const bContext *C, Panel *pa) //bt= uiDefBut(block, TEX, B_IDNAME, "OB: ", 10,180,140,20, ob->id.name+2, 0.0, 21.0, 0, 0, ""); //uiButSetFunc(bt, test_idbutton_cb, ob->id.name, NULL); - if((G.f & G_PARTICLEEDIT)==0) { + if((ob->mode & OB_MODE_PARTICLE_EDIT)==0) { // uiBlockBeginAlign(block); // uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_OBJECTPANELPARENT, "Par:", 160, 180, 140, 20, &ob->parent, "Parent Object"); if((ob->parent) && (ob->partype == PARBONE)) { diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 03cf81c71bb..a084adce1bf 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1107,7 +1107,7 @@ void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d) paint_facesel_test(base->object))); 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((base && (base->object->mode & OB_MODE_PARTICLE_EDIT)) && v3d->drawtype>OB_WIRE && (v3d->flag & V3D_ZBUF_SELECT)); else if(scene->obedit && v3d->drawtype>OB_WIRE && (v3d->flag & V3D_ZBUF_SELECT)); else { v3d->flag &= ~V3D_NEEDBACKBUFDRAW; @@ -2035,7 +2035,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) } // retopo= retopo_mesh_check() || retopo_curve_check(); - sculptparticle= (G.f & G_PARTICLEEDIT || (obact && obact->mode & OB_MODE_SCULPT)) && !scene->obedit; + sculptparticle= (obact && obact->mode & (OB_MODE_SCULPT|OB_MODE_PARTICLE_EDIT)) && !scene->obedit; if(retopo) view3d_update_depths(ar, v3d); @@ -2128,7 +2128,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) // XXX addafterqueue(ar->win, BACKBUFDRAW, 1); } - if((G.f & G_PARTICLEEDIT) && v3d->drawtype>OB_WIRE && (v3d->flag & V3D_ZBUF_SELECT)) { + if((ob && ob->mode & OB_MODE_PARTICLE_EDIT) && v3d->drawtype>OB_WIRE && (v3d->flag & V3D_ZBUF_SELECT)) { 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 f4b15647459..ec8cc22074d 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -994,7 +994,7 @@ static int viewcenter_exec(bContext *C, wmOperator *op) /* like a localview with else if (paint_facesel_test(ob)) { // XXX ok= minmax_tface(min, max); } - else if (G.f & G_PARTICLEEDIT) { + else if (ob && (ob->mode & OB_MODE_PARTICLE_EDIT)) { ok= PE_minmax(scene, min, max); } else { diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index 86082018834..76257bba45e 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -135,29 +135,6 @@ static int retopo_mesh_paint_check() {return 0;} /* end XXX ************* */ -static void ED_toggle_paint_modes(bContext *C, int mode) -{ - if(mode & G_PARTICLEEDIT) - WM_operator_name_call(C, "PARTICLE_OT_particle_edit_toggle", WM_OP_EXEC_REGION_WIN, NULL); -} - -/* well... in this file a lot of view mode manipulation happens, so let's have it defined here */ -int ED_view3d_exit_paint_modes(bContext *C) -{ - int restore = G.f; - - ED_toggle_paint_modes(C, G.f); - - G.f &= ~G_PARTICLEEDIT; - - return restore; -} - -void ED_view3d_restore_paint_modes(struct bContext *C, int mode) -{ - ED_toggle_paint_modes(C, mode); -} - static void do_view3d_header_buttons(bContext *C, void *arg, int event); #define B_SCENELOCK 101 @@ -3340,7 +3317,6 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event) if (v3d->modeselect == V3D_OBJECTMODE_SEL) { v3d->flag &= ~V3D_MODE; - ED_view3d_exit_paint_modes(C); ED_object_toggle_modes(C, ob->mode); ED_armature_exit_posemode(C, basact); if(obedit) @@ -3356,7 +3332,6 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event) else if (v3d->modeselect == V3D_SCULPTMODE_SEL) { if (ob && !(ob->mode & OB_MODE_SCULPT)) { 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_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */ @@ -3366,7 +3341,6 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event) else if (v3d->modeselect == V3D_VERTEXPAINTMODE_SEL) { if (ob && !(ob->mode & OB_MODE_VERTEX_PAINT)) { 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_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */ @@ -3376,7 +3350,6 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event) else if (v3d->modeselect == V3D_TEXTUREPAINTMODE_SEL) { 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); if(obedit) ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */ @@ -3386,7 +3359,6 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event) else if (v3d->modeselect == V3D_WEIGHTPAINTMODE_SEL) { 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); if(obedit) ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */ @@ -3405,9 +3377,8 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event) } } else if(v3d->modeselect == V3D_PARTICLEEDITMODE_SEL){ - if (!(G.f & G_PARTICLEEDIT)) { + if (ob && !(ob->mode & OB_MODE_PARTICLE_EDIT)) { 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_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */ @@ -3620,7 +3591,7 @@ static void view3d_header_pulldowns(const bContext *C, uiBlock *block, Object *o xco+= xmax; } } - else if(G.f & G_PARTICLEEDIT) { + else if(ob && ob->mode & OB_MODE_PARTICLE_EDIT) { xmax= GetButStringLength("Particle"); uiDefMenuBut(block, view3d_particlemenu, NULL, "Particle", xco,yco, xmax-3, 20, ""); xco+= xmax; @@ -3690,7 +3661,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) else if (ob && (ob->mode & OB_MODE_VERTEX_PAINT)) v3d->modeselect = V3D_VERTEXPAINTMODE_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; + else if(ob && (ob->mode & OB_MODE_PARTICLE_EDIT)) v3d->modeselect = V3D_PARTICLEEDITMODE_SEL; v3d->flag &= ~V3D_MODE; @@ -3830,7 +3801,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) } /* proportional falloff */ - if((obedit && (obedit->type == OB_MESH || obedit->type == OB_CURVE || obedit->type == OB_SURF || obedit->type == OB_LATTICE)) || G.f & G_PARTICLEEDIT) { + if((obedit && (obedit->type == OB_MESH || obedit->type == OB_CURVE || obedit->type == OB_SURF || obedit->type == OB_LATTICE)) || (ob && ob->mode & OB_MODE_PARTICLE_EDIT)) { uiBlockBeginAlign(block); uiDefIconTextButS(block, ICONTEXTROW,B_REDR, ICON_PROP_OFF, "Proportional %t|Off %x0|On %x1|Connected %x2", xco,yco,XIC+10,YIC, &(ts->proportional), 0, 1.0, 0, 0, "Proportional Edit Falloff (Hotkeys: O, Alt O) "); @@ -3891,7 +3862,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) BKE_mesh_end_editmesh(obedit->data, em); } - else if(G.f & G_PARTICLEEDIT) { + else if(ob && ob->mode & OB_MODE_PARTICLE_EDIT) { uiBlockBeginAlign(block); uiDefIconButBitI(block, TOG, SCE_SELECT_PATH, B_SEL_PATH, ICON_EDGESEL, xco,yco,XIC,YIC, &ts->particle.selectmode, 1.0, 0.0, 0, 0, "Path edit mode"); xco+= XIC; diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 3c881972c32..f35fceebd6d 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -701,7 +701,7 @@ void view3d_lasso_select(bContext *C, ViewContext *vc, short mcords[][2], short do_lasso_select_facemode(vc, mcords, moves, select); else if(ob && ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT)) ; - else if(G.f & G_PARTICLEEDIT) + else if(ob && ob->mode & OB_MODE_PARTICLE_EDIT) PE_lasso_select(C, mcords, moves, select); else do_lasso_select_objects(vc, mcords, moves, select); @@ -1326,6 +1326,7 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op) ScrArea *sa= CTX_wm_area(C); View3D *v3d= sa->spacedata.first; Object *obedit= CTX_data_edit_object(C); + Object *obact= CTX_data_active_object(C); rcti rect; Base *base; MetaElem *ml; @@ -1348,7 +1349,7 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op) // XXX face_borderselect(); return OPERATOR_FINISHED; } - else if(obedit==NULL && (G.f & G_PARTICLEEDIT)) { + else if(obedit==NULL && (obact && obact->mode & OB_MODE_PARTICLE_EDIT)) { return PE_border_select(C, &rect, (val==LEFTMOUSE)); } @@ -1561,6 +1562,7 @@ void VIEW3D_OT_select_border(wmOperatorType *ot) static int view3d_select_invoke(bContext *C, wmOperator *op, wmEvent *event) { Object *obedit= CTX_data_edit_object(C); + Object *obact= CTX_data_active_object(C); short extend= RNA_boolean_get(op->ptr, "extend"); view3d_operator_needs_opengl(C); @@ -1578,7 +1580,7 @@ static int view3d_select_invoke(bContext *C, wmOperator *op, wmEvent *event) mouse_mball(C, event->mval, extend); } - else if(G.f & G_PARTICLEEDIT) + else if(obact && obact->mode & OB_MODE_PARTICLE_EDIT) PE_mouse_particles(C, event->mval, extend); else mouse_select(C, event->mval, extend, 0); @@ -1781,12 +1783,13 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op) ScrArea *sa= CTX_wm_area(C); ARegion *ar= CTX_wm_region(C); Scene *scene= CTX_data_scene(C); + Object *obact= CTX_data_active_object(C); View3D *v3d= sa->spacedata.first; int x= RNA_int_get(op->ptr, "x"); int y= RNA_int_get(op->ptr, "y"); int radius= RNA_int_get(op->ptr, "radius"); - if(CTX_data_edit_object(C) || (G.f & G_PARTICLEEDIT)) { + if(CTX_data_edit_object(C) || (obact && obact->mode & OB_MODE_PARTICLE_EDIT)) { ViewContext vc; short mval[2], selecting; diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index eac13245c23..a8e769cc0d0 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -4898,7 +4898,7 @@ void special_aftertrans_update(TransInfo *t) // allqueue(REDRAWBUTSEDIT, 0); } - else if(G.f & G_PARTICLEEDIT) { + else if(t->scene->basact && (ob = t->scene->basact->object) && ob->mode & OB_MODE_PARTICLE_EDIT) { ; } else { @@ -5254,7 +5254,7 @@ void createTransData(bContext *C, TransInfo *t) } CTX_DATA_END; } - else if (G.f & G_PARTICLEEDIT && PE_can_edit(PE_get_current(scene, ob))) { + else if (ob && (ob->mode & OB_MODE_PARTICLE_EDIT) && PE_can_edit(PE_get_current(scene, ob))) { createTransParticleVerts(C, t); if(t->data && t->flag & T_PROP_EDIT) { diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index d0365e6f92a..168a65a2e75 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -343,11 +343,11 @@ static void animrecord_check_state (Scene *scene, ID *id, wmTimer *animtimer) void recalcData(TransInfo *t) { Scene *scene = t->scene; - Base *base; + Base *base = scene->basact; if (t->obedit) { } - else if(G.f & G_PARTICLEEDIT) { + else if(base && base->object->mode & OB_MODE_PARTICLE_EDIT) { flushTransParticles(t); } if (t->spacetype==SPACE_NODE) { diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index 07ca42ef448..2a8c88720d5 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -361,7 +361,7 @@ int calc_manipulator_stats(const bContext *C) 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) { + else if(ob && ob->mode & OB_MODE_PARTICLE_EDIT) { ParticleSystem *psys= PE_get_current(scene, ob); ParticleData *pa = psys->particles; ParticleEditKey *ek; diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 661d9ead799..1cfbac88731 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|OB_MODE_TEXTURE_PAINT))) - { - } - else if(G.f & G_PARTICLEEDIT) + else if(ob && (ob->mode & (OB_MODE_SCULPT|OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT|OB_MODE_PARTICLE_EDIT))) { } else { diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c index 1b5f61e77e2..18159414cf6 100644 --- a/source/blender/editors/util/undo.c +++ b/source/blender/editors/util/undo.c @@ -79,6 +79,7 @@ void ED_undo_push(bContext *C, char *str) { wmWindowManager *wm= CTX_wm_manager(C); Object *obedit= CTX_data_edit_object(C); + Object *obact= CTX_data_active_object(C); if(obedit) { if (U.undosteps == 0) return; @@ -96,7 +97,7 @@ void ED_undo_push(bContext *C, char *str) else if (obedit->type==OB_ARMATURE) undo_push_armature(C, str); } - else if(G.f & G_PARTICLEEDIT) { + else if(obact && obact->mode & OB_MODE_PARTICLE_EDIT) { if (U.undosteps == 0) return; PE_undo_push(CTX_data_scene(C), str); @@ -145,7 +146,7 @@ static int ed_undo_step(bContext *C, int step, const char *undoname) if(obact && obact->mode & OB_MODE_TEXTURE_PAINT) undo_imagepaint_step(step); - else if(G.f & G_PARTICLEEDIT) { + else if(obact && obact->mode & OB_MODE_PARTICLE_EDIT) { if(step==1) PE_undo(CTX_data_scene(C)); else @@ -210,13 +211,14 @@ static int ed_redo_exec(bContext *C, wmOperator *op) void ED_undo_menu(bContext *C) { Object *obedit= CTX_data_edit_object(C); + Object *obact= CTX_data_active_object(C); if(obedit) { //if ELEM7(obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE) // undo_editmode_menu(); } else { - if(G.f & G_PARTICLEEDIT) + if(obact && obact->mode & OB_MODE_PARTICLE_EDIT) PE_undo_menu(CTX_data_scene(C), CTX_data_active_object(C)); else if(U.uiflag & USER_GLOBALUNDO) { char *menu= BKE_undo_menu_string(); |