[Bf-blender-cvs] [317b8d96690] blender2.8: Transform: Snap used multiple eval contexts
Campbell Barton
noreply at git.blender.org
Fri Aug 11 03:30:14 CEST 2017
Commit: 317b8d96690cec6255a1e954ba642b08ef5d54fb
Author: Campbell Barton
Date: Fri Aug 11 11:23:39 2017 +1000
Branches: blender2.8
https://developer.blender.org/rB317b8d96690cec6255a1e954ba642b08ef5d54fb
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.
===================================================================
M source/blender/editors/armature/editarmature_sketch.c
M source/blender/editors/curve/editcurve.c
M source/blender/editors/include/ED_transform.h
M source/blender/editors/include/ED_transform_snap_object_context.h
M source/blender/editors/mesh/editmesh_tools.c
M source/blender/editors/space_view3d/view3d_ruler.c
M source/blender/editors/space_view3d/view3d_walk.c
M source/blender/editors/transform/transform_snap.c
M source/blender/editors/transform/transform_snap_object.c
M source/blender/makesrna/intern/rna_scene_api.c
===================================================================
diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c
index cb4d863b7b5..7407d12f7d7 100644
--- a/source/blender/editors/armature/editarmature_sketch.c
+++ b/source/blender/editors/armature/editarmature_sketch.c
@@ -1005,7 +1005,7 @@ static int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, S
if (ts->snap_mode == SCE_SNAP_MODE_VOLUME) {
float size;
if (peelObjectsSnapContext(
- C, snap_context, mvalf,
+ snap_context, mvalf,
&(const struct SnapObjectParams){
.snap_select = SNAP_NOT_SELECTED,
.use_object_edit_cage = false,
@@ -1045,7 +1045,7 @@ static int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, S
/* try to snap to closer object */
{
if (ED_transform_snap_object_project_view3d(
- C, snap_context,
+ snap_context,
ts->snap_mode,
&(const struct SnapObjectParams){
.snap_select = SNAP_NOT_SELECTED,
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 76b78e643ff..6327dbb8fae 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -5021,7 +5021,7 @@ static int add_vertex_invoke(bContext *C, wmOperator *op, const wmEvent *event)
vc.ar, vc.v3d);
ED_transform_snap_object_project_view3d_mixed(
- C, snap_context,
+ snap_context,
SCE_SELECT_FACE,
&(const struct SnapObjectParams){
.snap_select = (vc.scene->obedit != NULL) ? SNAP_NOT_ACTIVE : SNAP_ALL,
diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h
index 39dd6024022..483caf7c475 100644
--- a/source/blender/editors/include/ED_transform.h
+++ b/source/blender/editors/include/ED_transform.h
@@ -182,7 +182,7 @@ bool peelObjectsTransform(
/* return args */
float r_loc[3], float r_no[3], float *r_thickness);
bool peelObjectsSnapContext(
- const struct bContext *C, struct SnapObjectContext *sctx,
+ struct SnapObjectContext *sctx,
const float mval[2],
const struct SnapObjectParams *params,
const bool use_peel_object,
diff --git a/source/blender/editors/include/ED_transform_snap_object_context.h b/source/blender/editors/include/ED_transform_snap_object_context.h
index 4f93c35b8d6..3a042ebfb1d 100644
--- a/source/blender/editors/include/ED_transform_snap_object_context.h
+++ b/source/blender/editors/include/ED_transform_snap_object_context.h
@@ -85,34 +85,34 @@ void ED_transform_snap_object_context_set_editmesh_callbacks(
void *user_data);
bool ED_transform_snap_object_project_ray_ex(
- const struct bContext *C, struct SnapObjectContext *sctx,
+ struct SnapObjectContext *sctx,
const struct SnapObjectParams *params,
const float ray_start[3], const float ray_normal[3], float *ray_depth,
/* return args */
float r_loc[3], float r_no[3], int *r_index,
struct Object **r_ob, float r_obmat[4][4]);
bool ED_transform_snap_object_project_ray(
- const struct bContext *C, SnapObjectContext *sctx,
+ SnapObjectContext *sctx,
const struct SnapObjectParams *params,
const float ray_origin[3], const float ray_direction[3], float *ray_depth,
float r_co[3], float r_no[3]);
bool ED_transform_snap_object_project_ray_all(
- const struct bContext *C, SnapObjectContext *sctx,
+ SnapObjectContext *sctx,
const struct SnapObjectParams *params,
const float ray_start[3], const float ray_normal[3],
float ray_depth, bool sort,
struct ListBase *r_hit_list);
bool ED_transform_snap_object_project_view3d_ex(
- const struct bContext *C, struct SnapObjectContext *sctx,
+ struct SnapObjectContext *sctx,
const unsigned short snap_to,
const struct SnapObjectParams *params,
const float mval[2], float *dist_px,
float *ray_depth,
float r_loc[3], float r_no[3], int *r_index);
bool ED_transform_snap_object_project_view3d(
- const struct bContext *C, struct SnapObjectContext *sctx,
+ struct SnapObjectContext *sctx,
const unsigned short snap_to,
const struct SnapObjectParams *params,
const float mval[2], float *dist_px,
@@ -120,7 +120,7 @@ bool ED_transform_snap_object_project_view3d(
/* return args */
float r_loc[3], float r_no[3]);
bool ED_transform_snap_object_project_view3d_mixed(
- const struct bContext *C, SnapObjectContext *sctx,
+ SnapObjectContext *sctx,
const unsigned short snap_to_flag,
const struct SnapObjectParams *params,
const float mval_fl[2], float *dist_px,
@@ -128,7 +128,7 @@ bool ED_transform_snap_object_project_view3d_mixed(
float r_co[3], float r_no[3]);
bool ED_transform_snap_object_project_all_view3d_ex(
- const struct bContext *C, SnapObjectContext *sctx,
+ SnapObjectContext *sctx,
const struct SnapObjectParams *params,
const float mval[2],
float ray_depth, bool sort,
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 023b05db62f..cbed6a37c1f 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -317,7 +317,7 @@ void EMBM_project_snap_verts(bContext *C, ARegion *ar, BMEditMesh *em)
float mval[2], co_proj[3];
if (ED_view3d_project_float_object(ar, eve->co, mval, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) {
if (ED_transform_snap_object_project_view3d_mixed(
- C, snap_context,
+ snap_context,
SCE_SELECT_FACE,
&(const struct SnapObjectParams){
.snap_select = SNAP_NOT_ACTIVE,
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
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list