[Bf-blender-cvs] [9c928bb93e0] master: Fix T60183: Images as Planes (addon) Attribute Error.
Bastien Montagne
noreply at git.blender.org
Sat Jan 5 16:38:26 CET 2019
Commit: 9c928bb93e04f376ef6a9a84137a4109bbf7f7c0
Author: Bastien Montagne
Date: Sat Jan 5 16:33:38 2019 +0100
Branches: master
https://developer.blender.org/rB9c928bb93e04f376ef6a9a84137a4109bbf7f7c0
Fix T60183: Images as Planes (addon) Attribute Error.
Partially revert rB1b8c3774a86ebc04fceb9cd, there is no good reason to
make object.dimensions read-only, it works perfectly well from python
API! Only breaking case was that weird multi-editing UI feature, due to
how it sets things. But RNA setter itself works fine, and it's a handy
shortcut/helper for scripts.
Also when breaking API, it is good practivce to at least check official
add-ons...
===================================================================
M source/blender/makesrna/intern/rna_object.c
===================================================================
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 1c195ff559e..ec365a92a91 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -903,6 +903,12 @@ static void rna_Object_dimensions_get(PointerRNA *ptr, float *value)
BKE_object_dimensions_get(ob, value);
}
+static void rna_Object_dimensions_set(PointerRNA *ptr, const float *value)
+{
+ Object *ob = ptr->data;
+ BKE_object_dimensions_set(ob, value, 0);
+}
+
static int rna_Object_location_editable(PointerRNA *ptr, int index)
{
Object *ob = (Object *)ptr->data;
@@ -2303,10 +2309,9 @@ static void rna_def_object(BlenderRNA *brna)
prop = RNA_def_property(srna, "dimensions", PROP_FLOAT, PROP_XYZ_LENGTH);
RNA_def_property_array(prop, 3);
- /* Only for the transform-panel and conflicts with animating scale. */
- /* Disallow editing, it doesn't work properly, see: T54771. */
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
- RNA_def_property_float_funcs(prop, "rna_Object_dimensions_get", NULL, NULL);
+ /* Only as convinient helper for py API, and conflicts with animating scale. */
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_float_funcs(prop, "rna_Object_dimensions_get", "rna_Object_dimensions_set", NULL);
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");
RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
More information about the Bf-blender-cvs
mailing list