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:
authorCampbell Barton <ideasman42@gmail.com>2014-02-12 04:26:02 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-02-12 04:26:02 +0400
commit5c8d5c70cf9b01ba067c625bb0e5c0d26c76cb79 (patch)
treeeab40ffbe96854a75730772cc51b8fa52dc0748a /source/blender/editors/space_view3d/view3d_edit.c
parentbfd0b582ca6c9d7a851490a1f37fb98d4a9cf050 (diff)
View3d: ensure locked views are on an axis - behavior wasn't well defined.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_edit.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c42
1 files changed, 20 insertions, 22 deletions
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index c055a2efb21..fccc4d8e585 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -85,26 +85,6 @@
/* for ndof prints */
// #define DEBUG_NDOF_MOTION
-/**
- * Mostly this function just checks ``rv3d->viewlock & RV3D_LOCKED`` however there is a
- * special case where the flag is set but the user already switched out of an axis locked view.
- *
- * The 'view' in the function name refers to #RegionView3D.view which we may be locked.
- *
- * Functions which change the 'view' should call this check first, or...
- * only apply to the user view (in the instance of a quad-view setup).
- */
-bool ED_view3d_view_lock_check(View3D *UNUSED(v3d), RegionView3D *rv3d)
-{
- if (rv3d->viewlock & RV3D_LOCKED) {
- if ((RV3D_VIEW_IS_AXIS(rv3d->view) || rv3d->view == RV3D_VIEW_CAMERA)) {
- return true;
- }
- }
-
- return false;
-}
-
bool ED_view3d_offset_lock_check(struct View3D *v3d, struct RegionView3D *rv3d)
{
return (rv3d->persp != RV3D_CAMOB) && (v3d->ob_centre_cursor || v3d->ob_centre);
@@ -410,6 +390,24 @@ void ED_view3d_quadview_update(ScrArea *sa, ARegion *ar, bool do_clip)
view3d_boxview_copy(sa, ar_sync ? ar_sync : sa->regionbase.last);
}
+ /* ensure locked regions have an axis, locked user views don't make much sense */
+ if (viewlock & RV3D_LOCKED) {
+ int index_qsplit = 0;
+ for (ar = sa->regionbase.first; ar; ar = ar->next) {
+ if (ar->alignment == RGN_ALIGN_QSPLIT) {
+ rv3d = ar->regiondata;
+ if (rv3d->viewlock) {
+ if (!RV3D_VIEW_IS_AXIS(rv3d->view)) {
+ rv3d->view = ED_view3d_lock_view_from_index(index_qsplit);
+ rv3d->persp = RV3D_ORTHO;
+ ED_view3d_lock(rv3d);
+ }
+ }
+ index_qsplit++;
+ }
+ }
+ }
+
ED_area_tag_redraw(sa);
}
@@ -1006,7 +1004,7 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, const wmEvent *event)
vod = op->customdata;
/* poll should check but in some cases fails, see poll func for details */
- if (ED_view3d_view_lock_check(vod->v3d, vod->rv3d)) {
+ if (vod->rv3d->viewlock & RV3D_LOCKED) {
viewops_data_free(C, op);
return OPERATOR_PASS_THROUGH;
}
@@ -2282,7 +2280,7 @@ static int viewdolly_invoke(bContext *C, wmOperator *op, const wmEvent *event)
vod = op->customdata;
/* poll should check but in some cases fails, see poll func for details */
- if (ED_view3d_view_lock_check(vod->v3d, vod->rv3d)) {
+ if (vod->rv3d->viewlock & RV3D_LOCKED) {
viewops_data_free(C, op);
return OPERATOR_PASS_THROUGH;
}