Move meshdir and texturedir to mjsCompiler.

For backwards compatibility in the Python bindings, both `spec.compiler.meshdir` and `spec.meshdir` are now allowed.

Fixes #2834.

PiperOrigin-RevId: 809060113
Change-Id: Ie23f1c5dd57de43568312a8e062906f4013bb474
This commit is contained in:
Alessio Quaglino
2025-09-19 09:04:42 -07:00
committed by Copybara-Service
parent 681f5767b2
commit 77e025ea98
16 changed files with 98 additions and 79 deletions
+5 -12
View File
@@ -303,9 +303,6 @@ void mjCMesh::NameSpace(const mjCModel* m) {
if (modelfiledir_.empty()) {
modelfiledir_ = FilePath(m->spec_modelfiledir_);
}
if (meshdir_.empty()) {
meshdir_ = FilePath(m->spec_meshdir_);
}
if (!plugin_instance_name.empty()) {
plugin_instance_name = m->prefix + plugin_instance_name + m->suffix;
}
@@ -705,12 +702,12 @@ void mjCMesh::TryCompile(const mjVFS* vfs) {
}
// copy paths from model if not already defined
mujoco::user::FilePath meshdir_;
meshdir_ = FilePath(mjs_getString(compiler->meshdir));
if (modelfiledir_.empty()) {
modelfiledir_ = FilePath(model->modelfiledir_);
}
if (meshdir_.empty()) {
meshdir_ = FilePath(model->meshdir_);
}
// remove path from file if necessary
if (model->strippath) {
@@ -3131,9 +3128,6 @@ void mjCSkin::NameSpace(const mjCModel* m) {
if (modelfiledir_.empty()) {
modelfiledir_ = FilePath(m->spec_modelfiledir_);
}
if (meshdir_.empty()) {
meshdir_ = FilePath(m->spec_meshdir_);
}
}
@@ -3224,9 +3218,8 @@ void mjCSkin::Compile(const mjVFS* vfs) {
if (modelfiledir_.empty()) {
modelfiledir_ = FilePath(model->modelfiledir_);
}
if (meshdir_.empty()) {
meshdir_ = FilePath(model->meshdir_);
}
mujoco::user::FilePath meshdir_;
meshdir_ = FilePath(mjs_getString(compiler->meshdir));
FilePath filename = meshdir_ + FilePath(file_);
mjResource* resource = LoadResource(modelfiledir_.Str(), filename.Str(), vfs);