Blender  V3.3
abc_reader_transform.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 #include "abc_reader_transform.h"
8 #include "abc_util.h"
9 
10 #include "DNA_object_types.h"
11 
12 #include "BLI_utildefines.h"
13 
14 #include "BKE_object.h"
15 
16 using Alembic::Abc::ISampleSelector;
17 
18 namespace blender::io::alembic {
19 
20 AbcEmptyReader::AbcEmptyReader(const Alembic::Abc::IObject &object, ImportSettings &settings)
21  : AbcObjectReader(object, settings)
22 {
23  /* Empties have no data. It makes the import of Alembic files easier to
24  * understand when we name the empty after its name in Alembic. */
25  m_object_name = object.getName();
26 
27  Alembic::AbcGeom::IXform xform(object, Alembic::AbcGeom::kWrapExisting);
28  m_schema = xform.getSchema();
29 
31 }
32 
34 {
35  return m_schema.valid();
36 }
37 
39  const Alembic::AbcCoreAbstract::ObjectHeader &alembic_header,
40  const Object *const ob,
41  const char **err_str) const
42 {
43  if (!Alembic::AbcGeom::IXform::matches(alembic_header)) {
44  *err_str =
45  "Object type mismatch, Alembic object path pointed to XForm when importing, but not any "
46  "more.";
47  return false;
48  }
49 
50  if (ob->type != OB_EMPTY) {
51  *err_str = "Object type mismatch, Alembic object path points to XForm.";
52  return false;
53  }
54 
55  return true;
56 }
57 
58 void AbcEmptyReader::readObjectData(Main *bmain, const ISampleSelector &UNUSED(sample_sel))
59 {
61  m_object->data = nullptr;
62 }
63 
64 } // namespace blender::io::alembic
General operations, lookup, etc. for blender objects.
struct Object * BKE_object_add_only_object(struct Main *bmain, int type, const char *name) ATTR_RETURNS_NONNULL
Definition: object.cc:2241
#define UNUSED(x)
Object is a sort of wrapper for general info.
@ OB_EMPTY
AbcEmptyReader(const Alembic::Abc::IObject &object, ImportSettings &settings)
bool accepts_object_type(const Alembic::AbcCoreAbstract::ObjectHeader &alembic_header, const Object *const ob, const char **err_str) const override
void readObjectData(Main *bmain, const Alembic::Abc::ISampleSelector &sample_sel) override
virtual Alembic::AbcGeom::IXform xform()
void get_min_max_time(const Alembic::AbcGeom::IObject &object, const Schema &schema, chrono_t &min, chrono_t &max)
Definition: abc_util.h:66
Definition: BKE_main.h:121
void * data