Partial Fix T42652: Transform falloff for mesh islands

This doesn't currently do anything clever when a single vertex is shared by multiple islands
(uses closest only).
This commit is contained in:
Campbell Barton 2014-11-27 21:37:42 +01:00
parent f4f5f3b209
commit 6a45b2a232
Notes: blender-bot 2023-02-14 09:48:23 +01:00
Referenced by issue #42652, Proportional editing failing on rotations and scaling with individual origins
4 changed files with 25 additions and 2 deletions

View File

@ -200,6 +200,12 @@ static bool transdata_check_local_center(TransInfo *t, short around)
);
}
bool transdata_check_local_islands(TransInfo *t, short around)
{
return ((around == V3D_LOCAL) && (
(t->obedit && ELEM(t->obedit->type, OB_MESH))));
}
/* ************************** SPACE DEPENDANT CODE **************************** */
void setTransformViewMatrices(TransInfo *t)

View File

@ -552,6 +552,7 @@ void special_aftertrans_update(struct bContext *C, TransInfo *t);
int special_transform_moving(TransInfo *t);
void transform_autoik_update(TransInfo *t, short mode);
bool transdata_check_local_islands(TransInfo *t, short around);
int count_set_pose_transflags(int *out_mode, short around, struct Object *ob);

View File

@ -218,6 +218,9 @@ static void set_prop_dist(TransInfo *t, const bool with_dist)
float _proj_vec[3];
const float *proj_vec = NULL;
/* support for face-islands */
const bool use_island = transdata_check_local_islands(t, t->around);
if (t->flag & T_PROP_PROJECTED) {
if (t->spacetype == SPACE_VIEW3D && t->ar && t->ar->regiontype == RGN_TYPE_WINDOW) {
RegionView3D *rv3d = t->ar->regiondata;
@ -239,7 +242,12 @@ static void set_prop_dist(TransInfo *t, const bool with_dist)
for (i = 0, td = t->data; i < t->total; i++, td++) {
if (td->flag & TD_SELECTED) {
sub_v3_v3v3(vec, tob->center, td->center);
if (use_island) {
sub_v3_v3v3(vec, tob->iloc, td->iloc);
}
else {
sub_v3_v3v3(vec, tob->center, td->center);
}
mul_m3_v3(tob->mtx, vec);
if (proj_vec) {
@ -251,6 +259,10 @@ static void set_prop_dist(TransInfo *t, const bool with_dist)
dist_sq = len_squared_v3(vec);
if ((tob->rdist == -1.0f) || (dist_sq < SQUARE(tob->rdist))) {
tob->rdist = sqrtf(dist_sq);
if (use_island) {
copy_v3_v3(tob->center, td->center);
copy_m3_m3(tob->axismtx, td->axismtx);
}
}
}
else {

View File

@ -1191,7 +1191,11 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
/* exceptional case */
if (t->around == V3D_LOCAL) {
if (ELEM(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL)) {
t->options |= CTX_NO_PET;
const bool use_island = transdata_check_local_islands(t, t->around);
if (!use_island) {
t->options |= CTX_NO_PET;
}
}
}