diff options
author | Martin Felke <martin.felke@googlemail.com> | 2021-01-13 19:54:26 +0300 |
---|---|---|
committer | Martin Felke <martin.felke@googlemail.com> | 2021-01-13 19:54:26 +0300 |
commit | 32fef3040feb37b3346b8ebbfae7ba515e457a41 (patch) | |
tree | 75bc59773f457f1b41cd9e7eab93baf7d53a8980 | |
parent | 233ad61cb8d994c97ca10b88688cb905db2836ca (diff) |
fix attempt for conversion of multiple FM objects to keyframed shard objectsfracture_modifier
-rw-r--r-- | build_files/build_environment/CMakeLists.txt | 6 | ||||
-rw-r--r-- | build_files/build_environment/cmake/harvest.cmake | 6 | ||||
-rw-r--r-- | build_files/build_environment/cmake/versions.cmake | 10 | ||||
-rw-r--r-- | source/blender/editors/object/object_modifier.c | 45 |
4 files changed, 45 insertions, 22 deletions
diff --git a/build_files/build_environment/CMakeLists.txt b/build_files/build_environment/CMakeLists.txt index 89d4a9882ca..5031be834fa 100644 --- a/build_files/build_environment/CMakeLists.txt +++ b/build_files/build_environment/CMakeLists.txt @@ -46,9 +46,9 @@ include(ExternalProject) include(cmake/options.cmake) include(cmake/versions.cmake) -if(UNIX AND NOT APPLE) - include(cmake/breakpad.cmake) -endif() +#if(UNIX AND NOT APPLE) +# include(cmake/breakpad.cmake) +#endif() include(cmake/zlib.cmake) include(cmake/blendthumb.cmake) diff --git a/build_files/build_environment/cmake/harvest.cmake b/build_files/build_environment/cmake/harvest.cmake index 74898af608b..f8717a26e72 100644 --- a/build_files/build_environment/cmake/harvest.cmake +++ b/build_files/build_environment/cmake/harvest.cmake @@ -227,9 +227,9 @@ harvest(ogg/lib ffmpeg/lib "*.a") harvest(openal/include openal/include "*.h") if(UNIX AND NOT APPLE) harvest(openal/lib openal/lib "*.a") - harvest(breakpad/lib breakpad/lib "*.a") - harvest(breakpad/include/breakpad breakpad/include "*.h") - harvest(breakpad/bin breakpad/bin "*") + #harvest(breakpad/lib breakpad/lib "*.a") + #harvest(breakpad/include/breakpad breakpad/include "*.h") + #harvest(breakpad/bin breakpad/bin "*") endif() harvest(opencollada/include/opencollada opencollada/include "*.h") harvest(opencollada/lib/opencollada opencollada/lib "*.a") diff --git a/build_files/build_environment/cmake/versions.cmake b/build_files/build_environment/cmake/versions.cmake index 3aa1d4d0cac..19e9b064b61 100644 --- a/build_files/build_environment/cmake/versions.cmake +++ b/build_files/build_environment/cmake/versions.cmake @@ -23,7 +23,8 @@ set(ZLIB_URI https://netcologne.dl.sourceforge.net/project/libpng/zlib/${ZLIB_VE set(ZLIB_HASH 44d667c142d7cda120332623eab69f40) set(OPENAL_VERSION 1.17.2) -set(OPENAL_URI http://kcat.strangesoft.net/openal-releases/openal-soft-${OPENAL_VERSION}.tar.bz2) +#set(OPENAL_URI http://kcat.strangesoft.net/openal-releases/openal-soft-${OPENAL_VERSION}.tar.bz2) +set(OPENAL_URI https://www.openal-soft.org/openal-releases/openal-soft-${OPENAL_VERSION}.tar.bz2) set(OPENAL_HASH 1764e0d8fec499589b47ebc724e0913d) set(PNG_VERSION 1.6.21) @@ -149,8 +150,11 @@ set(PYTHON_HASH 57d1f8bfbabf4f2500273fb0706e6f21) if(UNIX AND NOT APPLE) # Needed to be compatible with GCC 7, other platforms can upgrade later set(TBB_VERSION 2017_U7) - set(TBB_URI https://github.com/01org/tbb/archive/${TBB_VERSION}.tar.gz) - set(TBB_HASH 364f2a4b80e978f38a69cbf7c466b898) + #set(TBB_URI https://github.com/01org/tbb/archive/${TBB_VERSION}.tar.gz) + #set(TBB_HASH 364f2a4b80e978f38a69cbf7c466b898) + set(TBB_URI https://github.com/oneapi-src/oneTBB/archive/${TBB_VERSION}.tar.gz) + set(TBB_HASH af1c799fe754924de7d5b00a6fb5f514) + else() 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) diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 91f439392f4..aa57ae5f181 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -3301,6 +3301,7 @@ static Object* do_convert_meshIsland(FractureModifierData* fmd, MeshIsland *mi, mul_m4_v3(ob_new->obmat, cent); copy_v3_v3(ob_new->loc, cent); +#if 0 /*if (mi->frame_count > 0)*/ { if (start < mi->start_frame) { start = mi->start_frame; @@ -3310,6 +3311,7 @@ static Object* do_convert_meshIsland(FractureModifierData* fmd, MeshIsland *mi, end = mi->start_frame + mi->frame_count; } } +#endif if (mi->rigidbody->type == RBO_TYPE_ACTIVE) { @@ -3359,13 +3361,20 @@ static Object* do_convert_meshIsland(FractureModifierData* fmd, MeshIsland *mi, //is there a bake, if yes... use that (disabled for now, odd probs...) if (is_baked) { - //BKE_ptcache_id_time(pid, scene, (float)i, NULL, NULL, NULL); - //if (BKE_ptcache_read(pid, (float)i, false)) + BKE_ptcache_id_time(pid, scene, (float)i, NULL, NULL, NULL); + if (BKE_ptcache_read(pid, (float)i, false)) { - //BKE_ptcache_validate(cache, i); - //copy_v3_v3(loc, mi->rigidbody->pos); - //copy_qt_qt(rot, mi->rigidbody->orn); - int x = i - start; + BKE_ptcache_validate(cache, i); + copy_v3_v3(loc, mi->rigidbody->pos); + copy_qt_qt(rot, mi->rigidbody->orn); + + // This works only if the conversion happens directly after baking. + // Otherwise this data is not stored in the blend. There was an attempt + // to rebuild it prior to conversion, but that lead to weird results. + + // so try to read the cache now. + + /*int x = i - start; loc[0] = mi->locs[x*3]; loc[1] = mi->locs[x*3+1]; @@ -3374,7 +3383,7 @@ static Object* do_convert_meshIsland(FractureModifierData* fmd, MeshIsland *mi, rot[0] = mi->rots[x*4]; rot[1] = mi->rots[x*4+1]; rot[2] = mi->rots[x*4+2]; - rot[3] = mi->rots[x*4+3]; + rot[3] = mi->rots[x*4+3];*/ if (fmd->fracture_mode == MOD_FRACTURE_EXTERNAL) { mul_qt_qtqt(rot, rot, mi->rot); @@ -3559,27 +3568,25 @@ static bool convert_modifier_to_keyframes(FractureModifierData* fmd, Group* gr, Base** basarray_old = MEM_mallocN(sizeof(Base*) * count, "conversion_tempbases_old"); double starttime; - is_baked = true; + //is_baked = true; if (scene && scene->rigidbody_world) { cache = scene->rigidbody_world->pointcache; } -#if 0 if (cache && (!(cache->flag & PTCACHE_OUTDATED) || cache->flag & PTCACHE_BAKED)) { //start = cache->startframe; //end = cache->endframe; /* need to "fill" the rigidbody world by doing 1 sim step, else bake cant be read properly */ - //BKE_rigidbody_do_simulation(scene, (float)(start+1)); + BKE_rigidbody_do_simulation(scene, (float)(start+1)); BKE_ptcache_id_from_rigidbody(&pid, NULL, scene->rigidbody_world); is_baked = true; } else { return false; } -#endif parent = BKE_object_add(G.main, scene, OB_EMPTY, name); BKE_mesh_center_of_surface(ob->data, obloc); @@ -3669,6 +3676,7 @@ static int rigidbody_convert_keyframes_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } +#if 0 //force a transform sync, gah if (cache->flag & PTCACHE_BAKED || !(cache->flag & PTCACHE_OUTDATED)) { @@ -3679,6 +3687,7 @@ static int rigidbody_convert_keyframes_exec(bContext *C, wmOperator *op) BKE_object_where_is_calc_time(scene, selob, (float)frame); } } +#endif #if 0 //this check might be wrong in case a passive shard (no sim data then) is first @@ -3714,9 +3723,9 @@ static int rigidbody_convert_keyframes_exec(bContext *C, wmOperator *op) CTX_DATA_END; //free a possible bake... because we added new rigidbodies, and this would mess up the mesh - if (scene->rigidbody_world && scene->rigidbody_world->pointcache) { + /*if (scene->rigidbody_world && scene->rigidbody_world->pointcache) { scene->rigidbody_world->pointcache->flag &= ~PTCACHE_BAKED; - } + }*/ DAG_relations_tag_update(G.main); WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); @@ -3737,6 +3746,16 @@ static int rigidbody_convert_keyframes_exec(bContext *C, wmOperator *op) static int rigidbody_convert_keyframes_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) { + Scene *scene = CTX_data_scene(C); + PointCache* cache = NULL; + + if (scene && scene->rigidbody_world) + { + cache = scene->rigidbody_world->pointcache; + RNA_int_set(op->ptr, "start_frame", cache->startframe); + RNA_int_set(op->ptr, "end_frame", cache->endframe); + } + return WM_operator_props_dialog_popup(C, op, 10 * UI_UNIT_X, 5 * UI_UNIT_Y); } |