Fix #28524: Push/Pull Assert when using Operator Panel to Alter Distance value
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 6 Sep 2011 14:59:55 +0000 (14:59 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 6 Sep 2011 14:59:55 +0000 (14:59 +0000)
Some transform operators (like push/pull, shrink/fatten, to sphere and so)
were creating "value" as single scalar value. This used to confuse
RNA_float_get_array used in initTransform.

Use RNA_float_get_array for array values and RNA_float_get for scalar value
in transform initi function.

source/blender/editors/transform/transform.c

index 0950719..1796bd4 100644 (file)
@@ -1678,7 +1678,14 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
        if (RNA_property_is_set(op->ptr, "value"))
        {
                float values[4]= {0}; /* incase value isn't length 4, avoid uninitialized memory  */
-               RNA_float_get_array(op->ptr, "value", values);
+               PropertyRNA *prop= RNA_struct_find_property(op->ptr, "value");
+
+               if(RNA_property_array_check(prop)) {
+                       RNA_float_get_array(op->ptr, "value", values);
+               } else {
+                       values[0]= RNA_float_get(op->ptr, "value");
+               }
+
                QUATCOPY(t->values, values);
                QUATCOPY(t->auto_values, values);
                t->flag |= T_AUTOVALUES;