Revision: 36903
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36903
Author:   campbellbarton
Date:     2011-05-26 05:35:30 +0000 (Thu, 26 May 2011)
Log Message:
-----------
fcurve/boolean evaluation, values below zero are no longer evaluated to true.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/anim_sys.c

Modified: trunk/blender/source/blender/blenkernel/intern/anim_sys.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/anim_sys.c   2011-05-26 
02:35:55 UTC (rev 36902)
+++ trunk/blender/source/blender/blenkernel/intern/anim_sys.c   2011-05-26 
05:35:30 UTC (rev 36903)
@@ -1043,6 +1043,9 @@
 }
 
 
+/* less then 1.0 evaluates to false, use epsilon to avoid float error */
+#define ANIMSYS_FLOAT_AS_BOOL(value) ((value) > ((1.0f-FLT_EPSILON)))
+
 /* Write the given value to a setting using RNA, and return success */
 static short animsys_write_rna_setting (PointerRNA *ptr, char *path, int 
array_index, float value)
 {
@@ -1074,9 +1077,9 @@
                        {
                                case PROP_BOOLEAN:
                                        if (array_len)
-                                               
RNA_property_boolean_set_index(&new_ptr, prop, array_index, (int)value);
+                                               
RNA_property_boolean_set_index(&new_ptr, prop, array_index, 
ANIMSYS_FLOAT_AS_BOOL(value));
                                        else
-                                               
RNA_property_boolean_set(&new_ptr, prop, (int)value);
+                                               
RNA_property_boolean_set(&new_ptr, prop, ANIMSYS_FLOAT_AS_BOOL(value));
                                        break;
                                case PROP_INT:
                                        if (array_len)
@@ -1867,9 +1870,9 @@
                {
                        case PROP_BOOLEAN:
                                if (RNA_property_array_length(ptr, prop))
-                                       RNA_property_boolean_set_index(ptr, 
prop, array_index, (int)value);
+                                       RNA_property_boolean_set_index(ptr, 
prop, array_index, ANIMSYS_FLOAT_AS_BOOL(value));
                                else
-                                       RNA_property_boolean_set(ptr, prop, 
(int)value);
+                                       RNA_property_boolean_set(ptr, prop, 
ANIMSYS_FLOAT_AS_BOOL(value));
                                break;
                        case PROP_INT:
                                if (RNA_property_array_length(ptr, prop))

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to