[Bf-blender-cvs] [70196c7] temp-text_editor_cursor_api: take 2 args (line, col) instead of a tuple, matches other similar functions.

Campbell Barton noreply at git.blender.org
Tue Dec 30 11:02:14 CET 2014


Commit: 70196c7712ad0e62625b8dcebe719cd86c779ec9
Author: Campbell Barton
Date:   Tue Dec 30 21:01:24 2014 +1100
Branches: temp-text_editor_cursor_api
https://developer.blender.org/rB70196c7712ad0e62625b8dcebe719cd86c779ec9

take 2 args (line, col) instead of a tuple, matches other similar functions.

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

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

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

diff --git a/source/blender/makesrna/intern/rna_space_api.c b/source/blender/makesrna/intern/rna_space_api.c
index 4196637..786ad38 100644
--- a/source/blender/makesrna/intern/rna_space_api.c
+++ b/source/blender/makesrna/intern/rna_space_api.c
@@ -51,12 +51,13 @@ static void rna_RegionView3D_update(ID *id, RegionView3D *rv3d)
 	}
 }
 
-static void rna_SpaceTextEditor_region_location_from_cursor(ID *id, SpaceText *st, int cursor_co[2], int r_pixel_pos[2])
+static void rna_SpaceTextEditor_region_location_from_cursor(ID *id, SpaceText *st, int line, int column, int r_pixel_pos[2])
 {
 	bScreen *sc = (bScreen *)id;
 	ScrArea *sa = BKE_screen_find_area_from_space(sc, (SpaceLink *)st);
 	if (sa) {
 		ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+		const int cursor_co[2] = {line, column};
 		ED_text_region_location_from_cursor(st, ar, cursor_co, r_pixel_pos);
 	}
 }
@@ -94,7 +95,9 @@ void RNA_api_space_text(StructRNA *srna)
 	func = RNA_def_function(srna, "region_location_from_cursor", "rna_SpaceTextEditor_region_location_from_cursor");
 	RNA_def_function_ui_description(func, "Retrieve the screen position in pixels from the given line and character position");
 	RNA_def_function_flag(func, FUNC_USE_SELF_ID);
-	parm = RNA_def_int_array(func, "cursor", 2, 0, 0, INT_MAX, "", "Text Position, line and character in line", 0, INT_MAX);
+	parm = RNA_def_int(func, "line", 0, INT_MIN, INT_MAX, "Line", "Line index", 0, INT_MAX);
+	RNA_def_property_flag(parm, PROP_REQUIRED);
+	parm = RNA_def_int(func, "column", 0, INT_MIN, INT_MAX, "Column", "Column index", 0, INT_MAX);
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	parm = RNA_def_int_array(func, "result", 2, 0, -1, INT_MAX, "", "Screen Position in Pixels", -1, INT_MAX);
 	RNA_def_function_output(func, parm);




More information about the Bf-blender-cvs mailing list