diff options
author | Ton Roosendaal <ton@blender.org> | 2009-01-02 22:10:35 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2009-01-02 22:10:35 +0300 |
commit | a6721c60d9bc0897e3ce0dc87264fbc705284397 (patch) | |
tree | 12dd77160bcfaa4b37e85a5e8ed29496bb6c0705 /source/blender/editors/util | |
parent | 16ca4b572e07aa0f83158c187a7c64b27675d4c9 (diff) |
2.5
From the anti-globalization department:
G.obedit terminated!
Wherever possible, use CTX_data_edit_object(C) to get this
now. It's stored in scene now, and the screen context has
it defined.
Diffstat (limited to 'source/blender/editors/util')
-rw-r--r-- | source/blender/editors/util/editmode_undo.c | 19 | ||||
-rw-r--r-- | source/blender/editors/util/undo.c | 27 |
2 files changed, 27 insertions, 19 deletions
diff --git a/source/blender/editors/util/editmode_undo.c b/source/blender/editors/util/editmode_undo.c index 2237f403f01..84ecf8e2d38 100644 --- a/source/blender/editors/util/editmode_undo.c +++ b/source/blender/editors/util/editmode_undo.c @@ -122,6 +122,7 @@ void undo_editmode_push(bContext *C, char *name, int (*validate_undo)(void *, void *)) { UndoElem *uel; + Object *obedit= CTX_data_edit_object(C); void *editdata; int nr; uintptr_t memused, totmem, maxmem; @@ -168,9 +169,9 @@ void undo_editmode_push(bContext *C, char *name, editdata= getdata(C); curundo->undodata= curundo->from_editmode(editdata); curundo->undosize= MEM_get_memory_in_use() - memused; - curundo->ob= G.obedit; - curundo->id= G.obedit->id; - curundo->type= G.obedit->type; + curundo->ob= obedit; + curundo->id= obedit->id; + curundo->type= obedit->type; if(U.undomemory != 0) { /* limit to maximum memory (afterwards, we can't know in advance) */ @@ -201,6 +202,7 @@ void undo_editmode_push(bContext *C, char *name, static void undo_clean_stack(bContext *C) { UndoElem *uel, *next; + Object *obedit= CTX_data_edit_object(C); int mixed= 0; /* global undo changes pointers, so we also allow identical names */ @@ -213,8 +215,8 @@ static void undo_clean_stack(bContext *C) next= uel->next; /* for when objects are converted, renamed, or global undo changes pointers... */ - if(uel->type==G.obedit->type) { - if(strcmp(uel->id.name, G.obedit->id.name)==0) { + if(uel->type==obedit->type) { + if(strcmp(uel->id.name, obedit->id.name)==0) { if(uel->validate_undo==NULL) isvalid= 1; else if(uel->validate_undo(uel->undodata, editdata)) @@ -222,7 +224,7 @@ static void undo_clean_stack(bContext *C) } } if(isvalid) - uel->ob= G.obedit; + uel->ob= obedit; else { mixed= 1; uel->freedata(uel->undodata); @@ -265,7 +267,7 @@ void undo_editmode_step(bContext *C, int step) } } -// DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA); +// DAG_object_flush_update(G.scene, obedit, OB_RECALC_DATA); /* XXX notifiers */ } @@ -324,8 +326,9 @@ void undo_editmode_menu(bContext *C) static void do_editmode_undohistorymenu(bContext *C, void *arg, int event) { + Object *obedit= CTX_data_edit_object(C); - if(G.obedit==NULL || event<1) return; + if(obedit==NULL || event<1) return; undo_number(C, event-1); diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c index b7923990101..138050d6b9c 100644 --- a/source/blender/editors/util/undo.c +++ b/source/blender/editors/util/undo.c @@ -82,20 +82,22 @@ static void sound_initialize_sounds() {} void ED_undo_push(bContext *C, char *str) { - if(G.obedit) { + Object *obedit= CTX_data_edit_object(C); + + if(obedit) { if (U.undosteps == 0) return; - if(G.obedit->type==OB_MESH) + if(obedit->type==OB_MESH) undo_push_mesh(C, str); - else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) + else if ELEM(obedit->type, OB_CURVE, OB_SURF) undo_push_curve(str); - else if (G.obedit->type==OB_FONT) + else if (obedit->type==OB_FONT) undo_push_font(str); - else if (G.obedit->type==OB_MBALL) + else if (obedit->type==OB_MBALL) undo_push_mball(str); - else if (G.obedit->type==OB_LATTICE) + else if (obedit->type==OB_LATTICE) undo_push_lattice(str); - else if (G.obedit->type==OB_ARMATURE) + else if (obedit->type==OB_ARMATURE) undo_push_armature(str); } else if(G.f & G_PARTICLEEDIT) { @@ -111,10 +113,11 @@ void ED_undo_push(bContext *C, char *str) static int ed_undo_step(bContext *C, wmOperator *op, int step) { + Object *obedit= CTX_data_edit_object(C); ScrArea *sa= CTX_wm_area(C); - if(G.obedit) { - if ELEM7(G.obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE) + if(obedit) { + if ELEM7(obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE) undo_editmode_step(C, step); } else { @@ -167,8 +170,10 @@ static int ed_redo_exec(bContext *C, wmOperator *op) void ED_undo_menu(bContext *C) { - if(G.obedit) { - //if ELEM7(G.obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE) + Object *obedit= CTX_data_edit_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 { |