diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-12-19 12:01:00 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-12-19 12:01:00 +0300 |
commit | c34f3c777f9a783033a098734c25716d1def3f09 (patch) | |
tree | e0746e729309d30a0c7711d80a43802963c1c1af /source/blender/blenkernel/intern/mesh.c | |
parent | a130c82f0a8df7a949d0888cb1fa798740012a48 (diff) |
Fix T53559: Auto texture space for text and font is wrong in Cycles
The issue actually goes a bit deeper, converting curve to mesh will
change texture space just because font and bezier curves are using CV
to calculate texture space.
So now when those objects are converted to mesh, we disable auto
texture space and copy evaluated space over.
Diffstat (limited to 'source/blender/blenkernel/intern/mesh.c')
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 0d01fe77453..a3fa754c725 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -1396,6 +1396,17 @@ void BKE_mesh_from_nurbs_displist(Object *ob, ListBase *dispbase, const bool use me->totcol = cu->totcol; me->mat = cu->mat; + /* Copy evaluated texture space from curve to mesh. + * + * Note that we disable auto texture space feature since that will cause + * texture space to evaluate differently for curve and mesh, since curve + * uses CV to calculate bounding box, and mesh uses what is coming from + * tessellated curve. + */ + me->texflag = cu->texflag & ~CU_AUTOSPACE; + copy_v3_v3(me->loc, cu->loc); + copy_v3_v3(me->size, cu->size); + copy_v3_v3(me->rot, cu->rot); BKE_mesh_texspace_calc(me); cu->mat = NULL; @@ -2420,6 +2431,11 @@ Mesh *BKE_mesh_new_from_object( /* copies the data */ copycu = tmpobj->data = BKE_curve_copy(bmain, (Curve *) ob->data); + /* make sure texture space is calculated for a copy of curve, + * it will be used for the final result. + */ + BKE_curve_texspace_calc(copycu); + /* temporarily set edit so we get updates from edit mode, but * also because for text datablocks copying it while in edit * mode gives invalid data structures */ @@ -2450,8 +2466,6 @@ Mesh *BKE_mesh_new_from_object( return NULL; } - BKE_mesh_texspace_copy_from_object(tmpmesh, ob); - BKE_libblock_free_us(bmain, tmpobj); /* XXX The curve to mesh conversion is convoluted... But essentially, BKE_mesh_from_nurbs_displist() |