Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-01-18 14:27:52 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-01-18 14:27:52 +0300
commit08dc18fda01e8d850aefc64ff3cca1f4afcc57ab (patch)
tree3443a8bb7a912903a0abd5987a79b4762118cf1e /source/blender/makesrna/intern/rna_fcurve.c
parentfb97780fdf4d6cd6b8ad0cdbc6582ae235be121c (diff)
rename fcurve.keyframe_points.add() --> insert()
add new add function which allocates a number of points instead.
Diffstat (limited to 'source/blender/makesrna/intern/rna_fcurve.c')
-rw-r--r--source/blender/makesrna/intern/rna_fcurve.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index 5aa1e8e836f..606dee0aa8b 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -546,12 +546,29 @@ 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 flag)
+static BezTriple *rna_FKeyframe_points_insert(FCurve *fcu, float frame, float value, int flag)
{
int index= insert_vert_fcurve(fcu, frame, value, flag);
return ((fcu->bezt) && (index >= 0))? (fcu->bezt + index) : NULL;
}
+static void rna_FKeyframe_points_add(FCurve *fcu, int tot)
+{
+ if(tot > 0) {
+ if(fcu->totvert) {
+ BezTriple *nbezt= MEM_callocN(sizeof(BezTriple) * (fcu->totvert + tot), "rna_FKeyframe_points_add");
+ memcpy(nbezt, fcu->bezt, sizeof(BezTriple) * fcu->totvert);
+ MEM_freeN(fcu->bezt);
+ fcu->bezt= nbezt;
+ }
+ else {
+ fcu->bezt= MEM_callocN(sizeof(BezTriple) * tot, "rna_FKeyframe_points_add");
+ }
+
+ fcu->totvert += tot;
+ }
+}
+
static void rna_FKeyframe_points_remove(FCurve *fcu, ReportList *reports, BezTriple *bezt, int do_fast)
{
int index= (int)(bezt - fcu->bezt);
@@ -1326,7 +1343,7 @@ static void rna_def_fcurve_keyframe_points(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_struct_sdna(srna, "FCurve");
RNA_def_struct_ui_text(srna, "Keyframe Points", "Collection of keyframe points");
- func= RNA_def_function(srna, "add", "rna_FKeyframe_points_add");
+ func= RNA_def_function(srna, "insert", "rna_FKeyframe_points_insert");
RNA_def_function_ui_description(func, "Add a keyframe point to a F-Curve.");
parm= RNA_def_float(func, "frame", 0.0f, -FLT_MAX, FLT_MAX, "", "X Value of this keyframe point", -FLT_MAX, FLT_MAX);
RNA_def_property_flag(parm, PROP_REQUIRED);
@@ -1338,6 +1355,9 @@ static void rna_def_fcurve_keyframe_points(BlenderRNA *brna, PropertyRNA *cprop)
parm= RNA_def_pointer(func, "keyframe", "Keyframe", "", "Newly created keyframe");
RNA_def_function_return(func, parm);
+ func= RNA_def_function(srna, "add", "rna_FKeyframe_points_add");
+ RNA_def_function_ui_description(func, "Add a keyframe point to a F-Curve.");
+ RNA_def_int(func, "count", 1, 1, INT_MAX, "Number", "Number of points to add to the spline", 1, INT_MAX);
func= RNA_def_function(srna, "remove", "rna_FKeyframe_points_remove");
RNA_def_function_ui_description(func, "Remove keyframe from an fcurve.");