|
14 | 14 | * limitations under the License.
|
15 | 15 | *
|
16 | 16 | */
|
17 |
| -#include "USD.hh" |
| 17 | +#include "USDWorld.hh" |
18 | 18 |
|
19 |
| -#include "sdf/usd/usd_parser/USDData.hh" |
20 |
| -#include "sdf/usd/usd_parser/USDStage.hh" |
21 |
| -#include "Physics.hh" |
| 19 | +#include <string> |
22 | 20 |
|
23 | 21 | #pragma push_macro ("__DEPRECATED")
|
24 | 22 | #undef __DEPRECATED
|
25 | 23 | #include <pxr/usd/usdPhysics/scene.h>
|
26 | 24 | #pragma pop_macro ("__DEPRECATED")
|
27 | 25 |
|
28 |
| -#include <string> |
| 26 | +#include "sdf/usd/usd_parser/USDData.hh" |
| 27 | +#include "sdf/usd/usd_parser/USDStage.hh" |
| 28 | +#include "USDPhysics.hh" |
29 | 29 |
|
30 | 30 | namespace sdf
|
31 | 31 | {
|
32 | 32 | inline namespace SDF_VERSION_NAMESPACE {
|
33 | 33 | namespace usd
|
34 | 34 | {
|
35 |
| - UsdErrors parseUSDWorld( |
36 |
| - const std::string &_inputFilename, |
| 35 | + UsdErrors parseUSDWorld(const std::string &_inputFileName, |
37 | 36 | std::shared_ptr<WorldInterface> &_world)
|
38 | 37 | {
|
39 | 38 | UsdErrors errors;
|
40 |
| - USDData usdData(_inputFilename); |
| 39 | + USDData usdData(_inputFileName); |
41 | 40 | usdData.Init();
|
42 | 41 | usdData.ParseMaterials();
|
43 | 42 |
|
44 |
| - auto referencee = pxr::UsdStage::Open(_inputFilename); |
45 |
| - if (!referencee) |
| 43 | + auto reference = pxr::UsdStage::Open(_inputFileName); |
| 44 | + if (!reference) |
46 | 45 | {
|
47 | 46 | errors.emplace_back(UsdError(
|
48 | 47 | UsdErrorCode::INVALID_USD_FILE,
|
49 |
| - "Unable to open [" + _inputFilename + "]")); |
| 48 | + "Unable to open [" + _inputFileName + "]")); |
50 | 49 | return errors;
|
51 | 50 | }
|
52 |
| - auto range = pxr::UsdPrimRange::Stage(referencee); |
53 |
| - |
54 |
| - _world->_worldName = referencee->GetDefaultPrim().GetName().GetText(); |
| 51 | + _world->worldName = reference->GetDefaultPrim().GetName().GetText(); |
55 | 52 |
|
| 53 | + auto range = pxr::UsdPrimRange::Stage(reference); |
56 | 54 | for (auto const &prim : range)
|
57 | 55 | {
|
| 56 | + std::string primName = prim.GetName(); |
| 57 | + |
58 | 58 | if (prim.IsA<pxr::UsdPhysicsScene>())
|
59 | 59 | {
|
60 | 60 | std::pair<std::string, std::shared_ptr<USDStage>> data =
|
61 |
| - usdData.FindStage(prim.GetPath().GetName()); |
| 61 | + usdData.FindStage(primName); |
| 62 | + if (!data.second) |
| 63 | + { |
| 64 | + errors.push_back(UsdError(UsdErrorCode::INVALID_PRIM_PATH, |
| 65 | + "Unable to retrieve the pxr::UsdPhysicsScene named [" |
| 66 | + + primName + "]")); |
| 67 | + return errors; |
| 68 | + } |
62 | 69 |
|
63 |
| - ParsePhysicsScene(prim, _world, data.second->MetersPerUnit()); |
| 70 | + ParseUSDPhysicsScene(prim, _world, data.second->MetersPerUnit()); |
64 | 71 | continue;
|
65 | 72 | }
|
66 | 73 | }
|
|
0 commit comments