Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Poirier <theeth@yahoo.com>2009-01-01 01:43:29 +0300
committerMartin Poirier <theeth@yahoo.com>2009-01-01 01:43:29 +0300
commitea42e70cb98713571704b2a48fd88cffc7bcbfb8 (patch)
tree604435a38fe2838c9cb55c273c05f29d616e81ce /source/blender/editors
parent471fc0947987660ff500964f453a244593b62e52 (diff)
2.5
- Transform for editmesh (including PET and editmesh snap) X-Mirror doesn't seem to work, but the option isn't accessible in the UI, so... - Replacing G.obedit with obedit from context in view3d_header (other files will have to be done too, I just happened to stumble on that one while fixing other things).
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/include/BIF_transform.h3
-rw-r--r--source/blender/editors/include/ED_mesh.h1
-rw-r--r--source/blender/editors/mesh/editmesh.c3
-rw-r--r--source/blender/editors/mesh/editmesh.h1
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c104
-rw-r--r--source/blender/editors/transform/transform.h4
-rw-r--r--source/blender/editors/transform/transform_conversions.c86
-rw-r--r--source/blender/editors/transform/transform_generics.c5
-rw-r--r--source/blender/editors/transform/transform_snap.c50
9 files changed, 131 insertions, 126 deletions
diff --git a/source/blender/editors/include/BIF_transform.h b/source/blender/editors/include/BIF_transform.h
index ca8488e1b63..26b91cedd3b 100644
--- a/source/blender/editors/include/BIF_transform.h
+++ b/source/blender/editors/include/BIF_transform.h
@@ -36,6 +36,7 @@ struct wmWindowManager;
struct ListBase;
struct wmEvent;
struct bContext;
+struct Object;
void transform_keymap_for_space(struct wmWindowManager *wm, struct ListBase *keymap, int spaceid);
void transform_operatortypes(void);
@@ -99,7 +100,7 @@ void BIF_setDualAxisConstraint(float vec1[3], float vec2[3], char *text);
void BIF_setLocalAxisConstraint(char axis, char *text);
void BIF_setLocalLockConstraint(char axis, char *text);
-int BIF_snappingSupported(void);
+int BIF_snappingSupported(struct Object *obedit);
struct TransformOrientation;
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h
index 0f9a6c383da..7a042aa286d 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -68,6 +68,7 @@ typedef struct ViewContext {
/* meshtools.c */
intptr_t mesh_octree_table(Object *ob, EditMesh *em, float *co, char mode);
+EditVert *editmesh_get_x_mirror_vert(Object *ob, EditMesh *em, float *co);
/* editmesh.c */
void make_editMesh(Scene *scene, Object *ob);
diff --git a/source/blender/editors/mesh/editmesh.c b/source/blender/editors/mesh/editmesh.c
index af7801bc95c..d3be73fed0c 100644
--- a/source/blender/editors/mesh/editmesh.c
+++ b/source/blender/editors/mesh/editmesh.c
@@ -1855,6 +1855,9 @@ static void free_undoMesh(void *umv)
{
UndoMesh *um= umv;
+ if (um == NULL)
+ return; /* XXX FIX ME, THIS SHOULD NEVER BE TRUE YET IT HAPPENS DURING TRANSFORM */
+
if(um->verts) MEM_freeN(um->verts);
if(um->edges) MEM_freeN(um->edges);
if(um->faces) MEM_freeN(um->faces);
diff --git a/source/blender/editors/mesh/editmesh.h b/source/blender/editors/mesh/editmesh.h
index 58c60e48089..67badd3f462 100644
--- a/source/blender/editors/mesh/editmesh.h
+++ b/source/blender/editors/mesh/editmesh.h
@@ -46,7 +46,6 @@ int edgetag_shortest_path(Scene *scene, EditMesh *em, EditEdge *source, EditEdge
/* ******************* meshtools.c */
-EditVert *editmesh_get_x_mirror_vert(Object *ob, EditMesh *em, float *co);
int mesh_get_x_mirror_vert(Object *ob, int index);
/* XXX move to uv editor? */
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index 040913d8e6f..27881ee627f 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -106,8 +106,8 @@
#define V3D_POSEMODE_SEL ICON_POSE_HLT
#define V3D_PARTICLEEDITMODE_SEL ICON_ANIM
-#define TEST_EDITMESH if(G.obedit==0) return; \
- if( (v3d->lay & G.obedit->lay)==0 ) return;
+#define TEST_EDITMESH if(obedit==0) return; \
+ if( (v3d->lay & obedit->lay)==0 ) return;
/* XXX port over */
static void handle_view3d_lock(void) {}
@@ -120,7 +120,6 @@ static void add_blockhandler(void *x, int y, int z) {}
static void toggle_blockhandler(void *x, int y, int z) {}
static void countall(void) {}
extern void borderselect();
-static int BIF_snappingSupported() {return 1;}
static int retopo_mesh_paint_check() {return 0;}
/* view3d handler codes */
@@ -401,6 +400,7 @@ static void do_view3d_view_alignviewmenu(bContext *C, void *arg, int event)
Scene *scene= CTX_data_scene(C);
ScrArea *sa= CTX_wm_area(C);
View3D *v3d= sa->spacedata.first;
+ Object *obedit = CTX_data_edit_object(C);
float *curs;
switch(event) {
@@ -408,7 +408,7 @@ static void do_view3d_view_alignviewmenu(bContext *C, void *arg, int event)
case 0: /* Align View to Selected (edit/faceselect mode) */
case 1:
case 2:
- if ((G.obedit) && (G.obedit->type == OB_MESH)) {
+ if ((obedit) && (obedit->type == OB_MESH)) {
editmesh_align_view_to_selected(v3d, event + 1);
}
else if (FACESEL_PAINT_TEST) {
@@ -454,6 +454,7 @@ static uiBlock *view3d_view_alignviewmenu(bContext *C, uiMenuBlockHandle *handle
{
/* static short tog=0; */
uiBlock *block;
+ Object *obedit = CTX_data_edit_object(C);
short yco= 0, menuwidth=120;
block= uiBeginBlock(C, handle->region, "view3d_view_alignviewmenu", UI_EMBOSSP, UI_HELV);
@@ -463,7 +464,7 @@ static uiBlock *view3d_view_alignviewmenu(bContext *C, uiMenuBlockHandle *handle
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Center Cursor and View All|Shift C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Align Active Camera to View|Ctrl Alt NumPad 0", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
- if (((G.obedit) && (G.obedit->type == OB_MESH)) || (FACESEL_PAINT_TEST)) {
+ if (((obedit) && (obedit->type == OB_MESH)) || (FACESEL_PAINT_TEST)) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Align View to Selected (Top)|Shift V", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Align View to Selected (Front)|Shift V", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Align View to Selected (Side)|Shift V", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
@@ -1797,8 +1798,8 @@ static void do_view3d_transformmenu(bContext *C, void *arg, int event)
Transform();
break;
case 9:
- if (G.obedit) {
- if (G.obedit->type == OB_MESH)
+ if (obedit) {
+ if (obedit->type == OB_MESH)
initTransform(TFM_SHRINKFATTEN, CTX_NONE);
Transform();
} else error("Only meshes can be shrinked/fattened");
@@ -1849,6 +1850,7 @@ static void do_view3d_transformmenu(bContext *C, void *arg, int event)
static uiBlock *view3d_transformmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
{
Scene *scene= CTX_data_scene(C);
+ Object *obedit = CTX_data_edit_object(C);
uiBlock *block;
short yco = 20, menuwidth = 120;
@@ -1866,21 +1868,21 @@ static uiBlock *view3d_transformmenu(bContext *C, uiMenuBlockHandle *handle, voi
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- if (G.obedit) {
- if (G.obedit->type == OB_MESH)
+ if (obedit) {
+ if (obedit->type == OB_MESH)
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Shrink/Fatten Along Normals|Alt S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
- else if (G.obedit->type == OB_CURVE) {
+ else if (obedit->type == OB_CURVE) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Tilt|T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 13, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Shrink/Fatten Radius|Alt S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 14, "");
}
}
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "To Sphere|Ctrl Shift S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
- if (G.obedit) uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Shear|Ctrl S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
+ if (obedit) uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Shear|Ctrl S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
else uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Shear|Ctrl Shift Alt S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Warp|Shift W", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Push/Pull|Shift P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, "");
- if (!G.obedit) {
+ if (!obedit) {
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Scale to Image Aspect Ratio|Alt V", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
@@ -1889,13 +1891,13 @@ static uiBlock *view3d_transformmenu(bContext *C, uiMenuBlockHandle *handle, voi
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "ObData to Center", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, "");
- if (!G.obedit) {
+ if (!obedit) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Center New", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Center Cursor", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Align to Transform Orientation|Ctrl Alt A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 21, "");
}
- if (BIF_snappingSupported())
+ if (BIF_snappingSupported(obedit))
{
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
@@ -2665,7 +2667,7 @@ void do_view3d_edit_mesh_verticesmenu(bContext *C, void *arg, int event)
count= removedoublesflag(1, 0, scene->toolsettings->doublimit);
notice("Removed: %d", count);
if (count) { /* only undo and redraw if an action is taken */
- DAG_object_flush_update(scene, G.obedit, OB_RECALC_DATA);
+ DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
ED_undo_push(C, "Rem Doubles");
}
break;
@@ -2680,7 +2682,7 @@ void do_view3d_edit_mesh_verticesmenu(bContext *C, void *arg, int event)
break;
case 5: /*merge */
mergemenu();
- DAG_object_flush_update(scene, G.obedit, OB_RECALC_DATA);
+ DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
break;
case 6: /* add hook */
add_hook_menu();
@@ -2784,7 +2786,7 @@ void do_view3d_edit_mesh_edgesmenu(bContext *C, void *arg, int event)
if(EdgeLoopDelete()) {
countall();
ED_undo_push(C, "Erase Edge Loop");
- DAG_object_flush_update(scene, G.obedit, OB_RECALC_DATA);
+ DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
}
break;
case 14: /*Collapse Edges*/
@@ -2794,12 +2796,12 @@ void do_view3d_edit_mesh_edgesmenu(bContext *C, void *arg, int event)
case 15:
editmesh_mark_sharp(1);
ED_undo_push(C, "Mark Sharp");
- DAG_object_flush_update(scene, G.obedit, OB_RECALC_DATA);
+ DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
break;
case 16:
editmesh_mark_sharp(0);
ED_undo_push(C, "Clear Sharp");
- DAG_object_flush_update(scene, G.obedit, OB_RECALC_DATA);
+ DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
break;
case 17: /* Adjust Bevel Weight */
if(!multires_level1_test()) {
@@ -2880,7 +2882,7 @@ void do_view3d_edit_mesh_facesmenu(bContext *C, void *arg, int event)
convert_to_triface(0);
allqueue(REDRAWVIEW3D, 0);
countall();
- DAG_object_flush_update(scene, G.obedit, OB_RECALC_DATA);
+ DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
break;
case 3: /* Tris to Quads */
join_triangles();
@@ -3178,6 +3180,7 @@ static void do_view3d_edit_meshmenu(bContext *C, void *arg, int event)
static uiBlock *view3d_edit_meshmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
{
Scene *scene= CTX_data_scene(C);
+ Object *obedit = CTX_data_edit_object(C);
uiBlock *block;
short yco= 0, menuwidth=120;
@@ -3234,7 +3237,7 @@ static uiBlock *view3d_edit_meshmenu(bContext *C, uiMenuBlockHandle *handle, voi
/* PITA but we should let users know that automerge cant work with multires :/ */
uiDefIconTextBut(block, BUTM, 1,
scene->automerge ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT,
- ((Mesh*)G.obedit->data)->mr ? "AutoMerge Editing (disabled by multires)" : "AutoMerge Editing",
+ ((Mesh*)obedit->data)->mr ? "AutoMerge Editing (disabled by multires)" : "AutoMerge Editing",
0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 13, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
@@ -3273,15 +3276,15 @@ static void do_view3d_edit_curve_controlpointsmenu(bContext *C, void *arg, int e
break;
case 2: /* Free */
sethandlesNurb(3);
- DAG_object_flush_update(scene, G.obedit, OB_RECALC_DATA);
+ DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
break;
case 3: /* vector */
sethandlesNurb(2);
- DAG_object_flush_update(scene, G.obedit, OB_RECALC_DATA);
+ DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
break;
case 4: /* smooth */
sethandlesNurb(1);
- DAG_object_flush_update(scene, G.obedit, OB_RECALC_DATA);
+ DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
break;
case 5: /* make vertex parent */
make_parent();
@@ -3423,7 +3426,7 @@ static void do_view3d_edit_curvemenu(bContext *C, void *arg, int event)
break;
case 7: /* toggle cyclic */
makecyclicNurb();
- DAG_object_flush_update(scene, G.obedit, OB_RECALC_DATA);
+ DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
break;
case 8: /* delete */
delete_context_selected();
@@ -4056,7 +4059,8 @@ static uiBlock *view3d_armature_settingsmenu(bContext *C, uiMenuBlockHandle *han
static uiBlock *view3d_edit_armaturemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
{
- bArmature *arm= G.obedit->data;
+ Object *obedit = CTX_data_edit_object(C);
+ bArmature *arm= obedit->data;
uiBlock *block;
short yco= 0, menuwidth=120;
@@ -5235,8 +5239,9 @@ static char *drawtype_pup(void)
str += sprintf(str, "%s", "|Textured %x5");
return string;
}
-static char *around_pup(void)
+static char *around_pup(const bContext *C)
{
+ Object *obedit = CTX_data_edit_object(C);
static char string[512];
char *str = string;
@@ -5245,7 +5250,7 @@ static char *around_pup(void)
str += sprintf(str, "%s", "|Median Point %x3");
str += sprintf(str, "%s", "|3D Cursor %x1");
str += sprintf(str, "%s", "|Individual Centers %x2");
- if ((G.obedit) && (G.obedit->type == OB_MESH))
+ if ((obedit) && (obedit->type == OB_MESH))
str += sprintf(str, "%s", "|Active Vert/Edge/Face %x4");
else
str += sprintf(str, "%s", "|Active Object %x4");
@@ -5300,6 +5305,7 @@ static void do_view3d_buttons(bContext *C, void *arg, int event)
ScrArea *sa= CTX_wm_area(C);
View3D *v3d= sa->spacedata.first;
Object *ob= OBACT;
+ Object *obedit = CTX_data_edit_object(C);
int bit, shift=0; // XXX shift arg?
/* watch it: if sa->win does not exist, check that when calling direct drawing routines */
@@ -5356,10 +5362,10 @@ static void do_view3d_buttons(bContext *C, void *arg, int event)
v3d->flag &= ~V3D_MODE;
// XXX exit_paint_modes();
// XXX if(ob) exit_posemode(); /* exit posemode for active object */
-// XXX if(G.obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */
+// XXX if(obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */
}
else if (v3d->modeselect == V3D_EDITMODE_SEL) {
- if(!G.obedit) {
+ if(!obedit) {
v3d->flag &= ~V3D_MODE;
// XXX exit_paint_modes();
// XXX enter_editmode(EM_WAITCURSOR);
@@ -5370,7 +5376,7 @@ static void do_view3d_buttons(bContext *C, void *arg, int event)
if (!(G.f & G_SCULPTMODE)) {
v3d->flag &= ~V3D_MODE;
// XXX exit_paint_modes();
-// XXX if(G.obedit) exit_editmode(2); /* exit editmode and undo */
+// XXX if(obedit) exit_editmode(2); /* exit editmode and undo */
// XXX set_sculptmode();
}
@@ -5379,7 +5385,7 @@ static void do_view3d_buttons(bContext *C, void *arg, int event)
if (!(G.f & G_VERTEXPAINT)) {
v3d->flag &= ~V3D_MODE;
// XXX exit_paint_modes();
-// XXX if(G.obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */
+// XXX if(obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */
// XXX set_vpaint();
}
@@ -5388,7 +5394,7 @@ static void do_view3d_buttons(bContext *C, void *arg, int event)
if (!(G.f & G_TEXTUREPAINT)) {
v3d->flag &= ~V3D_MODE;
// XXX exit_paint_modes();
-// XXX if(G.obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */
+// XXX if(obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */
// XXX set_texturepaint();
}
@@ -5397,7 +5403,7 @@ static void do_view3d_buttons(bContext *C, void *arg, int event)
if (!(G.f & G_WEIGHTPAINT) && (ob && ob->type == OB_MESH) ) {
v3d->flag &= ~V3D_MODE;
// XXX exit_paint_modes();
-// XXX if(G.obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */
+// XXX if(obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */
// XXX set_wpaint();
}
@@ -5406,7 +5412,7 @@ static void do_view3d_buttons(bContext *C, void *arg, int event)
if (ob) {
v3d->flag &= ~V3D_MODE;
-// XXX if(G.obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */
+// XXX if(obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */
// XXX enter_posemode();
}
@@ -5415,7 +5421,7 @@ static void do_view3d_buttons(bContext *C, void *arg, int event)
if (!(G.f & G_PARTICLEEDIT)) {
v3d->flag &= ~V3D_MODE;
// XXX exit_paint_modes();
-// XXX if(G.obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */
+// XXX if(obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */
// XXX PE_set_particle_edit();
}
@@ -5549,8 +5555,9 @@ static void do_view3d_buttons(bContext *C, void *arg, int event)
}
}
-static void view3d_header_pulldowns(uiBlock *block, View3D *v3d, Object *ob, int *xcoord, int yco)
+static void view3d_header_pulldowns(const bContext *C, uiBlock *block, View3D *v3d, Object *ob, int *xcoord, int yco)
{
+ Object *obedit = CTX_data_edit_object(C);
short xmax, xco= *xcoord;
/* pull down menus */
@@ -5572,7 +5579,7 @@ static void view3d_header_pulldowns(uiBlock *block, View3D *v3d, Object *ob, int
xco+= xmax;
xmax= GetButStringLength("Select");
- if (G.obedit) {
+ if (obedit) {
if (ob && ob->type == OB_MESH) {
uiDefPulldownBut(block, view3d_select_meshmenu, NULL, "Select", xco,yco-2, xmax-3, 24, "");
} else if (ob && (ob->type == OB_CURVE || ob->type == OB_SURF)) {
@@ -5603,7 +5610,7 @@ static void view3d_header_pulldowns(uiBlock *block, View3D *v3d, Object *ob, int
}
xco+= xmax;
- if (G.obedit) {
+ if (obedit) {
if (ob && ob->type == OB_MESH) {
xmax= GetButStringLength("Mesh");
uiDefPulldownBut(block, view3d_edit_meshmenu, NULL, "Mesh", xco,yco-2, xmax-3, 24, "");
@@ -5699,6 +5706,7 @@ void view3d_header_buttons(const bContext *C, ARegion *ar)
View3D *v3d= sa->spacedata.first;
Scene *scene= CTX_data_scene(C);
Object *ob= OBACT;
+ Object *obedit = CTX_data_edit_object(C);
uiBlock *block;
int a, xco, yco= 3;
@@ -5708,7 +5716,7 @@ void view3d_header_buttons(const bContext *C, ARegion *ar)
xco= ED_area_header_standardbuttons(C, block, yco);
if((sa->flag & HEADER_NO_PULLDOWN)==0)
- view3d_header_pulldowns(block, v3d, ob, &xco, yco);
+ view3d_header_pulldowns(C, block, v3d, ob, &xco, yco);
/* other buttons: */
uiBlockSetEmboss(block, UI_EMBOSS);
@@ -5716,7 +5724,7 @@ void view3d_header_buttons(const bContext *C, ARegion *ar)
/* mode */
v3d->modeselect = V3D_OBJECTMODE_SEL;
- if (G.obedit) v3d->modeselect = V3D_EDITMODE_SEL;
+ if (obedit) v3d->modeselect = V3D_EDITMODE_SEL;
else if(ob && (ob->flag & OB_POSEMODE)) v3d->modeselect = V3D_POSEMODE_SEL;
else if (G.f & G_SCULPTMODE) v3d->modeselect = V3D_SCULPTMODE_SEL;
else if (G.f & G_WEIGHTPAINT) v3d->modeselect = V3D_WEIGHTPAINTMODE_SEL;
@@ -5728,7 +5736,7 @@ void view3d_header_buttons(const bContext *C, ARegion *ar)
v3d->flag &= ~V3D_MODE;
/* not sure what the v3d->flag is useful for now... modeselect is confusing */
- if(G.obedit) v3d->flag |= V3D_EDITMODE;
+ if(obedit) v3d->flag |= V3D_EDITMODE;
if(ob && (ob->flag & OB_POSEMODE)) v3d->flag |= V3D_POSEMODE;
if(G.f & G_VERTEXPAINT) v3d->flag |= V3D_VERTEXPAINT;
if(G.f & G_WEIGHTPAINT) v3d->flag |= V3D_WEIGHTPAINT;
@@ -5778,13 +5786,13 @@ void view3d_header_buttons(const bContext *C, ARegion *ar)
uiBlockEndAlign(block);
}
} else {
- if (G.obedit==NULL && (G.f & (G_VERTEXPAINT|G_WEIGHTPAINT|G_TEXTUREPAINT))) {
+ if (obedit==NULL && (G.f & (G_VERTEXPAINT|G_WEIGHTPAINT|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)");
xco+= XIC+10;
} else {
/* Manipulators arnt used in weight paint mode */
// XXX char *str_menu;
- uiDefIconTextButS(block, ICONTEXTROW,B_AROUND, ICON_ROTATE, around_pup(), xco,yco,XIC+10,YIC, &(v3d->around), 0, 3.0, 0, 0, "Rotation/Scaling Pivot (Hotkeys: Comma, Shift Comma, Period, Ctrl Period, Alt Period)");
+ uiDefIconTextButS(block, ICONTEXTROW,B_AROUND, ICON_ROTATE, around_pup(C), xco,yco,XIC+10,YIC, &(v3d->around), 0, 3.0, 0, 0, "Rotation/Scaling Pivot (Hotkeys: Comma, Shift Comma, Period, Ctrl Period, Alt Period)");
xco+= XIC+10;
@@ -5841,7 +5849,7 @@ void view3d_header_buttons(const bContext *C, ARegion *ar)
}
/* LAYERS */
- if(G.obedit==NULL && v3d->localview==0) {
+ if(obedit==NULL && v3d->localview==0) {
int ob_lay = ob ? ob->lay : 0;
uiBlockBeginAlign(block);
for(a=0; a<5; a++) {
@@ -5869,7 +5877,7 @@ void view3d_header_buttons(const bContext *C, ARegion *ar)
}
/* proportional falloff */
- if((G.obedit && (G.obedit->type == OB_MESH || G.obedit->type == OB_CURVE || G.obedit->type == OB_SURF || G.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)) || G.f & G_PARTICLEEDIT) {
uiBlockBeginAlign(block);
uiDefIconTextButS(block, ICONTEXTROW,B_REDR, ICON_PROP_OFF, "Proportional %t|Off %x0|On %x1|Connected %x2", xco,yco,XIC+10,YIC, &(scene->proportional), 0, 1.0, 0, 0, "Proportional Edit Falloff (Hotkeys: O, Alt O) ");
@@ -5884,7 +5892,7 @@ void view3d_header_buttons(const bContext *C, ARegion *ar)
}
/* Snap */
- if (BIF_snappingSupported()) {
+ if (BIF_snappingSupported(obedit)) {
uiBlockBeginAlign(block);
if (scene->snap_flag & SCE_SNAP) {
@@ -5906,7 +5914,7 @@ void view3d_header_buttons(const bContext *C, ARegion *ar)
}
/* selection modus */
- if(G.obedit && (G.obedit->type == OB_MESH)) {
+ if(obedit && (obedit->type == OB_MESH)) {
uiBlockBeginAlign(block);
uiDefIconButBitS(block, TOG, SCE_SELECT_VERTEX, B_SEL_VERT, ICON_VERTEXSEL, xco,yco,XIC,YIC, &scene->selectmode, 1.0, 0.0, 0, 0, "Vertex select mode (Ctrl Tab 1)");
xco+= XIC;
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index 6e23fc5b1b3..96a2e7c52cc 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -239,8 +239,8 @@ typedef struct TransInfo {
struct ARegion *ar;
struct Scene *scene;
struct wmEvent *event; /* last event, reset at the start of each transformApply and nulled at the transformEnd */
- struct EditMesh *em; /* get from context */
- short mval[2]; /* current mouse position */
+ short mval[2]; /* current mouse position */
+ struct Object *obedit;
} TransInfo;
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 5fda8acae88..de368dcd1dc 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -124,6 +124,7 @@
#include "ED_keyframing.h"
#include "ED_keyframes_edit.h"
#include "ED_view3d.h"
+#include "ED_mesh.h"
#include "UI_view2d.h"
@@ -369,7 +370,7 @@ static void createTransEdge(bContext *C, TransInfo *t) {
td= t->data= MEM_callocN(t->total * sizeof(TransData), "TransCrease");
- Mat3CpyMat4(mtx, G.obedit->obmat);
+ Mat3CpyMat4(mtx, t->obedit->obmat);
Mat3Inv(smtx, mtx);
for(eed= em->edges.first; eed; eed= eed->next) {
@@ -1027,7 +1028,7 @@ static void createTransArmatureVerts(bContext *C, TransInfo *t)
// TRANSFORM_FIX_ME
#if 0
EditBone *ebo;
- bArmature *arm= G.obedit->data;
+ bArmature *arm= t->obedit->data;
TransData *td;
float mtx[3][3], smtx[3][3], delta[3], bonemat[3][3];
@@ -1053,7 +1054,7 @@ static void createTransArmatureVerts(bContext *C, TransInfo *t)
if (!t->total) return;
- Mat3CpyMat4(mtx, G.obedit->obmat);
+ Mat3CpyMat4(mtx, t->obedit->obmat);
Mat3Inv(smtx, mtx);
td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransEditBone");
@@ -1225,7 +1226,7 @@ static void createTransMBallVerts(bContext *C, TransInfo *t)
td = t->data= MEM_callocN(t->total*sizeof(TransData), "TransObData(MBall EditMode)");
tx = t->ext = MEM_callocN(t->total*sizeof(TransDataExtension), "MetaElement_TransExtension");
- Mat3CpyMat4(mtx, G.obedit->obmat);
+ Mat3CpyMat4(mtx, t->obedit->obmat);
Mat3Inv(smtx, mtx);
for(ml= editelems.first; ml; ml= ml->next) {
@@ -1376,7 +1377,7 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
else t->total = countsel;
t->data= MEM_callocN(t->total*sizeof(TransData), "TransObData(Curve EditMode)");
- Mat3CpyMat4(mtx, G.obedit->obmat);
+ Mat3CpyMat4(mtx, t->obedit->obmat);
Mat3Inv(smtx, mtx);
td = t->data;
@@ -1564,7 +1565,7 @@ static void createTransLatticeVerts(bContext *C, TransInfo *t)
else t->total = countsel;
t->data= MEM_callocN(t->total*sizeof(TransData), "TransObData(Lattice EditMode)");
- Mat3CpyMat4(mtx, G.obedit->obmat);
+ Mat3CpyMat4(mtx, t->obedit->obmat);
Mat3Inv(smtx, mtx);
td = t->data;
@@ -1887,7 +1888,7 @@ static void get_face_center(float *cent, EditMesh *em, EditVert *eve)
//way to overwrite what data is edited with transform
//static void VertsToTransData(TransData *td, EditVert *eve, BakeKey *key)
-static void VertsToTransData(TransData *td, EditMesh *em, EditVert *eve)
+static void VertsToTransData(TransInfo *t, TransData *td, EditMesh *em, EditVert *eve)
{
td->flag = 0;
//if(key)
@@ -1896,8 +1897,7 @@ static void VertsToTransData(TransData *td, EditMesh *em, EditVert *eve)
td->loc = eve->co;
VECCOPY(td->center, td->loc);
-// TRANSFORM_FIX_ME
-// if(G.vd->around==V3D_LOCAL && (em->selectmode & SCE_SELECT_FACE))
+ if(t->around==V3D_LOCAL && (em->selectmode & SCE_SELECT_FACE))
get_face_center(td->center, em, eve);
VECCOPY(td->iloc, td->loc);
@@ -1914,7 +1914,7 @@ static void VertsToTransData(TransData *td, EditMesh *em, EditVert *eve)
td->tdi = NULL;
td->val = NULL;
td->extra = NULL;
- if (BIF_GetTransInfo()->mode == TFM_BWEIGHT) {
+ if (t->mode == TFM_BWEIGHT) {
td->val = &(eve->bweight);
td->ival = eve->bweight;
}
@@ -1955,16 +1955,16 @@ static int modifiers_disable_subsurf_temporary(Object *ob)
}
/* disable subsurf temporal, get mapped cos, and enable it */
-static float *get_crazy_mapped_editverts(void)
+static float *get_crazy_mapped_editverts(TransInfo *t)
{
- Mesh *me= G.obedit->data;
+ Mesh *me= t->obedit->data;
DerivedMesh *dm;
float *vertexcos;
/* disable subsurf temporal, get mapped cos, and enable it */
- if(modifiers_disable_subsurf_temporary(G.obedit)) {
+ if(modifiers_disable_subsurf_temporary(t->obedit)) {
/* need to make new derivemesh */
- makeDerivedMesh(G.obedit, me->edit_mesh, CD_MASK_BAREMESH);
+ makeDerivedMesh(t->obedit, me->edit_mesh, CD_MASK_BAREMESH);
}
/* now get the cage */
@@ -1976,7 +1976,7 @@ static float *get_crazy_mapped_editverts(void)
dm->release(dm);
/* set back the flag, no new cage needs to be built, transform does it */
- modifiers_disable_subsurf_temporary(G.obedit);
+ modifiers_disable_subsurf_temporary(t->obedit);
return vertexcos;
}
@@ -2097,10 +2097,9 @@ void createTransBMeshVerts(TransInfo *t, BME_Mesh *bm, BME_TransData_Head *td) {
static void createTransEditVerts(bContext *C, TransInfo *t)
{
- // TRANSFORM_FIX_ME
-#if 0
+ Scene *scene = CTX_data_scene(C);
TransData *tob = NULL;
- EditMesh *em = t->em;
+ EditMesh *em = ((Mesh *)t->obedit->data)->edit_mesh;
EditVert *eve;
EditVert **nears = NULL;
EditVert *eve_act = NULL;
@@ -2110,13 +2109,13 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
int propmode = t->flag & T_PROP_EDIT;
int mirror = 0;
- if ((t->options & CTX_NO_MIRROR) == 0 && (G.scene->toolsettings->editbutflag & B_MESH_X_MIRROR))
+ if ((t->options & CTX_NO_MIRROR) == 0 && (scene->toolsettings->editbutflag & B_MESH_X_MIRROR))
{
mirror = 1;
}
// transform now requires awareness for select mode, so we tag the f1 flags in verts
- if(G.scene->selectmode & SCE_SELECT_VERTEX) {
+ if(scene->selectmode & SCE_SELECT_VERTEX) {
for(eve= em->verts.first; eve; eve= eve->next) {
if(eve->h==0 && (eve->f & SELECT))
eve->f1= SELECT;
@@ -2124,7 +2123,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
eve->f1= 0;
}
}
- else if(G.scene->selectmode & SCE_SELECT_EDGE) {
+ else if(scene->selectmode & SCE_SELECT_EDGE) {
EditEdge *eed;
for(eve= em->verts.first; eve; eve= eve->next) eve->f1= 0;
for(eed= em->edges.first; eed; eed= eed->next) {
@@ -2173,26 +2172,26 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
else t->total = countsel;
tob= t->data= MEM_callocN(t->total*sizeof(TransData), "TransObData(Mesh EditMode)");
- Mat3CpyMat4(mtx, G.obedit->obmat);
+ Mat3CpyMat4(mtx, t->obedit->obmat);
Mat3Inv(smtx, mtx);
- if(propmode) editmesh_set_connectivity_distance(t->em, t->total, vectors, nears);
+ if(propmode) editmesh_set_connectivity_distance(em, t->total, vectors, nears);
/* detect CrazySpace [tm] */
if(propmode==0) {
- if(modifiers_getCageIndex(G.obedit, NULL)>=0) {
- if(modifiers_isDeformed(G.obedit)) {
+ if(modifiers_getCageIndex(t->obedit, NULL)>=0) {
+ if(modifiers_isDeformed(t->obedit)) {
/* check if we can use deform matrices for modifier from the
start up to stack, they are more accurate than quats */
- totleft= editmesh_get_first_deform_matrices(&defmats, &defcos);
+ totleft= editmesh_get_first_deform_matrices(em, &defmats, &defcos);
/* if we still have more modifiers, also do crazyspace
correction with quats, relative to the coordinates after
the modifiers that support deform matrices (defcos) */
if(totleft > 0) {
- mappedcos= get_crazy_mapped_editverts();
+ mappedcos= get_crazy_mapped_editverts(t);
quats= MEM_mallocN( (t->total)*sizeof(float)*4, "crazy quats");
- set_crazyspace_quats(t->em, (float*)defcos, mappedcos, quats);
+ set_crazyspace_quats(em, (float*)defcos, mappedcos, quats);
if(mappedcos)
MEM_freeN(mappedcos);
}
@@ -2217,7 +2216,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
for (a=0, eve=em->verts.first; eve; eve=eve->next, a++) {
if(eve->h==0) {
if(propmode || eve->f1) {
- VertsToTransData(t, tob, t->em, eve);
+ VertsToTransData(t, tob, em, eve);
/* selected */
if(eve->f1) tob->flag |= TD_SELECTED;
@@ -2267,7 +2266,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
/* Mirror? */
if( (mirror>0 && tob->iloc[0]>0.0f) || (mirror<0 && tob->iloc[0]<0.0f)) {
- EditVert *vmir= editmesh_get_x_mirror_vert(G.obedit, tob->iloc); /* initializes octree on first call */
+ EditVert *vmir= editmesh_get_x_mirror_vert(t->obedit, em, tob->iloc); /* initializes octree on first call */
if(vmir != eve) tob->extra = vmir;
}
tob++;
@@ -2283,7 +2282,6 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
MEM_freeN(quats);
if(defmats)
MEM_freeN(defmats);
-#endif
}
/* ********************* UV ****************** */
@@ -2335,7 +2333,7 @@ static void createTransUVs(bContext *C, TransInfo *t)
int propmode = t->flag & T_PROP_EDIT;
int efa_s1,efa_s2,efa_s3,efa_s4;
- EditMesh *em = t->em;
+ EditMesh *em = ((Mesh *)t->obedit->data)->edit_mesh;
EditFace *efa;
if(is_uv_tface_editing_allowed()==0) return;
@@ -2469,7 +2467,7 @@ void flushTransUVs(TransInfo *t)
TransData2D *td;
int a, width, height;
Object *ob= OBACT;
- EditMesh *em = t->em;
+ EditMesh *em = ((Mesh *)ob->data)->edit_mesh;
float aspx, aspy, invx, invy;
transform_aspect_ratio_tface_uv(&aspx, &aspy);
@@ -3958,7 +3956,7 @@ void special_aftertrans_update(TransInfo *t)
short duplicate= (t->undostr && strstr(t->undostr, "Duplicate")) ? 1 : 0;
if (t->spacetype==SPACE_VIEW3D) {
- if (G.obedit) {
+ if (t->obedit) {
if (cancelled==0) {
#if 0 // TRANSFORM_FIX_ME
EM_automerge(1);
@@ -4118,12 +4116,12 @@ void special_aftertrans_update(TransInfo *t)
if (G.sipo->blocktype==ID_SEQ)
resetslowpar= 0;
}
- else if (G.obedit) {
+ else if (t->obedit) {
if (t->mode==TFM_BONESIZE || t->mode==TFM_BONE_ENVELOPE)
allqueue(REDRAWBUTSEDIT, 0);
/* table needs to be created for each edit command, since vertices can move etc */
- mesh_octree_table(G.obedit, NULL, 'e');
+ mesh_octree_table(t->obedit, NULL, 'e');
}
else if ((t->flag & T_POSE) && (t->poseobj)) {
bArmature *arm;
@@ -4405,23 +4403,21 @@ void createTransData(bContext *C, TransInfo *t)
sort_trans_data_dist(t);
}
}
- else if (0) { // // TRANSFORM_FIX_ME (G.obedit) {
- Object *obedit = NULL; // TRANSFORM_FIX_ME
-
+ else if (t->obedit) {
t->ext = NULL;
- if (obedit->type == OB_MESH) {
+ if (t->obedit->type == OB_MESH) {
createTransEditVerts(C, t);
}
- else if ELEM(obedit->type, OB_CURVE, OB_SURF) {
+ else if ELEM(t->obedit->type, OB_CURVE, OB_SURF) {
createTransCurveVerts(C, t);
}
- else if (obedit->type==OB_LATTICE) {
+ else if (t->obedit->type==OB_LATTICE) {
createTransLatticeVerts(C, t);
}
- else if (obedit->type==OB_MBALL) {
+ else if (t->obedit->type==OB_MBALL) {
createTransMBallVerts(C, t);
}
- else if (obedit->type==OB_ARMATURE) {
+ else if (t->obedit->type==OB_ARMATURE) {
t->flag &= ~T_PROP_EDIT;
createTransArmatureVerts(C, t);
}
@@ -4430,7 +4426,7 @@ void createTransData(bContext *C, TransInfo *t)
}
if(t->data && t->flag & T_PROP_EDIT) {
- if (ELEM(obedit->type, OB_CURVE, OB_MESH)) {
+ if (ELEM(t->obedit->type, OB_CURVE, OB_MESH)) {
sort_trans_data(t); // makes selected become first in array
set_prop_dist(t, 0);
sort_trans_data_dist(t);
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index fb4af42e5ef..56aad813b50 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -678,13 +678,14 @@ void initTransInfo (bContext *C, TransInfo *t, wmEvent *event)
t->scene = sce;
t->sa = sa;
t->ar = ar;
- if (obedit && obedit->type==OB_MESH)
- t->em = ((Mesh *)obedit->data)->edit_mesh;
+ t->obedit = obedit;
t->data = NULL;
t->ext = NULL;
t->flag = 0;
+
+ t->propsize = 1.0f; /* TRANSFORM_FIX_ME this needs to be saved in scene or something */
/* setting PET flag */
if ((t->options & CTX_NO_PET) == 0 && (sce->proportional)) {
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index a70ace8b9b5..9375a776fed 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -107,11 +107,11 @@ int snapObjects(TransInfo *t, int *dist, float *loc, float *no, int mode);
/****************** IMPLEMENTATIONS *********************/
-int BIF_snappingSupported(void)
+int BIF_snappingSupported(Object *obedit)
{
int status = 0;
- if (G.obedit == NULL || G.obedit->type==OB_MESH) /* only support object or mesh */
+ if (obedit == NULL || obedit->type==OB_MESH) /* only support object or mesh */
{
status = 1;
}
@@ -208,7 +208,7 @@ int handleSnapping(TransInfo *t, wmEvent *event)
{
int status = 0;
- if (BIF_snappingSupported() && event->type == TABKEY && event->shift)
+ if (BIF_snappingSupported(t->obedit) && event->type == TABKEY && event->shift)
{
/* toggle snap and reinit */
G.scene->snap_flag ^= SCE_SNAP;
@@ -418,9 +418,8 @@ float RotationBetween(TransInfo *t, float p1[3], float p2[3])
VECCOPY(center, t->center);
if(t->flag & (T_EDIT|T_POSE)) {
- // TRANSFORM_FIX_ME
-// Object *ob= G.obedit?G.obedit:t->poseobj;
-// Mat4MulVecfl(ob->obmat, center);
+ Object *ob= t->obedit?t->obedit:t->poseobj;
+ Mat4MulVecfl(ob->obmat, center);
}
VecSubf(start, p1, center);
@@ -475,9 +474,8 @@ float ResizeBetween(TransInfo *t, float p1[3], float p2[3])
VECCOPY(center, t->center);
if(t->flag & (T_EDIT|T_POSE)) {
- // TRANSFORM_FIX_ME
-// Object *ob= G.obedit?G.obedit:t->poseobj;
-// Mat4MulVecfl(ob->obmat, center);
+ Object *ob= t->obedit?t->obedit:t->poseobj;
+ Mat4MulVecfl(ob->obmat, center);
}
VecSubf(d1, p1, center);
@@ -500,10 +498,8 @@ void CalcSnapGrid(TransInfo *t, float *vec)
void CalcSnapGeometry(TransInfo *t, float *vec)
{
- Object *obedit = NULL;
-
/* Object mode */
- if (obedit == NULL)
+ if (t->obedit == NULL)
{
if (t->spacetype == SPACE_VIEW3D)
{
@@ -537,7 +533,7 @@ void CalcSnapGeometry(TransInfo *t, float *vec)
}
}
/* Mesh edit mode */
- else if (obedit != NULL && obedit->type==OB_MESH)
+ else if (t->obedit->type==OB_MESH)
{
if (t->spacetype == SPACE_VIEW3D)
{
@@ -577,7 +573,7 @@ void CalcSnapGeometry(TransInfo *t, float *vec)
t->tsnap.snapPoint[0] *= aspx;
t->tsnap.snapPoint[1] *= aspy;
- //Mat4MulVecfl(G.obedit->obmat, t->tsnap.snapPoint);
+ Mat4MulVecfl(t->obedit->obmat, t->tsnap.snapPoint);
t->tsnap.status |= POINT_INIT;
}
@@ -598,7 +594,7 @@ void TargetSnapCenter(TransInfo *t)
{
VECCOPY(t->tsnap.snapTarget, t->center);
if(t->flag & (T_EDIT|T_POSE)) {
- Object *ob= G.obedit?G.obedit:t->poseobj;
+ Object *ob= t->obedit?t->obedit:t->poseobj;
Mat4MulVecfl(ob->obmat, t->tsnap.snapTarget);
}
@@ -629,7 +625,7 @@ void TargetSnapActive(TransInfo *t)
VECCOPY(t->tsnap.snapTarget, active_td->center);
if(t->flag & (T_EDIT|T_POSE)) {
- Object *ob= G.obedit?G.obedit:t->poseobj;
+ Object *ob= t->obedit?t->obedit:t->poseobj;
Mat4MulVecfl(ob->obmat, t->tsnap.snapTarget);
}
@@ -665,7 +661,7 @@ void TargetSnapMedian(TransInfo *t)
VecMulf(t->tsnap.snapTarget, 1.0 / t->total);
if(t->flag & (T_EDIT|T_POSE)) {
- Object *ob= G.obedit?G.obedit:t->poseobj;
+ Object *ob= t->obedit?t->obedit:t->poseobj;
Mat4MulVecfl(ob->obmat, t->tsnap.snapTarget);
}
@@ -740,7 +736,7 @@ void TargetSnapClosest(TransInfo *t)
VECCOPY(loc, td->center);
if(t->flag & (T_EDIT|T_POSE)) {
- Object *ob= G.obedit?G.obedit:t->poseobj;
+ Object *ob= t->obedit?t->obedit:t->poseobj;
Mat4MulVecfl(ob->obmat, loc);
}
@@ -1184,15 +1180,15 @@ int snapObjects(TransInfo *t, int *dist, float *loc, float *no, int mode) {
if (mode == NOT_ACTIVE)
{
- // TRANSFORM_FIX_ME
-// DerivedMesh *dm;
-// Object *ob = G.obedit;
-//
-// dm = editmesh_get_derived_cage(CD_MASK_BAREMESH);
-//
-// retval = snapDerivedMesh(t, ob, dm, ob->obmat, ray_start, ray_normal, mval, loc, no, dist, &depth, 1);
-//
-// dm->release(dm);
+ DerivedMesh *dm;
+ Object *ob = t->obedit;
+ EditMesh *em = ((Mesh *)t->obedit->data)->edit_mesh;
+
+ dm = editmesh_get_derived_cage(em, CD_MASK_BAREMESH);
+
+ retval = snapDerivedMesh(t, ob, dm, ob->obmat, ray_start, ray_normal, t->mval, loc, no, dist, &depth, 1);
+
+ dm->release(dm);
}
for ( base = scene->base.first; base != NULL; base = base->next ) {