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-15 18:14:48 +0300
committerSybren A. Stüvel <sybren@stuvel.eu>2018-06-15 18:15:42 +0300
commited3d693cb181c21c8d00b6d2aa734e25c2d65cda (patch)
treee44c3ea635efd5ee6c3b694bd856eb8f7d5de7a3 /source/blender/depsgraph/intern/depsgraph.cc
parent43d22d80e72d1a1bf49d33fc4f8bd1a031e3358b (diff)
Dependency graph fixes for RigidBodyWorld
- rbw->group added to the depsgraph. - Mesh evaluation added when necessary. - Prevent of double-free by freeing the scene before objects.
Diffstat (limited to 'source/blender/depsgraph/intern/depsgraph.cc')
-rw-r--r--source/blender/depsgraph/intern/depsgraph.cc42
1 files changed, 24 insertions, 18 deletions
diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc
index 26a23cff372..16427d3eb59 100644
--- a/source/blender/depsgraph/intern/depsgraph.cc
+++ b/source/blender/depsgraph/intern/depsgraph.cc
@@ -327,27 +327,33 @@ IDDepsNode *Depsgraph::add_id_node(ID *id, ID *id_cow_hint)
return id_node;
}
-void Depsgraph::clear_id_nodes()
+void Depsgraph::clear_id_nodes_conditional(const std::function <bool (ID_Type id_type)>& filter)
{
- /* Free memory used by ID nodes. */
- {
- /* Stupid workaround to ensure we free IDs in a proper order. */
- foreach (IDDepsNode *id_node, id_nodes) {
- if (id_node->id_cow == NULL) {
- /* This means builder "stole" ownership of the copy-on-written
- * datablock for her own dirty needs.
- */
- continue;
- }
- if (!deg_copy_on_write_is_expanded(id_node->id_cow)) {
- continue;
- }
- const ID_Type id_type = GS(id_node->id_cow->name);
- if (id_type != ID_PA) {
- id_node->destroy();
- }
+ foreach (IDDepsNode *id_node, id_nodes) {
+ if (id_node->id_cow == NULL) {
+ /* This means builder "stole" ownership of the copy-on-written
+ * datablock for her own dirty needs.
+ */
+ continue;
+ }
+ if (!deg_copy_on_write_is_expanded(id_node->id_cow)) {
+ continue;
+ }
+ const ID_Type id_type = GS(id_node->id_cow->name);
+ if (filter(id_type)) {
+ id_node->destroy();
}
}
+}
+
+void Depsgraph::clear_id_nodes()
+{
+ /* Free memory used by ID nodes. */
+
+ /* Stupid workaround to ensure we free IDs in a proper order. */
+ clear_id_nodes_conditional([](ID_Type id_type) { return id_type == ID_SCE; });
+ clear_id_nodes_conditional([](ID_Type id_type) { return id_type != ID_PA; });
+
foreach (IDDepsNode *id_node, id_nodes) {
OBJECT_GUARDED_DELETE(id_node, IDDepsNode);
}