Fix for range checks in generated RNA functions. The code was skipping the value...
authorLukas Toenne <lukas.toenne@googlemail.com>
Wed, 12 Dec 2012 17:50:35 +0000 (17:50 +0000)
committerLukas Toenne <lukas.toenne@googlemail.com>
Wed, 12 Dec 2012 17:50:35 +0000 (17:50 +0000)
source/blender/makesrna/intern/makesrna.c

index 6fa53f4e029b4568be231d85f7fc22688811d58b..1d9b737ba29a8db20d11ffb0759bc7db1fdd8aa4 100644 (file)
@@ -760,7 +760,7 @@ static void rna_clamp_value(FILE *f, PropertyRNA *prop, int array)
        if (prop->type == PROP_INT) {
                IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
 
-               if (iprop->hardmin != INT_MIN || iprop->hardmax != INT_MAX) {
+               if (iprop->hardmin != INT_MIN || iprop->hardmax != INT_MAX || iprop->range) {
                        if (array) fprintf(f, "CLAMPIS(values[i], ");
                        else fprintf(f, "CLAMPIS(value, ");
                        if (iprop->range) {
@@ -776,7 +776,7 @@ static void rna_clamp_value(FILE *f, PropertyRNA *prop, int array)
        else if (prop->type == PROP_FLOAT) {
                FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
 
-               if (fprop->hardmin != -FLT_MAX || fprop->hardmax != FLT_MAX) {
+               if (fprop->hardmin != -FLT_MAX || fprop->hardmax != FLT_MAX || fprop->range) {
                        if (array) fprintf(f, "CLAMPIS(values[i], ");
                        else fprintf(f, "CLAMPIS(value, ");
                        if (fprop->range) {