diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/transform/transform.h | 1 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_conversions.c | 23 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_generics.c | 5 |
3 files changed, 17 insertions, 12 deletions
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 5cac49aff34..3f8166216ba 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -384,6 +384,7 @@ typedef struct TransInfo { #define T_EDIT (1 << 1) #define T_POSE (1 << 2) #define T_TEXTURE (1 << 3) + /* transforming the camera while in camera view */ #define T_CAMERA (1 << 4) // trans on points, having no rotation/scale #define T_POINTS (1 << 6) diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index a8c6f476999..97e517cabfe 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -4776,7 +4776,8 @@ static bool constraints_list_needinv(TransInfo *t, ListBase *list) } /* transcribe given object into TransData for Transforming */ -static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob) +static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob, + const Object *ob_act) { Scene *scene = t->scene; bool constinv; @@ -4902,7 +4903,7 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob) } /* set active flag */ - if (ob == OBACT) { + if (ob == ob_act) { td->flag |= TD_ACTIVE; } } @@ -5907,6 +5908,9 @@ int special_transform_moving(TransInfo *t) static void createTransObject(bContext *C, TransInfo *t) { + Scene *scene = t->scene; + const Object *ob_act = OBACT; + TransData *td = NULL; TransDataExtension *tx; int propmode = t->flag & T_PROP_EDIT; @@ -5948,7 +5952,7 @@ static void createTransObject(bContext *C, TransInfo *t) td->flag |= TD_SKIP; } - ObjectToTransData(t, td, ob); + ObjectToTransData(t, td, ob, ob_act); td->val = NULL; td++; tx++; @@ -5956,7 +5960,6 @@ static void createTransObject(bContext *C, TransInfo *t) CTX_DATA_END; if (propmode) { - Scene *scene = t->scene; View3D *v3d = t->view; Base *base; @@ -5971,7 +5974,7 @@ static void createTransObject(bContext *C, TransInfo *t) td->ext = tx; td->ext->rotOrder = ob->rotmode; - ObjectToTransData(t, td, ob); + ObjectToTransData(t, td, ob, ob_act); td->val = NULL; td++; tx++; @@ -7052,11 +7055,15 @@ void createTransData(bContext *C, TransInfo *t) sort_trans_data_dist(t); } + /* Check if we're transforming the camera from the camera */ if ((t->spacetype == SPACE_VIEW3D) && (t->ar->regiontype == RGN_TYPE_WINDOW)) { View3D *v3d = t->view; - RegionView3D *rv3d = CTX_wm_region_view3d(C); - if (rv3d && (t->flag & T_OBJECT) && v3d->camera == OBACT && rv3d->persp == RV3D_CAMOB) { - t->flag |= T_CAMERA; + RegionView3D *rv3d = t->ar->regiondata; + if ((rv3d->persp == RV3D_CAMOB) && v3d->camera) { + /* we could have a flag to easily check an object is being transformed */ + if (v3d->camera->recalc) { + t->flag |= T_CAMERA; + } } } } diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 8e7e5c4c1ce..79ae0efbcb3 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -1715,11 +1715,8 @@ void calculateCenter(TransInfo *t) /* for panning from cameraview */ if (t->flag & T_OBJECT) { if (t->spacetype == SPACE_VIEW3D && t->ar && t->ar->regiontype == RGN_TYPE_WINDOW) { - View3D *v3d = t->view; - Scene *scene = t->scene; - RegionView3D *rv3d = t->ar->regiondata; - if (v3d->camera == OBACT && rv3d->persp == RV3D_CAMOB) { + if (t->flag & T_CAMERA) { float axis[3]; /* persinv is nasty, use viewinv instead, always right */ copy_v3_v3(axis, t->viewinv[2]); |