diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-01-16 10:32:09 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-01-16 10:32:09 +0300 |
commit | 735653cda86c88c4768bf0456afd8112044704fd (patch) | |
tree | 853f95098f72e59bba28dafa1ae99853ff3729cc /source/blender/editors/object | |
parent | c383d742288025da1eb26417c614f56a3c500b5d (diff) |
Fix T52354: Origin to Geometry uses Bounds w/ Median Center is set
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r-- | source/blender/editors/object/object_transform.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index 373b7a4a0aa..57a04cbd0f3 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -813,7 +813,6 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) Object *tob; float cursor[3], cent[3], cent_neg[3], centn[3]; int centermode = RNA_enum_get(op->ptr, "type"); - int around = RNA_enum_get(op->ptr, "center"); /* initialized from v3d->around */ ListBase ctx_data_list; CollectionPointerLink *ctx_ob; @@ -826,12 +825,22 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) BKE_report(op->reports, RPT_ERROR, "Operation cannot be performed in edit mode"); return OPERATOR_CANCELLED; } - else { - /* get the view settings if 'around' isn't set and the view is available */ - View3D *v3d = CTX_wm_view3d(C); - copy_v3_v3(cursor, scene->cursor.location); - if (v3d && !RNA_struct_property_is_set(op->ptr, "center")) - around = scene->toolsettings->transform_pivot_point; + + int around; + { + PropertyRNA *prop_center = RNA_struct_find_property(op->ptr, "center"); + if (RNA_property_is_set(op->ptr, prop_center)) { + around = RNA_property_enum_get(op->ptr, prop_center); + } + else { + if (scene->toolsettings->transform_pivot_point == V3D_AROUND_CENTER_BOUNDS) { + around = V3D_AROUND_CENTER_BOUNDS; + } + else { + around = V3D_AROUND_CENTER_MEDIAN; + } + RNA_property_enum_set(op->ptr, prop_center, around); + } } zero_v3(cent); |