Blender V5.0
usd_reader_instance.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 NVIDIA Corporation. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
6
7#include "BKE_lib_id.hh"
8#include "BKE_object.hh"
9
11#include "DNA_object_types.h"
12
13namespace blender::io::usd {
14
16{
17 this->object_ = BKE_object_add_only_object(bmain, OB_EMPTY, name_.c_str());
18 this->object_->data = nullptr;
19 this->object_->instance_collection = nullptr;
20 this->object_->transflag |= OB_DUPLICOLLECTION;
21}
22
24{
25 if (this->object_ && this->object_->instance_collection != coll) {
26 if (this->object_->instance_collection) {
27 id_us_min(&this->object_->instance_collection->id);
28 this->object_->instance_collection = nullptr;
29 }
30 id_us_plus(&coll->id);
31 this->object_->instance_collection = coll;
32 }
33}
34
36{
37 if (pxr::UsdPrim proto = prim_.GetPrototype()) {
38 return proto.GetPath();
39 }
40
41 return pxr::SdfPath();
42}
43
44} // namespace blender::io::usd
void id_us_plus(ID *id)
Definition lib_id.cc:358
void id_us_min(ID *id)
Definition lib_id.cc:366
General operations, lookup, etc. for blender objects.
Object * BKE_object_add_only_object(Main *bmain, int type, const char *name) ATTR_RETURNS_NONNULL
Object groups, one object can be in many groups at once.
Object is a sort of wrapper for general info.
@ OB_EMPTY
@ OB_DUPLICOLLECTION
void create_object(Main *bmain) override
void set_instance_collection(Collection *coll)