Blender  V3.3
usd_reader_stage.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2021 Tangent Animation and. NVIDIA Corporation. All rights reserved. */
3 #pragma once
4 
5 struct Main;
6 
7 #include "usd.h"
8 #include "usd_reader_prim.h"
9 
10 #include <pxr/usd/usd/stage.h>
11 #include <pxr/usd/usdGeom/imageable.h>
12 
13 #include <vector>
14 
15 struct ImportSettings;
16 
17 namespace blender::io::usd {
18 
19 typedef std::map<pxr::SdfPath, std::vector<USDPrimReader *>> ProtoReaderMap;
20 
22 
23  protected:
24  pxr::UsdStageRefPtr stage_;
27 
28  std::vector<USDPrimReader *> readers_;
29 
30  public:
31  USDStageReader(pxr::UsdStageRefPtr stage,
32  const USDImportParams &params,
33  const ImportSettings &settings);
34 
36 
37  USDPrimReader *create_reader_if_allowed(const pxr::UsdPrim &prim);
38 
39  USDPrimReader *create_reader(const pxr::UsdPrim &prim);
40 
41  void collect_readers(struct Main *bmain);
42 
43  bool valid() const;
44 
45  pxr::UsdStageRefPtr stage()
46  {
47  return stage_;
48  }
49  const USDImportParams &params() const
50  {
51  return params_;
52  }
53 
54  const ImportSettings &settings() const
55  {
56  return settings_;
57  }
58 
59  void clear_readers();
60 
61  const std::vector<USDPrimReader *> &readers() const
62  {
63  return readers_;
64  };
65 
66  void sort_readers();
67 
68  private:
69  USDPrimReader *collect_readers(Main *bmain, const pxr::UsdPrim &prim);
70 
78  bool include_by_visibility(const pxr::UsdGeomImageable &imageable) const;
79 
87  bool include_by_purpose(const pxr::UsdGeomImageable &imageable) const;
88 };
89 
90 }; // namespace blender::io::usd
std::vector< USDPrimReader * > readers_
USDPrimReader * create_reader(const pxr::UsdPrim &prim)
const USDImportParams & params() const
const std::vector< USDPrimReader * > & readers() const
USDPrimReader * create_reader_if_allowed(const pxr::UsdPrim &prim)
const ImportSettings & settings() const
void collect_readers(struct Main *bmain)
USDStageReader(pxr::UsdStageRefPtr stage, const USDImportParams &params, const ImportSettings &settings)
std::map< pxr::SdfPath, std::vector< USDPrimReader * > > ProtoReaderMap
Definition: BKE_main.h:121