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>2012-10-08 13:39:35 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-10-08 13:39:35 +0400
commit1487ef9828d576088eac3a792069ea95d15579af (patch)
treefdcc1bedd0327e9be85a652936262442f49d67c5
parente91badc2666aa04af34473d71dc576afb52eec06 (diff)
quiet msvc warning & allow zero arguments to add functions.
-rw-r--r--source/blender/makesrna/intern/rna_curve.c4
-rw-r--r--source/blender/makesrna/intern/rna_fcurve.c2
-rw-r--r--source/blender/makesrna/intern/rna_gpencil.c18
3 files changed, 14 insertions, 10 deletions
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c
index c47cb8ef2af..8cba5899b76 100644
--- a/source/blender/makesrna/intern/rna_curve.c
+++ b/source/blender/makesrna/intern/rna_curve.c
@@ -1163,7 +1163,7 @@ static void rna_def_curve_spline_points(BlenderRNA *brna, PropertyRNA *cprop)
func = RNA_def_function(srna, "add", "rna_Curve_spline_points_add");
RNA_def_function_ui_description(func, "Add a number of points to this spline");
RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS);
- RNA_def_int(func, "count", 1, 1, INT_MAX, "Number", "Number of points to add to the spline", 1, INT_MAX);
+ RNA_def_int(func, "count", 1, 0, INT_MAX, "Number", "Number of points to add to the spline", 0, INT_MAX);
#if 0
func= RNA_def_function(srna, "remove", "rna_Curve_spline_remove");
@@ -1190,7 +1190,7 @@ static void rna_def_curve_spline_bezpoints(BlenderRNA *brna, PropertyRNA *cprop)
func = RNA_def_function(srna, "add", "rna_Curve_spline_bezpoints_add");
RNA_def_function_ui_description(func, "Add a number of points to this spline");
RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS);
- RNA_def_int(func, "count", 1, INT_MIN, INT_MAX, "Number", "Number of points to add to the spline", 0, INT_MAX);
+ RNA_def_int(func, "count", 1, 0, INT_MAX, "Number", "Number of points to add to the spline", 0, INT_MAX);
#if 0
func = RNA_def_function(srna, "remove", "rna_Curve_spline_remove");
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index 24b14fdb884..d899b5833bb 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -1497,7 +1497,7 @@ static void rna_def_fcurve_keyframe_points(BlenderRNA *brna, PropertyRNA *cprop)
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);
+ RNA_def_int(func, "count", 1, 0, INT_MAX, "Number", "Number of points to add to the spline", 0, INT_MAX);
func = RNA_def_function(srna, "remove", "rna_FKeyframe_points_remove");
RNA_def_function_ui_description(func, "Remove keyframe from an F-Curve");
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index ae1c7fd2d5b..fffee4b61ef 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -113,12 +113,14 @@ static void rna_GPencilLayer_info_set(PointerRNA *ptr, const char *value)
static void rna_GPencil_stroke_point_add(bGPDstroke *stroke, int count)
{
- if (stroke->points == NULL)
- stroke->points = MEM_callocN(sizeof(bGPDspoint) * count, "gp_stroke_points");
- else
- stroke->points = MEM_reallocN(stroke->points, sizeof(bGPDspoint) * (stroke->totpoints + count));
+ if (count > 0) {
+ if (stroke->points == NULL)
+ stroke->points = MEM_callocN(sizeof(bGPDspoint) * count, "gp_stroke_points");
+ else
+ stroke->points = MEM_reallocN(stroke->points, sizeof(bGPDspoint) * (stroke->totpoints + count));
- stroke->totpoints += count;
+ stroke->totpoints += count;
+ }
}
static void rna_GPencil_stroke_point_pop(bGPDstroke *stroke, ReportList *reports, int index)
@@ -174,12 +176,14 @@ static void rna_GPencil_stroke_remove(bGPDframe *frame, ReportList *reports, bGP
static bGPDframe *rna_GPencil_frame_new(bGPDlayer *layer, ReportList *reports, int frame_number)
{
+ bGPDframe *frame;
+
if (BKE_gpencil_layer_find_frame(layer, frame_number)) {
BKE_reportf(reports, RPT_ERROR, "Frame already exists on this frame number");
return NULL;
}
- bGPDframe *frame = gpencil_frame_addnew(layer, frame_number);
+ frame = gpencil_frame_addnew(layer, frame_number);
WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
@@ -293,7 +297,7 @@ static void rna_def_gpencil_stroke_points_api(BlenderRNA *brna, PropertyRNA *cpr
func = RNA_def_function(srna, "add", "rna_GPencil_stroke_point_add");
RNA_def_function_ui_description(func, "Add a new grease pencil stroke point");
- RNA_def_int(func, "count", 1, 1, INT_MAX, "Number", "Number of points to add to the stroke", 1, INT_MAX);
+ RNA_def_int(func, "count", 1, 0, INT_MAX, "Number", "Number of points to add to the stroke", 0, INT_MAX);
func = RNA_def_function(srna, "pop", "rna_GPencil_stroke_point_pop");
RNA_def_function_ui_description(func, "Remove a grease pencil stroke point");