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

This commit is contained in:
2014-05-15 19:06:25 +10:00
parent c742a4b62b
commit 42eb36ecf6
2 changed files with 23 additions and 10 deletions

View File

@@ -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);

View File

@@ -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__ */