blob: 7db1423e9cbd186249a66837ad9adecd79bbb5e6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup balembic
*/
#include "abc_writer_instance.h"
#include "abc_hierarchy_iterator.h"
#include "BLI_assert.h"
#include "CLG_log.h"
static CLG_LogRef LOG = {"io.alembic"};
namespace blender::io::alembic {
using Alembic::Abc::OObject;
ABCInstanceWriter::ABCInstanceWriter(const ABCWriterConstructorArgs &args)
: ABCAbstractWriter(args)
{
}
void ABCInstanceWriter::create_alembic_objects(const HierarchyContext *context)
{
OObject original = args_.hierarchy_iterator->get_alembic_object(context->original_export_path);
OObject abc_parent = args_.abc_parent;
if (!abc_parent.addChildInstance(original, args_.abc_name)) {
CLOG_WARN(&LOG, "unable to export %s as instance", args_.abc_path.c_str());
return;
}
CLOG_INFO(&LOG, 2, "exporting instance %s", args_.abc_path.c_str());
}
void ABCInstanceWriter::ensure_custom_properties_exporter(const HierarchyContext & /*context*/)
{
/* Intentionally do nothing. Instances should not have their own custom properties. */
}
Alembic::Abc::OCompoundProperty ABCInstanceWriter::abc_prop_for_custom_props()
{
return Alembic::Abc::OCompoundProperty();
}
OObject ABCInstanceWriter::get_alembic_object() const
{
/* There is no OObject for an instance. */
BLI_assert_msg(0, "ABCInstanceWriter cannot return its Alembic OObject");
return OObject();
}
bool ABCInstanceWriter::is_supported(const HierarchyContext *context) const
{
return context->is_instance();
}
void ABCInstanceWriter::do_write(HierarchyContext & /*context*/)
{
/* Instances don't have data to be written. Just creating them is enough. */
}
} // namespace blender::io::alembic
|