Add mjmMaterial and mjmFrame to C API.

PiperOrigin-RevId: 606191307
Change-Id: Iaf43f81522029002b28bba14ea046b1c968ab2e7
This commit is contained in:
Alessio Quaglino
2024-02-12 02:55:00 -08:00
committed by Copybara-Service
parent 4b8363de6d
commit 4e5b194e88
9 changed files with 192 additions and 54 deletions
+5 -5
View File
@@ -667,8 +667,8 @@ void mjCModel::DeleteMaterial(std::vector<T*>& list, std::string_view name) {
template <class T>
static void DeleteTexture(std::vector<T*>& list, std::string_view name = "") {
for (T* plist : list) {
if (name.empty() || plist->texture == name) {
plist->texture.clear();
if (name.empty() || plist->get_texture() == name) {
plist->del_texture();
}
}
}
@@ -869,12 +869,12 @@ void mjCModel::IndexAssets(bool discard) {
mjCMaterial* pmat = materials[i];
// find texture by name
if (!pmat->texture.empty()) {
mjCBase* m = FindObject(mjOBJ_TEXTURE, pmat->texture);
if (!pmat->texture_.empty()) {
mjCBase* m = FindObject(mjOBJ_TEXTURE, pmat->texture_);
if (m) {
pmat->texid = m->id;
} else {
throw mjCError(pmat, "texture '%s' not found in material %d", pmat->texture.c_str(), i);
throw mjCError(pmat, "texture '%s' not found in material %d", pmat->texture_.c_str(), i);
}
}
}