Add USD content type support in MJCF.

PiperOrigin-RevId: 788075561
Change-Id: If37cc254cab0411454de7663e0b3ff9f2b263281
This commit is contained in:
Sam Haves
2025-07-28 10:52:41 -07:00
committed by Copybara-Service
parent 3434f5d9c7
commit a04e0385e4
3 changed files with 26 additions and 2 deletions
+7
View File
@@ -45,6 +45,9 @@
#include "xml/xml_base.h"
#include "xml/xml_util.h"
#include "tinyxml2.h"
#ifdef mjUSEUSD
#include <mujoco/experimental/usd/usd.h>
#endif // mjUSEUSD
namespace {
using std::string;
@@ -3332,6 +3335,10 @@ void mjXReader::Asset(XMLElement* section, const mjVFS* vfs) {
if (content_type == "text/xml") {
child = mj_parseXML(filename.c_str(), vfs, error.data(), error.size());
#ifdef mjUSEUSD
} else if (content_type == "text/usd") {
child = mj_parseUSD(filename.c_str(), vfs, error.data(), error.size());
#endif // mjUSEUSD
} else {
throw mjXError(elem, "unsupported content_type: %s", content_type.c_str());
}