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:
Diffstat (limited to 'source/blender/editors/transform')
-rw-r--r--source/blender/editors/transform/transform.c18
-rw-r--r--source/blender/editors/transform/transform_constraints.c8
-rw-r--r--source/blender/editors/transform/transform_conversions.c8
-rw-r--r--source/blender/editors/transform/transform_generics.c38
-rw-r--r--source/blender/editors/transform/transform_manipulator.c26
-rw-r--r--source/blender/editors/transform/transform_orientations.c19
-rw-r--r--source/blender/editors/transform/transform_snap.c2
7 files changed, 59 insertions, 60 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index b7322e3142e..584e2e9c4c1 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -132,7 +132,7 @@ static void helpline(TransInfo *t, float *vec)
VECCOPY(vecrot, vec);
if(t->flag & T_EDIT) {
- Object *ob=G.obedit;
+ Object *ob= t->obedit;
if(ob) Mat4MulVecfl(ob->obmat, vecrot);
}
else if(t->flag & T_POSE) {
@@ -1126,8 +1126,8 @@ void initManipulator(int mode)
Trans.mode = mode;
/* automatic switch to scaling bone envelopes */
- if(mode==TFM_RESIZE && G.obedit && G.obedit->type==OB_ARMATURE) {
- bArmature *arm= G.obedit->data;
+ if(mode==TFM_RESIZE && t->obedit && t->obedit->type==OB_ARMATURE) {
+ bArmature *arm= t->obedit->data;
if(arm->drawtype==ARM_ENVELOPE)
mode= TFM_BONE_ENVELOPE;
}
@@ -1721,8 +1721,8 @@ int Warp(TransInfo *t, short mval[2])
VECCOPY(cursor, curs);
VECCOPY(gcursor, cursor);
if (t->flag & T_EDIT) {
- VecSubf(cursor, cursor, G.obedit->obmat[3]);
- VecSubf(gcursor, gcursor, G.obedit->obmat[3]);
+ VecSubf(cursor, cursor, t->obedit->obmat[3]);
+ VecSubf(gcursor, gcursor, t->obedit->obmat[3]);
Mat3MulVecfl(t->data->smtx, gcursor);
}
Mat4MulVecfl(t->viewmat, cursor);
@@ -1894,7 +1894,7 @@ int Shear(TransInfo *t, short mval[2])
if (td->flag & TD_SKIP)
continue;
- if (G.obedit) {
+ if (t->obedit) {
float mat3[3][3];
Mat3MulMat3(mat3, totmat, td->mtx);
Mat3MulMat3(tmat, td->smtx, mat3);
@@ -1937,7 +1937,7 @@ void initResize(TransInfo *t)
t->flag |= T_NULL_ONE;
t->num.flag |= NUM_NULL_ONE;
t->num.flag |= NUM_AFFECT_ALL;
- if (!G.obedit) {
+ if (!t->obedit) {
t->flag |= T_NO_ZERO;
t->num.flag |= NUM_NO_ZERO;
}
@@ -2916,7 +2916,7 @@ int Translation(TransInfo *t, short mval[2])
void initShrinkFatten(TransInfo *t)
{
// If not in mesh edit mode, fallback to Resize
- if (G.obedit==NULL || G.obedit->type != OB_MESH) {
+ if (t->obedit==NULL || t->obedit->type != OB_MESH) {
initResize(t);
}
else {
@@ -3834,7 +3834,7 @@ void initMirror(TransInfo *t)
initMouseInputMode(t, &t->mouse, INPUT_NONE);
t->flag |= T_NULL_ONE;
- if (!G.obedit) {
+ if (!t->obedit) {
t->flag |= T_NO_ZERO;
}
}
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index 94c4ffa1497..cdde416ef9a 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -489,7 +489,7 @@ void setConstraint(TransInfo *t, float space[3][3], int mode, const char text[])
void setLocalConstraint(TransInfo *t, int mode, const char text[]) {
if (t->flag & T_EDIT) {
float obmat[3][3];
- Mat3CpyMat4(obmat, G.obedit->obmat);
+ Mat3CpyMat4(obmat, t->scene->obedit->obmat);
setConstraint(t, obmat, mode|CON_LOCAL, text);
}
else {
@@ -748,8 +748,8 @@ void BIF_drawPropCircle()
BIF_ThemeColor(TH_GRID);
/* if editmode we need to go into object space */
- if(G.obedit && t->spacetype == SPACE_VIEW3D)
- mymultmatrix(G.obedit->obmat);
+ if(t->scene->obedit && t->spacetype == SPACE_VIEW3D)
+ mymultmatrix(t->scene->obedit->obmat);
mygetmatrix(tmat);
Mat4Invert(imat, tmat);
@@ -759,7 +759,7 @@ void BIF_drawPropCircle()
set_inverted_drawing(0);
/* if editmode we restore */
- if(G.obedit && t->spacetype == SPACE_VIEW3D)
+ if(t->scene->obedit && t->spacetype == SPACE_VIEW3D)
myloadmatrix(G.vd->viewmat);
#endif
}
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index de368dcd1dc..020d5143911 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -1968,7 +1968,7 @@ static float *get_crazy_mapped_editverts(TransInfo *t)
}
/* now get the cage */
- dm= editmesh_get_derived_cage(me->edit_mesh, CD_MASK_BAREMESH);
+ dm= editmesh_get_derived_cage(t->obedit, me->edit_mesh, CD_MASK_BAREMESH);
vertexcos= MEM_mallocN(3*sizeof(float)*G.totvert, "vertexcos map");
dm->foreachMappedVert(dm, make_vertexcos__mapFunc, vertexcos);
@@ -2183,7 +2183,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
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(em, &defmats, &defcos);
+ totleft= editmesh_get_first_deform_matrices(t->obedit, em, &defmats, &defcos);
/* if we still have more modifiers, also do crazyspace
correction with quats, relative to the coordinates after
@@ -3950,8 +3950,7 @@ static void recalc_all_ipos(void)
void special_aftertrans_update(TransInfo *t)
{
Object *ob;
- Base *base;
- short redrawipo=0, resetslowpar=1;
+// short redrawipo=0, resetslowpar=1;
int cancelled= (t->state == TRANS_CANCEL);
short duplicate= (t->undostr && strstr(t->undostr, "Duplicate")) ? 1 : 0;
@@ -4000,7 +3999,6 @@ void special_aftertrans_update(TransInfo *t)
for (ale= anim_data.first; ale; ale= ale->next) {
Object *nob= ANIM_nla_mapping_get(&ac, ale);
Ipo *ipo= ale->key_data;
- IpoCurve *icu;
if ( (saction->flag & SACTION_NOTRANSKEYCULL)==0 &&
((cancelled == 0) || (duplicate)) )
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 56aad813b50..5d96b16751c 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -241,7 +241,7 @@ static void clipMirrorModifier(TransInfo *t, Object *ob)
}
}
-/* assumes G.obedit set to mesh object */
+/* assumes obedit set to mesh object */
static void editmesh_apply_to_mirror(TransInfo *t)
{
TransData *td = t->data;
@@ -429,8 +429,8 @@ void recalcData(TransInfo *t)
}
}
}
- else if (G.obedit) {
- if (G.obedit->type == OB_MESH) {
+ else if (t->obedit) {
+ if (t->obedit->type == OB_MESH) {
if(t->spacetype==SPACE_IMAGE) {
flushTransUVs(t);
if (G.sima->flag & SI_LIVE_UNWRAP)
@@ -442,19 +442,19 @@ void recalcData(TransInfo *t)
/* Only retopo if not snapping, Note, this is the only case of G.qual being used, but we have no T_SHIFT_MOD - Campbell */
retopo_do_all();
}
- clipMirrorModifier(t, G.obedit);
+ clipMirrorModifier(t, t->obedit);
}
if((t->options & CTX_NO_MIRROR) == 0 && (G.scene->toolsettings->editbutflag & B_MESH_X_MIRROR))
editmesh_apply_to_mirror(t);
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA); /* sets recalc flags */
+ DAG_object_flush_update(G.scene, t->obedit, OB_RECALC_DATA); /* sets recalc flags */
recalc_editnormals();
}
}
- else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
+ else if ELEM(t->obedit->type, OB_CURVE, OB_SURF) {
Nurb *nu= editNurb.first;
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA); /* sets recalc flags */
+ DAG_object_flush_update(G.scene, t->obedit, OB_RECALC_DATA); /* sets recalc flags */
if (t->state == TRANS_CANCEL) {
while(nu) {
@@ -471,8 +471,8 @@ void recalcData(TransInfo *t)
retopo_do_all();
}
}
- else if(G.obedit->type==OB_ARMATURE){ /* no recalc flag, does pose */
- bArmature *arm= G.obedit->data;
+ else if(t->obedit->type==OB_ARMATURE){ /* no recalc flag, does pose */
+ bArmature *arm= t->obedit->data;
EditBone *ebo;
TransData *td = t->data;
int i;
@@ -548,13 +548,13 @@ void recalcData(TransInfo *t)
transform_armature_mirror_update();
}
- else if(G.obedit->type==OB_LATTICE) {
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA); /* sets recalc flags */
+ else if(t->obedit->type==OB_LATTICE) {
+ DAG_object_flush_update(G.scene, t->obedit, OB_RECALC_DATA); /* sets recalc flags */
if(editLatt->flag & LT_OUTSIDE) outside_lattice(editLatt);
}
else {
- DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA); /* sets recalc flags */
+ DAG_object_flush_update(G.scene, t->obedit, OB_RECALC_DATA); /* sets recalc flags */
}
}
else if( (t->flag & T_POSE) && t->poseobj) {
@@ -630,7 +630,7 @@ void drawLine(float *center, float *dir, char axis, short options)
float v1[3], v2[3], v3[3];
char col[3], col2[3];
- //if(G.obedit) mymultmatrix(G.obedit->obmat); // sets opengl viewing
+ //if(t->obedit) mymultmatrix(t->obedit->obmat); // sets opengl viewing
VecCopyf(v3, dir);
VecMulf(v3, G.vd->far);
@@ -671,7 +671,7 @@ void initTransInfo (bContext *C, TransInfo *t, wmEvent *event)
/* moving: is shown in drawobject() (transform color) */
// TRANSFORM_FIX_ME
-// if(G.obedit || (t->flag & T_POSE) ) G.moving= G_TRANSFORM_EDIT;
+// if(obedit || (t->flag & T_POSE) ) G.moving= G_TRANSFORM_EDIT;
// else if(G.f & G_PARTICLEEDIT) G.moving= G_TRANSFORM_PARTICLE;
// else G.moving= G_TRANSFORM_OBJ;
@@ -914,7 +914,7 @@ void restoreTransObjects(TransInfo *t)
void calculateCenter2D(TransInfo *t)
{
if (t->flag & (T_EDIT|T_POSE)) {
- Object *ob= G.obedit?G.obedit:t->poseobj;
+ Object *ob= t->obedit?t->obedit:t->poseobj;
float vec[3];
VECCOPY(vec, t->center);
@@ -935,7 +935,7 @@ void calculateCenterCursor(TransInfo *t)
/* If edit or pose mode, move cursor in local space */
if (t->flag & (T_EDIT|T_POSE)) {
- Object *ob = G.obedit?G.obedit:t->poseobj;
+ Object *ob = t->obedit?t->obedit:t->poseobj;
float mat[3][3], imat[3][3];
VecSubf(t->center, t->center, ob->obmat[3]);
@@ -1047,7 +1047,7 @@ void calculateCenter(TransInfo *t)
/* EDIT MODE ACTIVE EDITMODE ELEMENT */
#if 0 // TRANSFORM_FIX_ME
- if (G.obedit && G.obedit->type == OB_MESH && EM_get_actSelection(&ese)) {
+ if (t->obedit && t->obedit->type == OB_MESH && EM_get_actSelection(&ese)) {
EM_editselection_center(t->center, &ese);
calculateCenter2D(t);
break;
@@ -1073,7 +1073,7 @@ void calculateCenter(TransInfo *t)
VECCOPY(t->con.center, 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->con.center);
}
@@ -1113,7 +1113,7 @@ void calculateCenter(TransInfo *t)
{
/* initgrabz() defines a factor for perspective depth correction, used in window_to_3d() */
if(t->flag & (T_EDIT|T_POSE)) {
- Object *ob= G.obedit?G.obedit:t->poseobj;
+ Object *ob= t->obedit?t->obedit:t->poseobj;
float vec[3];
VECCOPY(vec, t->center);
diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c
index 692c4a65bd7..6cf38bb1adb 100644
--- a/source/blender/editors/transform/transform_manipulator.c
+++ b/source/blender/editors/transform/transform_manipulator.c
@@ -231,11 +231,11 @@ int calc_manipulator_stats(ScrArea *sa)
G.scene->twcent[0]= G.scene->twcent[1]= G.scene->twcent[2]= 0.0f;
INIT_MINMAX(G.scene->twmin, G.scene->twmax);
- if(G.obedit) {
- ob= G.obedit;
+ if(t->obedit) {
+ ob= t->obedit;
if((ob->lay & G.vd->lay)==0) return 0;
- if(G.obedit->type==OB_MESH) {
+ if(t->obedit->type==OB_MESH) {
EditMesh *em = NULL; // TRANSFORM_FIX_ME
EditVert *eve;
EditSelection ese;
@@ -256,8 +256,8 @@ int calc_manipulator_stats(ScrArea *sa)
}
}
} /* end editmesh */
- else if (G.obedit->type==OB_ARMATURE){
- bArmature *arm= G.obedit->data;
+ else if (t->obedit->type==OB_ARMATURE){
+ bArmature *arm= t->obedit->data;
EditBone *ebo;
for (ebo=G.edbo.first;ebo;ebo=ebo->next){
if(ebo->layer & arm->layer) {
@@ -275,7 +275,7 @@ int calc_manipulator_stats(ScrArea *sa)
}
}
}
- else if ELEM3(G.obedit->type, OB_CURVE, OB_SURF, OB_FONT) {
+ else if ELEM3(t->obedit->type, OB_CURVE, OB_SURF, OB_FONT) {
Nurb *nu;
BezTriple *bezt;
BPoint *bp;
@@ -331,7 +331,7 @@ int calc_manipulator_stats(ScrArea *sa)
nu= nu->next;
}
}
- else if(G.obedit->type==OB_MBALL) {
+ else if(t->obedit->type==OB_MBALL) {
/* editmball.c */
extern ListBase editelems; /* go away ! */
MetaElem *ml, *ml_sel=NULL;
@@ -346,7 +346,7 @@ int calc_manipulator_stats(ScrArea *sa)
ml= ml->next;
}
}
- else if(G.obedit->type==OB_LATTICE) {
+ else if(t->obedit->type==OB_LATTICE) {
BPoint *bp;
bp= editLatt->def;
@@ -363,9 +363,9 @@ int calc_manipulator_stats(ScrArea *sa)
/* selection center */
if(totsel) {
VecMulf(G.scene->twcent, 1.0f/(float)totsel); // centroid!
- Mat4MulVecfl(G.obedit->obmat, G.scene->twcent);
- Mat4MulVecfl(G.obedit->obmat, G.scene->twmin);
- Mat4MulVecfl(G.obedit->obmat, G.scene->twmax);
+ Mat4MulVecfl(t->obedit->obmat, G.scene->twcent);
+ Mat4MulVecfl(t->obedit->obmat, G.scene->twmin);
+ Mat4MulVecfl(t->obedit->obmat, G.scene->twmax);
}
}
else if(ob && (ob->flag & OB_POSEMODE)) {
@@ -451,7 +451,7 @@ int calc_manipulator_stats(ScrArea *sa)
break;
case V3D_MANIP_NORMAL:
- if(G.obedit || ob->flag & OB_POSEMODE) {
+ if(t->obedit || ob->flag & OB_POSEMODE) {
float mat[3][3];
int type;
@@ -1435,7 +1435,7 @@ void BIF_draw_manipulator(ScrArea *sa)
v3d->twmat[3][0]= (G.scene->twmin[0] + G.scene->twmax[0])/2.0f;
v3d->twmat[3][1]= (G.scene->twmin[1] + G.scene->twmax[1])/2.0f;
v3d->twmat[3][2]= (G.scene->twmin[2] + G.scene->twmax[2])/2.0f;
- if(v3d->around==V3D_ACTIVE && G.obedit==NULL) {
+ if(v3d->around==V3D_ACTIVE && t->obedit==NULL) {
Object *ob= OBACT;
if(ob && !(ob->flag & OB_POSEMODE))
VECCOPY(v3d->twmat[3], ob->obmat[3]);
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index 7082f1a7459..3ce3b1a8127 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -77,10 +77,10 @@ void BIF_manageTransformOrientation(int confirm, int set) {
Object *ob = OBACT;
int index = -1;
- if (G.obedit) {
- if (G.obedit->type == OB_MESH)
+ if (t->obedit) {
+ if (t->obedit->type == OB_MESH)
index = manageMeshSpace(confirm, set);
- else if (G.obedit->type == OB_ARMATURE)
+ else if (t->obedit->type == OB_ARMATURE)
index = manageBoneSpace(confirm, set);
}
else if (ob && (ob->flag & OB_POSEMODE)) {
@@ -431,6 +431,7 @@ int getTransformOrientation(bContext *C, float normal[3], float plane[3], int ac
Scene *scene = CTX_data_scene(C);
ScrArea *sa = CTX_wm_area(C);
View3D *v3d = sa->spacedata.first;
+ Object *obedit= CTX_data_edit_object(C);
Base *base;
Object *ob = OBACT;
int result = ORIENTATION_NONE;
@@ -438,7 +439,7 @@ int getTransformOrientation(bContext *C, float normal[3], float plane[3], int ac
normal[0] = normal[1] = normal[2] = 0;
plane[0] = plane[1] = plane[2] = 0;
- if(G.obedit)
+ if(obedit)
{
float imat[3][3], mat[3][3];
@@ -448,7 +449,7 @@ int getTransformOrientation(bContext *C, float normal[3], float plane[3], int ac
Mat3Inv(mat, imat);
Mat3Transp(mat);
- ob= G.obedit;
+ ob= obedit;
if(ob->type==OB_MESH)
{
@@ -598,7 +599,7 @@ int getTransformOrientation(bContext *C, float normal[3], float plane[3], int ac
}
}
} /* end editmesh */
- else if ELEM3(G.obedit->type, OB_CURVE, OB_SURF, OB_FONT)
+ else if ELEM3(obedit->type, OB_CURVE, OB_SURF, OB_FONT)
{
extern ListBase editNurb; /* BOOO! go away stupid extern */
Nurb *nu;
@@ -644,7 +645,7 @@ int getTransformOrientation(bContext *C, float normal[3], float plane[3], int ac
result = ORIENTATION_NORMAL;
}
}
- else if(G.obedit->type==OB_MBALL)
+ else if(obedit->type==OB_MBALL)
{
/* editmball.c */
extern ListBase editelems; /* go away ! */
@@ -681,9 +682,9 @@ int getTransformOrientation(bContext *C, float normal[3], float plane[3], int ac
result = ORIENTATION_NORMAL;
}
}
- else if (G.obedit->type == OB_ARMATURE)
+ else if (obedit->type == OB_ARMATURE)
{
- bArmature *arm = G.obedit->data;
+ bArmature *arm = obedit->data;
EditBone *ebone;
for (ebone = G.edbo.first; ebone; ebone=ebone->next) {
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 9375a776fed..f6207fd7ab0 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -1184,7 +1184,7 @@ int snapObjects(TransInfo *t, int *dist, float *loc, float *no, int mode) {
Object *ob = t->obedit;
EditMesh *em = ((Mesh *)t->obedit->data)->edit_mesh;
- dm = editmesh_get_derived_cage(em, CD_MASK_BAREMESH);
+ dm = editmesh_get_derived_cage(t->obedit, em, CD_MASK_BAREMESH);
retval = snapDerivedMesh(t, ob, dm, ob->obmat, ray_start, ray_normal, t->mval, loc, no, dist, &depth, 1);