diff options
Diffstat (limited to 'source/blender/editors/transform/transform_generics.c')
-rw-r--r-- | source/blender/editors/transform/transform_generics.c | 72 |
1 files changed, 45 insertions, 27 deletions
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 8bbeec63155..15e2d32cc94 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -39,7 +39,11 @@ #include "DNA_lattice_types.h" #include "DNA_screen_types.h" #include "DNA_space_types.h" +#include "DNA_scene_types.h" +#include "DNA_object_types.h" +#include "DNA_meshdata_types.h" #include "DNA_view3d_types.h" +#include "DNA_modifier_types.h" #include "RNA_access.h" @@ -54,23 +58,14 @@ #include "BKE_animsys.h" #include "BKE_action.h" -#include "BKE_anim.h" #include "BKE_armature.h" -#include "BKE_cloth.h" #include "BKE_curve.h" #include "BKE_depsgraph.h" #include "BKE_displist.h" -#include "BKE_depsgraph.h" #include "BKE_fcurve.h" -#include "BKE_global.h" -#include "BKE_group.h" #include "BKE_lattice.h" -#include "BKE_key.h" #include "BKE_mesh.h" -#include "BKE_modifier.h" #include "BKE_nla.h" -#include "BKE_object.h" -#include "BKE_utildefines.h" #include "BKE_context.h" #include "ED_anim_api.h" @@ -84,6 +79,7 @@ #include "ED_space_api.h" #include "ED_uvedit.h" #include "ED_view3d.h" +#include "ED_curve.h" /* for ED_curve_editnurbs */ //#include "BDR_unwrapper.h" @@ -189,8 +185,8 @@ static void clipMirrorModifier(TransInfo *t, Object *ob) copy_v3_v3(iloc, td->iloc); if (mmd->mirror_ob) { - mul_v3_m4v3(loc, mtx, loc); - mul_v3_m4v3(iloc, mtx, iloc); + mul_m4_v3(mtx, loc); + mul_m4_v3(mtx, iloc); } clip = 0; @@ -218,7 +214,7 @@ static void clipMirrorModifier(TransInfo *t, Object *ob) } if (clip) { if (mmd->mirror_ob) { - mul_v3_m4v3(loc, imtx, loc); + mul_m4_v3(imtx, loc); } copy_v3_v3(td->loc, loc); } @@ -636,14 +632,15 @@ void recalcData(TransInfo *t) if (t->obedit) { if ELEM(t->obedit->type, OB_CURVE, OB_SURF) { Curve *cu= t->obedit->data; - Nurb *nu= cu->editnurb->first; + ListBase *nurbs= ED_curve_editnurbs(cu); + Nurb *nu= nurbs->first; if(t->state != TRANS_CANCEL) { clipMirrorModifier(t, t->obedit); } DAG_id_flush_update(t->obedit->data, OB_RECALC_DATA); /* sets recalc flags */ - + if (t->state == TRANS_CANCEL) { while(nu) { calchandlesNurb(nu); /* Cant do testhandlesNurb here, it messes up the h1 and h2 flags */ @@ -662,7 +659,7 @@ void recalcData(TransInfo *t) Lattice *la= t->obedit->data; DAG_id_flush_update(t->obedit->data, OB_RECALC_DATA); /* sets recalc flags */ - if(la->editlatt->flag & LT_OUTSIDE) outside_lattice(la->editlatt); + if(la->editlatt->latt->flag & LT_OUTSIDE) outside_lattice(la->editlatt->latt); } else if (t->obedit->type == OB_MESH) { EditMesh *em = ((Mesh*)t->obedit->data)->edit_mesh; @@ -810,7 +807,7 @@ void recalcData(TransInfo *t) /* sets recalc flags fully, instead of flushing existing ones * otherwise proxies don't function correctly */ - DAG_id_flush_update(&ob->id, OB_RECALC); + DAG_id_flush_update(&ob->id, OB_RECALC_OB); } } @@ -960,7 +957,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) { t->current_orientation = RNA_enum_get(op->ptr, "constraint_orientation"); - if (t->current_orientation >= V3D_MANIP_CUSTOM + BIF_countTransformOrientation(C) - 1) + if (t->current_orientation >= V3D_MANIP_CUSTOM + BIF_countTransformOrientation(C)) { t->current_orientation = V3D_MANIP_GLOBAL; } @@ -1031,9 +1028,9 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) { switch(RNA_enum_get(op->ptr, "proportional")) { - case 2: /* XXX connected constant */ + case PROP_EDIT_CONNECTED: t->flag |= T_PROP_CONNECTED; - case 1: /* XXX prop on constant */ + case PROP_EDIT_ON: t->flag |= T_PROP_EDIT; break; } @@ -1043,11 +1040,19 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) /* use settings from scene only if modal */ if (t->flag & T_MODAL) { - if ((t->options & CTX_NO_PET) == 0 && (ts->proportional != PROP_EDIT_OFF)) { - t->flag |= T_PROP_EDIT; + if ((t->options & CTX_NO_PET) == 0) + { + if (t->obedit && ts->proportional != PROP_EDIT_OFF) + { + t->flag |= T_PROP_EDIT; - if(ts->proportional == PROP_EDIT_CONNECTED) - t->flag |= T_PROP_CONNECTED; + if(ts->proportional == PROP_EDIT_CONNECTED) + t->flag |= T_PROP_CONNECTED; + } + else if (t->obedit == NULL && ts->proportional_objects) + { + t->flag |= T_PROP_EDIT; + } } } } @@ -1068,9 +1073,9 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) t->prop_size = 1.0f; } - if (op && RNA_struct_find_property(op->ptr, "proportional_editing_falloff") && RNA_property_is_set(op->ptr, "proportional_editing_falloff")) + if (op && RNA_struct_find_property(op->ptr, "proportional_edit_falloff") && RNA_property_is_set(op->ptr, "proportional_edit_falloff")) { - t->prop_mode = RNA_enum_get(op->ptr, "proportional_editing_falloff"); + t->prop_mode = RNA_enum_get(op->ptr, "proportional_edit_falloff"); } else { @@ -1167,6 +1172,7 @@ static void restoreElement(TransData *td) { if (td->val) { *td->val = td->ival; } + if (td->ext && (td->flag&TD_NO_EXT)==0) { if (td->ext->rot) { VECCOPY(td->ext->rot, td->ext->irot); @@ -1188,11 +1194,23 @@ static void restoreElement(TransData *td) { void restoreTransObjects(TransInfo *t) { TransData *td; - + TransData2D *td2d; + for (td = t->data; td < t->data + t->total; td++) { restoreElement(td); } + for (td2d=t->data2d; t->data2d && td2d < t->data2d + t->total; td2d++) { + if (td2d->h1) { + td2d->h1[0] = td2d->ih1[0]; + td2d->h1[1] = td2d->ih1[1]; + } + if (td2d->h2) { + td2d->h2[0] = td2d->ih2[0]; + td2d->h2[1] = td2d->ih2[1]; + } + } + unit_m3(t->mat); recalcData(t); @@ -1276,7 +1294,7 @@ void calculateCenterMedian(TransInfo *t) if (t->data[i].flag & TD_SELECTED) { if (!(t->data[i].flag & TD_NOCENTER)) { - add_v3_v3v3(partial, partial, t->data[i].center); + add_v3_v3(partial, t->data[i].center); total++; } } |