Merge branch 'blender-v2.83-release'

This commit is contained in:
Campbell Barton 2020-05-15 23:16:39 +10:00
commit 998e26704b
9 changed files with 52 additions and 14 deletions

View File

@ -261,8 +261,9 @@ void BKE_nurb_handles_calc(struct Nurb *nu);
void BKE_nurb_handles_autocalc(struct Nurb *nu, int flag);
void BKE_nurb_bezt_handle_test(struct BezTriple *bezt,
const eBezTriple_Flag__Alias sel_flag,
const bool use_handle);
void BKE_nurb_handles_test(struct Nurb *nu, const bool use_handles);
const bool use_handle,
const bool use_around_local);
void BKE_nurb_handles_test(struct Nurb *nu, const bool use_handles, const bool use_around_local);
/* **** Depsgraph evaluation **** */

View File

@ -4169,7 +4169,8 @@ void BKE_nurb_handle_calc_simple_auto(Nurb *nu, BezTriple *bezt)
*/
void BKE_nurb_bezt_handle_test(BezTriple *bezt,
const eBezTriple_Flag__Alias sel_flag,
const bool use_handle)
const bool use_handle,
const bool use_around_local)
{
short flag = 0;
@ -4192,6 +4193,10 @@ void BKE_nurb_bezt_handle_test(BezTriple *bezt,
flag = (bezt->f2 & sel_flag) ? (SEL_F1 | SEL_F2 | SEL_F3) : 0;
}
if (use_around_local) {
flag &= ~SEL_F2;
}
/* check for partial selection */
if (!ELEM(flag, 0, SEL_F1 | SEL_F2 | SEL_F3)) {
if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM)) {
@ -4218,7 +4223,7 @@ void BKE_nurb_bezt_handle_test(BezTriple *bezt,
#undef SEL_F3
}
void BKE_nurb_handles_test(Nurb *nu, const bool use_handle)
void BKE_nurb_handles_test(Nurb *nu, const bool use_handle, const bool use_around_local)
{
BezTriple *bezt;
int a;
@ -4230,7 +4235,7 @@ void BKE_nurb_handles_test(Nurb *nu, const bool use_handle)
bezt = nu->bezt;
a = nu->pntsu;
while (a--) {
BKE_nurb_bezt_handle_test(bezt, SELECT, use_handle);
BKE_nurb_bezt_handle_test(bezt, SELECT, use_handle, use_around_local);
bezt++;
}

View File

@ -1147,7 +1147,7 @@ void testhandles_fcurve(FCurve *fcu, eBezTriple_Flag sel_flag, const bool use_ha
/* loop over beztriples */
for (a = 0, bezt = fcu->bezt; a < fcu->totvert; a++, bezt++) {
BKE_nurb_bezt_handle_test(bezt, sel_flag, use_handle);
BKE_nurb_bezt_handle_test(bezt, sel_flag, use_handle, false);
}
/* recalculate handles */

View File

@ -295,7 +295,7 @@ static void graphedit_activekey_handles_cb(bContext *C, void *fcu_ptr, void *bez
bezt->h2 = HD_ALIGN;
}
else {
BKE_nurb_bezt_handle_test(bezt, SELECT, true);
BKE_nurb_bezt_handle_test(bezt, SELECT, true, false);
}
/* now call standard updates */

View File

@ -1005,7 +1005,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
}
}
BKE_nurb_test_2d(nu);
BKE_nurb_handles_test(nu, true); /* test for bezier too */
BKE_nurb_handles_test(nu, true, false); /* test for bezier too */
nu = nu->next;
}

View File

@ -83,16 +83,45 @@
#include "transform_convert.h"
#include "transform_mode.h"
bool transform_mode_use_local_origins(const TransInfo *t)
{
return ELEM(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL);
}
/**
* Transforming around ourselves is no use, fallback to individual origins,
* useful for curve/armatures.
*/
void transform_around_single_fallback(TransInfo *t)
{
if ((t->data_len_all == 1) &&
(ELEM(t->around, V3D_AROUND_CENTER_BOUNDS, V3D_AROUND_CENTER_MEDIAN, V3D_AROUND_ACTIVE)) &&
(ELEM(t->mode, TFM_RESIZE, TFM_ROTATION, TFM_TRACKBALL))) {
t->around = V3D_AROUND_LOCAL_ORIGINS;
if ((ELEM(t->around, V3D_AROUND_CENTER_BOUNDS, V3D_AROUND_CENTER_MEDIAN, V3D_AROUND_ACTIVE)) &&
transform_mode_use_local_origins(t)) {
bool is_data_single = false;
if (t->data_len_all == 1) {
is_data_single = true;
}
else if (t->data_len_all == 3) {
if (t->obedit_type == OB_CURVE) {
/* Special case check for curve, if we have a single curve bezier triple selected
* treat */
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
if (!tc->data_len) {
continue;
}
if (tc->data_len == 3) {
const TransData *td = tc->data;
if ((td[0].loc == td[1].loc) && (td[1].loc == td[2].loc)) {
is_data_single = true;
}
}
break;
}
}
}
if (is_data_single) {
t->around = V3D_AROUND_LOCAL_ORIGINS;
}
}
}

View File

@ -100,6 +100,7 @@ void flushTransTracking(TransInfo *t);
/********************* intern **********************/
/* transform_convert.c */
bool transform_mode_use_local_origins(const TransInfo *t);
void transform_around_single_fallback(TransInfo *t);
bool constraints_list_needinv(TransInfo *t, ListBase *list);
void calc_distanceCurveVerts(TransData *head, TransData *tail);

View File

@ -167,6 +167,8 @@ void createTransCurveVerts(TransInfo *t)
((v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_CU_HANDLES) == 0) :
false;
bool use_around_origins_for_handles_test = ((t->around == V3D_AROUND_LOCAL_ORIGINS) &&
transform_mode_use_local_origins(t));
float mtx[3][3], smtx[3][3];
copy_m3_m4(mtx, tc->obedit->obmat);
@ -342,7 +344,7 @@ void createTransCurveVerts(TransInfo *t)
if (ELEM(t->mode, TFM_CURVE_SHRINKFATTEN, TFM_TILT, TFM_DUMMY) == 0) {
/* sets the handles based on their selection,
* do this after the data is copied to the TransData */
BKE_nurb_handles_test(nu, !hide_handles);
BKE_nurb_handles_test(nu, !hide_handles, use_around_origins_for_handles_test);
}
}
else {

View File

@ -111,7 +111,7 @@ void ED_transverts_update_obedit(TransVertStore *tvs, Object *obedit)
}
BKE_nurb_test_2d(nu);
BKE_nurb_handles_test(nu, true); /* test for bezier too */
BKE_nurb_handles_test(nu, true, false); /* test for bezier too */
nu = nu->next;
}
}