Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2018-09-30 22:36:02 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2018-09-30 22:37:32 +0300
commit3a09ff77a1d74af2df7da5225c8292d3cf1243a6 (patch)
tree565eb6ebd2a97675c7f508c0af68a4c09c0b6703 /source/blender
parent0722981e99b0f174067b9d07eeaf7c55401f85eb (diff)
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.).
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/font.c1
-rw-r--r--source/blender/editors/curve/editfont.c12
-rw-r--r--source/blender/editors/object/object_add.c1
3 files changed, 10 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c
index 587a2612997..b81d633f156 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -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;
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index 0275cb68550..b87584dc8b7 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -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);
}
}
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index c6f9c1230a6..3fccb5f6943 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -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;