diff options
author | Jason Wilkins <Jason.A.Wilkins@gmail.com> | 2011-05-28 16:33:53 +0400 |
---|---|---|
committer | Jason Wilkins <Jason.A.Wilkins@gmail.com> | 2011-05-28 16:33:53 +0400 |
commit | 844d6f0ac0bc71fed53b36e537175d4e2ca9c2e2 (patch) | |
tree | 47a98a6626b8405943c0656bcf5cc5314dc47f8f /source/blender/makesrna | |
parent | 43385394ed1fae8b83a09a1418f0b4a9a4ea301b (diff) |
rearranged previous patch to compile with C89
conversion to double probably not needed
better comments
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_brush.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index 97f6b902c46..c0c054ea2ac 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -168,11 +168,14 @@ static void rna_Brush_set_size(PointerRNA *ptr, int value) { 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 @@ static void rna_Brush_set_unprojected_radius(PointerRNA *ptr, float value) { 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); |