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.
This commit is contained in:
Sergey Sharybin 2017-12-19 10:01:00 +01:00
parent a130c82f0a
commit c34f3c777f
Notes: blender-bot 2023-02-14 06:49:57 +01:00
Referenced by commit 7e8525663c, Font objects: Support proper auto-space
Referenced by issue #53683, 2.79a release
Referenced by issue #53559, Cycles does not respect the automatically calculated texture space for objects of type TEXT
1 changed files with 16 additions and 2 deletions

View File

@ -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()