2.5/Particle edit:
* Made particle edit object-localized.
This commit is contained in:
@@ -118,8 +118,6 @@ typedef struct Global {
|
||||
/* #define G_NOFROZEN (1 << 17) also removed */
|
||||
#define G_GREASEPENCIL (1 << 17)
|
||||
|
||||
#define G_PARTICLEEDIT (1 << 30)
|
||||
|
||||
/* #define G_AUTOMATKEYS (1 << 30) also removed */
|
||||
#define G_HIDDENHANDLES (1 << 31) /* used for curves only */
|
||||
|
||||
|
||||
@@ -2077,7 +2077,7 @@ static void clear_mesh_caches(Object *ob)
|
||||
static void mesh_build_data(Scene *scene, Object *ob, CustomDataMask dataMask)
|
||||
{
|
||||
Object *obact = scene->basact?scene->basact->object:NULL;
|
||||
int editing = paint_facesel_test(ob)|(G.f & G_PARTICLEEDIT);
|
||||
int editing = paint_facesel_test(ob)|(ob && ob->mode & OB_MODE_PARTICLE_EDIT);
|
||||
int needMapping = editing && (ob==obact);
|
||||
float min[3], max[3];
|
||||
|
||||
|
||||
@@ -226,7 +226,7 @@ static void clear_global(void)
|
||||
|
||||
G.main= NULL;
|
||||
|
||||
G.f &= ~(G_FACESELECT + G_PARTICLEEDIT);
|
||||
G.f &= ~(G_FACESELECT);
|
||||
}
|
||||
|
||||
/* make sure path names are correct for OS */
|
||||
|
||||
@@ -692,8 +692,8 @@ char *CTX_data_mode_string(const bContext *C)
|
||||
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(ob->mode & OB_MODE_PARTICLE_EDIT) return "particlemode";
|
||||
}
|
||||
else if(G.f & G_PARTICLEEDIT) return "particlemode";
|
||||
}
|
||||
|
||||
return "objectmode";
|
||||
|
||||
@@ -321,7 +321,7 @@ int psys_ob_has_hair(Object *ob)
|
||||
}
|
||||
int psys_in_edit_mode(Scene *scene, ParticleSystem *psys)
|
||||
{
|
||||
return ((G.f & G_PARTICLEEDIT) && psys==psys_get_current((scene->basact)->object) && psys->edit);
|
||||
return ((scene->basact->object->mode & OB_MODE_PARTICLE_EDIT) && psys==psys_get_current((scene->basact)->object) && psys->edit);
|
||||
}
|
||||
int psys_check_enabled(Object *ob, ParticleSystem *psys)
|
||||
{
|
||||
@@ -431,9 +431,6 @@ void psys_free(Object *ob, ParticleSystem * psys)
|
||||
int nr = 0;
|
||||
ParticleSystem * tpsys;
|
||||
|
||||
if(ob->particlesystem.first == NULL && G.f & G_PARTICLEEDIT)
|
||||
G.f &= ~G_PARTICLEEDIT;
|
||||
|
||||
psys_free_path_cache(psys);
|
||||
|
||||
free_hair(psys, 1);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -512,11 +512,12 @@ extern Object workob;
|
||||
#define OB_LOCK_SCALE 448
|
||||
|
||||
/* ob->mode */
|
||||
#define OB_MODE_NONE 0
|
||||
#define OB_MODE_SCULPT 1
|
||||
#define OB_MODE_VERTEX_PAINT 2
|
||||
#define OB_MODE_WEIGHT_PAINT 4
|
||||
#define OB_MODE_TEXTURE_PAINT 8
|
||||
#define OB_MODE_NONE 0
|
||||
#define OB_MODE_SCULPT 1
|
||||
#define OB_MODE_VERTEX_PAINT 2
|
||||
#define OB_MODE_WEIGHT_PAINT 4
|
||||
#define OB_MODE_TEXTURE_PAINT 8
|
||||
#define OB_MODE_PARTICLE_EDIT 16
|
||||
|
||||
/* ob->softflag in DNA_object_force.h */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user