Blender  V2.93
abc_writer_instance.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_writer_instance.h"
22 #include "abc_hierarchy_iterator.h"
23 
24 #include "BLI_assert.h"
25 
26 #include "CLG_log.h"
27 static CLG_LogRef LOG = {"io.alembic"};
28 
29 namespace blender::io::alembic {
30 
31 using Alembic::Abc::OObject;
32 
34  : ABCAbstractWriter(args)
35 {
36 }
37 
39 {
40  OObject original = args_.hierarchy_iterator->get_alembic_object(context->original_export_path);
41  OObject abc_parent = args_.abc_parent;
42  if (!abc_parent.addChildInstance(original, args_.abc_name)) {
43  CLOG_WARN(&LOG, "unable to export %s as instance", args_.abc_path.c_str());
44  return;
45  }
46  CLOG_INFO(&LOG, 2, "exporting instance %s", args_.abc_path.c_str());
47 }
48 
50 {
51  /* Intentionally do nothing. Instances should not have their own custom properties. */
52 }
53 
54 Alembic::Abc::OCompoundProperty ABCInstanceWriter::abc_prop_for_custom_props()
55 {
56  return Alembic::Abc::OCompoundProperty();
57 }
58 
60 {
61  /* There is no OObject for an instance. */
62  BLI_assert(!"ABCInstanceWriter cannot return its Alembic OObject");
63  return OObject();
64 }
65 
67 {
68  return context->is_instance();
69 }
70 
72 {
73  /* Instances don't have data to be written. Just creating them is enough. */
74 }
75 
76 } // namespace blender::io::alembic
#define BLI_assert(a)
Definition: BLI_assert.h:58
#define CLOG_WARN(clg_ref,...)
Definition: CLG_log.h:203
#define CLOG_INFO(clg_ref, level,...)
Definition: CLG_log.h:201
static CLG_LogRef LOG
const ABCWriterConstructorArgs args_
Alembic::Abc::OObject get_alembic_object(const std::string &export_path) const
virtual void create_alembic_objects(const HierarchyContext *context) override
virtual bool is_supported(const HierarchyContext *context) const override
virtual void do_write(HierarchyContext &context) override
Alembic::Abc::OCompoundProperty abc_prop_for_custom_props() override
virtual Alembic::Abc::OObject get_alembic_object() const override
void ensure_custom_properties_exporter(const HierarchyContext &context) override
ABCInstanceWriter(const ABCWriterConstructorArgs &args)
struct SELECTID_Context context
Definition: select_engine.c:47