Files
test2/source/blender/io/usd/intern/usd_reader_instance.h
Michael Kowalski ea89e11e01 USD: import scenegraph instances.
Added support for importing USD instanceable primitives into Blender
as collection instances.

Added a new USDInstanceReader class for importing USD
instances as Blender objects that instance collections containing
prototype data.

Extended the USDStageReader to read USD prototype prims into
collections that are instanced on the objects created by the instance
readers.

Removed the "Import Instance Proxies" import option.

Importing instances is enabled with a new "Scene Instancing" import
option, which is true by default.  If this option is off, instances will be
imported as copies (which is the functionality previously enabled by
the "Import Instance Proxies" option).

Removed calls to UsdSkelBindingAPI::Apply() in the skeleton and
blend shape import code, as these calls were unnecessary and were
generating errors when importing instance prototypes with UsdSkel
data.

Nested instancing and animated prototypes are supported.

Pull Request: https://projects.blender.org/blender/blender/pulls/115076
2023-12-28 19:08:23 +01:00

43 lines
952 B
C++

/* SPDX-FileCopyrightText: 2023 NVIDIA Corporation. All rights reserved.
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include "usd_reader_xform.h"
#include <pxr/usd/usdGeom/xform.h>
struct Collection;
namespace blender::io::usd {
/**
* Convert a USD instanced prim to a blender collection instance.
*/
class USDInstanceReader : public USDXformReader {
public:
USDInstanceReader(const pxr::UsdPrim &prim,
const USDImportParams &import_params,
const ImportSettings &settings);
bool valid() const override;
/**
* Create an object that instances a collection.
*/
void create_object(Main *bmain, double motionSampleTime) override;
/**
* Assign the given collection to the object.
*/
void set_instance_collection(Collection *coll);
/**
* Get the path of the USD prototype prim.
*/
pxr::SdfPath proto_path() const;
};
} // namespace blender::io::usd