[Bf-blender-cvs] [42eb36e] master: Fix 3D font selection and material lagging behind with vertical cursor motion

Campbell Barton noreply at git.blender.org
Thu May 15 11:08:45 CEST 2014


Commit: 42eb36ecf6e09b2d3801bf367d12e469b7322c00
Author: Campbell Barton
Date:   Thu May 15 19:06:25 2014 +1000
https://developer.blender.org/rB42eb36ecf6e09b2d3801bf367d12e469b7322c00

Fix 3D font selection and material lagging behind with vertical cursor motion

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

M	source/blender/editors/curve/editfont.c
M	source/blender/makesdna/DNA_vfont_types.h

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

diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index bd13d38..36e1210 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -247,8 +247,19 @@ static void text_update_edited(bContext *C, Object *obedit, int mode)
 	struct Main *bmain = CTX_data_main(C);
 	Curve *cu = obedit->data;
 	EditFont *ef = cu->editfont;
+
+	/* run update first since it can move the cursor */
+	if (mode == FO_EDIT) {
+		/* re-tesselllate */
+		DAG_id_tag_update(obedit->data, 0);
+	}
+	else {
+		/* depsgraph runs above, but since we're not tagging for update, call direct */
+		BKE_vfont_to_curve(bmain, obedit, mode);
+	}
+
 	cu->curinfo = ef->textbufinfo[ef->pos ? ef->pos - 1 : 0];
-	
+
 	if (obedit->totcol > 0) {
 		obedit->actcol = cu->curinfo.mat_nr;
 
@@ -259,15 +270,6 @@ static void text_update_edited(bContext *C, Object *obedit, int mode)
 		}
 	}
 
-	if (mode == FO_EDIT) {
-		/* re-tesselllate */
-		DAG_id_tag_update(obedit->data, 0);
-	}
-	else {
-		/* depsgraph runs above, but since we're not tagging for update, call direct */
-		BKE_vfont_to_curve(bmain, obedit, mode);
-	}
-
 	WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
 }
 
@@ -1056,6 +1058,14 @@ static int move_cursor(bContext *C, int type, const bool select)
 	else if (ef->pos >= MAXTEXT) ef->pos = MAXTEXT;
 	else if (ef->pos < 0)        ef->pos = 0;
 
+	/* apply virtical cursor motion to position immediately
+	 * otherwise the selection will lag behind */
+	if (FO_CURS_IS_MOTION(cursmove)) {
+		struct Main *bmain = CTX_data_main(C);
+		BKE_vfont_to_curve(bmain, obedit, cursmove);
+		cursmove = FO_CURS;
+	}
+
 	if (select == 0) {
 		if (ef->selstart) {
 			struct Main *bmain = CTX_data_main(C);
diff --git a/source/blender/makesdna/DNA_vfont_types.h b/source/blender/makesdna/DNA_vfont_types.h
index 416c5f5..14ec6c9 100644
--- a/source/blender/makesdna/DNA_vfont_types.h
+++ b/source/blender/makesdna/DNA_vfont_types.h
@@ -65,6 +65,9 @@ typedef struct VFont {
 #define FO_PAGEDOWN		9
 #define FO_SELCHANGE	10
 
+/* BKE_vfont_to_curve will move the cursor in these cases */
+#define FO_CURS_IS_MOTION(mode) (ELEM4(mode, FO_CURSUP, FO_CURSDOWN, FO_PAGEUP, FO_PAGEDOWN))
+
 #define FO_BUILTIN_NAME "<builtin>"
 
 #endif  /* __DNA_VFONT_TYPES_H__ */




More information about the Bf-blender-cvs mailing list