Blender  V3.3
abc_writer_instance.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 #include "abc_writer_instance.h"
9 
10 #include "BLI_assert.h"
11 
12 #include "CLG_log.h"
13 static CLG_LogRef LOG = {"io.alembic"};
14 
15 namespace blender::io::alembic {
16 
17 using Alembic::Abc::OObject;
18 
20  : ABCAbstractWriter(args)
21 {
22 }
23 
25 {
26  OObject original = args_.hierarchy_iterator->get_alembic_object(context->original_export_path);
27  OObject abc_parent = args_.abc_parent;
28  if (!abc_parent.addChildInstance(original, args_.abc_name)) {
29  CLOG_WARN(&LOG, "unable to export %s as instance", args_.abc_path.c_str());
30  return;
31  }
32  CLOG_INFO(&LOG, 2, "exporting instance %s", args_.abc_path.c_str());
33 }
34 
36 {
37  /* Intentionally do nothing. Instances should not have their own custom properties. */
38 }
39 
40 Alembic::Abc::OCompoundProperty ABCInstanceWriter::abc_prop_for_custom_props()
41 {
42  return Alembic::Abc::OCompoundProperty();
43 }
44 
46 {
47  /* There is no OObject for an instance. */
48  BLI_assert_msg(0, "ABCInstanceWriter cannot return its Alembic OObject");
49  return OObject();
50 }
51 
53 {
54  return context->is_instance();
55 }
56 
58 {
59  /* Instances don't have data to be written. Just creating them is enough. */
60 }
61 
62 } // namespace blender::io::alembic
#define BLI_assert_msg(a, msg)
Definition: BLI_assert.h:53
#define CLOG_WARN(clg_ref,...)
Definition: CLG_log.h:189
#define CLOG_INFO(clg_ref, level,...)
Definition: CLG_log.h:187
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)