Fixes setting object bound dimensions using Multiple Value Edition from UI. #117731

Open
Jaume Bellet wants to merge 1 commits from JaumeBellet/blender:pr-0019-object-dimensions-set-fix into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
3 changed files with 13 additions and 5 deletions

View File

@ -81,6 +81,10 @@ class OBJECT_PT_transform(ObjectButtonsPanel, Panel):
row.use_property_decorate = False
row.prop(ob, "lock_scale", text="", emboss=False, icon='DECORATE_UNLOCKED')
col = layout.column()
row = col.row(align=True)
row.prop(ob, "dimensions")
row.use_property_decorate = False
class OBJECT_PT_delta_transform(ObjectButtonsPanel, Panel):
bl_label = "Delta Transform"

View File

@ -3647,6 +3647,12 @@ void BKE_object_dimensions_set_ex(Object *ob,
}
}
}
/* Reset the bounds, so will get the new ones*/
ob->runtime->bounds_eval.reset();
/* calculate local matrix so when getting bounds the scale match */
BKE_object_to_mat4(ob, ob->object_to_world);
}
}

View File

@ -1244,6 +1244,7 @@ static void rna_Object_dimensions_set(PointerRNA *ptr, const float *value)
{
Object *ob = static_cast<Object *>(ptr->data);
BKE_object_dimensions_set(ob, value, 0);
}
static int rna_Object_location_editable(PointerRNA *ptr, int index)
@ -3245,11 +3246,8 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_float_funcs(
prop, "rna_Object_dimensions_get", "rna_Object_dimensions_set", nullptr);
RNA_def_property_ui_range(prop, 0.0f, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
RNA_def_property_ui_text(prop,
"Dimensions",
"Absolute bounding box dimensions of the object.\n"
"Warning: Assigning to it or its members multiple consecutive times "
"will not work correctly, as this needs up-to-date evaluated data");
RNA_def_property_ui_text(
prop, "Dimensions", "Absolute bounding box dimensions of the object.");
RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
/* delta transforms */