Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormakowalski <makowalski@nvidia.com>2021-03-11 23:14:06 +0300
committermakowalski <makowalski@nvidia.com>2021-03-11 23:14:06 +0300
commit3fdfa0782da55683e2cc617efafb5e7ff21ba7fa (patch)
tree966532087c14c46097e65cbbe32bdebfdb34f979 /source/blender/io
parent54b5ecc058fb06b5b14396d720d2de97a4da54a9 (diff)
USD Import: remove UsdPrimReader stage member.
The UsdPrimReader class doesn't need a stage pointer as a member because the stage can implicitly be accessed through the prim itself, as long as the prim is valid. I removed the UsdPrimReader::stage_ member and updated the relevant constructors and function calls. Also, updated the various readers to construct schemas directly from the contained prim, e.g., pxr::UsdLuxRectLight rect_light(prim_)
Diffstat (limited to 'source/blender/io')
-rw-r--r--source/blender/io/usd/intern/usd_capi.cc2
-rw-r--r--source/blender/io/usd/intern/usd_reader_camera.cc6
-rw-r--r--source/blender/io/usd/intern/usd_reader_camera.h5
-rw-r--r--source/blender/io/usd/intern/usd_reader_curve.cc10
-rw-r--r--source/blender/io/usd/intern/usd_reader_curve.h5
-rw-r--r--source/blender/io/usd/intern/usd_reader_geom.h5
-rw-r--r--source/blender/io/usd/intern/usd_reader_instance.cc5
-rw-r--r--source/blender/io/usd/intern/usd_reader_instance.h3
-rw-r--r--source/blender/io/usd/intern/usd_reader_light.cc22
-rw-r--r--source/blender/io/usd/intern/usd_reader_light.h5
-rw-r--r--source/blender/io/usd/intern/usd_reader_mesh.cc14
-rw-r--r--source/blender/io/usd/intern/usd_reader_mesh.h3
-rw-r--r--source/blender/io/usd/intern/usd_reader_nurbs.cc4
-rw-r--r--source/blender/io/usd/intern/usd_reader_nurbs.h5
-rw-r--r--source/blender/io/usd/intern/usd_reader_prim.cc4
-rw-r--r--source/blender/io/usd/intern/usd_reader_prim.h4
-rw-r--r--source/blender/io/usd/intern/usd_reader_stage.cc2
-rw-r--r--source/blender/io/usd/intern/usd_reader_volume.cc8
-rw-r--r--source/blender/io/usd/intern/usd_reader_volume.h5
-rw-r--r--source/blender/io/usd/intern/usd_reader_xform.h5
-rw-r--r--source/blender/io/usd/intern/usd_util.cc35
-rw-r--r--source/blender/io/usd/intern/usd_util.h5
22 files changed, 86 insertions, 76 deletions
diff --git a/source/blender/io/usd/intern/usd_capi.cc b/source/blender/io/usd/intern/usd_capi.cc
index ba0bc9bb886..25ecbff01b4 100644
--- a/source/blender/io/usd/intern/usd_capi.cc
+++ b/source/blender/io/usd/intern/usd_capi.cc
@@ -889,7 +889,7 @@ CacheReader *CacheReader_open_usd_object(USDStageHandle *handle,
}
// TODO: The handle does not have the proper import params or settings
- USDPrimReader *usd_reader = create_fake_reader(archive, prim);
+ USDPrimReader *usd_reader = create_reader(archive, prim);
if (usd_reader == NULL) {
/* This object is not supported */
diff --git a/source/blender/io/usd/intern/usd_reader_camera.cc b/source/blender/io/usd/intern/usd_reader_camera.cc
index 6c28763424f..a967976cbf2 100644
--- a/source/blender/io/usd/intern/usd_reader_camera.cc
+++ b/source/blender/io/usd/intern/usd_reader_camera.cc
@@ -60,7 +60,11 @@ void USDCameraReader::read_object_data(Main *bmain, double motionSampleTime)
{
Camera *bcam = (Camera *)object_->data;
- pxr::UsdGeomCamera cam_prim = pxr::UsdGeomCamera::Get(stage_, prim_.GetPath());
+ pxr::UsdGeomCamera cam_prim(prim_);
+
+ if (!cam_prim) {
+ return;
+ }
pxr::VtValue val;
cam_prim.GetFocalLengthAttr().Get(&val, motionSampleTime);
diff --git a/source/blender/io/usd/intern/usd_reader_camera.h b/source/blender/io/usd/intern/usd_reader_camera.h
index 31d4db656a1..c5a7b1d5561 100644
--- a/source/blender/io/usd/intern/usd_reader_camera.h
+++ b/source/blender/io/usd/intern/usd_reader_camera.h
@@ -23,11 +23,10 @@ namespace blender::io::usd {
class USDCameraReader : public USDXformReader {
public:
- USDCameraReader(pxr::UsdStageRefPtr stage,
- const pxr::UsdPrim &object,
+ USDCameraReader(const pxr::UsdPrim &object,
const USDImportParams &import_params,
ImportSettings &settings)
- : USDXformReader(stage, object, import_params, settings)
+ : USDXformReader(object, import_params, settings)
{
}
diff --git a/source/blender/io/usd/intern/usd_reader_curve.cc b/source/blender/io/usd/intern/usd_reader_curve.cc
index f2572021b7e..1bc8568d64d 100644
--- a/source/blender/io/usd/intern/usd_reader_curve.cc
+++ b/source/blender/io/usd/intern/usd_reader_curve.cc
@@ -85,7 +85,11 @@ void USDCurvesReader::read_object_data(Main *bmain, double motionSampleTime)
void USDCurvesReader::read_curve_sample(Curve *cu, double motionSampleTime)
{
- curve_prim_ = pxr::UsdGeomBasisCurves::Get(stage_, prim_.GetPath());
+ curve_prim_ = pxr::UsdGeomBasisCurves(prim_);
+
+ if (!curve_prim_) {
+ return;
+ }
pxr::UsdAttribute widthsAttr = curve_prim_.GetWidthsAttr();
pxr::UsdAttribute vertexAttr = curve_prim_.GetCurveVertexCountsAttr();
@@ -199,7 +203,9 @@ Mesh *USDCurvesReader::read_mesh(struct Mesh *existing_mesh,
float vel_scale,
const char **err_str)
{
- pxr::UsdGeomCurves curve_prim_ = pxr::UsdGeomCurves::Get(stage_, prim_.GetPath());
+ // TODO(makowalski): here and elsewhere, move curve_prim_ initialization to
+ // the constructor.
+ pxr::UsdGeomCurves curve_prim_(prim_);
pxr::UsdAttribute widthsAttr = curve_prim_.GetWidthsAttr();
pxr::UsdAttribute vertexAttr = curve_prim_.GetCurveVertexCountsAttr();
diff --git a/source/blender/io/usd/intern/usd_reader_curve.h b/source/blender/io/usd/intern/usd_reader_curve.h
index a74562e9f5a..a54d15ea8a6 100644
--- a/source/blender/io/usd/intern/usd_reader_curve.h
+++ b/source/blender/io/usd/intern/usd_reader_curve.h
@@ -30,11 +30,10 @@ class USDCurvesReader : public USDGeomReader {
Curve *curve_;
public:
- USDCurvesReader(pxr::UsdStageRefPtr stage,
- const pxr::UsdPrim &object,
+ USDCurvesReader(const pxr::UsdPrim &object,
const USDImportParams &import_params,
ImportSettings &settings)
- : USDGeomReader(stage, object, import_params, settings)
+ : USDGeomReader(object, import_params, settings)
{
}
diff --git a/source/blender/io/usd/intern/usd_reader_geom.h b/source/blender/io/usd/intern/usd_reader_geom.h
index 7cb35959d7c..dd5796c697d 100644
--- a/source/blender/io/usd/intern/usd_reader_geom.h
+++ b/source/blender/io/usd/intern/usd_reader_geom.h
@@ -25,11 +25,10 @@ namespace blender::io::usd {
class USDGeomReader : public USDXformReader {
public:
- USDGeomReader(pxr::UsdStageRefPtr stage,
- const pxr::UsdPrim &object,
+ USDGeomReader(const pxr::UsdPrim &object,
const USDImportParams &import_params,
ImportSettings &settings)
- : USDXformReader(stage, object, import_params, settings)
+ : USDXformReader(object, import_params, settings)
{
}
diff --git a/source/blender/io/usd/intern/usd_reader_instance.cc b/source/blender/io/usd/intern/usd_reader_instance.cc
index 23b9aba58b0..b4dc88dfad6 100644
--- a/source/blender/io/usd/intern/usd_reader_instance.cc
+++ b/source/blender/io/usd/intern/usd_reader_instance.cc
@@ -26,11 +26,10 @@
namespace blender::io::usd {
-USDInstanceReader::USDInstanceReader(pxr::UsdStageRefPtr stage,
- const pxr::UsdPrim &object,
+USDInstanceReader::USDInstanceReader(const pxr::UsdPrim &object,
const USDImportParams &import_params,
ImportSettings &settings)
- : USDXformReader(stage, object, import_params, settings)
+ : USDXformReader(object, import_params, settings)
{
}
diff --git a/source/blender/io/usd/intern/usd_reader_instance.h b/source/blender/io/usd/intern/usd_reader_instance.h
index ab3cef3aa7b..5cc04a04e94 100644
--- a/source/blender/io/usd/intern/usd_reader_instance.h
+++ b/source/blender/io/usd/intern/usd_reader_instance.h
@@ -31,8 +31,7 @@ namespace blender::io::usd {
class USDInstanceReader : public USDXformReader {
public:
- USDInstanceReader(pxr::UsdStageRefPtr stage,
- const pxr::UsdPrim &object,
+ USDInstanceReader(const pxr::UsdPrim &object,
const USDImportParams &import_params,
ImportSettings &settings);
diff --git a/source/blender/io/usd/intern/usd_reader_light.cc b/source/blender/io/usd/intern/usd_reader_light.cc
index 91bee43813f..0112ac53425 100644
--- a/source/blender/io/usd/intern/usd_reader_light.cc
+++ b/source/blender/io/usd/intern/usd_reader_light.cc
@@ -70,7 +70,12 @@ void USDLightReader::read_object_data(Main *bmain, double motionSampleTime)
{
Light *blight = (Light *)object_->data;
- pxr::UsdLuxLight light_prim = pxr::UsdLuxLight::Get(stage_, prim_.GetPath());
+ pxr::UsdLuxLight light_prim(prim_);
+
+ if (!light_prim) {
+ return;
+ }
+
pxr::UsdLuxShapingAPI shapingAPI(light_prim);
// Set light type
@@ -133,7 +138,8 @@ void USDLightReader::read_object_data(Main *bmain, double motionSampleTime)
switch (blight->type) {
case LA_AREA:
if (blight->area_shape == LA_AREA_RECT && prim_.IsA<pxr::UsdLuxRectLight>()) {
- pxr::UsdLuxRectLight rect_light = pxr::UsdLuxRectLight::Get(stage_, prim_.GetPath());
+
+ pxr::UsdLuxRectLight rect_light(prim_);
pxr::VtValue width;
rect_light.GetWidthAttr().Get(&width, motionSampleTime);
@@ -146,7 +152,8 @@ void USDLightReader::read_object_data(Main *bmain, double motionSampleTime)
}
if (blight->area_shape == LA_AREA_DISK && prim_.IsA<pxr::UsdLuxDiskLight>()) {
- pxr::UsdLuxDiskLight disk_light = pxr::UsdLuxDiskLight::Get(stage_, prim_.GetPath());
+
+ pxr::UsdLuxDiskLight disk_light(prim_);
pxr::VtValue radius;
disk_light.GetRadiusAttr().Get(&radius, motionSampleTime);
@@ -156,7 +163,8 @@ void USDLightReader::read_object_data(Main *bmain, double motionSampleTime)
break;
case LA_LOCAL:
if (prim_.IsA<pxr::UsdLuxSphereLight>()) {
- pxr::UsdLuxSphereLight sphere_light = pxr::UsdLuxSphereLight::Get(stage_, prim_.GetPath());
+
+ pxr::UsdLuxSphereLight sphere_light(prim_);
pxr::VtValue radius;
sphere_light.GetRadiusAttr().Get(&radius, motionSampleTime);
@@ -166,7 +174,8 @@ void USDLightReader::read_object_data(Main *bmain, double motionSampleTime)
break;
case LA_SPOT:
if (prim_.IsA<pxr::UsdLuxSphereLight>()) {
- pxr::UsdLuxSphereLight sphere_light = pxr::UsdLuxSphereLight::Get(stage_, prim_.GetPath());
+
+ pxr::UsdLuxSphereLight sphere_light(prim_);
pxr::VtValue radius;
sphere_light.GetRadiusAttr().Get(&radius, motionSampleTime);
@@ -184,8 +193,7 @@ void USDLightReader::read_object_data(Main *bmain, double motionSampleTime)
break;
case LA_SUN:
if (prim_.IsA<pxr::UsdLuxDistantLight>()) {
- pxr::UsdLuxDistantLight distant_light = pxr::UsdLuxDistantLight::Get(stage_,
- prim_.GetPath());
+ pxr::UsdLuxDistantLight distant_light(prim_);
pxr::VtValue angle;
distant_light.GetAngleAttr().Get(&angle, motionSampleTime);
diff --git a/source/blender/io/usd/intern/usd_reader_light.h b/source/blender/io/usd/intern/usd_reader_light.h
index 5f64e4b422b..f721f220e35 100644
--- a/source/blender/io/usd/intern/usd_reader_light.h
+++ b/source/blender/io/usd/intern/usd_reader_light.h
@@ -23,11 +23,10 @@ namespace blender::io::usd {
class USDLightReader : public USDXformReader {
public:
- USDLightReader(pxr::UsdStageRefPtr stage,
- const pxr::UsdPrim &object,
+ USDLightReader(const pxr::UsdPrim &object,
const USDImportParams &import_params,
ImportSettings &settings)
- : USDXformReader(stage, object, import_params, settings)
+ : USDXformReader(object, import_params, settings)
{
}
diff --git a/source/blender/io/usd/intern/usd_reader_mesh.cc b/source/blender/io/usd/intern/usd_reader_mesh.cc
index 26b8de07a65..e6b52775d06 100644
--- a/source/blender/io/usd/intern/usd_reader_mesh.cc
+++ b/source/blender/io/usd/intern/usd_reader_mesh.cc
@@ -185,11 +185,10 @@ static void *add_customdata_cb(Mesh *mesh, const char *name, int data_type)
namespace blender::io::usd {
-USDMeshReader::USDMeshReader(pxr::UsdStageRefPtr stage,
- const pxr::UsdPrim &object,
+USDMeshReader::USDMeshReader(const pxr::UsdPrim &object,
const USDImportParams &import_params,
ImportSettings &settings)
- : USDGeomReader(stage, object, import_params, settings),
+ : USDGeomReader(object, import_params, settings),
is_left_handed_(false),
last_num_positions_(-1),
has_uvs_(false),
@@ -213,6 +212,7 @@ void USDMeshReader::read_object_data(Main *bmain, double motionSampleTime)
is_initial_load_ = true;
Mesh *read_mesh = this->read_mesh(
mesh, motionSampleTime, import_params_.global_read_flag, 1.0f, NULL);
+
is_initial_load_ = false;
if (read_mesh != mesh) {
/* XXX fixme after 2.80; mesh->flag isn't copied by BKE_mesh_nomain_to_mesh() */
@@ -833,7 +833,7 @@ void USDMeshReader::readFaceSetsSample(Main *bmain, Mesh *mesh, const double mot
std::map<pxr::SdfPath, int> mat_map;
assign_facesets_to_mpoly(motionSampleTime, mesh->mpoly, mesh->totpoly, mat_map);
- utils::assign_materials(bmain, object_, mat_map, this->import_params_, this->stage_);
+ utils::assign_materials(bmain, object_, mat_map, this->import_params_, this->prim_.GetStage());
}
Mesh *USDMeshReader::read_mesh(Mesh *existing_mesh,
@@ -842,7 +842,11 @@ Mesh *USDMeshReader::read_mesh(Mesh *existing_mesh,
float vel_scale,
const char **err_str)
{
- mesh_prim_ = pxr::UsdGeomMesh::Get(stage_, prim_.GetPath());
+ mesh_prim_ = pxr::UsdGeomMesh(prim_);
+
+ if (!mesh_prim_) {
+ return existing_mesh;
+ }
mesh_prim_.GetOrientationAttr().Get(&orientation_);
if (orientation_ == pxr::UsdGeomTokens->leftHanded)
diff --git a/source/blender/io/usd/intern/usd_reader_mesh.h b/source/blender/io/usd/intern/usd_reader_mesh.h
index 2215bb9fadf..e7564b424d8 100644
--- a/source/blender/io/usd/intern/usd_reader_mesh.h
+++ b/source/blender/io/usd/intern/usd_reader_mesh.h
@@ -48,8 +48,7 @@ class USDMeshReader : public USDGeomReader {
bool is_initial_load_;
public:
- USDMeshReader(pxr::UsdStageRefPtr stage,
- const pxr::UsdPrim &object,
+ USDMeshReader(const pxr::UsdPrim &object,
const USDImportParams &import_params,
ImportSettings &settings);
diff --git a/source/blender/io/usd/intern/usd_reader_nurbs.cc b/source/blender/io/usd/intern/usd_reader_nurbs.cc
index dd4fd0ad968..638fe7dfb9c 100644
--- a/source/blender/io/usd/intern/usd_reader_nurbs.cc
+++ b/source/blender/io/usd/intern/usd_reader_nurbs.cc
@@ -102,7 +102,7 @@ void USDNurbsReader::read_object_data(Main *bmain, double motionSampleTime)
void USDNurbsReader::read_curve_sample(Curve *cu, double motionSampleTime)
{
- curve_prim_ = pxr::UsdGeomNurbsCurves::Get(stage_, prim_.GetPath());
+ curve_prim_ = pxr::UsdGeomNurbsCurves(prim_);
pxr::UsdAttribute widthsAttr = curve_prim_.GetWidthsAttr();
pxr::UsdAttribute vertexAttr = curve_prim_.GetCurveVertexCountsAttr();
@@ -204,7 +204,7 @@ Mesh *USDNurbsReader::read_mesh(struct Mesh *existing_mesh,
float vel_scale,
const char **err_str)
{
- pxr::UsdGeomCurves curve_prim_ = pxr::UsdGeomCurves::Get(stage_, prim_.GetPath());
+ pxr::UsdGeomCurves curve_prim_(prim_);
pxr::UsdAttribute widthsAttr = curve_prim_.GetWidthsAttr();
pxr::UsdAttribute vertexAttr = curve_prim_.GetCurveVertexCountsAttr();
diff --git a/source/blender/io/usd/intern/usd_reader_nurbs.h b/source/blender/io/usd/intern/usd_reader_nurbs.h
index a53732ddbd9..8a768d55efb 100644
--- a/source/blender/io/usd/intern/usd_reader_nurbs.h
+++ b/source/blender/io/usd/intern/usd_reader_nurbs.h
@@ -30,11 +30,10 @@ class USDNurbsReader : public USDGeomReader {
Curve *curve_;
public:
- USDNurbsReader(pxr::UsdStageRefPtr stage,
- const pxr::UsdPrim &object,
+ USDNurbsReader(const pxr::UsdPrim &object,
const USDImportParams &import_params,
ImportSettings &settings)
- : USDGeomReader(stage, object, import_params, settings)
+ : USDGeomReader(object, import_params, settings)
{
}
diff --git a/source/blender/io/usd/intern/usd_reader_prim.cc b/source/blender/io/usd/intern/usd_reader_prim.cc
index a235774c21d..9300752f9b7 100644
--- a/source/blender/io/usd/intern/usd_reader_prim.cc
+++ b/source/blender/io/usd/intern/usd_reader_prim.cc
@@ -38,15 +38,13 @@ extern "C" {
namespace blender::io::usd {
-USDPrimReader::USDPrimReader(pxr::UsdStageRefPtr stage,
- const pxr::UsdPrim &object,
+USDPrimReader::USDPrimReader(const pxr::UsdPrim &object,
const USDImportParams &import_params,
ImportSettings &settings)
: name_(object.GetName().GetString()),
prim_path_(object.GetPrimPath().GetString()),
object_(nullptr),
prim_(object),
- stage_(stage),
import_params_(import_params),
parent_reader_(nullptr),
settings_(&settings),
diff --git a/source/blender/io/usd/intern/usd_reader_prim.h b/source/blender/io/usd/intern/usd_reader_prim.h
index 000d31f330e..6eefaf9539f 100644
--- a/source/blender/io/usd/intern/usd_reader_prim.h
+++ b/source/blender/io/usd/intern/usd_reader_prim.h
@@ -85,15 +85,13 @@ class USDPrimReader {
std::string prim_path_;
Object *object_;
pxr::UsdPrim prim_;
- pxr::UsdStageRefPtr stage_;
const USDImportParams &import_params_;
USDPrimReader *parent_reader_;
ImportSettings *settings_;
int refcount_;
public:
- USDPrimReader(pxr::UsdStageRefPtr stage,
- const pxr::UsdPrim &object,
+ USDPrimReader(const pxr::UsdPrim &object,
const USDImportParams &import_params,
ImportSettings &settings);
virtual ~USDPrimReader();
diff --git a/source/blender/io/usd/intern/usd_reader_stage.cc b/source/blender/io/usd/intern/usd_reader_stage.cc
index dc51eabef39..e9bd4a80641 100644
--- a/source/blender/io/usd/intern/usd_reader_stage.cc
+++ b/source/blender/io/usd/intern/usd_reader_stage.cc
@@ -139,7 +139,7 @@ static USDPrimReader *_handlePrim(Main *bmain,
// or the root prims of scenegraph 'master' prototypes
// from being added.
if (!(prim.IsPseudoRoot() || prim.IsMaster())) {
- reader = blender::io::usd::create_reader(stage, prim, params, settings);
+ reader = blender::io::usd::create_reader(prim, params, settings);
if (reader == NULL)
return NULL;
diff --git a/source/blender/io/usd/intern/usd_reader_volume.cc b/source/blender/io/usd/intern/usd_reader_volume.cc
index e557e861861..6d0d43340e4 100644
--- a/source/blender/io/usd/intern/usd_reader_volume.cc
+++ b/source/blender/io/usd/intern/usd_reader_volume.cc
@@ -67,7 +67,11 @@ void USDVolumeReader::create_object(Main *bmain, double motionSampleTime)
void USDVolumeReader::read_object_data(Main *bmain, double motionSampleTime)
{
- volume_ = pxr::UsdVolVolume::Get(stage_, prim_.GetPath());
+ volume_ = pxr::UsdVolVolume(prim_);
+
+ if (!volume_) {
+ return;
+ }
pxr::UsdVolVolume::FieldMap fields = volume_.GetFieldPaths();
@@ -78,7 +82,7 @@ void USDVolumeReader::read_object_data(Main *bmain, double motionSampleTime)
for (auto it = fields.begin(); it != fields.end(); ++it) {
- pxr::UsdPrim fieldPrim = stage_->GetPrimAtPath(it->second);
+ pxr::UsdPrim fieldPrim = prim_.GetStage()->GetPrimAtPath(it->second);
if (fieldPrim.IsA<pxr::UsdVolOpenVDBAsset>()) {
pxr::UsdVolOpenVDBAsset fieldBase(fieldPrim);
diff --git a/source/blender/io/usd/intern/usd_reader_volume.h b/source/blender/io/usd/intern/usd_reader_volume.h
index 8d5c7206b5d..c7cd06f7703 100644
--- a/source/blender/io/usd/intern/usd_reader_volume.h
+++ b/source/blender/io/usd/intern/usd_reader_volume.h
@@ -27,11 +27,10 @@ class USDVolumeReader : public USDXformReader {
pxr::UsdVolVolume volume_;
public:
- USDVolumeReader(pxr::UsdStageRefPtr stage,
- const pxr::UsdPrim &object,
+ USDVolumeReader(const pxr::UsdPrim &object,
const USDImportParams &import_params,
ImportSettings &settings)
- : USDXformReader(stage, object, import_params, settings)
+ : USDXformReader(object, import_params, settings)
{
}
diff --git a/source/blender/io/usd/intern/usd_reader_xform.h b/source/blender/io/usd/intern/usd_reader_xform.h
index 88b2d94361d..bcd5b88c541 100644
--- a/source/blender/io/usd/intern/usd_reader_xform.h
+++ b/source/blender/io/usd/intern/usd_reader_xform.h
@@ -23,11 +23,10 @@ namespace blender::io::usd {
class USDXformReader : public USDPrimReader {
public:
- USDXformReader(pxr::UsdStageRefPtr stage,
- const pxr::UsdPrim &object,
+ USDXformReader(const pxr::UsdPrim &object,
const USDImportParams &import_params,
ImportSettings &settings)
- : USDPrimReader(stage, object, import_params, settings)
+ : USDPrimReader(object, import_params, settings)
{
}
diff --git a/source/blender/io/usd/intern/usd_util.cc b/source/blender/io/usd/intern/usd_util.cc
index 80ff20c513a..1562c324b10 100644
--- a/source/blender/io/usd/intern/usd_util.cc
+++ b/source/blender/io/usd/intern/usd_util.cc
@@ -87,67 +87,66 @@ extern "C" {
namespace blender::io::usd {
-USDPrimReader *create_reader(const pxr::UsdStageRefPtr &stage,
- const pxr::UsdPrim &prim,
+USDPrimReader *create_reader(const pxr::UsdPrim &prim,
const USDImportParams &params,
ImportSettings &settings)
{
USDPrimReader *reader = nullptr;
if (params.use_instancing && prim.IsInstance()) {
- reader = new USDInstanceReader(stage, prim, params, settings);
+ reader = new USDInstanceReader(prim, params, settings);
}
else if (params.import_cameras && prim.IsA<pxr::UsdGeomCamera>()) {
- reader = new USDCameraReader(stage, prim, params, settings);
+ reader = new USDCameraReader(prim, params, settings);
}
else if (params.import_curves && prim.IsA<pxr::UsdGeomBasisCurves>()) {
- reader = new USDCurvesReader(stage, prim, params, settings);
+ reader = new USDCurvesReader(prim, params, settings);
}
else if (params.import_curves && prim.IsA<pxr::UsdGeomNurbsCurves>()) {
- reader = new USDNurbsReader(stage, prim, params, settings);
+ reader = new USDNurbsReader(prim, params, settings);
}
else if (params.import_meshes && prim.IsA<pxr::UsdGeomMesh>()) {
- reader = new USDMeshReader(stage, prim, params, settings);
+ reader = new USDMeshReader(prim, params, settings);
}
else if (params.import_lights && prim.IsA<pxr::UsdLuxLight>()) {
- reader = new USDLightReader(stage, prim, params, settings);
+ reader = new USDLightReader(prim, params, settings);
}
else if (params.import_volumes && prim.IsA<pxr::UsdVolVolume>()) {
- reader = new USDVolumeReader(stage, prim, params, settings);
+ reader = new USDVolumeReader(prim, params, settings);
}
else if (prim.IsA<pxr::UsdGeomImageable>()) {
- reader = new USDXformReader(stage, prim, params, settings);
+ reader = new USDXformReader(prim, params, settings);
}
return reader;
}
// TODO: The handle does not have the proper import params or settings
-USDPrimReader *create_fake_reader(USDStageReader *archive, const pxr::UsdPrim &prim)
+USDPrimReader *create_reader(class USDStageReader *archive, const pxr::UsdPrim &prim)
{
USDPrimReader *reader = nullptr;
// TODO(makowalski): Handle true instancing?
if (prim.IsA<pxr::UsdGeomCamera>()) {
- reader = new USDCameraReader(archive->stage(), prim, archive->params(), archive->settings());
+ reader = new USDCameraReader(prim, archive->params(), archive->settings());
}
else if (prim.IsA<pxr::UsdGeomBasisCurves>()) {
- reader = new USDCurvesReader(archive->stage(), prim, archive->params(), archive->settings());
+ reader = new USDCurvesReader(prim, archive->params(), archive->settings());
}
else if (prim.IsA<pxr::UsdGeomNurbsCurves>()) {
- reader = new USDNurbsReader(archive->stage(), prim, archive->params(), archive->settings());
+ reader = new USDNurbsReader(prim, archive->params(), archive->settings());
}
else if (prim.IsA<pxr::UsdGeomMesh>()) {
- reader = new USDMeshReader(archive->stage(), prim, archive->params(), archive->settings());
+ reader = new USDMeshReader(prim, archive->params(), archive->settings());
}
else if (prim.IsA<pxr::UsdLuxLight>()) {
- reader = new USDLightReader(archive->stage(), prim, archive->params(), archive->settings());
+ reader = new USDLightReader(prim, archive->params(), archive->settings());
}
else if (prim.IsA<pxr::UsdVolVolume>()) {
- reader = new USDVolumeReader(archive->stage(), prim, archive->params(), archive->settings());
+ reader = new USDVolumeReader(prim, archive->params(), archive->settings());
}
else if (prim.IsA<pxr::UsdGeomImageable>()) {
- reader = new USDXformReader(archive->stage(), prim, archive->params(), archive->settings());
+ reader = new USDXformReader(prim, archive->params(), archive->settings());
}
return reader;
}
diff --git a/source/blender/io/usd/intern/usd_util.h b/source/blender/io/usd/intern/usd_util.h
index b83bbe01784..c78f460c80a 100644
--- a/source/blender/io/usd/intern/usd_util.h
+++ b/source/blender/io/usd/intern/usd_util.h
@@ -37,11 +37,10 @@ namespace blender::io::usd {
struct ImportSettings;
class USDPrimReader;
-USDPrimReader *create_reader(const pxr::UsdStageRefPtr &stage,
- const pxr::UsdPrim &prim,
+USDPrimReader *create_reader(const pxr::UsdPrim &prim,
const USDImportParams &params,
ImportSettings &settings);
-USDPrimReader *create_fake_reader(class USDStageReader *archive, const pxr::UsdPrim &prim);
+USDPrimReader *create_reader(class USDStageReader *archive, const pxr::UsdPrim &prim);
} // Namespace blender::io::usd