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:
Diffstat (limited to 'source/blender/nodes/intern/CMP_nodes/CMP_math.c')
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_math.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_math.c b/source/blender/nodes/intern/CMP_nodes/CMP_math.c
index 4348fd18759..b7a67f3563b 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_math.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_math.c
@@ -140,7 +140,12 @@ static void do_math(bNode *node, float *out, float *in, float *in2)
break;
case 14: /* Round */
{
- out[0]= (out[0]<0)?(int)(in[0] - 0.5f):(int)(in[0] + 0.5f);
+ /* round by the second value */
+ if( in2[0] != 0.0f )
+ out[0]= floorf(in[0] / in2[0] + 0.5f) * in2[0];
+ else
+ out[0]= floorf(in[0] + 0.5f);
+
}
break;
case 15: /* Less Than */