[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52937] trunk/blender/source/blender/ makesrna/intern/makesrna.c: Fix for range checks in generated RNA functions .

Lukas Toenne lukas.toenne at googlemail.com
Wed Dec 12 18:50:38 CET 2012


Revision: 52937
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52937
Author:   lukastoenne
Date:     2012-12-12 17:50:35 +0000 (Wed, 12 Dec 2012)
Log Message:
-----------
Fix for range checks in generated RNA functions. The code was skipping the value clamping for float and int properties if using the min/max values of the respective number format, but not taking into account range callbacks of the property.

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

Modified: trunk/blender/source/blender/makesrna/intern/makesrna.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/makesrna.c	2012-12-12 16:51:05 UTC (rev 52936)
+++ trunk/blender/source/blender/makesrna/intern/makesrna.c	2012-12-12 17:50:35 UTC (rev 52937)
@@ -760,7 +760,7 @@
 	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 @@
 	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) {




More information about the Bf-blender-cvs mailing list