diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-05-15 13:06:25 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-05-15 13:06:25 +0400 |
commit | 42eb36ecf6e09b2d3801bf367d12e469b7322c00 (patch) | |
tree | 02e608211b1e374a6dbd40ee14a034f396a5ea8c /source | |
parent | c742a4b62b26b7878c122d8a204ccf0c2d934dde (diff) |
Fix 3D font selection and material lagging behind with vertical cursor motion
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/curve/editfont.c | 30 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_vfont_types.h | 3 |
2 files changed, 23 insertions, 10 deletions
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index bd13d383746..36e1210402d 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 416c5f594a3..14ec6c9b312 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__ */ |