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@blender.org>2019-11-26 16:35:47 +0300
committerSybren A. Stüvel <sybren@blender.org>2019-11-26 18:26:52 +0300
commitf18ad385dffe70f5e57df00ff9bbb7b42fa05be0 (patch)
tree00c70215a421b1187d7482f428d1548d0b29ea1c /source/blender/alembic
parenta018a7fb0d5b2cd6de2bb7b4f4aa092594655fdd (diff)
Alembic export: don't assume transform is always animated
Instead of always writing the transform on every frame, it's now checked whether the object is animated at all. This could be made stricter to reduce false positives, for example by checking FCurves and drivers to see whether translation/rotation/scale is animated. However, this approach is already better than the `return true` we had before. This commit adds the BKE_animdata_id_is_animated(id) function, which returns true if the ID datablock has non-empty animation data. This is determined by checking the the active action's fcurves, the drivers, and NLA tracks.
Diffstat (limited to 'source/blender/alembic')
-rw-r--r--source/blender/alembic/intern/abc_mesh.cc10
-rw-r--r--source/blender/alembic/intern/abc_transform.cc6
2 files changed, 5 insertions, 11 deletions
diff --git a/source/blender/alembic/intern/abc_mesh.cc b/source/blender/alembic/intern/abc_mesh.cc
index 89fafc65e5d..edcb6263da3 100644
--- a/source/blender/alembic/intern/abc_mesh.cc
+++ b/source/blender/alembic/intern/abc_mesh.cc
@@ -304,14 +304,8 @@ AbcGenericMeshWriter::~AbcGenericMeshWriter()
bool AbcGenericMeshWriter::isAnimated() const
{
- if (m_object->data != NULL) {
- AnimData *adt = BKE_animdata_from_id(static_cast<ID *>(m_object->data));
- /* TODO(Sybren): make this check more strict, as the AnimationData may
- * actually be empty (no fcurves, drivers, etc.) and thus effectively
- * have no animation at all. */
- if (adt != NULL) {
- return true;
- }
+ if (BKE_animdata_id_is_animated(static_cast<ID *>(m_object->data))) {
+ return true;
}
if (BKE_key_from_object(m_object) != NULL) {
return true;
diff --git a/source/blender/alembic/intern/abc_transform.cc b/source/blender/alembic/intern/abc_transform.cc
index 505acfc164a..9b12fe86d59 100644
--- a/source/blender/alembic/intern/abc_transform.cc
+++ b/source/blender/alembic/intern/abc_transform.cc
@@ -29,6 +29,7 @@ extern "C" {
#include "BLI_math.h"
+#include "BKE_animsys.h"
#include "BKE_object.h"
#include "DEG_depsgraph_query.h"
@@ -130,10 +131,9 @@ Imath::Box3d AbcTransformWriter::bounds()
return Imath::transform(bounds, m_matrix);
}
-bool AbcTransformWriter::hasAnimation(Object * /*ob*/) const
+bool AbcTransformWriter::hasAnimation(Object *ob) const
{
- /* TODO(kevin): implement this. */
- return true;
+ return BKE_animdata_id_is_animated(&ob->id);
}
/* ************************************************************************** */