diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 8f41f0611d4..24ed97ccfc1 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -1436,6 +1436,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; @@ -2460,6 +2471,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 */ @@ -2490,8 +2506,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() diff --git a/tests/python/CMakeLists.txt b/tests/python/CMakeLists.txt index dd4c57b43eb..9f1de64c2e9 100644 --- a/tests/python/CMakeLists.txt +++ b/tests/python/CMakeLists.txt @@ -547,6 +547,7 @@ if(WITH_CYCLES) add_cycles_render_test(shader) add_cycles_render_test(shader_tangent) add_cycles_render_test(shadow_catcher) + add_cycles_render_test(texture_space) add_cycles_render_test(volume) else() MESSAGE(STATUS "Disabling Cycles tests because tests folder does not exist")