Skip to content

Commit

Permalink
Merge branch 'sdf12' into ahcorde/usd_to_sdf/headerGuard
Browse files Browse the repository at this point in the history
  • Loading branch information
ahcorde authored Mar 23, 2022
2 parents 2fec998 + a905f0c commit ad3d994
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
12 changes: 8 additions & 4 deletions usd/src/usd_parser/USDMaterial.cc
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ namespace sdf
assetPath(pxr::TfToken("diffuse_texture"), variantShader);
pbrWorkflow.SetAlbedoMap(materialPath.GetAssetPath());
std::string fullAlbedoName =
ignition::common::findFile(materialPath.GetAssetPath());
ignition::common::findFile(ignition::common::basename(
materialPath.GetAssetPath()));
UsdErrors errorCopy = copyFile(
fullAlbedoName, materialPath.GetAssetPath());
if (!errorCopy.empty())
Expand All @@ -160,7 +161,8 @@ namespace sdf
assetPath(pxr::TfToken("normalmap_texture"), variantShader);
pbrWorkflow.SetNormalMap(materialPath.GetAssetPath());
std::string fullNormalName =
ignition::common::findFile(materialPath.GetAssetPath());
ignition::common::findFile(ignition::common::basename(
materialPath.GetAssetPath()));
auto errorCopy = copyFile(fullNormalName,
materialPath.GetAssetPath());
if (!errorCopy.empty())
Expand All @@ -176,7 +178,8 @@ namespace sdf
pxr::TfToken("reflectionroughness_texture"), variantShader);
pbrWorkflow.SetRoughnessMap(materialPath.GetAssetPath());
std::string fullRoughnessName =
ignition::common::findFile(materialPath.GetAssetPath());
ignition::common::findFile(ignition::common::basename(
materialPath.GetAssetPath()));
auto errorCopy = copyFile(
fullRoughnessName, materialPath.GetAssetPath());
if (!errorCopy.empty())
Expand All @@ -192,7 +195,8 @@ namespace sdf
pxr::TfToken("metallic_texture"), variantShader);
pbrWorkflow.SetMetalnessMap(materialPath.GetAssetPath());
std::string fullMetalnessName =
ignition::common::findFile(materialPath.GetAssetPath());
ignition::common::findFile(ignition::common::basename(
materialPath.GetAssetPath()));
auto errorCopy = copyFile(
fullMetalnessName, materialPath.GetAssetPath());
if (!errorCopy.empty())
Expand Down
8 changes: 6 additions & 2 deletions usd/src/usd_parser/USDWorld.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,12 @@ namespace usd
{
UsdErrors errors;
USDData usdData(_inputFileName);
usdData.Init();
usdData.ParseMaterials();
errors = usdData.Init();
if (!errors.empty())
return errors;
errors = usdData.ParseMaterials();
if (!errors.empty())
return errors;

auto reference = pxr::UsdStage::Open(_inputFileName);
if (!reference)
Expand Down
5 changes: 5 additions & 0 deletions usd/src/usd_parser/usd2sdf_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include <ignition/common/Filesystem.hh>
#include <ignition/common/TempDirectory.hh>
#include <ignition/common/Util.hh>

#include <ignition/utilities/ExtraTestMacros.hh>

Expand Down Expand Up @@ -74,6 +75,10 @@ TEST(check_cmd, IGN_UTILS_TEST_DISABLED_ON_WIN32(SDF))
{
const auto tmp = ignition::common::createTempDirectory("usd",
ignition::common::tempDirectoryPath());

auto systemPaths = ignition::common::systemPaths();
systemPaths->AddFilePaths(ignition::common::joinPaths(
sdf::testing::TestFile("usd"), "materials", "textures"));
// Check a good SDF file
{
const std::string path = sdf::testing::TestFile("usd", "upAxisZ.usda");
Expand Down

0 comments on commit ad3d994

Please sign in to comment.