Skip to content

Commit

Permalink
review feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Ashton Larkin <[email protected]>
  • Loading branch information
adlarkin committed Mar 14, 2022
1 parent 9617797 commit 966dc01
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
3 changes: 1 addition & 2 deletions usd/src/usd_parser/Parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,14 @@ namespace usd
}

std::ofstream out(_outputFilenameSdf.c_str(), std::ios::out);
std::string string = root.ToElement()->ToString("");
if (!out)
{
errors.emplace_back(UsdError(
UsdErrorCode::SDF_TO_USD_PARSING_ERROR,
"Unable to open file [" + _outputFilenameSdf + "] for writing"));
return errors;
}
out << string;
out << root.ToElement()->ToString("");
out.close();
return errors;
}
Expand Down
9 changes: 4 additions & 5 deletions usd/src/usd_parser/USD2SDF.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,25 @@ UsdErrors USD2SDF::Read(const std::string &_fileName,

sdf::World sdfWorld;

const auto errorsParseUSD = parseUSDWorld(_fileName, sdfWorld);
if (!errorsParseUSD.empty())
errors = parseUSDWorld(_fileName, sdfWorld);
if (!errors.empty())
{
errors.emplace_back(UsdError(
UsdErrorCode::SDF_TO_USD_PARSING_ERROR,
"Error parsing usd file [" + _fileName + "]"));
return errors;
}

auto addWorldErrors = _root.AddWorld(sdfWorld);
const auto addWorldErrors = _root.AddWorld(sdfWorld);
if (!addWorldErrors.empty())
{
for (auto & error: addWorldErrors)
for (const auto & error: addWorldErrors)
{
errors.emplace_back(error);
}
errors.emplace_back(UsdError(
UsdErrorCode::SDF_ERROR,
"Error adding the world [" + sdfWorld.Name() + "]"));
return errors;
}

return errors;
Expand Down
9 changes: 5 additions & 4 deletions usd/src/usd_parser/USD2SDF.hh
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@ inline namespace SDF_VERSION_NAMESPACE {
/// \brief constructor
public: USD2SDF() = default;

/// \brief convert USD file to sdf xml document
/// \param[in] _fileMame string containing USD filename.
/// \param[out] _sdfXmlDoc Document to populate with the sdf model.
/// \brief convert USD file to a sdf::Root object
/// \param[in] _fileName string containing USD filename.
/// \param[out] _root Root element to populate with the equivalent sdf
/// information from _fileName.
/// \return UsdErrors, which is a list of UsdError objects. An empty list
/// means no errors occurred when populating _sdfXmlOut with the contents
/// means no errors occurred when populating _root with the contents
/// of _fileName
public: UsdErrors Read(
const std::string &_fileName,
Expand Down
1 change: 1 addition & 0 deletions usd/src/usd_parser/USDPhysics_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "test_config.h"
#include "test_utils.hh"

#include "sdf/World.hh"
#include "USDPhysics.hh"

/////////////////////////////////////////////////
Expand Down

0 comments on commit 966dc01

Please sign in to comment.