Copy default spec before assigning defaults.
PiperOrigin-RevId: 609766747 Change-Id: I79ebff62928ac2ffa5133020ee8bd001b68cdcd3
This commit is contained in:
committed by
Copybara-Service
parent
ce52047c6f
commit
c6a41fbfe6
@@ -541,6 +541,7 @@ mjCDef* mjCModel::AddDef(string name, int parentid) {
|
|||||||
|
|
||||||
// initialize contents
|
// initialize contents
|
||||||
if (parentid>=0 && parentid<thisid) {
|
if (parentid>=0 && parentid<thisid) {
|
||||||
|
defaults[parentid]->CopyFromSpec();
|
||||||
*def = *defaults[parentid];
|
*def = *defaults[parentid];
|
||||||
defaults[parentid]->childid.push_back(thisid);
|
defaults[parentid]->childid.push_back(thisid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -566,6 +566,23 @@ void mjCDef::PointToLocal() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void mjCDef::CopyFromSpec() {
|
||||||
|
joint.CopyFromSpec();
|
||||||
|
geom.CopyFromSpec();
|
||||||
|
site.CopyFromSpec();
|
||||||
|
camera.CopyFromSpec();
|
||||||
|
light.CopyFromSpec();
|
||||||
|
flex.CopyFromSpec();
|
||||||
|
mesh.CopyFromSpec();
|
||||||
|
material.CopyFromSpec();
|
||||||
|
pair.CopyFromSpec();
|
||||||
|
equality.CopyFromSpec();
|
||||||
|
tendon.CopyFromSpec();
|
||||||
|
actuator.CopyFromSpec();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//------------------------- class mjCBase implementation -------------------------------------------
|
//------------------------- class mjCBase implementation -------------------------------------------
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
|
|||||||
@@ -1397,6 +1397,7 @@ class mjCDef {
|
|||||||
void Compile(const mjCModel* model); // compiler
|
void Compile(const mjCModel* model); // compiler
|
||||||
mjCDef& operator=(const mjCDef& other); // copy assignment
|
mjCDef& operator=(const mjCDef& other); // copy assignment
|
||||||
void PointToLocal(void);
|
void PointToLocal(void);
|
||||||
|
void CopyFromSpec(void);
|
||||||
|
|
||||||
// identifiers
|
// identifiers
|
||||||
std::string name; // class name
|
std::string name; // class name
|
||||||
|
|||||||
Reference in New Issue
Block a user