[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36978] trunk/blender/source/blender/ makesrna/intern/rna_brush.c: rearranged previous patch to compile with C89

Jason Wilkins Jason.A.Wilkins at gmail.com
Sat May 28 14:33:54 CEST 2011


Revision: 36978
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36978
Author:   jwilkins
Date:     2011-05-28 12:33:53 +0000 (Sat, 28 May 2011)
Log Message:
-----------
rearranged previous patch to compile with C89
conversion to double probably not needed
better comments

Modified Paths:
--------------
    trunk/blender/source/blender/makesrna/intern/rna_brush.c

Modified: trunk/blender/source/blender/makesrna/intern/rna_brush.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_brush.c	2011-05-28 12:11:39 UTC (rev 36977)
+++ trunk/blender/source/blender/makesrna/intern/rna_brush.c	2011-05-28 12:33:53 UTC (rev 36978)
@@ -168,11 +168,14 @@
 {
 	Brush* me = (Brush*)(ptr->data);
 
-	// set unprojected radius, so they remain consistent
-	double size= (double)brush_size(me);
-	float unprojected_radius = 0.0f;
-	assert(size != 0); // paranoia: sanity checks during load and rna make sure we don't divide by zero here
-	unprojected_radius= (float)(brush_unprojected_radius(me) * (double)value / size);
+	float size= (float)brush_size(me);
+	float unprojected_radius;
+
+	// paranoia: previous checks should make sure we don't divide by zero
+	assert(size != 0);
+
+	// set unprojected radius, so it remains consistent with size
+	unprojected_radius= (float)(brush_unprojected_radius(me) * value / size);
 	brush_set_unprojected_radius(me, unprojected_radius);
 
 	brush_set_size(me, value);
@@ -224,11 +227,14 @@
 {
 	Brush* me = (Brush*)(ptr->data);
 
-	// set size, so they remain consistent
-	double unprojected_radius= (double)brush_unprojected_radius(me);
-	int size = 0;
-	assert(unprojected_radius != 0); // paranoia: sanity checks during load and rna make sure we don't divide by zero here
-	size= (int)((double)brush_size(me) * (double)value / unprojected_radius);
+	float unprojected_radius= brush_unprojected_radius(me);
+	int size;
+
+	// paranoia: previous checks should make sure we don't divide by zero
+	assert(unprojected_radius != 0.0f);
+
+	// set size, so that it is consistent with unprojected_radius
+	size= (int)((float)brush_size(me) * value / unprojected_radius);
 	brush_set_size(me, size);
 
 	brush_set_unprojected_radius(me, value);




More information about the Bf-blender-cvs mailing list