Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-11-05 07:48:37 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-11-05 07:48:37 +0300
commit9ac0541563c42f6fcc9160915d103e8af626e088 (patch)
tree3db5fd3290874620ab8ee1bc4e38e9bcee7022e5 /source
parenta88b9a4e003c57d6cbf0ab2e4ae535e7e6a79c9d (diff)
parent52a2d5cbd269c4f7f84a866a3080ce821dce80d3 (diff)
Merge branch 'blender-v2.91-release'
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/transform/transform_mode_tosphere.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/source/blender/editors/transform/transform_mode_tosphere.c b/source/blender/editors/transform/transform_mode_tosphere.c
index d50b26d3e5a..15906f2c90c 100644
--- a/source/blender/editors/transform/transform_mode_tosphere.c
+++ b/source/blender/editors/transform/transform_mode_tosphere.c
@@ -56,6 +56,8 @@ static void to_sphere_radius_update(TransInfo *t)
struct ToSphereInfo *data = t->custom.mode.data;
float radius = 0.0f;
+ const bool is_local_center = transdata_check_local_center(t, t->around);
+
if (t->flag & T_PROP_EDIT_ALL) {
int factor_accum = 0.0f;
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
@@ -64,7 +66,8 @@ static void to_sphere_radius_update(TransInfo *t)
if (td->factor == 0.0f) {
continue;
}
- radius += td->factor * len_v3v3(tc->center_local, td->iloc);
+ const float *center = is_local_center ? td->center : tc->center_local;
+ radius += td->factor * len_v3v3(center, td->iloc);
factor_accum += td->factor;
}
}
@@ -76,7 +79,8 @@ static void to_sphere_radius_update(TransInfo *t)
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
TransData *td = tc->data;
for (int i = 0; i < tc->data_len; i++, td++) {
- radius += len_v3v3(tc->center_local, td->iloc);
+ const float *center = is_local_center ? td->center : tc->center_local;
+ radius += len_v3v3(center, td->iloc);
}
}
radius /= (float)t->data_len_all;
@@ -94,6 +98,8 @@ static void to_sphere_radius_update(TransInfo *t)
static void applyToSphere(TransInfo *t, const int UNUSED(mval[2]))
{
+ const bool is_local_center = transdata_check_local_center(t, t->around);
+
float vec[3];
float ratio, radius;
int i;
@@ -135,7 +141,9 @@ static void applyToSphere(TransInfo *t, const int UNUSED(mval[2]))
continue;
}
- sub_v3_v3v3(vec, td->iloc, tc->center_local);
+ const float *center = is_local_center ? td->center : tc->center_local;
+
+ sub_v3_v3v3(vec, td->iloc, center);
radius = normalize_v3(vec);
@@ -143,7 +151,7 @@ static void applyToSphere(TransInfo *t, const int UNUSED(mval[2]))
mul_v3_fl(vec, radius * (1.0f - tratio) + data->radius * tratio);
- add_v3_v3v3(td->loc, tc->center_local, vec);
+ add_v3_v3v3(td->loc, center, vec);
}
}