diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2015-05-19 12:20:54 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2015-05-19 12:20:54 +0300 |
commit | 8357040667f3008d9d0f1e33f0b0dc54ff4a3ef8 (patch) | |
tree | bf3743b1cf42a7fa257fb2cac3a835bc7da17825 /source/blender/blenkernel | |
parent | 8ef679b6fddfa4f9d6a417b578e8ce77ca320c61 (diff) | |
parent | e8561e966d3d6ced9569e9a91aa123975e9ee95a (diff) |
Merge branch 'master' into gooseberry
Conflicts:
source/blender/windowmanager/intern/wm_playanim.c
Diffstat (limited to 'source/blender/blenkernel')
18 files changed, 212 insertions, 73 deletions
diff --git a/source/blender/blenkernel/BKE_bpath.h b/source/blender/blenkernel/BKE_bpath.h index 990b414a4cf..10ee504f244 100644 --- a/source/blender/blenkernel/BKE_bpath.h +++ b/source/blender/blenkernel/BKE_bpath.h @@ -48,13 +48,21 @@ void *BKE_bpath_list_backup(struct Main *bmain, const int flag); void BKE_bpath_list_restore(struct Main *bmain, const int flag, void *ls_handle); void BKE_bpath_list_free(void *ls_handle); -#define BKE_BPATH_TRAVERSE_ABS (1 << 0) /* convert paths to absolute */ -#define BKE_BPATH_TRAVERSE_SKIP_LIBRARY (1 << 2) /* skip library paths */ -#define BKE_BPATH_TRAVERSE_SKIP_PACKED (1 << 3) /* skip packed data */ -#define BKE_BPATH_TRAVERSE_SKIP_MULTIFILE (1 << 4) /* skip paths where a single dir is used with an array of files, eg. - * sequence strip images and pointcache. in this case only use the first - * file, this is needed for directory manipulation functions which might - * otherwise modify the same directory multiple times */ +enum { + /* convert paths to absolute */ + BKE_BPATH_TRAVERSE_ABS = (1 << 0), + /* skip library paths */ + BKE_BPATH_TRAVERSE_SKIP_LIBRARY = (1 << 1), + /* skip packed data */ + BKE_BPATH_TRAVERSE_SKIP_PACKED = (1 << 2), + /* skip paths where a single dir is used with an array of files, eg. + * sequence strip images and pointcache. in this case only use the first + * file, this is needed for directory manipulation functions which might + * otherwise modify the same directory multiple times */ + BKE_BPATH_TRAVERSE_SKIP_MULTIFILE = (1 << 3), + /* reload data (when the path is edited) */ + BKE_BPATH_TRAVERSE_RELOAD_EDITED = (1 << 4), +}; /* high level funcs */ diff --git a/source/blender/blenkernel/BKE_mesh_mapping.h b/source/blender/blenkernel/BKE_mesh_mapping.h index dcf5d2ed78d..a2f47858f90 100644 --- a/source/blender/blenkernel/BKE_mesh_mapping.h +++ b/source/blender/blenkernel/BKE_mesh_mapping.h @@ -102,7 +102,8 @@ typedef struct MeshElemMap { /* mapping */ UvVertMap *BKE_mesh_uv_vert_map_create( struct MPoly *mpoly, struct MLoop *mloop, struct MLoopUV *mloopuv, - unsigned int totpoly, unsigned int totvert, int selected, float *limit, bool use_winding); + unsigned int totpoly, unsigned int totvert, + const float limit[2], const bool selected, const bool use_winding); UvMapVert *BKE_mesh_uv_vert_map_get_vert(UvVertMap *vmap, unsigned int v); void BKE_mesh_uv_vert_map_free(UvVertMap *vmap); diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h index 1df633cc966..c7ef53589aa 100644 --- a/source/blender/blenkernel/BKE_pbvh.h +++ b/source/blender/blenkernel/BKE_pbvh.h @@ -145,8 +145,10 @@ typedef enum { PBVH_Subdivide = 1, PBVH_Collapse = 2, } PBVHTopologyUpdateMode; -bool BKE_pbvh_bmesh_update_topology(PBVH *bvh, PBVHTopologyUpdateMode mode, - const float center[3], float radius); +bool BKE_pbvh_bmesh_update_topology( + PBVH *bvh, PBVHTopologyUpdateMode mode, + const float center[3], const float view_normal[3], + float radius); /* Node Access */ diff --git a/source/blender/blenkernel/intern/appdir.c b/source/blender/blenkernel/intern/appdir.c index e4ed8c3ef73..3f69618b591 100644 --- a/source/blender/blenkernel/intern/appdir.c +++ b/source/blender/blenkernel/intern/appdir.c @@ -607,30 +607,42 @@ bool BKE_appdir_program_python_search( const int version_major, const int version_minor) { const char *basename = "python"; + char python_ver[16]; + /* check both possible names */ + const char *python_names[] = {basename, python_ver}; + int i; + bool is_found = false; + BLI_snprintf(python_ver, sizeof(python_ver), "%s%d.%d", basename, version_major, version_minor); + { const char *python_bin_dir = BKE_appdir_folder_id(BLENDER_SYSTEM_PYTHON, "bin"); if (python_bin_dir) { - BLI_join_dirfile(fullpath, fullpath_len, python_bin_dir, basename); - if ( + + for (i = 0; i < ARRAY_SIZE(python_names); i++) { + BLI_join_dirfile(fullpath, fullpath_len, python_bin_dir, python_names[i]); + + if ( #ifdef _WIN32 - BLI_path_program_extensions_add_win32(fullpath, fullpath_len) + BLI_path_program_extensions_add_win32(fullpath, fullpath_len) #else - BLI_exists(fullpath) + BLI_exists(fullpath) #endif - ) - { - is_found = true; + ) + { + is_found = true; + } } } } if (is_found == false) { - char python_ver[16]; - BLI_snprintf(python_ver, sizeof(python_ver), "%s%d.%d", basename, version_major, version_minor); - if (BLI_path_program_search(fullpath, fullpath_len, python_ver)) { - is_found = true; + for (i = 0; i < ARRAY_SIZE(python_names); i++) { + if (BLI_path_program_search(fullpath, fullpath_len, python_names[i])) { + is_found = true; + break; + } } } diff --git a/source/blender/blenkernel/intern/bpath.c b/source/blender/blenkernel/intern/bpath.c index b7352cce0d0..8248ea2fa37 100644 --- a/source/blender/blenkernel/intern/bpath.c +++ b/source/blender/blenkernel/intern/bpath.c @@ -324,13 +324,14 @@ void BKE_bpath_missing_files_find(Main *bmain, const char *searchpath, ReportLis const bool find_all) { struct BPathFind_Data data = {NULL}; + const int flag = BKE_BPATH_TRAVERSE_ABS | BKE_BPATH_TRAVERSE_RELOAD_EDITED; data.basedir = bmain->name; data.reports = reports; data.searchdir = searchpath; data.find_all = find_all; - BKE_bpath_traverse_main(bmain, missing_files_find__visit_cb, BKE_BPATH_TRAVERSE_ABS, (void *)&data); + BKE_bpath_traverse_main(bmain, missing_files_find__visit_cb, flag, (void *)&data); } /* Run a visitor on a string, replacing the contents of the string as needed. */ @@ -437,9 +438,14 @@ void BKE_bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int if (BKE_image_has_packedfile(ima) == false || (flag & BKE_BPATH_TRAVERSE_SKIP_PACKED) == 0) { if (ELEM(ima->source, IMA_SRC_FILE, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) { if (rewrite_path_fixed(ima->name, visit_cb, absbase, bpath_user_data)) { - if (!BKE_image_has_packedfile(ima)) { - BKE_image_signal(ima, NULL, IMA_SIGNAL_RELOAD); - BKE_image_walk_all_users(bmain, ima, bpath_traverse_image_user_cb); + if (flag & BKE_BPATH_TRAVERSE_RELOAD_EDITED) { + if (!BKE_image_has_packedfile(ima) && + /* image may have been painted onto (and not saved, T44543) */ + !BKE_image_is_dirty(ima)) + { + BKE_image_signal(ima, NULL, IMA_SIGNAL_RELOAD); + BKE_image_walk_all_users(bmain, ima, bpath_traverse_image_user_cb); + } } } } diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 45fb5dbc384..8660f122c10 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -793,7 +793,7 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, else { /* we need to check if the next material changes */ int next_actualFace = dm->drawObject->triangle_to_mface[0]; - int prev_mat_nr = -1; + short prev_mat_nr = -1; for (i = 0; i < tottri; i++) { //int actualFace = dm->drawObject->triangle_to_mface[i]; diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c index 5230634fe4c..90decfde30f 100644 --- a/source/blender/blenkernel/intern/editderivedmesh.c +++ b/source/blender/blenkernel/intern/editderivedmesh.c @@ -521,8 +521,6 @@ static void emDM_drawMappedFaces(DerivedMesh *dm, GLenum poly_prev = GL_ZERO; GLenum shade_prev = GL_ZERO; - (void)setMaterial; /* UNUSED */ - /* currently unused -- each original face is handled separately */ (void)compareDrawOptions; @@ -539,6 +537,8 @@ static void emDM_drawMappedFaces(DerivedMesh *dm, } if (bmdm->vertexCos) { + short prev_mat_nr = -1; + /* add direct access */ const float (*vertexCos)[3] = bmdm->vertexCos; const float (*vertexNos)[3]; @@ -569,8 +569,14 @@ static void emDM_drawMappedFaces(DerivedMesh *dm, setDrawOptions(userData, BM_elem_index_get(efa))); if (draw_option != DM_DRAW_OPTION_SKIP) { const GLenum poly_type = GL_TRIANGLES; /* BMESH NOTE, this is odd but keep it for now to match trunk */ - if (setMaterial) - setMaterial(efa->mat_nr + 1, NULL); + + if (efa->mat_nr != prev_mat_nr) { + if (setMaterial) { + setMaterial(efa->mat_nr + 1, NULL); + } + prev_mat_nr = efa->mat_nr; + } + if (draw_option == DM_DRAW_OPTION_STIPPLE) { /* enabled with stipple */ if (poly_prev != GL_ZERO) glEnd(); @@ -645,6 +651,8 @@ static void emDM_drawMappedFaces(DerivedMesh *dm, } } else { + short prev_mat_nr = -1; + BM_mesh_elem_index_ensure(bm, lnors ? BM_FACE | BM_LOOP : BM_FACE); for (i = 0; i < tottri; i++) { @@ -661,8 +669,12 @@ static void emDM_drawMappedFaces(DerivedMesh *dm, if (draw_option != DM_DRAW_OPTION_SKIP) { const GLenum poly_type = GL_TRIANGLES; /* BMESH NOTE, this is odd but keep it for now to match trunk */ - if (setMaterial) - setMaterial(efa->mat_nr + 1, NULL); + if (efa->mat_nr != prev_mat_nr) { + if (setMaterial) { + setMaterial(efa->mat_nr + 1, NULL); + } + prev_mat_nr = efa->mat_nr; + } if (draw_option == DM_DRAW_OPTION_STIPPLE) { /* enabled with stipple */ diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 413e34e72a8..6e58513e38e 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -46,6 +46,7 @@ #include "BLI_blenlib.h" #include "BLI_math.h" #include "BLI_easing.h" +#include "BLI_threads.h" #include "BLI_utildefines.h" #include "BLF_translation.h" @@ -69,6 +70,10 @@ #define SMALL -1.0e-10 #define SELECT 1 +#ifdef WITH_PYTHON +static ThreadMutex python_driver_lock = BLI_MUTEX_INITIALIZER; +#endif + /* ************************** Data-Level Functions ************************* */ /* ---------------------- Freeing --------------------------- */ @@ -1807,7 +1812,9 @@ static float evaluate_driver(ChannelDriver *driver, const float evaltime) /* this evaluates the expression using Python, and returns its result: * - on errors it reports, then returns 0.0f */ + BLI_mutex_lock(&python_driver_lock); driver->curval = BPY_driver_exec(driver, evaltime); + BLI_mutex_unlock(&python_driver_lock); } #else /* WITH_PYTHON*/ (void)evaltime; diff --git a/source/blender/blenkernel/intern/mesh_mapping.c b/source/blender/blenkernel/intern/mesh_mapping.c index e4a85eb399b..8b41aded3d9 100644 --- a/source/blender/blenkernel/intern/mesh_mapping.c +++ b/source/blender/blenkernel/intern/mesh_mapping.c @@ -54,8 +54,10 @@ /* this replaces the non bmesh function (in trunk) which takes MTFace's, if we ever need it back we could * but for now this replaces it because its unused. */ -UvVertMap *BKE_mesh_uv_vert_map_create(struct MPoly *mpoly, struct MLoop *mloop, struct MLoopUV *mloopuv, - unsigned int totpoly, unsigned int totvert, int selected, float *limit, bool use_winding) +UvVertMap *BKE_mesh_uv_vert_map_create( + struct MPoly *mpoly, struct MLoop *mloop, struct MLoopUV *mloopuv, + unsigned int totpoly, unsigned int totvert, + const float limit[2], const bool selected, const bool use_winding) { UvVertMap *vmap; UvMapVert *buf; diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 3950e87031e..cef3dd4f826 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -3078,8 +3078,9 @@ void BKE_object_handle_update_ex(EvaluationContext *eval_ctx, // printf("ob proxy copy, lib ob %s proxy %s\n", ob->id.name, ob->proxy_from->id.name); if (ob->proxy_from->proxy_group) { /* transform proxy into group space */ Object *obg = ob->proxy_from->proxy_group; - invert_m4_m4(obg->imat, obg->obmat); - mul_m4_m4m4(ob->obmat, obg->imat, ob->proxy_from->obmat); + float imat[4][4]; + invert_m4_m4(imat, obg->obmat); + mul_m4_m4m4(ob->obmat, imat, ob->proxy_from->obmat); if (obg->dup_group) { /* should always be true */ add_v3_v3(ob->obmat[3], obg->dup_group->dupli_ofs); } diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c index 567fb2ebba1..6752beb6d3b 100644 --- a/source/blender/blenkernel/intern/object_update.c +++ b/source/blender/blenkernel/intern/object_update.c @@ -37,6 +37,7 @@ #include "BLI_blenlib.h" #include "BLI_utildefines.h" #include "BLI_math.h" +#include "BLI_threads.h" #include "BKE_global.h" #include "BKE_armature.h" @@ -65,6 +66,8 @@ # define DEBUG_PRINT if (G.debug & G_DEBUG_DEPSGRAPH) printf #endif +static ThreadMutex material_lock = BLI_MUTEX_INITIALIZER; + void BKE_object_eval_local_transform(EvaluationContext *UNUSED(eval_ctx), Scene *UNUSED(scene), Object *ob) @@ -246,12 +249,16 @@ void BKE_object_handle_data_update(EvaluationContext *eval_ctx, */ if (ob->totcol) { int a; - for (a = 1; a <= ob->totcol; a++) { - Material *ma = give_current_material(ob, a); - if (ma) { - /* recursively update drivers for this material */ - material_drivers_update(scene, ma, ctime); + if (ob->totcol != 0) { + BLI_mutex_lock(&material_lock); + for (a = 1; a <= ob->totcol; a++) { + Material *ma = give_current_material(ob, a); + if (ma) { + /* recursively update drivers for this material */ + material_drivers_update(scene, ma, ctime); + } } + BLI_mutex_unlock(&material_lock); } } else if (ob->type == OB_LAMP) @@ -318,8 +325,9 @@ void BKE_object_eval_uber_transform(EvaluationContext *UNUSED(eval_ctx), if (ob->proxy_from->proxy_group) { /* Transform proxy into group space. */ Object *obg = ob->proxy_from->proxy_group; - invert_m4_m4(obg->imat, obg->obmat); - mul_m4_m4m4(ob->obmat, obg->imat, ob->proxy_from->obmat); + float imat[4][4]; + invert_m4_m4(imat, obg->obmat); + mul_m4_m4m4(ob->obmat, imat, ob->proxy_from->obmat); /* Should always be true. */ if (obg->dup_group) { add_v3_v3(ob->obmat[3], obg->dup_group->dupli_ofs); diff --git a/source/blender/blenkernel/intern/outliner_treehash.c b/source/blender/blenkernel/intern/outliner_treehash.c index 21664bfd285..f31ba34a984 100644 --- a/source/blender/blenkernel/intern/outliner_treehash.c +++ b/source/blender/blenkernel/intern/outliner_treehash.c @@ -102,6 +102,9 @@ static void fill_treehash(void *treehash, BLI_mempool *treestore) TreeStoreElem *tselem; BLI_mempool_iter iter; BLI_mempool_iternew(treestore, &iter); + + BLI_assert(treehash); + while ((tselem = BLI_mempool_iterstep(&iter))) { BKE_outliner_treehash_add_element(treehash, tselem); } @@ -121,6 +124,8 @@ static void free_treehash_group(void *key) void *BKE_outliner_treehash_rebuild_from_treestore(void *treehash, BLI_mempool *treestore) { + BLI_assert(treehash); + BLI_ghash_clear_ex(treehash, NULL, free_treehash_group, BLI_mempool_count(treestore)); fill_treehash(treehash, treestore); return treehash; @@ -144,12 +149,19 @@ static TseGroup *BKE_outliner_treehash_lookup_group(GHash *th, short type, short tse_template.type = type; tse_template.nr = type ? nr : 0; // we're picky! :) tse_template.id = id; + + BLI_assert(th); + return BLI_ghash_lookup(th, &tse_template); } TreeStoreElem *BKE_outliner_treehash_lookup_unused(void *treehash, short type, short nr, struct ID *id) { - TseGroup *group = BKE_outliner_treehash_lookup_group(treehash, type, nr, id); + TseGroup *group; + + BLI_assert(treehash); + + group = BKE_outliner_treehash_lookup_group(treehash, type, nr, id); if (group) { int i; for (i = 0; i < group->size; i++) { @@ -163,11 +175,17 @@ TreeStoreElem *BKE_outliner_treehash_lookup_unused(void *treehash, short type, s TreeStoreElem *BKE_outliner_treehash_lookup_any(void *treehash, short type, short nr, struct ID *id) { - TseGroup *group = BKE_outliner_treehash_lookup_group(treehash, type, nr, id); + TseGroup *group; + + BLI_assert(treehash); + + group = BKE_outliner_treehash_lookup_group(treehash, type, nr, id); return group ? group->elems[0] : NULL; } void BKE_outliner_treehash_free(void *treehash) { + BLI_assert(treehash); + BLI_ghash_free(treehash, NULL, free_treehash_group); } diff --git a/source/blender/blenkernel/intern/particle_distribute.c b/source/blender/blenkernel/intern/particle_distribute.c index ca8df2f8fbb..13bb7c65025 100644 --- a/source/blender/blenkernel/intern/particle_distribute.c +++ b/source/blender/blenkernel/intern/particle_distribute.c @@ -333,7 +333,7 @@ static void init_mv_jit(float *jit, int num, int seed2, float amount) rng = BLI_rng_new(31415926 + num + seed2); x= 0; - num2 = 2 * num; + num2 = 2 * num; for (i=0; i<num2; i+=2) { jit[i] = x + amount*rad1*(0.5f - BLI_rng_get_float(rng)); diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c index e631a4a365d..9f092bd651f 100644 --- a/source/blender/blenkernel/intern/pbvh_bmesh.c +++ b/source/blender/blenkernel/intern/pbvh_bmesh.c @@ -48,6 +48,9 @@ # include "BKE_global.h" #endif +/* Support for only operating on front-faces */ +#define USE_EDGEQUEUE_FRONTFACE + /* don't add edges into the queue multiple times */ #define USE_EDGEQUEUE_TAG /** @@ -598,6 +601,12 @@ typedef struct { #ifdef USE_EDGEQUEUE_EVEN_SUBDIV float limit_len; #endif + +#ifdef USE_EDGEQUEUE_FRONTFACE + const float *view_normal; + unsigned int use_view_normal : 1; +#endif + } EdgeQueue; typedef struct { @@ -719,6 +728,14 @@ static void long_edge_queue_edge_add_recursive( { BLI_assert(len_sq > SQUARE(limit_len)); +#ifdef USE_EDGEQUEUE_FRONTFACE + if (eq_ctx->q->use_view_normal) { + if (dot_v3v3(l_edge->f->no, eq_ctx->q->view_normal) < 0.0f) { + return; + } + } +#endif + #ifdef USE_EDGEQUEUE_TAG if (EDGE_QUEUE_TEST(l_edge->e) == false) #endif @@ -787,6 +804,14 @@ static void long_edge_queue_face_add( EdgeQueueContext *eq_ctx, BMFace *f) { +#ifdef USE_EDGEQUEUE_FRONTFACE + if (eq_ctx->q->use_view_normal) { + if (dot_v3v3(f->no, eq_ctx->q->view_normal) < 0.0f) { + return; + } + } +#endif + if (edge_queue_tri_in_sphere(eq_ctx->q, f)) { BMLoop *l_iter; BMLoop *l_first; @@ -814,6 +839,14 @@ static void short_edge_queue_face_add( EdgeQueueContext *eq_ctx, BMFace *f) { +#ifdef USE_EDGEQUEUE_FRONTFACE + if (eq_ctx->q->use_view_normal) { + if (dot_v3v3(f->no, eq_ctx->q->view_normal) < 0.0f) { + return; + } + } +#endif + if (edge_queue_tri_in_sphere(eq_ctx->q, f)) { BMLoop *l_iter; BMLoop *l_first; @@ -837,7 +870,7 @@ static void short_edge_queue_face_add( */ static void long_edge_queue_create( EdgeQueueContext *eq_ctx, - PBVH *bvh, const float center[3], + PBVH *bvh, const float center[3], const float view_normal[3], float radius) { int n; @@ -850,6 +883,13 @@ static void long_edge_queue_create( eq_ctx->q->limit_len = bvh->bm_max_edge_len; #endif +#ifdef USE_EDGEQUEUE_FRONTFACE + eq_ctx->q->view_normal = view_normal; + eq_ctx->q->use_view_normal = (view_normal != NULL); +#else + UNUSED_VARS(view_normal); +#endif + #ifdef USE_EDGEQUEUE_TAG_VERIFY pbvh_bmesh_edge_tag_verify(bvh); #endif @@ -886,7 +926,7 @@ static void long_edge_queue_create( */ static void short_edge_queue_create( EdgeQueueContext *eq_ctx, - PBVH *bvh, const float center[3], + PBVH *bvh, const float center[3], const float view_normal[3], float radius) { int n; @@ -899,6 +939,13 @@ static void short_edge_queue_create( eq_ctx->q->limit_len = bvh->bm_min_edge_len; #endif +#ifdef USE_EDGEQUEUE_FRONTFACE + eq_ctx->q->view_normal = view_normal; + eq_ctx->q->use_view_normal = (view_normal != NULL); +#else + UNUSED_VARS(view_normal); +#endif + for (n = 0; n < bvh->totnode; n++) { PBVHNode *node = &bvh->nodes[n]; @@ -1704,7 +1751,8 @@ void BKE_pbvh_build_bmesh( /* Collapse short edges, subdivide long edges */ bool BKE_pbvh_bmesh_update_topology( PBVH *bvh, PBVHTopologyUpdateMode mode, - const float center[3], float radius) + const float center[3], const float view_normal[3], + float radius) { /* 2 is enough for edge faces - manifold edge */ BLI_buffer_declare_static(BMLoop *, edge_loops, BLI_BUFFER_NOP, 2); @@ -1716,12 +1764,16 @@ bool BKE_pbvh_bmesh_update_topology( bool modified = false; int n; + if (view_normal) { + BLI_assert(len_squared_v3(view_normal) != 0.0f); + } + if (mode & PBVH_Collapse) { EdgeQueue q; BLI_mempool *queue_pool = BLI_mempool_create(sizeof(BMVert *[2]), 0, 128, BLI_MEMPOOL_NOP); EdgeQueueContext eq_ctx = {&q, queue_pool, bvh->bm, cd_vert_mask_offset, cd_vert_node_offset, cd_face_node_offset}; - short_edge_queue_create(&eq_ctx, bvh, center, radius); + short_edge_queue_create(&eq_ctx, bvh, center, view_normal, radius); modified |= !BLI_heap_is_empty(q.heap); pbvh_bmesh_collapse_short_edges(&eq_ctx, bvh, &deleted_faces); @@ -1734,7 +1786,7 @@ bool BKE_pbvh_bmesh_update_topology( BLI_mempool *queue_pool = BLI_mempool_create(sizeof(BMVert *[2]), 0, 128, BLI_MEMPOOL_NOP); EdgeQueueContext eq_ctx = {&q, queue_pool, bvh->bm, cd_vert_mask_offset, cd_vert_node_offset, cd_face_node_offset}; - long_edge_queue_create(&eq_ctx, bvh, center, radius); + long_edge_queue_create(&eq_ctx, bvh, center, view_normal, radius); modified |= !BLI_heap_is_empty(q.heap); pbvh_bmesh_subdivide_long_edges(&eq_ctx, bvh, &edge_loops); BLI_heap_free(q.heap, NULL); diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index a67e9c42e9d..01bc4a1c237 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -3324,7 +3324,7 @@ void BKE_ptcache_bake(PTCacheBaker *baker) } } - BLI_end_threads(&threads); + BLI_end_threads(&threads); } /* clear baking flag */ if (pid) { diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 52932a36ae1..dc5b77a1bf4 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -1035,6 +1035,7 @@ static int sb_detect_aabb_collisionCached(float UNUSED(force[3]), unsigned int U ccd_Mesh *ccdm = BLI_ghashIterator_getValue (ihash); ob = BLI_ghashIterator_getKey (ihash); + { /* only with deflecting set */ if (ob->pd && ob->pd->deflect) { #if 0 /* UNUSED */ @@ -1076,6 +1077,7 @@ static int sb_detect_aabb_collisionCached(float UNUSED(force[3]), unsigned int U } } /* if (ob->pd && ob->pd->deflect) */ BLI_ghashIterator_step(ihash); + } } /* while () */ BLI_ghashIterator_free(ihash); return deflected; @@ -1114,6 +1116,7 @@ static int sb_detect_face_pointCached(float face_v1[3], float face_v2[3], float ccd_Mesh *ccdm = BLI_ghashIterator_getValue (ihash); ob = BLI_ghashIterator_getKey (ihash); + { /* only with deflecting set */ if (ob->pd && ob->pd->deflect) { MVert *mvert= NULL; @@ -1177,6 +1180,7 @@ static int sb_detect_face_pointCached(float face_v1[3], float face_v2[3], float } /* if (mvert) */ } /* if (ob->pd && ob->pd->deflect) */ BLI_ghashIterator_step(ihash); + } } /* while () */ BLI_ghashIterator_free(ihash); return deflected; @@ -1206,6 +1210,7 @@ static int sb_detect_face_collisionCached(float face_v1[3], float face_v2[3], fl ccd_Mesh *ccdm = BLI_ghashIterator_getValue (ihash); ob = BLI_ghashIterator_getKey (ihash); + { /* only with deflecting set */ if (ob->pd && ob->pd->deflect) { MFace *mface= NULL; @@ -1315,6 +1320,7 @@ static int sb_detect_face_collisionCached(float face_v1[3], float face_v2[3], fl }/* while a */ } /* if (ob->pd && ob->pd->deflect) */ BLI_ghashIterator_step(ihash); + } } /* while () */ BLI_ghashIterator_free(ihash); return deflected; @@ -1434,6 +1440,7 @@ static int sb_detect_edge_collisionCached(float edge_v1[3], float edge_v2[3], fl ccd_Mesh *ccdm = BLI_ghashIterator_getValue (ihash); ob = BLI_ghashIterator_getKey (ihash); + { /* only with deflecting set */ if (ob->pd && ob->pd->deflect) { MFace *mface= NULL; @@ -1555,6 +1562,7 @@ static int sb_detect_edge_collisionCached(float edge_v1[3], float edge_v2[3], fl }/* while a */ } /* if (ob->pd && ob->pd->deflect) */ BLI_ghashIterator_step(ihash); + } } /* while () */ BLI_ghashIterator_free(ihash); return deflected; @@ -1762,6 +1770,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3], ccd_Mesh *ccdm = BLI_ghashIterator_getValue (ihash); ob = BLI_ghashIterator_getKey (ihash); + { /* only with deflecting set */ if (ob->pd && ob->pd->deflect) { MFace *mface= NULL; @@ -1799,7 +1808,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3], else { /*aye that should be cached*/ printf("missing cache error\n"); - BLI_ghashIterator_step(ihash); + BLI_ghashIterator_step(ihash); continue; } @@ -1917,16 +1926,16 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3], if (facedist > outerfacethickness*ff) force_mag_norm =(float)force_mag_norm*fa*(facedist - outerfacethickness)*(facedist - outerfacethickness); *damp=ob->pd->pdef_sbdamp; - if (facedist > 0.0f) { - *damp *= (1.0f - facedist/outerfacethickness); - Vec3PlusStVec(outerforceaccu, force_mag_norm, d_nvect); - deflected = 3; + if (facedist > 0.0f) { + *damp *= (1.0f - facedist/outerfacethickness); + Vec3PlusStVec(outerforceaccu, force_mag_norm, d_nvect); + deflected = 3; - } - else { - Vec3PlusStVec(innerforceaccu, force_mag_norm, d_nvect); - if (deflected < 2) deflected = 2; - } + } + else { + Vec3PlusStVec(innerforceaccu, force_mag_norm, d_nvect); + if (deflected < 2) deflected = 2; + } if ((mprevvert) && (*damp > 0.0f)) { choose_winner(ve, opco, nv1, nv3, nv4, vv1, vv3, vv4); @@ -1997,6 +2006,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3], }/* while a */ } /* if (ob->pd && ob->pd->deflect) */ BLI_ghashIterator_step(ihash); + } } /* while () */ if (deflected == 1) { // no face but 'outer' edge cylinder sees vert @@ -2335,14 +2345,14 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo float kd = 1.0f; if (sb_deflect_face(ob, bp->pos, facenormal, defforce, &cf, timenow, vel, &intrusion)) { - if (intrusion < 0.0f) { - sb->scratch->flag |= SBF_DOFUZZY; - bp->loc_flag |= SBF_DOFUZZY; - bp->choke = sb->choke*0.01f; - } + if (intrusion < 0.0f) { + sb->scratch->flag |= SBF_DOFUZZY; + bp->loc_flag |= SBF_DOFUZZY; + bp->choke = sb->choke*0.01f; + } - sub_v3_v3v3(cfforce, bp->vec, vel); - Vec3PlusStVec(bp->force, -cf*50.0f, cfforce); + sub_v3_v3v3(cfforce, bp->vec, vel); + Vec3PlusStVec(bp->force, -cf*50.0f, cfforce); Vec3PlusStVec(bp->force, kd, defforce); } @@ -3484,7 +3494,7 @@ static void makelatticesprings(Lattice *lt, BodySpring *bs, int dostiff, Object bs->v1 = bpc; bs->v2 = bpc+dw+dv-1; bs->springtype=SB_BEND; - bs->len= globallen((bp+dw+dv-1)->vec, bp->vec, ob); + bs->len= globallen((bp+dw+dv-1)->vec, bp->vec, ob); bs++; } } diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index 3a4b95d8f18..a46fda6076b 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -305,7 +305,7 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm, * UV map in really simple cases with mirror + subsurf, see second part of T44530. Also, initially * intention is to treat merged vertices from mirror modifier as seams, see code below with ME_VERT_MERGED * This fixes a very old regression (2.49 was correct here) */ - vmap = BKE_mesh_uv_vert_map_create(mpoly, mloop, mloopuv, totface, totvert, 0, limit, true); + vmap = BKE_mesh_uv_vert_map_create(mpoly, mloop, mloopuv, totface, totvert, limit, false, true); if (!vmap) return 0; diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index 4a491c2dee0..88a412d5e95 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -629,7 +629,7 @@ void BKE_texture_default(Tex *tex) tex->env->stype = ENV_ANIM; tex->env->clipsta = 0.1; tex->env->clipend = 100; - tex->env->cuberes = 600; + tex->env->cuberes = 512; tex->env->depth = 0; } @@ -1423,7 +1423,7 @@ EnvMap *BKE_texture_envmap_add(void) env->stype = ENV_ANIM; env->clipsta = 0.1; env->clipend = 100.0; - env->cuberes = 600; + env->cuberes = 512; env->viewscale = 0.5; return env; |