2023-12-28 19:08:23 +01:00
|
|
|
/* SPDX-FileCopyrightText: 2023 NVIDIA Corporation. All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2024-02-05 19:02:00 +01:00
|
|
|
#include "usd_reader_xform.hh"
|
2023-12-28 19:08:23 +01:00
|
|
|
|
|
|
|
|
struct Collection;
|
2024-02-28 22:08:04 +01:00
|
|
|
struct Main;
|
2023-12-28 19:08:23 +01:00
|
|
|
|
|
|
|
|
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,
|
2024-10-28 23:00:40 +01:00
|
|
|
const ImportSettings &settings)
|
|
|
|
|
: USDXformReader(prim, import_params, settings)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool valid() const override
|
|
|
|
|
{
|
|
|
|
|
return prim_.IsValid() && prim_.IsInstance();
|
|
|
|
|
}
|
2023-12-28 19:08:23 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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
|