diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-08-11 04:23:39 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-08-11 04:23:39 +0300 |
commit | 317b8d96690cec6255a1e954ba642b08ef5d54fb (patch) | |
tree | eb2c37bc74d60a00fe5a52a77997c559847361e5 /source/blender/editors/space_view3d | |
parent | d1328feeb125328615bcf832cbc82d9f9a18e023 (diff) |
Transform: Snap used multiple eval contexts
Changes for 2.8x to use EvaluationContext caused some confusion
- Would use scene layer passed from snap context.
- Would generate duplis from Main eval context.
- Would take context argument and use it to create another eval context.
Adding context args all over and filling in a new eval-context
for every ray-cast test isn't ideal either.
Remove the context argument since the purpose of
SnapObjectContext is to avoid this kind of confusion.
Store the EvaluationContext once and re-use.
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_ruler.c | 14 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_walk.c | 14 |
2 files changed, 14 insertions, 14 deletions
diff --git a/source/blender/editors/space_view3d/view3d_ruler.c b/source/blender/editors/space_view3d/view3d_ruler.c index acf8ed29c6b..f62a12b071f 100644 --- a/source/blender/editors/space_view3d/view3d_ruler.c +++ b/source/blender/editors/space_view3d/view3d_ruler.c @@ -738,7 +738,7 @@ static void view3d_ruler_item_project(RulerInfo *ruler_info, float r_co[3], /* use for mousemove events */ static bool view3d_ruler_item_mousemove( - const bContext *C, RulerInfo *ruler_info, const int mval[2], + RulerInfo *ruler_info, const int mval[2], const bool do_thickness, const bool do_snap) { const float eps_bias = 0.0002f; @@ -763,7 +763,7 @@ static bool view3d_ruler_item_mousemove( co_other = ruler_item->co[ruler_item->co_index == 0 ? 2 : 0]; if (ED_transform_snap_object_project_view3d_mixed( - C, ruler_info->snap_context, + ruler_info->snap_context, SCE_SELECT_FACE, &(const struct SnapObjectParams){ .snap_select = SNAP_ALL, @@ -776,7 +776,7 @@ static bool view3d_ruler_item_mousemove( /* add some bias */ madd_v3_v3v3fl(ray_start, co, ray_normal, eps_bias); ED_transform_snap_object_project_ray( - C, ruler_info->snap_context, + ruler_info->snap_context, &(const struct SnapObjectParams){ .snap_select = SNAP_ALL, .use_object_edit_cage = true, @@ -792,7 +792,7 @@ static bool view3d_ruler_item_mousemove( bool use_depth = (v3d->drawtype >= OB_SOLID); if (ED_transform_snap_object_project_view3d_mixed( - C, ruler_info->snap_context, + ruler_info->snap_context, (SCE_SELECT_VERTEX | SCE_SELECT_EDGE) | (use_depth ? SCE_SELECT_FACE : 0), &(const struct SnapObjectParams){ .snap_select = SNAP_ALL, @@ -924,7 +924,7 @@ static int view3d_ruler_modal(bContext *C, wmOperator *op, const wmEvent *event) if (use_depth) { /* snap the first point added, not essential but handy */ ruler_item->co_index = 0; - view3d_ruler_item_mousemove(C, ruler_info, event->mval, false, true); + view3d_ruler_item_mousemove(ruler_info, event->mval, false, true); copy_v3_v3(ruler_info->drag_start_co, ruler_item->co[ruler_item->co_index]); } else { @@ -977,7 +977,7 @@ static int view3d_ruler_modal(bContext *C, wmOperator *op, const wmEvent *event) } /* update the new location */ - view3d_ruler_item_mousemove(C, ruler_info, event->mval, + view3d_ruler_item_mousemove(ruler_info, event->mval, event->shift != 0, event->ctrl != 0); do_draw = true; } @@ -1026,7 +1026,7 @@ static int view3d_ruler_modal(bContext *C, wmOperator *op, const wmEvent *event) case MOUSEMOVE: { if (ruler_info->state == RULER_STATE_DRAG) { - if (view3d_ruler_item_mousemove(C, ruler_info, event->mval, + if (view3d_ruler_item_mousemove(ruler_info, event->mval, event->shift != 0, event->ctrl != 0)) { do_draw = true; diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c index 4ff084129c3..d4642edf084 100644 --- a/source/blender/editors/space_view3d/view3d_walk.c +++ b/source/blender/editors/space_view3d/view3d_walk.c @@ -423,7 +423,7 @@ static void walk_navigation_mode_set(bContext *C, wmOperator *op, WalkInfo *walk * \param r_distance Distance to the hit point */ static bool walk_floor_distance_get( - const bContext *C, RegionView3D *rv3d, WalkInfo *walk, const float dvec[3], + RegionView3D *rv3d, WalkInfo *walk, const float dvec[3], float *r_distance) { float ray_normal[3] = {0, 0, -1}; /* down */ @@ -441,7 +441,7 @@ static bool walk_floor_distance_get( add_v3_v3(ray_start, dvec_tmp); ret = ED_transform_snap_object_project_ray( - C, walk->snap_context, + walk->snap_context, &(const struct SnapObjectParams){ .snap_select = SNAP_ALL, }, @@ -459,7 +459,7 @@ static bool walk_floor_distance_get( * \param r_normal Normal of the hit surface, transformed to always face the camera */ static bool walk_ray_cast( - const bContext *C, RegionView3D *rv3d, WalkInfo *walk, + RegionView3D *rv3d, WalkInfo *walk, float r_location[3], float r_normal[3], float *ray_distance) { float ray_normal[3] = {0, 0, -1}; /* forward */ @@ -475,7 +475,7 @@ static bool walk_ray_cast( normalize_v3(ray_normal); ret = ED_transform_snap_object_project_ray( - C, walk->snap_context, + walk->snap_context, &(const struct SnapObjectParams){ .snap_select = SNAP_ALL, }, @@ -921,7 +921,7 @@ static void walkEvent(bContext *C, wmOperator *op, WalkInfo *walk, const wmEvent { float loc[3], nor[3]; float distance; - bool ret = walk_ray_cast(C, walk->rv3d, walk, loc, nor, &distance); + bool ret = walk_ray_cast(walk->rv3d, walk, loc, nor, &distance); /* in case we are teleporting middle way from a jump */ walk->speed_jump = 0.0f; @@ -1201,7 +1201,7 @@ static int walkApply(bContext *C, wmOperator *op, WalkInfo *walk) float difference = -100.0f; float fall_distance; - ret = walk_floor_distance_get(C, rv3d, walk, dvec, &ray_distance); + ret = walk_floor_distance_get(rv3d, walk, dvec, &ray_distance); if (ret) { difference = walk->view_height - ray_distance; @@ -1254,7 +1254,7 @@ static int walkApply(bContext *C, wmOperator *op, WalkInfo *walk) if (t > walk->teleport.duration) { /* check to see if we are landing */ - ret = walk_floor_distance_get(C, rv3d, walk, dvec, &ray_distance); + ret = walk_floor_distance_get(rv3d, walk, dvec, &ray_distance); if (ret) { difference = walk->view_height - ray_distance; |