Page MenuHome

"Convert Text to Curve" disregards "Text ON Curve"
Closed, ResolvedPublicBUG

Description

System Information
Operating system: Linux Ubuntu 19.10
Graphics card: NVidia 1060 Ti

Blender Version
Broken: latest build
Worked: 2.79

Short description of error
When a text has a transform "Text on Curve" assigned and you convert the text to curves, the "Text on Curve" is disregarded and will convert without any transforms.

Exact steps for others to reproduce the error

  • Add Bezier Circle
  • Add Text
  • Assign Bezier Circle to "Text on Curve" in Data Properties->Font->Transform
  • Convert Text to Curve ("Curve from Mesh/Text")
  • Observe conversion not including the Text on Curve

Thanks for looking into it,
Roel

Related Objects

Event Timeline

Philipp Oeser (lichtwerk) changed the task status from Needs Triage to Confirmed.Mar 13 2020, 11:35 AM
Philipp Oeser (lichtwerk) claimed this task.
Philipp Oeser (lichtwerk) changed the subtype of this task from "Report" to "Bug".

Confirmed, checking...

Getting the following here:
BLI_assert failed: /blender/source/blender/blenkernel/intern/font.c:1227, vfont_to_curve(), at 'cu->textoncurve->runtime.curve_cache != ((void *)0)'

Hm, depsgraph is supposedly already ensured to be updated in convert_exec, doing BKE_vfont_to_curve with evaluated object only seems to make things worse :

1
2
3diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
4index 17b6bfdb956..51c1c81fab6 100644
5--- a/source/blender/editors/object/object_add.c
6+++ b/source/blender/editors/object/object_add.c
7@@ -2310,7 +2310,8 @@ static int convert_exec(bContext *C, wmOperator *op)
8 */
9 /* XXX This may fail/crash, since BKE_vfont_to_curve()
10 * accesses evaluated data in some cases (bastien). */
11- BKE_vfont_to_curve(newob, FO_EDIT);
12+ depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
13+ BKE_vfont_to_curve(DEG_get_evaluated_object(depsgraph, newob), FO_EDIT);
14
15 newob->type = OB_CURVE;
16 cu->type = OB_CURVE;

Well, assert is gone, but no splines in Curve then...
Not sure... (esp. since conversion to mesh seems to go fine later?)

@Sergey Sharybin (sergey), @Bastien Montagne (mont29): any ideas?

This could surely get some love guys..

Hi @Roel Koster (kostex) I appreciate your enthusiasm, but please remember that the communication in the tracker is strictly about reproducing the issues or fixing it.

You are already subscribed to this task so you will receive any news regarding it. So please be understanding and keep the communication here on point.

@Philipp Oeser (lichtwerk) you was 80% there!

So general mind set in such operations: get something from evaluated object, but that into the original one. This way you're taking into account all the modifiers and what not, and you allow net object evaluation to use data you've modified.

What is happening in BKE_vfont_to_curve is that it uses same object for source and destination. This isn't what you want since what was happening is that you was modifying the evaluated datablock, which gets fully overwritten during next depsgraph update.

Luckily there is BKE_vfont_to_curve_ex which allows to read and write to two explicit pointers. Something like this snippet should work, but please give it a second test :)

1diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
2index 9119d1cac86..9e0a6d51614 100644
3--- a/source/blender/editors/object/object_add.c
4+++ b/source/blender/editors/object/object_add.c
5@@ -2380,13 +2380,8 @@ static int convert_exec(bContext *C, wmOperator *op)
6
7 cu = newob->data;
8
9- /* TODO(sergey): Ideally DAG will create nurbs list for a curve data
10- * datablock, but for until we've got granular update
11- * lets take care by selves.
12- */
13- /* XXX This may fail/crash, since BKE_vfont_to_curve()
14- * accesses evaluated data in some cases (bastien). */
15- BKE_vfont_to_curve(newob, FO_EDIT);
16+ Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
17+ BKE_vfont_to_curve_ex(ob_eval, ob_eval->data, FO_EDIT, &cu->nurb, NULL, NULL, NULL, NULL);
18
19 newob->type = OB_CURVE;
20 cu->type = OB_CURVE;
21F

That makes a lot of sense [and is working fine], thx @Sergey Sharybin (sergey)!
I guess this is fine to commit then.