No public description
PiperOrigin-RevId: 809074980 Change-Id: Ib3e3522addceddba6a057cfef80fcbd30a420b3d
This commit is contained in:
committed by
Copybara-Service
parent
77e025ea98
commit
26ea20a21f
+16
-18
@@ -1210,13 +1210,6 @@ void mjCBase::NameSpace(const mjCModel* m) {
|
||||
|
||||
|
||||
|
||||
mjsCompiler* mjCBase::FindCompiler(const mjsCompiler* compiler) const {
|
||||
mjSpec* origin = model->FindSpec(compiler);
|
||||
return origin ? &origin->compiler : &model->spec.compiler;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// load resource if found (fallback to OS filesystem)
|
||||
mjResource* mjCBase::LoadResource(const std::string& modelfiledir,
|
||||
const std::string& filename,
|
||||
@@ -1320,7 +1313,8 @@ mjCBody::mjCBody(mjCModel* _model) {
|
||||
|
||||
mjCBody::mjCBody(const mjCBody& other, mjCModel* _model) {
|
||||
model = _model;
|
||||
compiler = FindCompiler(other.compiler);
|
||||
mjSpec* origin = model->FindSpec(other.compiler);
|
||||
compiler = origin ? &origin->compiler : &model->spec.compiler;
|
||||
*this = other;
|
||||
CopyPlugin();
|
||||
}
|
||||
@@ -1395,8 +1389,7 @@ mjCBody& mjCBody::operator+=(const mjCBody& other) {
|
||||
mjCBody& mjCBody::operator+=(const mjCFrame& other) {
|
||||
// append a copy of the attached spec
|
||||
if (other.model != model && !model->FindSpec(&other.model->spec.compiler)) {
|
||||
model->AppendSpec(&other.model->spec, &other.model->spec.compiler);
|
||||
static_cast<mjCModel*>(other.model->spec.element)->AddRef();
|
||||
model->AppendSpec(mj_copySpec(&other.model->spec), &other.model->spec.compiler);
|
||||
}
|
||||
|
||||
// create a copy of the subtree that contains the frame
|
||||
@@ -2651,8 +2644,7 @@ mjCFrame& mjCFrame::operator=(const mjCFrame& other) {
|
||||
mjCFrame& mjCFrame::operator+=(const mjCBody& other) {
|
||||
// append a copy of the attached spec
|
||||
if (other.model != model && !model->FindSpec(&other.model->spec.compiler)) {
|
||||
model->AppendSpec(&other.model->spec, &other.model->spec.compiler);
|
||||
static_cast<mjCModel*>(other.model->spec.element)->AddRef();
|
||||
model->AppendSpec(mj_copySpec(&other.model->spec), &other.model->spec.compiler);
|
||||
}
|
||||
|
||||
// apply namespace and store keyframes in the source model
|
||||
@@ -4371,6 +4363,9 @@ void mjCHField::NameSpace(const mjCModel* m) {
|
||||
if (modelfiledir_.empty()) {
|
||||
modelfiledir_ = FilePath(m->spec_modelfiledir_);
|
||||
}
|
||||
if (meshdir_.empty()) {
|
||||
meshdir_ = FilePath(m->spec_meshdir_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4494,8 +4489,9 @@ void mjCHField::Compile(const mjVFS* vfs) {
|
||||
if (modelfiledir_.empty()) {
|
||||
modelfiledir_ = FilePath(model->modelfiledir_);
|
||||
}
|
||||
mujoco::user::FilePath meshdir_;
|
||||
meshdir_ = FilePath(mjs_getString(compiler->meshdir));
|
||||
if (meshdir_.empty()) {
|
||||
meshdir_ = FilePath(model->meshdir_);
|
||||
}
|
||||
|
||||
FilePath filename = meshdir_ + FilePath(file_);
|
||||
mjResource* resource = LoadResource(modelfiledir_.Str(), filename.Str(), vfs);
|
||||
@@ -4630,6 +4626,9 @@ void mjCTexture::NameSpace(const mjCModel* m) {
|
||||
if (modelfiledir_.empty()) {
|
||||
modelfiledir_ = FilePath(m->spec_modelfiledir_);
|
||||
}
|
||||
if (texturedir_.empty()) {
|
||||
texturedir_ = FilePath(m->spec_texturedir_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5219,8 +5218,6 @@ void mjCTexture::LoadCubeSeparate(const mjVFS* vfs) {
|
||||
}
|
||||
|
||||
// make filename
|
||||
mujoco::user::FilePath texturedir_;
|
||||
texturedir_ = FilePath(mjs_getString(compiler->texturedir));
|
||||
FilePath filename = texturedir_ + FilePath(cubefiles_[i]);
|
||||
|
||||
// load PNG or custom
|
||||
@@ -5299,8 +5296,9 @@ void mjCTexture::Compile(const mjVFS* vfs) {
|
||||
if (modelfiledir_.empty()) {
|
||||
modelfiledir_ = FilePath(model->modelfiledir_);
|
||||
}
|
||||
mujoco::user::FilePath texturedir_;
|
||||
texturedir_ = FilePath(mjs_getString(compiler->texturedir));
|
||||
if (texturedir_.empty()) {
|
||||
texturedir_ = FilePath(model->texturedir_);
|
||||
}
|
||||
|
||||
// buffer from user
|
||||
if (!data_.empty()) {
|
||||
|
||||
Reference in New Issue
Block a user