Files
test2/source/blender/io/usd/intern/usd_reader_pointinstancer.h
Ashley Ruglys fcd10ee33a USD: PointInstancer import support
Added support for static point instancing import.

Added a new USDPointInstancerReader class to import UsdGeomPointInstancer
primitives as Point Clouds with geometry node modifiers that use
Instance on Points geometry nodes to instance collections containing
prototype geometry.

Added logic to the USDStageReader class to traverse the USD stage to
create readers for point instancer prototypes.

Extended USDStageReader::collect_readers() to take arguments to include
undefined prims and to exclude a set of specified prims when traversing
the stage.  Allowing traversing undefined prims is necessary because
prototype prims may be specified as "overs" in the USD stage.

Added a USDPrimReader::is_in_instancer_proto_ boolean flag which
identifies readers of prims that are in point instancer prototypes.
The flag simplifies management of collections and is used to
determine whether global transforms should be applied to root objects.

Limitation: point cloud animation is not yet supported.

This partially addresses https://projects.blender.org/blender/blender/issues/96747.

Co-authored-by: Michael Kowalski <makowalski@nvidia.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/113107
2024-02-01 15:37:43 +01:00

43 lines
1.1 KiB
C++

/* SPDX-FileCopyrightText: 2023 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include "usd_reader_xform.h"
struct Collection;
namespace blender::io::usd {
/* Wraps the UsdGeomPointInstancer schema. Creates a Blender point cloud object. */
class USDPointInstancerReader : public USDXformReader {
public:
USDPointInstancerReader(const pxr::UsdPrim &prim,
const USDImportParams &import_params,
const ImportSettings &settings);
bool valid() const override;
void create_object(Main *bmain, double motionSampleTime) override;
void read_object_data(Main *bmain, double motionSampleTime) override;
pxr::SdfPathVector proto_paths() const;
/**
* Set the given collection on the Collection Info
* node referenced by the geometry nodes modifier
* on the object created by the reader. This assumes
* create_object() and read_object_data() have already
* been called.
*
* \param bmain: Pointer to Main
* \param coll: The collection to set
*/
void set_collection(Main *bmain, Collection &coll);
};
} // namespace blender::io::usd