This rewrites the Alembic and USD data importers to work with and output GeometrySets instead of Meshes. The main motivation for this change is to be able to import properly point clouds, which are currently imported as Meshes, and curves data, which suffer from a lot of issues due to limitations of legacy curves structures (fixed by the new curves data-block) and are also converted to Meshes. Further, for Curves, it will allow importing arbitrary attributes. This patch was primarily meant for Alembic, but changes to USD import were necessary as they share the same modifier. For Alembic: There should be no behavioral changes for Meshes Curves are imported as the new Curves object type Points are imported as PointClouds For USD: There should be no behavioral changes for Meshes Curves are imported as the new Curves object type Note that the current USD importer does not support loading PointClouds, so this patch does not add support for it. For both Alembic and USD, knots arrays are not read anymore, as the new Curves object does not expose the ability to set them. Improvements can be made in the future if and when example assets are provided. This fixes at least the following: #58704: Animated Alembic curves don't update on render #112308: Curves have offset animations (alembic / USD) #118261: wrong motion blur from usd in cycles and reverting to the first frame when disabeling motion blur Co-authored-by: Jesse Yurkovich <jesse.y@gmail.com> Pull Request: https://projects.blender.org/blender/blender/pulls/115623
41 lines
930 B
C++
41 lines
930 B
C++
/* SPDX-FileCopyrightText: 2021 Tangent Animation. All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
#pragma once
|
|
|
|
#include "usd.hh"
|
|
#include "usd_reader_xform.hh"
|
|
|
|
struct Mesh;
|
|
|
|
namespace blender::bke {
|
|
struct GeometrySet;
|
|
}
|
|
|
|
namespace blender::io::usd {
|
|
|
|
class USDGeomReader : public USDXformReader {
|
|
|
|
public:
|
|
USDGeomReader(const pxr::UsdPrim &prim,
|
|
const USDImportParams &import_params,
|
|
const ImportSettings &settings)
|
|
: USDXformReader(prim, import_params, settings)
|
|
{
|
|
}
|
|
|
|
virtual void read_geometry(bke::GeometrySet &geometry_set,
|
|
USDMeshReadParams params,
|
|
const char **err_str) = 0;
|
|
|
|
virtual bool topology_changed(const Mesh * /*existing_mesh*/, double /*motionSampleTime*/)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
void add_cache_modifier();
|
|
void add_subdiv_modifier();
|
|
};
|
|
|
|
} // namespace blender::io::usd
|