diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2020-07-28 13:38:01 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-07-28 13:38:31 +0300 |
commit | 050de1fb8e830ad9978eb5c1d956630d10b927a2 (patch) | |
tree | 9669cb9a0c8b210045df2233a1e6c2a738105f17 /source/blender/io/common/intern/abstract_hierarchy_iterator.cc | |
parent | d738e47b0dc329a668bad0de9522545b20b26673 (diff) |
Fix T79263: Alembic, exported rigid body animation not moving
The root cause was that `BKE_object_moves_in_time()` incorrectly returns
`false` when an object is moved by the physics system.
This also fixes the same issue in the USD exporter.
Diffstat (limited to 'source/blender/io/common/intern/abstract_hierarchy_iterator.cc')
-rw-r--r-- | source/blender/io/common/intern/abstract_hierarchy_iterator.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/source/blender/io/common/intern/abstract_hierarchy_iterator.cc b/source/blender/io/common/intern/abstract_hierarchy_iterator.cc index 8e66c069e18..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}) { |