[Bf-blender-cvs] [1094c3f276a] blender-v2.81-release: RNA: region_to_view took int's instead of floats

Campbell Barton noreply at git.blender.org
Wed Oct 16 05:08:29 CEST 2019


Commit: 1094c3f276a3ba207e7a9d132e1e2ea53f0e74ba
Author: Campbell Barton
Date:   Wed Oct 16 14:06:25 2019 +1100
Branches: blender-v2.81-release
https://developer.blender.org/rB1094c3f276a3ba207e7a9d132e1e2ea53f0e74ba

RNA: region_to_view took int's instead of floats

Internally the function uses float's, RNA exposed args as int's.

Python3.8 warns about int/float conversion in toolbar drawing code.

===================================================================

M	source/blender/makesrna/intern/rna_screen.c

===================================================================

diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c
index 728ef3fb706..1637f8cfed5 100644
--- a/source/blender/makesrna/intern/rna_screen.c
+++ b/source/blender/makesrna/intern/rna_screen.c
@@ -272,7 +272,7 @@ static void rna_Area_ui_type_update(bContext *C, PointerRNA *ptr)
   sa->butspacetype_subtype = 0;
 }
 
-static void rna_View2D_region_to_view(struct View2D *v2d, int x, int y, float result[2])
+static void rna_View2D_region_to_view(struct View2D *v2d, float x, float y, float result[2])
 {
   UI_view2d_region_to_view(v2d, x, y, &result[0], &result[1]);
 }
@@ -406,9 +406,9 @@ static void rna_def_view2d_api(StructRNA *srna)
 
   func = RNA_def_function(srna, "region_to_view", "rna_View2D_region_to_view");
   RNA_def_function_ui_description(func, "Transform region coordinates to 2D view");
-  parm = RNA_def_int(func, "x", 0, INT_MIN, INT_MAX, "x", "Region x coordinate", -10000, 10000);
+  parm = RNA_def_float(func, "x", 0, -FLT_MAX, FLT_MAX, "x", "Region x coordinate", -10000, 10000);
   RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-  parm = RNA_def_int(func, "y", 0, INT_MIN, INT_MAX, "y", "Region y coordinate", -10000, 10000);
+  parm = RNA_def_float(func, "y", 0, -FLT_MAX, FLT_MAX, "y", "Region y coordinate", -10000, 10000);
   RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
   parm = RNA_def_float_array(func,
                              "result",



More information about the Bf-blender-cvs mailing list