Blender  V2.93
abc_reader_transform.cc
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
21 #include "abc_reader_transform.h"
22 #include "abc_util.h"
23 
24 #include "DNA_object_types.h"
25 
26 #include "BLI_utildefines.h"
27 
28 #include "BKE_object.h"
29 
30 using Alembic::Abc::ISampleSelector;
31 
32 namespace blender::io::alembic {
33 
34 AbcEmptyReader::AbcEmptyReader(const Alembic::Abc::IObject &object, ImportSettings &settings)
35  : AbcObjectReader(object, settings)
36 {
37  /* Empties have no data. It makes the import of Alembic files easier to
38  * understand when we name the empty after its name in Alembic. */
39  m_object_name = object.getName();
40 
41  Alembic::AbcGeom::IXform xform(object, Alembic::AbcGeom::kWrapExisting);
42  m_schema = xform.getSchema();
43 
45 }
46 
48 {
49  return m_schema.valid();
50 }
51 
53  const Alembic::AbcCoreAbstract::ObjectHeader &alembic_header,
54  const Object *const ob,
55  const char **err_str) const
56 {
57  if (!Alembic::AbcGeom::IXform::matches(alembic_header)) {
58  *err_str =
59  "Object type mismatch, Alembic object path pointed to XForm when importing, but not any "
60  "more.";
61  return false;
62  }
63 
64  if (ob->type != OB_EMPTY) {
65  *err_str = "Object type mismatch, Alembic object path points to XForm.";
66  return false;
67  }
68 
69  return true;
70 }
71 
72 void AbcEmptyReader::readObjectData(Main *bmain, const ISampleSelector &UNUSED(sample_sel))
73 {
75  m_object->data = nullptr;
76 }
77 
78 } // 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_NONNULL(1) ATTR_RETURNS_NONNULL
Definition: object.c:2193
#define UNUSED(x)
Object is a sort of wrapper for general info.
@ OB_EMPTY
bool accepts_object_type(const Alembic::AbcCoreAbstract::ObjectHeader &alembic_header, const Object *const ob, const char **err_str) const
AbcEmptyReader(const Alembic::Abc::IObject &object, ImportSettings &settings)
void readObjectData(Main *bmain, const Alembic::Abc::ISampleSelector &sample_sel)
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:80
Definition: BKE_main.h:116
void * data