diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index 96ec09f844e..491defcd016 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -546,17 +546,9 @@ static void rna_FModifierStepped_end_frame_range(PointerRNA *ptr, float *min, fl *max= MAXFRAMEF; } -static BezTriple *rna_FKeyframe_points_add(FCurve *fcu, float frame, float value, int do_replace, int do_needed, int do_fast) +static BezTriple *rna_FKeyframe_points_add(FCurve *fcu, float frame, float value, int flag) { - int index; - int flag= 0; - - if(do_replace) flag |= INSERTKEY_REPLACE; - if(do_needed) flag |= INSERTKEY_NEEDED; - if(do_fast) flag |= INSERTKEY_FAST; - - - index= insert_vert_fcurve(fcu, frame, value, flag); + int index= insert_vert_fcurve(fcu, frame, value, flag); return ((fcu->bezt) && (index >= 0))? (fcu->bezt + index) : NULL; } @@ -1323,6 +1315,12 @@ static void rna_def_fcurve_keyframe_points(BlenderRNA *brna, PropertyRNA *cprop) FunctionRNA *func; PropertyRNA *parm; + static EnumPropertyItem keyframe_flag_items[] = { + {INSERTKEY_REPLACE, "REPLACE", 0, "Replace", "Don't add any new keyframes, but just replace existing ones"}, + {INSERTKEY_NEEDED, "NEEDED", 0, "Needed", "Only adds keyframes that are needed"}, + {INSERTKEY_FAST, "FAST", 0, "Fast", "Fast keyframe insertion to avoid recalculating the curve each time"}, + {0, NULL, 0, NULL, NULL}}; + RNA_def_property_srna(cprop, "FCurveKeyframePoints"); srna= RNA_def_struct(brna, "FCurveKeyframePoints", NULL); RNA_def_struct_sdna(srna, "FCurve"); @@ -1334,10 +1332,9 @@ static void rna_def_fcurve_keyframe_points(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_flag(parm, PROP_REQUIRED); parm= RNA_def_float(func, "value", 0.0f, -FLT_MAX, FLT_MAX, "", "Y Value of this keyframe point", -FLT_MAX, FLT_MAX); RNA_def_property_flag(parm, PROP_REQUIRED); - /* optional */ - RNA_def_boolean(func, "replace", 0, "Replace", "Don't add any new keyframes, but just replace existing ones"); - RNA_def_boolean(func, "needed", 0, "Needed", "Only adds keyframes that are needed"); - RNA_def_boolean(func, "fast", 0, "Fast", "Fast keyframe insertion to avoid recalculating the curve each time"); + + parm= RNA_def_enum(func, "options", keyframe_flag_items, 0, "", "Keyframe options."); + RNA_def_property_flag(parm, PROP_ENUM_FLAG); parm= RNA_def_pointer(func, "keyframe", "Keyframe", "", "Newly created keyframe"); RNA_def_function_return(func, parm);