Welcome to mirror list, hosted at ThFree Co, Russian Federation.

abc_writer_instance.cc « exporter « alembic « io « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7f3b044cb8b0293337bf0e557fbdc3ac04315080 (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */

/** \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)
{
}

ABCInstanceWriter::~ABCInstanceWriter()
{
}

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(!"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