diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2020-07-28 13:40:05 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-07-28 13:40:05 +0300 |
commit | f0c4566ce3bec861006eda299c9ddad85086813f (patch) | |
tree | b5c3e86b873115e4ae1e50b88e17f1dc2dc278de /source | |
parent | ec80f1d37658fb0f627a3990f7ecf739b9be075d (diff) | |
parent | 050de1fb8e830ad9978eb5c1d956630d10b927a2 (diff) |
Merge remote-tracking branch 'origin/blender-v2.90-release'
Diffstat (limited to 'source')
4 files changed, 29 insertions, 0 deletions
diff --git a/source/blender/io/alembic/exporter/abc_writer_transform.cc b/source/blender/io/alembic/exporter/abc_writer_transform.cc index 65d6b7c5b41..39af99c142c 100644 --- a/source/blender/io/alembic/exporter/abc_writer_transform.cc +++ b/source/blender/io/alembic/exporter/abc_writer_transform.cc @@ -107,6 +107,9 @@ bool ABCTransformWriter::check_is_animated(const HierarchyContext &context) cons * depsgraph whether this object instance has a time source. */ return true; } + if (check_has_physics(context)) { + return true; + } return BKE_object_moves_in_time(context.object, context.animation_check_include_parent); } diff --git a/source/blender/io/common/IO_abstract_hierarchy_iterator.h b/source/blender/io/common/IO_abstract_hierarchy_iterator.h index a274847e109..d289d86b397 100644 --- a/source/blender/io/common/IO_abstract_hierarchy_iterator.h +++ b/source/blender/io/common/IO_abstract_hierarchy_iterator.h @@ -129,7 +129,14 @@ class AbstractHierarchyWriter { // but wasn't used while exporting the current frame (for example, a particle-instanced mesh of // which the particle is no longer alive). protected: + /* Return true if the data written by this writer changes over time. + * Note that this function assumes this is an object data writer. Transform writers should not + * call this but implement their own logic. */ virtual bool check_is_animated(const HierarchyContext &context) const; + + /* Helper functions for animation checks. */ + static bool check_has_physics(const HierarchyContext &context); + static bool check_has_deforming_physics(const HierarchyContext &context); }; /* Determines which subset of the writers actually gets to write. */ 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}) { diff --git a/source/blender/io/usd/intern/usd_writer_transform.cc b/source/blender/io/usd/intern/usd_writer_transform.cc index 643f1a8f4b1..49983115455 100644 --- a/source/blender/io/usd/intern/usd_writer_transform.cc +++ b/source/blender/io/usd/intern/usd_writer_transform.cc @@ -58,6 +58,9 @@ bool USDTransformWriter::check_is_animated(const HierarchyContext &context) cons * depsgraph whether this object instance has a time source. */ return true; } + if (check_has_physics(context)) { + return true; + } return BKE_object_moves_in_time(context.object, context.animation_check_include_parent); } |