Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@stuvel.eu>2018-06-27 18:08:58 +0300
committerSybren A. Stüvel <sybren@stuvel.eu>2018-06-28 15:20:11 +0300
commit98a0bcd4252e952fa5438e9d1b69b0204f8a8746 (patch)
treef3bf13553441e60b7097395220de9b146019135c /source/blender/editors/physics
parent9b050b736baea22547b6c6baaab37bba3356e42b (diff)
Prevent copying too much in the Rigid Body simulation
To prevent the pointcache from being copied-on-write too (and requiring copying back), the cache is now shared between the original and evaluated scenes. Reading from the cache is always allowed; running the sim and writing to the cache is only allowed when the depsgraph is active. Some pointers have moved from RigidBodyWorld (RBO) to RigidBodyWorldShared (RBOS). writefile.c copies some pointers back from RBOS to RBO so that the file can still be opened on older Blenders without crashing on a segfault. The RigidBodyWorldShared struct is written to the blend file, because it refers to the PointCache ID block. The RigidObjectShared struct is runtime-only, and thus not saved to the blend file. An RNA getter-function is used to hide the new 'shared' pointer. As a result the Python API hasn't changed. Reviewed by: campbellbarton Differential Revision: https://developer.blender.org/D3508
Diffstat (limited to 'source/blender/editors/physics')
-rw-r--r--source/blender/editors/physics/rigidbody_world.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/source/blender/editors/physics/rigidbody_world.c b/source/blender/editors/physics/rigidbody_world.c
index 8d5258a7522..52a20ed7cf7 100644
--- a/source/blender/editors/physics/rigidbody_world.c
+++ b/source/blender/editors/physics/rigidbody_world.c
@@ -114,8 +114,7 @@ static int rigidbody_world_remove_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- BKE_rigidbody_free_world(rbw);
- scene->rigidbody_world = NULL;
+ BKE_rigidbody_free_world(scene);
/* done */
return OPERATOR_FINISHED;
@@ -152,14 +151,14 @@ static int rigidbody_world_export_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "No Rigid Body World to export");
return OPERATOR_CANCELLED;
}
- if (rbw->physics_world == NULL) {
+ if (rbw->shared->physics_world == NULL) {
BKE_report(op->reports, RPT_ERROR, "Rigid Body World has no associated physics data to export");
return OPERATOR_CANCELLED;
}
RNA_string_get(op->ptr, "filepath", path);
#ifdef WITH_BULLET
- RB_dworld_export(rbw->physics_world, path);
+ RB_dworld_export(rbw->shared->physics_world, path);
#endif
return OPERATOR_FINISHED;
}