Fix T56879: Blender2.8 Crash when Editing Text on Curve.
Moving cursor in 3D text edit mode calls `BKE_vfont_to_curve_ex()`, which expects to work with evaluated data (curve cache runtime etc.).
This commit is contained in:
parent
0722981e99
commit
3a09ff77a1
Notes:
blender-bot
2023-06-07 10:31:13 +02:00
Referenced by issue #56879, Blender2.8 Crash when Editing Text on Curve
|
@ -1392,6 +1392,7 @@ bool BKE_vfont_to_curve_nubase(Object *ob, int mode, ListBase *r_nubase)
|
|||
NULL, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
/** Warning: expects to have access to evaluated data (i.e. passed object should be evaluated one...). */
|
||||
bool BKE_vfont_to_curve(Object *ob, int mode)
|
||||
{
|
||||
Curve *cu = ob->data;
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
#include "BKE_report.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
#include "RNA_define.h"
|
||||
|
@ -246,6 +247,7 @@ static int insert_into_textbuf(Object *obedit, uintptr_t c)
|
|||
|
||||
static void text_update_edited(bContext *C, Object *obedit, int mode)
|
||||
{
|
||||
Depsgraph *depsgraph = CTX_data_depsgraph(C);
|
||||
Curve *cu = obedit->data;
|
||||
EditFont *ef = cu->editfont;
|
||||
|
||||
|
@ -258,7 +260,8 @@ static void text_update_edited(bContext *C, Object *obedit, int mode)
|
|||
}
|
||||
else {
|
||||
/* depsgraph runs above, but since we're not tagging for update, call direct */
|
||||
BKE_vfont_to_curve(obedit, mode);
|
||||
/* We need evaluated data here. */
|
||||
BKE_vfont_to_curve(DEG_get_evaluated_object(depsgraph, obedit), mode);
|
||||
}
|
||||
|
||||
cu->curinfo = ef->textbufinfo[ef->pos ? ef->pos - 1 : 0];
|
||||
|
@ -895,6 +898,7 @@ static const EnumPropertyItem move_type_items[] = {
|
|||
|
||||
static int move_cursor(bContext *C, int type, const bool select)
|
||||
{
|
||||
Depsgraph *depsgraph = CTX_data_depsgraph(C);
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
Curve *cu = obedit->data;
|
||||
EditFont *ef = cu->editfont;
|
||||
|
@ -977,17 +981,17 @@ 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
|
||||
/* apply vertical cursor motion to position immediately
|
||||
* otherwise the selection will lag behind */
|
||||
if (FO_CURS_IS_MOTION(cursmove)) {
|
||||
BKE_vfont_to_curve(obedit, cursmove);
|
||||
BKE_vfont_to_curve(DEG_get_evaluated_object(depsgraph, obedit), cursmove);
|
||||
cursmove = FO_CURS;
|
||||
}
|
||||
|
||||
if (select == 0) {
|
||||
if (ef->selstart) {
|
||||
ef->selstart = ef->selend = 0;
|
||||
BKE_vfont_to_curve(obedit, FO_SELCHANGE);
|
||||
BKE_vfont_to_curve(DEG_get_evaluated_object(depsgraph, obedit), FO_SELCHANGE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1942,6 +1942,7 @@ static int convert_exec(bContext *C, wmOperator *op)
|
|||
* datablock, but for until we've got granular update
|
||||
* lets take care by selves.
|
||||
*/
|
||||
/* XXX This may fail/crash, since BKE_vfont_to_curve() accesses evaluated data in some cases (bastien). */
|
||||
BKE_vfont_to_curve(newob, FO_EDIT);
|
||||
|
||||
newob->type = OB_CURVE;
|
||||
|
|
Loading…
Reference in New Issue