diff options
Diffstat (limited to 'source/blender/io/usd')
4 files changed, 30 insertions, 33 deletions
diff --git a/source/blender/io/usd/intern/abstract_hierarchy_iterator.cc b/source/blender/io/usd/intern/abstract_hierarchy_iterator.cc index a958a445a3d..50f81c2ffb1 100644 --- a/source/blender/io/usd/intern/abstract_hierarchy_iterator.cc +++ b/source/blender/io/usd/intern/abstract_hierarchy_iterator.cc @@ -25,6 +25,8 @@ extern "C" { #include "BKE_anim.h" +#include "BKE_animsys.h" +#include "BKE_key.h" #include "BKE_particle.h" #include "BLI_assert.h" @@ -33,6 +35,7 @@ extern "C" { #include "DNA_ID.h" #include "DNA_layer_types.h" +#include "DNA_modifier_types.h" #include "DNA_object_types.h" #include "DNA_particle_types.h" @@ -76,6 +79,31 @@ AbstractHierarchyWriter::~AbstractHierarchyWriter() { } +bool AbstractHierarchyWriter::check_is_animated(const HierarchyContext &context) const +{ + const Object *object = context.object; + + if (BKE_animdata_id_is_animated(static_cast<ID *>(object->data))) { + return true; + } + if (BKE_key_from_object(object) != nullptr) { + return true; + } + + /* Test modifiers. */ + /* TODO(Sybren): replace this with a check on the depsgraph to properly check for dependency on + * time. */ + ModifierData *md = static_cast<ModifierData *>(object->modifiers.first); + while (md) { + if (md->type != eModifierType_Subsurf) { + return true; + } + md = md->next; + } + + return false; +} + AbstractHierarchyIterator::AbstractHierarchyIterator(Depsgraph *depsgraph) : depsgraph_(depsgraph), writers_() { diff --git a/source/blender/io/usd/intern/abstract_hierarchy_iterator.h b/source/blender/io/usd/intern/abstract_hierarchy_iterator.h index c121e3b704d..64c831877ab 100644 --- a/source/blender/io/usd/intern/abstract_hierarchy_iterator.h +++ b/source/blender/io/usd/intern/abstract_hierarchy_iterator.h @@ -115,6 +115,8 @@ class AbstractHierarchyWriter { // TODO(Sybren): add function like absent() that's called when a writer was previously created, // but wasn't used while exporting the current frame (for example, a particle-instanced mesh of // which the particle is no longer alive). + protected: + virtual bool check_is_animated(const HierarchyContext &context) const; }; /* AbstractHierarchyIterator iterates over objects in a dependency graph, and constructs export diff --git a/source/blender/io/usd/intern/usd_writer_abstract.cc b/source/blender/io/usd/intern/usd_writer_abstract.cc index 4d0b4364fb5..76a2436ee92 100644 --- a/source/blender/io/usd/intern/usd_writer_abstract.cc +++ b/source/blender/io/usd/intern/usd_writer_abstract.cc @@ -21,13 +21,6 @@ #include <pxr/base/tf/stringUtils.h> -extern "C" { -#include "BKE_animsys.h" -#include "BKE_key.h" - -#include "DNA_modifier_types.h" -} - /* TfToken objects are not cheap to construct, so we do it once. */ namespace usdtokens { // Materials @@ -85,31 +78,6 @@ void USDAbstractWriter::write(HierarchyContext &context) frame_has_been_written_ = true; } -bool USDAbstractWriter::check_is_animated(const HierarchyContext &context) const -{ - const Object *object = context.object; - - if (BKE_animdata_id_is_animated(static_cast<ID *>(object->data))) { - return true; - } - if (BKE_key_from_object(object) != nullptr) { - return true; - } - - /* Test modifiers. */ - /* TODO(Sybren): replace this with a check on the depsgraph to properly check for dependency on - * time. */ - ModifierData *md = static_cast<ModifierData *>(object->modifiers.first); - while (md) { - if (md->type != eModifierType_Subsurf) { - return true; - } - md = md->next; - } - - return false; -} - const pxr::SdfPath &USDAbstractWriter::usd_path() const { return usd_export_context_.usd_path; diff --git a/source/blender/io/usd/intern/usd_writer_abstract.h b/source/blender/io/usd/intern/usd_writer_abstract.h index 835d3a42c80..ad8049f499c 100644 --- a/source/blender/io/usd/intern/usd_writer_abstract.h +++ b/source/blender/io/usd/intern/usd_writer_abstract.h @@ -66,7 +66,6 @@ class USDAbstractWriter : public AbstractHierarchyWriter { protected: virtual void do_write(HierarchyContext &context) = 0; - virtual bool check_is_animated(const HierarchyContext &context) const; pxr::UsdTimeCode get_export_time_code() const; pxr::UsdShadeMaterial ensure_usd_material(Material *material); |