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:
authorHans Goudey <h.goudey@me.com>2020-08-12 21:19:05 +0300
committerHans Goudey <h.goudey@me.com>2020-08-12 21:19:05 +0300
commit31705201dddebf7e3be5c4533b89f380aad1ede1 (patch)
tree53c8be86b15e9ebd96dd60cad52e6acac8ce2324 /source/blender/io/common/intern/abstract_hierarchy_iterator.cc
parentea4c327c977223922c41c889fa2bd51403409dca (diff)
parent337b6d075880ea44ff5183804a387dc98673ffb9 (diff)
Merge branch 'master' into active-fcurve-keyframe
Diffstat (limited to 'source/blender/io/common/intern/abstract_hierarchy_iterator.cc')
-rw-r--r--source/blender/io/common/intern/abstract_hierarchy_iterator.cc24
1 files changed, 23 insertions, 1 deletions
diff --git a/source/blender/io/common/intern/abstract_hierarchy_iterator.cc b/source/blender/io/common/intern/abstract_hierarchy_iterator.cc
index 3622c1eb7cd..fbefc8c8e7e 100644
--- a/source/blender/io/common/intern/abstract_hierarchy_iterator.cc
+++ b/source/blender/io/common/intern/abstract_hierarchy_iterator.cc
@@ -39,6 +39,7 @@
#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
#include "DNA_particle_types.h"
+#include "DNA_rigidbody_types.h"
#include "DEG_depsgraph_query.h"
@@ -127,6 +128,9 @@ bool AbstractHierarchyWriter::check_is_animated(const HierarchyContext &context)
if (BKE_key_from_object(object) != nullptr) {
return true;
}
+ if (check_has_deforming_physics(context)) {
+ return true;
+ }
/* Test modifiers. */
/* TODO(Sybren): replace this with a check on the depsgraph to properly check for dependency on
@@ -142,6 +146,18 @@ bool AbstractHierarchyWriter::check_is_animated(const HierarchyContext &context)
return false;
}
+bool AbstractHierarchyWriter::check_has_physics(const HierarchyContext &context)
+{
+ const RigidBodyOb *rbo = context.object->rigidbody_object;
+ return rbo != nullptr && rbo->type == RBO_TYPE_ACTIVE;
+}
+
+bool AbstractHierarchyWriter::check_has_deforming_physics(const HierarchyContext &context)
+{
+ const RigidBodyOb *rbo = context.object->rigidbody_object;
+ return rbo != nullptr && rbo->type == RBO_TYPE_ACTIVE && (rbo->flag & RBO_FLAG_USE_DEFORM) != 0;
+}
+
AbstractHierarchyIterator::AbstractHierarchyIterator(Depsgraph *depsgraph)
: depsgraph_(depsgraph), writers_(), export_subset_({true, true})
{
@@ -149,6 +165,12 @@ AbstractHierarchyIterator::AbstractHierarchyIterator(Depsgraph *depsgraph)
AbstractHierarchyIterator::~AbstractHierarchyIterator()
{
+ /* release_writers() cannot be called here directly, as it calls into the pure-virtual
+ * release_writer() function. By the time this destructor is called, the subclass that implements
+ * that pure-virtual function is already destructed. */
+ BLI_assert(
+ writers_.empty() ||
+ !"release_writers() should be called before the AbstractHierarchyIterator goes out of scope");
}
void AbstractHierarchyIterator::iterate_and_write()
@@ -165,7 +187,7 @@ void AbstractHierarchyIterator::iterate_and_write()
void AbstractHierarchyIterator::release_writers()
{
for (WriterMap::value_type it : writers_) {
- delete_object_writer(it.second);
+ release_writer(it.second);
}
writers_.clear();
}