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>2011-05-12 10:52:24 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-05-12 10:52:24 +0400
commit2f08309ffe0f1a005f4f7e26bc6d9d4b15fbf822 (patch)
tree5a683a22b8a67c84d09d552a910a93affb711786
parenta131ce066a8ef4730892dbbf58517535e6ca0188 (diff)
window_to_3d_vector was incorrect but dolly view operator was accounting for it. fixed so result isnt negated and mouse coords dont need to be adjusted.
-rw-r--r--release/scripts/modules/view3d_utils.py2
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c10
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c10
3 files changed, 12 insertions, 10 deletions
diff --git a/release/scripts/modules/view3d_utils.py b/release/scripts/modules/view3d_utils.py
index a4e05e7e1c0..15f5aaa20b7 100644
--- a/release/scripts/modules/view3d_utils.py
+++ b/release/scripts/modules/view3d_utils.py
@@ -65,7 +65,7 @@ def region_2d_to_location_3d(region, rv3d, coord, depth_location):
from mathutils.geometry import intersect_point_line
origin_start = rv3d.view_matrix.inverted()[3].to_3d()
origin_end = origin_start + region_2d_to_vector_3d(region, rv3d, coord)
- return intersect_point_line(depth_vector, origin_start, origin_end)[0]
+ return intersect_point_line(depth_location, origin_start, origin_end)[0]
def location_3d_to_region_2d(region, rv3d, coord):
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 30bfc355480..fb0a33674f7 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -396,7 +396,7 @@ static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event)
}
/* for dolly */
- window_to_3d_vector(vod->ar, vod->mousevec, (vod->oldx - vod->ar->winrct.xmin)-(vod->ar->winx)/2, (vod->oldy - vod->ar->winrct.ymin)-(vod->ar->winy)/2);
+ window_to_3d_vector(vod->ar, vod->mousevec, vod->oldx - vod->ar->winrct.xmin, vod->oldy - vod->ar->winrct.ymin);
/* lookup, we dont pass on v3d to prevent confusement */
vod->grid= v3d->grid;
@@ -1349,7 +1349,7 @@ void VIEW3D_OT_zoom(wmOperatorType *ot)
static void view_dolly_mouseloc(ARegion *ar, float orig_ofs[3], float dvec[3], float dfac)
{
RegionView3D *rv3d= ar->regiondata;
- madd_v3_v3v3fl(rv3d->ofs, orig_ofs, dvec, 1.0 - dfac);
+ madd_v3_v3v3fl(rv3d->ofs, orig_ofs, dvec, -(1.0 - dfac));
}
static void viewdolly_apply(ViewOpsData *vod, int x, int y, const short zoom_invert)
@@ -1444,7 +1444,8 @@ static int viewdolly_exec(bContext *C, wmOperator *op)
else {
sa= CTX_wm_area(C);
ar= CTX_wm_region(C);
- normalize_v3_v3(mousevec, ((RegionView3D *)ar->regiondata)->viewinv[2]);
+ negate_v3_v3(mousevec, ((RegionView3D *)ar->regiondata)->viewinv[2]);
+ normalize_v3(mousevec);
}
/* v3d= sa->spacedata.first; */ /* UNUSED */
@@ -1498,7 +1499,8 @@ static int viewdolly_invoke(bContext *C, wmOperator *op, wmEvent *event)
/* overwrite the mouse vector with the view direction (zoom into the center) */
if((U.uiflag & USER_ZOOM_TO_MOUSEPOS) == 0) {
- normalize_v3_v3(vod->mousevec, vod->rv3d->viewinv[2]);
+ negate_v3_v3(vod->mousevec, vod->rv3d->viewinv[2]);
+ normalize_v3(vod->mousevec);
}
if (event->type == MOUSEZOOM) {
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index b46c7236170..f8a5a5ad78a 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -687,15 +687,15 @@ void window_to_3d_vector(ARegion *ar, float out[3], short mx, short my)
float dx, dy;
float viewvec[3];
- dx= 2.0f*mx/ar->winx;
- dy= 2.0f*my/ar->winy;
+ dx= (2.0f * mx / ar->winx) - 1.0f;
+ dy= (2.0f * my / ar->winy) - 1.0f;
/* normalize here so vecs are proportional to eachother */
normalize_v3_v3(viewvec, rv3d->viewinv[2]);
- out[0]= viewvec[0] - (rv3d->persinv[0][0]*dx + rv3d->persinv[1][0]*dy);
- out[1]= viewvec[1] - (rv3d->persinv[0][1]*dx + rv3d->persinv[1][1]*dy);
- out[2]= viewvec[2] - (rv3d->persinv[0][2]*dx + rv3d->persinv[1][2]*dy);
+ out[0]= (rv3d->persinv[0][0]*dx + rv3d->persinv[1][0]*dy) - viewvec[0];
+ out[1]= (rv3d->persinv[0][1]*dx + rv3d->persinv[1][1]*dy) - viewvec[1];
+ out[2]= (rv3d->persinv[0][2]*dx + rv3d->persinv[1][2]*dy) - viewvec[2];
normalize_v3(out);
}