diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-09-20 09:10:40 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-09-20 09:10:40 +0300 |
commit | 851228766e375928d31683decb89ca1c9613b938 (patch) | |
tree | ffa791cdf160fea8c47344d8ff1fb4f65e189f51 | |
parent | 869f0a840f2da1176e1e30488f6f4adcc9fe7aa0 (diff) | |
parent | a2d246c5c0b6abffc1f12f288bfe275121fb943e (diff) |
Merge branch 'master' into blender2.8
-rw-r--r-- | build_files/build_environment/cmake/numpy.cmake | 3 | ||||
-rw-r--r-- | build_files/build_environment/cmake/sndfile.cmake | 2 | ||||
-rw-r--r-- | build_files/build_environment/cmake/versions.cmake | 14 | ||||
-rw-r--r-- | build_files/build_environment/patches/python_apple.diff | 33 | ||||
-rw-r--r-- | build_files/cmake/platform/platform_apple.cmake | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/polyfill2d.c | 12 | ||||
-rw-r--r-- | tests/gtests/blenlib/BLI_polyfill2d_test.cc | 75 |
7 files changed, 94 insertions, 47 deletions
diff --git a/build_files/build_environment/cmake/numpy.cmake b/build_files/build_environment/cmake/numpy.cmake index b1bf1691a28..874158fb5e9 100644 --- a/build_files/build_environment/cmake/numpy.cmake +++ b/build_files/build_environment/cmake/numpy.cmake @@ -45,10 +45,9 @@ ExternalProject_Add(external_numpy DOWNLOAD_DIR ${DOWNLOAD_DIR} URL_HASH MD5=${NUMPY_HASH} PREFIX ${BUILD_DIR}/numpy - PATCH_COMMAND ${PATCH_CMD} --verbose -p 1 -N -d ${BUILD_DIR}/numpy/src/external_numpy < ${PATCH_DIR}/numpy.diff CONFIGURE_COMMAND "" LOG_BUILD 1 - BUILD_COMMAND ${PYTHON_BINARY} ${BUILD_DIR}/numpy/src/external_numpy/setup.py build ${NUMPY_BUILD_OPTION} install + BUILD_COMMAND ${PYTHON_BINARY} ${BUILD_DIR}/numpy/src/external_numpy/setup.py build ${NUMPY_BUILD_OPTION} install --old-and-unmanageable INSTALL_COMMAND ${NUMPY_INSTALL} ) diff --git a/build_files/build_environment/cmake/sndfile.cmake b/build_files/build_environment/cmake/sndfile.cmake index 38ba3043c98..d54a71dd7ce 100644 --- a/build_files/build_environment/cmake/sndfile.cmake +++ b/build_files/build_environment/cmake/sndfile.cmake @@ -32,7 +32,7 @@ ExternalProject_Add(external_sndfile DOWNLOAD_DIR ${DOWNLOAD_DIR} URL_HASH MD5=${SNDFILE_HASH} PREFIX ${BUILD_DIR}/sndfile - CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/sndfile/src/external_sndfile/ && ${SNDFILE_ENV} ${CONFIGURE_COMMAND} ${SNDFILE_OPTIONS} --prefix=${mingw_LIBDIR}/sndfile + CONFIGURE_COMMAND cd ${BUILD_DIR}/sndfile/src/external_sndfile/ && ${SNDFILE_ENV} ${CONFIGURE_COMMAND} ${SNDFILE_OPTIONS} --prefix=${mingw_LIBDIR}/sndfile BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/sndfile/src/external_sndfile/ && make -j${MAKE_THREADS} INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/sndfile/src/external_sndfile/ && make install INSTALL_DIR ${LIBDIR}/sndfile diff --git a/build_files/build_environment/cmake/versions.cmake b/build_files/build_environment/cmake/versions.cmake index 5b5af6cfec1..77ae955d6a3 100644 --- a/build_files/build_environment/cmake/versions.cmake +++ b/build_files/build_environment/cmake/versions.cmake @@ -131,10 +131,10 @@ set(OSL_VERSION 1.7.5) set(OSL_URI https://github.com/imageworks/OpenShadingLanguage/archive/Release-${OSL_VERSION}.zip) set(OSL_HASH 6924dd5d453159e7b6eb106a08c358cf) -set(PYTHON_VERSION 3.5.3) -set(PYTHON_SHORT_VERSION 3.5) +set(PYTHON_VERSION 3.6.2) +set(PYTHON_SHORT_VERSION 3.6) set(PYTHON_URI https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tar.xz) -set(PYTHON_HASH 57d1f8bfbabf4f2500273fb0706e6f21) +set(PYTHON_HASH 2c68846471994897278364fc18730dd9) set(TBB_VERSION 44_20160128) set(TBB_URI https://www.threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb${TBB_VERSION}oss_src_0.tgz) @@ -148,10 +148,10 @@ set(REQUESTS_VERSION v2.10.0) set(REQUESTS_URI https://github.com/kennethreitz/requests/archive/${REQUESTS_VERSION}.zip) set(REQUESTS_HASH 6ebefdf0210c7f0933f61501334e46c3) -set(NUMPY_VERSION v1.10.1) -set(NUMPY_SHORT_VERSION 1.10) -set(NUMPY_URI https://pypi.python.org/packages/a5/2e/5412784108f5dc0f827fb460ccdeaa9d76286979fe5ddd070d526d168a59/numpy-1.10.1.zip) -set(NUMPY_HASH 6f57c58bc5b28440fbeccd505da63d58) +set(NUMPY_VERSION v1.13.1) +set(NUMPY_SHORT_VERSION 1.13) +set(NUMPY_URI https://pypi.python.org/packages/c0/3a/40967d9f5675fbb097ffec170f59c2ba19fc96373e73ad47c2cae9a30aed/numpy-1.13.1.zip) +set(NUMPY_HASH 2c3c0f4edf720c3a7b525dacc825b9ae) set(LAME_VERSION 3.99.5) set(LAME_URI http://downloads.sourceforge.net/project/lame/lame/3.99/lame-${LAME_VERSION}.tar.gz) diff --git a/build_files/build_environment/patches/python_apple.diff b/build_files/build_environment/patches/python_apple.diff index 0ca7a8d8f04..34a7906ed6c 100644 --- a/build_files/build_environment/patches/python_apple.diff +++ b/build_files/build_environment/patches/python_apple.diff @@ -1,28 +1,5 @@ ---- Modules/expat/expat_external.h 2016-12-17 06:51:30 -0500 -+++ Modules/expat/expat_external.h 2016-12-17 06:55:29 -0500 -@@ -7,9 +7,17 @@ - - /* External API definitions */ - --/* Namespace external symbols to allow multiple libexpat version to -- co-exist. */ --#include "pyexpatns.h" -+/* -+ -+ HACK: Fix build breakage on MacOS: -+ *** WARNING: renaming "pyexpat" since importing it failed: dlopen(build/lib.macosx-10.6-i386-3.3/pyexpat.so, 2): Symbol not found: _XML_ErrorString -+ This reverts c242a8f30806 from the python hg repo: -+ restore namespacing of pyexpat symbols (closes #19186) -+ See http://bugs.python.org/issue19186#msg214069 -+ The recommendation to include Modules/inc at first broke the Linux build... -+ So do it this way, as it was before. Needs some realignment later. -+ -+*/ - - #if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__) - #define XML_USE_MSC_EXTENSIONS 1 ---- pyconfig.h.in 2017-04-05 02:47:52.000000000 +0200 -+++ pyconfig.h.in 2017-04-05 02:51:33.000000000 +0200 +--- pyconfig.h.in 2017-09-19 14:41:01.000000000 +0300 ++++ pyconfig.h.in 2017-09-19 14:43:18.000000000 +0300 @@ -119,12 +119,6 @@ /* Define to 1 if you have the `clock' function. */ #undef HAVE_CLOCK @@ -33,10 +10,10 @@ -/* Define to 1 if you have the `clock_gettime' function. */ -#undef HAVE_CLOCK_GETTIME - - /* Define if the C compiler supports computed gotos. */ - #undef HAVE_COMPUTED_GOTOS + /* Define to 1 if you have the `clock_settime' function. */ + #undef HAVE_CLOCK_SETTIME -@@ -338,9 +332,6 @@ +@@ -369,9 +363,6 @@ /* Define this if you have flockfile(), getc_unlocked(), and funlockfile() */ #undef HAVE_GETC_UNLOCKED diff --git a/build_files/cmake/platform/platform_apple.cmake b/build_files/cmake/platform/platform_apple.cmake index e26466cc6d5..0b394199183 100644 --- a/build_files/cmake/platform/platform_apple.cmake +++ b/build_files/cmake/platform/platform_apple.cmake @@ -90,7 +90,7 @@ endif() if(WITH_PYTHON) # we use precompiled libraries for py 3.5 and up by default - set(PYTHON_VERSION 3.5) + set(PYTHON_VERSION 3.6) if(NOT WITH_PYTHON_MODULE AND NOT WITH_PYTHON_FRAMEWORK) # normally cached but not since we include them with blender set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}m") diff --git a/source/blender/blenlib/intern/polyfill2d.c b/source/blender/blenlib/intern/polyfill2d.c index 5f9b92198a5..018e2f9be5a 100644 --- a/source/blender/blenlib/intern/polyfill2d.c +++ b/source/blender/blenlib/intern/polyfill2d.c @@ -411,11 +411,11 @@ static bool kdtree2d_isect_tri_recursive( } #define KDTREE2D_ISECT_TRI_RECURSE_NEG \ - (((node->neg != KDNODE_UNSET) && (co[node->axis] > bounds[node->axis].min)) && \ + (((node->neg != KDNODE_UNSET) && (co[node->axis] >= bounds[node->axis].min)) && \ (kdtree2d_isect_tri_recursive(tree, tri_index, tri_coords, tri_center, bounds, \ &tree->nodes[node->neg]))) #define KDTREE2D_ISECT_TRI_RECURSE_POS \ - (((node->pos != KDNODE_UNSET) && (co[node->axis] < bounds[node->axis].max)) && \ + (((node->pos != KDNODE_UNSET) && (co[node->axis] <= bounds[node->axis].max)) && \ (kdtree2d_isect_tri_recursive(tree, tri_index, tri_coords, tri_center, bounds, \ &tree->nodes[node->pos]))) @@ -698,12 +698,12 @@ static bool pf_ear_tip_check(PolyFill *pf, PolyIndex *pi_ear_tip) /* check if counting is wrong */ { uint coords_tot_concave_test = 0; - uint i = pf->coords_tot; - while (i--) { - if (coords_sign[indices[i]] != CONVEX) { + PolyIndex *pi_iter = pi_ear_tip; + do { + if (pi_iter->sign != CONVEX) { coords_tot_concave_test += 1; } - } + } while ((pi_iter = pi_iter->next) != pi_ear_tip); BLI_assert(coords_tot_concave_test == pf->coords_tot_concave); } #endif diff --git a/tests/gtests/blenlib/BLI_polyfill2d_test.cc b/tests/gtests/blenlib/BLI_polyfill2d_test.cc index eefcdd6e85e..df98ead4cb9 100644 --- a/tests/gtests/blenlib/BLI_polyfill2d_test.cc +++ b/tests/gtests/blenlib/BLI_polyfill2d_test.cc @@ -210,6 +210,26 @@ static void test_polyfill_template( #endif } +static void test_polyfill_template_flip_sign( + const char *id, bool is_degenerate, + const float poly[][2], const unsigned int poly_tot, + unsigned int tris[][3], const unsigned int tris_tot) +{ + float (*poly_copy)[2] = (float (*)[2])MEM_mallocN(sizeof(float[2]) * poly_tot, id); + for (int flip_x = 0; flip_x < 2; flip_x++) { + for (int flip_y = 0; flip_y < 2; flip_y++) { + float sign_x = flip_x ? -1.0f : 1.0f; + float sign_y = flip_y ? -1.0f : 1.0f; + for (int i = 0; i < poly_tot; i++) { + poly_copy[i][0] = poly[i][0] * sign_x; + poly_copy[i][1] = poly[i][1] * sign_y; + } + test_polyfill_template(id, is_degenerate, poly_copy, poly_tot, tris, tris_tot); + } + } + MEM_freeN(poly_copy); +} + #ifdef USE_COMBINATIONS_ALL static void test_polyfill_template_main( const char *id, bool is_degenerate, @@ -232,7 +252,7 @@ static void test_polyfill_template_main( for (poly_cycle = 0; poly_cycle < poly_tot; poly_cycle++) { // printf("polytest %s ofs=%d, reverse=%d\n", id, poly_cycle, poly_reverse); - test_polyfill_template(id, is_degenerate, poly, poly_tot, tris, tris_tot); + test_polyfill_template_flip_sign(id, is_degenerate, poly, poly_tot, tris, tris_tot); /* cycle */ copy_v2_v2(tmp, poly_copy[0]); @@ -249,7 +269,7 @@ static void test_polyfill_template_main( const float poly[][2], const unsigned int poly_tot, unsigned int tris[][3], const unsigned int tris_tot) { - test_polyfill_template(id, is_degenerate, poly, poly_tot, tris, tris_tot); + test_polyfill_template_flip_sign(id, is_degenerate, poly, poly_tot, tris, tris_tot); } #endif /* USE_COMBINATIONS_ALL */ @@ -309,6 +329,43 @@ static void polyfill_to_obj( /* -------------------------------------------------------------------- */ /* tests */ +/** + * Script to generate the data below: + * + * \code{.py} + * # This example assumes we have a mesh object in edit-mode + * + * import bpy + * import bmesh + * + * obj = bpy.context.edit_object + * me = obj.data + * bm = bmesh.from_edit_mesh(me) + * + * def clean_float(num): + * if int(num) == num: + * return str(int(num)) + * prec = 1 + * while True: + * text = f"{num:.{prec}f}" + * if float(text) == num: + * return text + * prec += 1 + * + * for f in bm.faces: + * if f.select: + * print(f"\t// data for face: {f.index}") + * print("\tconst float poly[][2] = {", end="") + * coords = [[clean_float(num) for num in l.vert.co[0:2]] for l in f.loops] + * print("\t ", end="") + * for i, (x, y) in enumerate(coords): + * if (i % 2) == 0: + * print("\n\t ", end="") + * print(f"{{{x}, {y}}}", end=",") + * print("\n\t};") + * \endcode + */ + #define POLY_TRI_COUNT(len) ((len) - 2) @@ -519,3 +576,17 @@ TEST(polyfill2d, IssueT41986_axis_align) TEST_POLYFILL_TEMPLATE_STATIC(poly, false); } + +/* Blender bug T52834 */ +TEST(polyfill2d, IssueT52834_axis_align_co_linear) +{ + const float poly[][2] = { + {40, 0}, {36, 0}, {36, 5}, {35, 5}, {35, 0}, {30, 0}, {30, 5}, {29, 5}, {29, 0}, {24, 0}, {24, 3}, + {23, 4}, {23, 0}, {18, 0}, {18, 5}, {17, 5}, {17, 0}, {12, 0}, {12, 5}, {11, 5}, {11, 0}, {6, 0}, + {6, 5}, {5, 5}, {5, 0}, {0, 0}, {0, 5}, {-1, 5}, {-1, 0}, {-6, 0}, {-9, -3}, {-6, -3}, {-6, -2}, + {-1, -2}, {0, -2}, {5, -2}, {6, -2}, {11, -2}, {12, -2}, {17, -2}, {18, -2}, {23, -2}, {24, -2}, + {29, -2}, {30, -2}, {35, -2}, {36, -2}, {40, -2}, + }; + + TEST_POLYFILL_TEMPLATE_STATIC(poly, false); +} |