Blender V5.3
usd_reader_points.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2024 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4#pragma once
5
6#include "usd.hh"
7#include "usd_api_modifier.hh"
8#include "usd_reader_geom.hh"
9
10#include <pxr/usd/usdGeom/points.h>
11
12namespace blender {
13
14struct Main;
15struct PointCloud;
16
17namespace io::usd {
18
19/*
20 * Read UsdGeomPoints primitives as Blender point clouds.
21 */
23 private:
24 pxr::UsdGeomPoints points_prim_;
25
26 public:
27 USDPointsReader(const pxr::UsdPrim &prim,
28 const USDImportParams &import_params,
29 const ImportSettings &settings)
30 : USDGeomReader(prim, import_params, settings), points_prim_(prim)
31 {
32 }
33
34 bool valid() const override
35 {
36 return bool(points_prim_);
37 }
38
39 /* Initial object creation. */
40 void create_object(Main *bmain) override;
41
42 /* Initial point cloud data update. */
43 void read_object_data(Main *bmain, pxr::UsdTimeCode time) override;
44
45 /* Implement point cloud update. This may be called by the cache modifier
46 * to update animated geometry. */
47 void read_geometry(bke::GeometrySet &geometry_set,
48 USDMeshReadParams params,
49 const char **r_err_str) override;
50
51 void read_ids(PointCloud *pointcloud, const pxr::UsdTimeCode time) const;
52 void read_velocities(PointCloud *pointcloud, const pxr::UsdTimeCode time) const;
53 void read_custom_data(PointCloud *pointcloud, const pxr::UsdTimeCode time) const;
54
55 /* Return true if the USD data may be time varying. */
56 bool is_animated() const;
57};
58
59} // namespace io::usd
60} // namespace blender
USDGeomReader(const pxr::UsdPrim &prim, const USDImportParams &import_params, const ImportSettings &settings)
void read_velocities(PointCloud *pointcloud, const pxr::UsdTimeCode time) const
void create_object(Main *bmain) override
void read_geometry(bke::GeometrySet &geometry_set, USDMeshReadParams params, const char **r_err_str) override
USDPointsReader(const pxr::UsdPrim &prim, const USDImportParams &import_params, const ImportSettings &settings)
void read_ids(PointCloud *pointcloud, const pxr::UsdTimeCode time) const
void read_object_data(Main *bmain, pxr::UsdTimeCode time) override
const pxr::UsdPrim & prim() const
void read_custom_data(const std::string &iobject_full_name, const ICompoundProperty &prop, const CDStreamConfig &config, const Alembic::Abc::ISampleSelector &iss)
BMesh Iterators.