Merge branch 'master' into blender2.8
This commit is contained in:
@@ -224,9 +224,10 @@ typedef struct LassoSelectUserData {
|
||||
bool is_changed;
|
||||
} LassoSelectUserData;
|
||||
|
||||
static void view3d_userdata_lassoselect_init(LassoSelectUserData *r_data,
|
||||
ViewContext *vc, const rcti *rect, const int (*mcords)[2],
|
||||
const int moves, const bool select)
|
||||
static void view3d_userdata_lassoselect_init(
|
||||
LassoSelectUserData *r_data,
|
||||
ViewContext *vc, const rcti *rect, const int (*mcords)[2],
|
||||
const int moves, const bool select)
|
||||
{
|
||||
r_data->vc = vc;
|
||||
|
||||
@@ -302,7 +303,8 @@ static bool edge_inside_rect(const rctf *rect, const float v1[2], const float v2
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void do_lasso_select_pose__doSelectBone(void *userData, struct bPoseChannel *pchan, const float screen_co_a[2], const float screen_co_b[2])
|
||||
static void do_lasso_select_pose__doSelectBone(
|
||||
void *userData, struct bPoseChannel *pchan, const float screen_co_a[2], const float screen_co_b[2])
|
||||
{
|
||||
LassoSelectUserData *data = userData;
|
||||
bArmature *arm = data->vc->obact->data;
|
||||
@@ -424,7 +426,8 @@ static void do_lasso_select_mesh__doSelectVert(void *userData, BMVert *eve, cons
|
||||
BM_vert_select_set(data->vc->em->bm, eve, data->select);
|
||||
}
|
||||
}
|
||||
static void do_lasso_select_mesh__doSelectEdge(void *userData, BMEdge *eed, const float screen_co_a[2], const float screen_co_b[2], int index)
|
||||
static void do_lasso_select_mesh__doSelectEdge(
|
||||
void *userData, BMEdge *eed, const float screen_co_a[2], const float screen_co_b[2], int index)
|
||||
{
|
||||
LassoSelectUserData *data = userData;
|
||||
|
||||
@@ -462,7 +465,7 @@ static void do_lasso_select_mesh__doSelectFace(void *userData, BMFace *efa, cons
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -518,7 +521,8 @@ static void do_lasso_select_mesh(
|
||||
EDBM_selectmode_flush(vc->em);
|
||||
}
|
||||
|
||||
static void do_lasso_select_curve__doSelect(void *userData, Nurb *UNUSED(nu), BPoint *bp, BezTriple *bezt, int beztindex, const float screen_co[2])
|
||||
static void do_lasso_select_curve__doSelect(
|
||||
void *userData, Nurb *UNUSED(nu), BPoint *bp, BezTriple *bezt, int beztindex, const float screen_co[2])
|
||||
{
|
||||
LassoSelectUserData *data = userData;
|
||||
Object *obedit = data->vc->obedit;
|
||||
@@ -593,7 +597,8 @@ static void do_lasso_select_lattice(ViewContext *vc, const int mcords[][2], shor
|
||||
lattice_foreachScreenVert(vc, do_lasso_select_lattice__doSelect, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
|
||||
}
|
||||
|
||||
static void do_lasso_select_armature__doSelectBone(void *userData, struct EditBone *ebone, const float screen_co_a[2], const float screen_co_b[2])
|
||||
static void do_lasso_select_armature__doSelectBone(
|
||||
void *userData, struct EditBone *ebone, const float screen_co_a[2], const float screen_co_b[2])
|
||||
{
|
||||
LassoSelectUserData *data = userData;
|
||||
bArmature *arm = data->vc->obedit->data;
|
||||
@@ -699,7 +704,8 @@ static void do_lasso_select_meta(ViewContext *vc, const int mcords[][2], short m
|
||||
mball_foreachScreenElem(vc, do_lasso_select_mball__doSelectElem, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
|
||||
}
|
||||
|
||||
static void do_lasso_select_meshobject__doSelectVert(void *userData, MVert *mv, const float screen_co[2], int UNUSED(index))
|
||||
static void do_lasso_select_meshobject__doSelectVert(
|
||||
void *userData, MVert *mv, const float screen_co[2], int UNUSED(index))
|
||||
{
|
||||
LassoSelectUserData *data = userData;
|
||||
|
||||
@@ -709,7 +715,9 @@ static void do_lasso_select_meshobject__doSelectVert(void *userData, MVert *mv,
|
||||
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(
|
||||
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;
|
||||
@@ -740,8 +748,8 @@ static void do_lasso_select_paintvert(const struct EvaluationContext *eval_ctx,
|
||||
|
||||
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(
|
||||
eval_ctx, vc, do_lasso_select_meshobject__doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
|
||||
}
|
||||
|
||||
if (select == false) {
|
||||
@@ -749,7 +757,9 @@ static void do_lasso_select_paintvert(const struct EvaluationContext *eval_ctx,
|
||||
}
|
||||
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(
|
||||
const EvaluationContext *eval_ctx,
|
||||
ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select)
|
||||
{
|
||||
Object *ob = vc->obact;
|
||||
Mesh *me = ob->data;
|
||||
@@ -804,9 +814,10 @@ static void do_lasso_select_node(int mcords[][2], short moves, const bool select
|
||||
}
|
||||
#endif
|
||||
|
||||
static void view3d_lasso_select(bContext *C, ViewContext *vc,
|
||||
const int mcords[][2], short moves,
|
||||
bool extend, bool select)
|
||||
static void view3d_lasso_select(
|
||||
bContext *C, ViewContext *vc,
|
||||
const int mcords[][2], short moves,
|
||||
bool extend, bool select)
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
|
||||
@@ -916,7 +927,8 @@ typedef struct SelMenuItemF {
|
||||
static SelMenuItemF object_mouse_select_menu_data[SEL_MENU_SIZE];
|
||||
|
||||
/* special (crappy) operator only for menu select */
|
||||
static const EnumPropertyItem *object_select_menu_enum_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
|
||||
static const EnumPropertyItem *object_select_menu_enum_itemf(
|
||||
bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
|
||||
{
|
||||
EnumPropertyItem *item = NULL, item_tmp = {0};
|
||||
int totitem = 0;
|
||||
@@ -1396,8 +1408,9 @@ static bool ed_object_select_pick(
|
||||
while (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(view_layer)) dist_temp += 10.0f;
|
||||
@@ -1586,8 +1599,9 @@ typedef struct BoxSelectUserData {
|
||||
bool is_changed;
|
||||
} BoxSelectUserData;
|
||||
|
||||
static void view3d_userdata_boxselect_init(BoxSelectUserData *r_data,
|
||||
ViewContext *vc, const rcti *rect, const bool select)
|
||||
static void view3d_userdata_boxselect_init(
|
||||
BoxSelectUserData *r_data,
|
||||
ViewContext *vc, const rcti *rect, const bool select)
|
||||
{
|
||||
r_data->vc = vc;
|
||||
|
||||
@@ -1609,7 +1623,8 @@ bool edge_inside_circle(const float cent[2], float radius, const float screen_co
|
||||
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;
|
||||
|
||||
@@ -1701,7 +1716,8 @@ static int do_paintvert_box_select(
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static void do_nurbs_box_select__doSelect(void *userData, Nurb *UNUSED(nu), BPoint *bp, BezTriple *bezt, int beztindex, const float screen_co[2])
|
||||
static void do_nurbs_box_select__doSelect(
|
||||
void *userData, Nurb *UNUSED(nu), BPoint *bp, BezTriple *bezt, int beztindex, const float screen_co[2])
|
||||
{
|
||||
BoxSelectUserData *data = userData;
|
||||
Object *obedit = data->vc->obedit;
|
||||
@@ -1779,7 +1795,8 @@ static void do_mesh_box_select__doSelectVert(void *userData, BMVert *eve, const
|
||||
BM_vert_select_set(data->vc->em->bm, eve, data->select);
|
||||
}
|
||||
}
|
||||
static void do_mesh_box_select__doSelectEdge(void *userData, BMEdge *eed, const float screen_co_a[2], const float screen_co_b[2], int index)
|
||||
static void do_mesh_box_select__doSelectEdge(
|
||||
void *userData, BMEdge *eed, const float screen_co_a[2], const float screen_co_b[2], int index)
|
||||
{
|
||||
BoxSelectUserData *data = userData;
|
||||
|
||||
@@ -1806,7 +1823,7 @@ static void do_mesh_box_select__doSelectFace(void *userData, BMFace *efa, const
|
||||
}
|
||||
}
|
||||
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;
|
||||
@@ -1860,7 +1877,7 @@ static int do_mesh_box_select(
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -1896,7 +1913,7 @@ static int do_meta_box_select(
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -2371,8 +2388,9 @@ typedef struct CircleSelectUserData {
|
||||
bool is_changed;
|
||||
} CircleSelectUserData;
|
||||
|
||||
static void view3d_userdata_circleselect_init(CircleSelectUserData *r_data,
|
||||
ViewContext *vc, const bool select, const int mval[2], const float rad)
|
||||
static void view3d_userdata_circleselect_init(
|
||||
CircleSelectUserData *r_data,
|
||||
ViewContext *vc, const bool select, const int mval[2], const float rad)
|
||||
{
|
||||
r_data->vc = vc;
|
||||
r_data->select = select;
|
||||
@@ -2395,7 +2413,8 @@ static void mesh_circle_doSelectVert(void *userData, BMVert *eve, const float sc
|
||||
BM_vert_select_set(data->vc->em->bm, eve, data->select);
|
||||
}
|
||||
}
|
||||
static void mesh_circle_doSelectEdge(void *userData, BMEdge *eed, const float screen_co_a[2], const float screen_co_b[2], int UNUSED(index))
|
||||
static void mesh_circle_doSelectEdge(
|
||||
void *userData, BMEdge *eed, const float screen_co_a[2], const float screen_co_b[2], int UNUSED(index))
|
||||
{
|
||||
CircleSelectUserData *data = userData;
|
||||
|
||||
@@ -2412,7 +2431,9 @@ static void mesh_circle_doSelectFace(void *userData, BMFace *efa, const float sc
|
||||
}
|
||||
}
|
||||
|
||||
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(
|
||||
const EvaluationContext *eval_ctx,
|
||||
ViewContext *vc, const bool select, const int mval[2], float rad)
|
||||
{
|
||||
ToolSettings *ts = vc->scene->toolsettings;
|
||||
int bbsel;
|
||||
@@ -2456,7 +2477,9 @@ static void mesh_circle_select(const struct EvaluationContext *eval_ctx, ViewCon
|
||||
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(
|
||||
const EvaluationContext *eval_ctx,
|
||||
ViewContext *vc, const bool select, const int mval[2], float rad)
|
||||
{
|
||||
Object *ob = vc->obact;
|
||||
Mesh *me = ob->data;
|
||||
@@ -2472,7 +2495,8 @@ static void paint_facesel_circle_select(const struct EvaluationContext *eval_ctx
|
||||
}
|
||||
}
|
||||
|
||||
static void paint_vertsel_circle_select_doSelectVert(void *userData, MVert *mv, const float screen_co[2], int UNUSED(index))
|
||||
static void paint_vertsel_circle_select_doSelectVert(
|
||||
void *userData, MVert *mv, const float screen_co[2], int UNUSED(index))
|
||||
{
|
||||
CircleSelectUserData *data = userData;
|
||||
|
||||
@@ -2480,7 +2504,8 @@ static void paint_vertsel_circle_select_doSelectVert(void *userData, MVert *mv,
|
||||
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(
|
||||
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;
|
||||
@@ -2503,7 +2528,8 @@ static void paint_vertsel_circle_select(const struct EvaluationContext *eval_ctx
|
||||
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(
|
||||
eval_ctx, vc, paint_vertsel_circle_select_doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
|
||||
}
|
||||
|
||||
if (select != LEFTMOUSE) {
|
||||
@@ -2513,7 +2539,8 @@ static void paint_vertsel_circle_select(const struct EvaluationContext *eval_ctx
|
||||
}
|
||||
|
||||
|
||||
static void nurbscurve_circle_doSelect(void *userData, Nurb *UNUSED(nu), BPoint *bp, BezTriple *bezt, int beztindex, const float screen_co[2])
|
||||
static void nurbscurve_circle_doSelect(
|
||||
void *userData, Nurb *UNUSED(nu), BPoint *bp, BezTriple *bezt, int beztindex, const float screen_co[2])
|
||||
{
|
||||
CircleSelectUserData *data = userData;
|
||||
Object *obedit = data->vc->obedit;
|
||||
@@ -2587,7 +2614,8 @@ static bool pchan_circle_doSelectJoint(void *userData, bPoseChannel *pchan, cons
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
static void do_circle_select_pose__doSelectBone(void *userData, struct bPoseChannel *pchan, const float screen_co_a[2], const float screen_co_b[2])
|
||||
static void do_circle_select_pose__doSelectBone(
|
||||
void *userData, struct bPoseChannel *pchan, const float screen_co_a[2], const float screen_co_b[2])
|
||||
{
|
||||
CircleSelectUserData *data = userData;
|
||||
bArmature *arm = data->vc->obact->data;
|
||||
@@ -2673,7 +2701,8 @@ static bool armature_circle_doSelectJoint(void *userData, EditBone *ebone, const
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
static void do_circle_select_armature__doSelectBone(void *userData, struct EditBone *ebone, const float screen_co_a[2], const float screen_co_b[2])
|
||||
static void do_circle_select_armature__doSelectBone(
|
||||
void *userData, struct EditBone *ebone, const float screen_co_a[2], const float screen_co_b[2])
|
||||
{
|
||||
CircleSelectUserData *data = userData;
|
||||
bArmature *arm = data->vc->obedit->data;
|
||||
@@ -2758,7 +2787,7 @@ static void mball_circle_select(ViewContext *vc, const bool select, const int mv
|
||||
/** Callbacks for circle selection in Editmode */
|
||||
|
||||
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:
|
||||
@@ -2795,8 +2824,9 @@ static bool object_circle_select(ViewContext *vc, const bool select, const int m
|
||||
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_object_base_select(base, select ? BA_SELECT : BA_DESELECT);
|
||||
|
||||
Reference in New Issue
Block a user