[Bf-blender-cvs] [e848cb9] master: Fix for knife when in ortho camera view
Campbell Barton
noreply at git.blender.org
Mon Jun 16 20:11:16 CEST 2014
Commit: e848cb9e48541cebe6bf47674e6db71d152d759f
Author: Campbell Barton
Date: Tue Jun 17 03:48:01 2014 +1000
https://developer.blender.org/rBe848cb9e48541cebe6bf47674e6db71d152d759f
Fix for knife when in ortho camera view
===================================================================
M source/blender/editors/mesh/editmesh_knife.c
M source/blender/editors/space_view3d/view3d_project.c
===================================================================
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index 0c84199..8be8c41 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -1177,8 +1177,8 @@ static bool point_is_visible(KnifeTool_OpData *kcd, const float p[3], const floa
madd_v3_v3v3fl(p_ofs, p, view, KNIFE_FLT_EPSBIG * 3.0f);
/* avoid projecting behind the viewpoint */
- if (kcd->is_ortho) {
- dist = FLT_MAX;
+ if (kcd->is_ortho && (kcd->vc.rv3d->persp != RV3D_CAMOB)) {
+ dist = kcd->vc.v3d->far * 2.0f;
}
/* see if there's a face hit between p1 and the view */
@@ -1215,7 +1215,7 @@ static void set_linehit_depth(KnifeTool_OpData *kcd, KnifeLineHit *lh)
ED_view3d_win_to_segment(kcd->ar, kcd->vc.v3d, lh->schit, vnear, vfar, true);
mul_m4_v3(kcd->ob->imat, vnear);
- if (kcd->is_ortho) {
+ if (kcd->is_ortho && (kcd->vc.rv3d->persp != RV3D_CAMOB)) {
if (kcd->ortho_extent == 0.0f)
calc_ortho_extent(kcd);
clip_to_ortho_planes(vnear, vfar, kcd->ortho_extent + 10.0f);
@@ -1291,7 +1291,7 @@ static void knife_find_line_hits(KnifeTool_OpData *kcd)
* this gives precision error; rather then solving properly
* (which may involve using doubles everywhere!),
* limit the distance between these points */
- if (kcd->is_ortho) {
+ if (kcd->is_ortho && (kcd->vc.rv3d->persp != RV3D_CAMOB)) {
if (kcd->ortho_extent == 0.0f)
calc_ortho_extent(kcd);
clip_to_ortho_planes(v1, v3, kcd->ortho_extent + 10.0f);
diff --git a/source/blender/editors/space_view3d/view3d_project.c b/source/blender/editors/space_view3d/view3d_project.c
index 00ce51a..9b14df4 100644
--- a/source/blender/editors/space_view3d/view3d_project.c
+++ b/source/blender/editors/space_view3d/view3d_project.c
@@ -320,6 +320,7 @@ static void view3d_win_to_ray_segment(const ARegion *ar, View3D *v3d, const floa
end_offset = v3d->far;
}
else {
+ const float ortho_extent = 1000.0f;
float vec[4];
vec[0] = 2.0f * mval[0] / ar->winx - 1;
vec[1] = 2.0f * mval[1] / ar->winy - 1;
@@ -329,8 +330,8 @@ static void view3d_win_to_ray_segment(const ARegion *ar, View3D *v3d, const floa
mul_m4_v4(rv3d->persinv, vec);
copy_v3_v3(r_ray_co, vec);
- start_offset = -1000.0f;
- end_offset = 1000.0f;
+ start_offset = (rv3d->persp == RV3D_CAMOB) ? 0.0f : -ortho_extent;
+ end_offset = ortho_extent;
}
if (r_ray_start) {
More information about the Bf-blender-cvs
mailing list