Merge branch 'master' into blender2.8
authorCampbell Barton <ideasman42@gmail.com>
Sun, 11 Mar 2018 05:08:12 +0000 (16:08 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 11 Mar 2018 05:11:56 +0000 (16:11 +1100)
1  2 
source/blender/editors/space_view3d/view3d_select.c

index a90a719b556a53f5f7a94a97f666f0bd75c39477,1f9f941a507bf609a2fcdcb02bdf47c922b1b499..5614ba9b0db364098d6564383b75586cc37bb014
@@@ -461,9 -485,7 +464,9 @@@ static void do_lasso_select_mesh__doSel
        }
  }
  
 -static void do_lasso_select_mesh(ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select)
 +static void do_lasso_select_mesh(
-         const struct EvaluationContext *eval_ctx, ViewContext *vc,
++        const EvaluationContext *eval_ctx, ViewContext *vc,
 +        const int mcords[][2], short moves, bool extend, bool select)
  {
        LassoSelectUserData data;
        ToolSettings *ts = vc->scene->toolsettings;
@@@ -709,7 -734,7 +715,9 @@@ static void do_lasso_select_meshobject_
                SET_FLAG_FROM_TEST(mv->flag, data->select, SELECT);
        }
  }
- static void do_lasso_select_paintvert(const struct EvaluationContext *eval_ctx, ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select)
 -static void do_lasso_select_paintvert(ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select)
++static void do_lasso_select_paintvert(
++        const EvaluationContext *eval_ctx,
++        ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select)
  {
        const bool use_zbuf = (vc->v3d->flag & V3D_ZBUF_SELECT) != 0;
        Object *ob = vc->obact;
  
                ED_view3d_init_mats_rv3d(vc->obact, vc->rv3d);
  
-               meshobject_foreachScreenVert(eval_ctx, vc, do_lasso_select_meshobject__doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
 -              meshobject_foreachScreenVert(vc, do_lasso_select_meshobject__doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
--
++              meshobject_foreachScreenVert(
++                      eval_ctx, vc, do_lasso_select_meshobject__doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
        }
  
        if (select == false) {
        }
        paintvert_flush_flags(ob);
  }
- static void do_lasso_select_paintface(const struct EvaluationContext *eval_ctx, ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select)
 -static void do_lasso_select_paintface(ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select)
++static void do_lasso_select_paintface(
++        const EvaluationContext *eval_ctx,
++        ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select)
  {
        Object *ob = vc->obact;
        Mesh *me = ob->data;
@@@ -1394,13 -1410,14 +1406,14 @@@ static bool ed_object_select_pick
                else {
                        base = startbase;
                        while (base) {
 -                              if (BASE_SELECTABLE(v3d, base)) {
 +                              if (BASE_SELECTABLE(base)) {
                                        float screen_co[2];
-                                       if (ED_view3d_project_float_global(ar, base->object->obmat[3], screen_co,
-                                                                          V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN | V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK)
+                                       if (ED_view3d_project_float_global(
+                                                   ar, base->object->obmat[3], screen_co,
+                                                   V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN | V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK)
                                        {
                                                float dist_temp = len_manhattan_v2v2(mval_fl, screen_co);
 -                                              if (base == BASACT) dist_temp += 10.0f;
 +                                              if (base == BASACT(view_layer)) dist_temp += 10.0f;
                                                if (dist_temp < dist) {
                                                        dist = dist_temp;
                                                        basact = base;
@@@ -1609,7 -1624,7 +1623,8 @@@ bool edge_inside_circle(const float cen
        return (dist_squared_to_line_segment_v2(cent, screen_co_a, screen_co_b) < radius_squared);
  }
  
--static void do_paintvert_box_select__doSelectVert(void *userData, MVert *mv, const float screen_co[2], int UNUSED(index))
++static void do_paintvert_box_select__doSelectVert(
++        void *userData, MVert *mv, const float screen_co[2], int UNUSED(index))
  {
        BoxSelectUserData *data = userData;
  
@@@ -1805,8 -1821,7 +1822,8 @@@ static void do_mesh_box_select__doSelec
                BM_face_select_set(data->vc->em->bm, efa, data->select);
        }
  }
 -static int do_mesh_box_select(ViewContext *vc, rcti *rect, bool select, bool extend)
 +static int do_mesh_box_select(
-         const struct EvaluationContext *eval_ctx, ViewContext *vc, rcti *rect, bool select, bool extend)
++        const EvaluationContext *eval_ctx, ViewContext *vc, rcti *rect, bool select, bool extend)
  {
        BoxSelectUserData data;
        ToolSettings *ts = vc->scene->toolsettings;
        return OPERATOR_FINISHED;
  }
  
 -static int do_meta_box_select(ViewContext *vc, rcti *rect, bool select, bool extend)
 +static int do_meta_box_select(
-         const struct EvaluationContext *eval_ctx, ViewContext *vc,
++        const EvaluationContext *eval_ctx, ViewContext *vc,
 +        const rcti *rect, bool select, bool extend)
  {
        MetaBall *mb = (MetaBall *)vc->obedit->data;
        MetaElem *ml;
        return OPERATOR_FINISHED;
  }
  
 -static int do_armature_box_select(ViewContext *vc, rcti *rect, bool select, bool extend)
 +static int do_armature_box_select(
-         const struct EvaluationContext *eval_ctx, ViewContext *vc,
++        const EvaluationContext *eval_ctx, ViewContext *vc,
 +        const rcti *rect, bool select, bool extend)
  {
        bArmature *arm = vc->obedit->data;
        EditBone *ebone;
@@@ -2412,7 -2394,7 +2431,9 @@@ static void mesh_circle_doSelectFace(vo
        }
  }
  
- static void mesh_circle_select(const struct EvaluationContext *eval_ctx, ViewContext *vc, const bool select, const int mval[2], float rad)
 -static void mesh_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad)
++static void mesh_circle_select(
++        const EvaluationContext *eval_ctx,
++        ViewContext *vc, const bool select, const int mval[2], float rad)
  {
        ToolSettings *ts = vc->scene->toolsettings;
        int bbsel;
        EDBM_selectmode_flush(vc->em);
  }
  
- static void paint_facesel_circle_select(const struct EvaluationContext *eval_ctx, ViewContext *vc, const bool select, const int mval[2], float rad)
 -static void paint_facesel_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad)
++static void paint_facesel_circle_select(
++        const EvaluationContext *eval_ctx,
++        ViewContext *vc, const bool select, const int mval[2], float rad)
  {
        Object *ob = vc->obact;
        Mesh *me = ob->data;
@@@ -2480,7 -2463,7 +2504,8 @@@ static void paint_vertsel_circle_select
                SET_FLAG_FROM_TEST(mv->flag, data->select, SELECT);
        }
  }
- static void paint_vertsel_circle_select(const struct EvaluationContext *eval_ctx, ViewContext *vc, const bool select, const int mval[2], float rad)
 -static void paint_vertsel_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad)
++static void paint_vertsel_circle_select(
++        const EvaluationContext *eval_ctx, ViewContext *vc, const bool select, const int mval[2], float rad)
  {
        const bool use_zbuf = (vc->v3d->flag & V3D_ZBUF_SELECT) != 0;
        Object *ob = vc->obact;
                ED_view3d_init_mats_rv3d(vc->obact, vc->rv3d); /* for foreach's screen/vert projection */
  
                view3d_userdata_circleselect_init(&data, vc, select, mval, rad);
-               meshobject_foreachScreenVert(eval_ctx, vc, paint_vertsel_circle_select_doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
 -              meshobject_foreachScreenVert(vc, paint_vertsel_circle_select_doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
++              meshobject_foreachScreenVert(
++                      eval_ctx, vc, paint_vertsel_circle_select_doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
        }
  
        if (select != LEFTMOUSE) {
@@@ -2757,8 -2743,7 +2786,8 @@@ static void mball_circle_select(ViewCon
  
  /** Callbacks for circle selection in Editmode */
  
 -static void obedit_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad)
 +static void obedit_circle_select(
-         const struct EvaluationContext *eval_ctx, ViewContext *vc, const bool select, const int mval[2], float rad)
++        const EvaluationContext *eval_ctx, ViewContext *vc, const bool select, const int mval[2], float rad)
  {
        switch (vc->obedit->type) {
                case OB_MESH:
@@@ -2792,14 -2777,15 +2821,15 @@@ static bool object_circle_select(ViewCo
  
  
        Base *base;
 -      for (base = FIRSTBASE; base; base = base->next) {
 -              if (BASE_SELECTABLE(vc->v3d, base) && ((base->flag & SELECT) != select_flag)) {
 +      for (base = FIRSTBASE(view_layer); base; base = base->next) {
 +              if (BASE_SELECTABLE(base) && ((base->flag & BASE_SELECTED) != select_flag)) {
                        float screen_co[2];
-                       if (ED_view3d_project_float_global(vc->ar, base->object->obmat[3], screen_co,
-                                                          V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN | V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK)
+                       if (ED_view3d_project_float_global(
+                                   vc->ar, base->object->obmat[3], screen_co,
+                                   V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN | V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK)
                        {
                                if (len_squared_v2v2(mval_fl, screen_co) <= radius_squared) {
 -                                      ED_base_object_select(base, select ? BA_SELECT : BA_DESELECT);
 +                                      ED_object_base_select(base, select ? BA_SELECT : BA_DESELECT);
                                        changed = true;
                                }
                        }