[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51173] trunk/blender/source/blender/ makesrna/intern: quiet msvc warning & allow zero arguments to add functions .

Campbell Barton ideasman42 at gmail.com
Mon Oct 8 11:39:35 CEST 2012


Revision: 51173
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51173
Author:   campbellbarton
Date:     2012-10-08 09:39:35 +0000 (Mon, 08 Oct 2012)
Log Message:
-----------
quiet msvc warning & allow zero arguments to add functions.

Modified Paths:
--------------
    trunk/blender/source/blender/makesrna/intern/rna_curve.c
    trunk/blender/source/blender/makesrna/intern/rna_fcurve.c
    trunk/blender/source/blender/makesrna/intern/rna_gpencil.c

Modified: trunk/blender/source/blender/makesrna/intern/rna_curve.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_curve.c	2012-10-08 08:44:48 UTC (rev 51172)
+++ trunk/blender/source/blender/makesrna/intern/rna_curve.c	2012-10-08 09:39:35 UTC (rev 51173)
@@ -1163,7 +1163,7 @@
 	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 @@
 	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");

Modified: trunk/blender/source/blender/makesrna/intern/rna_fcurve.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_fcurve.c	2012-10-08 08:44:48 UTC (rev 51172)
+++ trunk/blender/source/blender/makesrna/intern/rna_fcurve.c	2012-10-08 09:39:35 UTC (rev 51173)
@@ -1497,7 +1497,7 @@
 
 	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");

Modified: trunk/blender/source/blender/makesrna/intern/rna_gpencil.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_gpencil.c	2012-10-08 08:44:48 UTC (rev 51172)
+++ trunk/blender/source/blender/makesrna/intern/rna_gpencil.c	2012-10-08 09:39:35 UTC (rev 51173)
@@ -113,12 +113,14 @@
 
 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 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 @@
 
 	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");




More information about the Bf-blender-cvs mailing list