Fix T52354: Origin to Geometry uses Bounds w/ Median Center is set
This commit is contained in:
parent
c383d74228
commit
735653cda8
Notes:
blender-bot
2023-10-13 01:54:23 +02:00
Referenced by issue #52354, Origin to Geometry uses bounding box while set to Median Center
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue