From 9a556fd69b75b63fa26848ada2bf8322a0374222 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 26 May 2011 05:35:30 +0000 Subject: [PATCH] fcurve/boolean evaluation, values below zero are no longer evaluated to true. --- source/blender/blenkernel/intern/anim_sys.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 5198172c205..fdc102bf779 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -1043,6 +1043,9 @@ static short animsys_remap_path (AnimMapper *UNUSED(remap), char *path, char **d } +/* 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 @@ static short animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_i { 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 @@ void nladata_flush_channels (ListBase *channels) { 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))