Files
test2/source/blender/io/usd/intern/usd_reader_curve.hh
Jesse Yurkovich 21db0daa4e USD: Read and write custom attributes for Curves
Add support for reading and writing custom `Curves` attributes.

This allows us to roundtrip Blender's Hair grooms containing UVs and
other attribute data. Note that animated attribute values are not
supported with this change.

This will also address #120042

Pull Request: https://projects.blender.org/blender/blender/pulls/121928
2024-05-25 22:23:40 +02:00

52 lines
1.4 KiB
C++

/* SPDX-FileCopyrightText: 2023 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later
* Adapted from the Blender Alembic importer implementation. Copyright 2016 Kévin Dietrich.
* Modifications Copyright 2021 Tangent Animation. All rights reserved. */
#pragma once
#include "usd.hh"
#include "usd_reader_geom.hh"
#include <pxr/usd/usdGeom/basisCurves.h>
struct Curves;
namespace blender::bke {
struct GeometrySet;
class CurvesGeometry;
} // namespace blender::bke
namespace blender::io::usd {
class USDCurvesReader : public USDGeomReader {
protected:
pxr::UsdGeomBasisCurves curve_prim_;
Curves *curve_;
public:
USDCurvesReader(const pxr::UsdPrim &prim,
const USDImportParams &import_params,
const ImportSettings &settings)
: USDGeomReader(prim, import_params, settings), curve_prim_(prim), curve_(nullptr)
{
}
bool valid() const override
{
return bool(curve_prim_);
}
void create_object(Main *bmain, double motionSampleTime) override;
void read_object_data(Main *bmain, double motionSampleTime) override;
void read_curve_sample(Curves *curves_id, double motionSampleTime);
void read_geometry(bke::GeometrySet &geometry_set,
USDMeshReadParams params,
const char **err_str) override;
void read_custom_data(bke::CurvesGeometry &curves, const double motionSampleTime) const;
};
} // namespace blender::io::usd