Replace PointToLocal with operator overload in mjCDef.
PiperOrigin-RevId: 609376948 Change-Id: Id69909d06ab48824a9cbe0d5a305e8f8b72a193d
This commit is contained in:
committed by
Copybara-Service
parent
cf7bd77cd3
commit
0ae9ba37f9
@@ -483,11 +483,20 @@ mjCDef::mjCDef(void) {
|
||||
mjm_defaultEquality(equality.spec);
|
||||
mjm_defaultTendon(tendon.spec);
|
||||
mjm_defaultActuator(actuator.spec);
|
||||
|
||||
// make sure all the pointers are local
|
||||
PointToLocal();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// copy constructor
|
||||
mjCDef::mjCDef(const mjCDef& other) {
|
||||
*this = other;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// compiler
|
||||
void mjCDef::Compile(const mjCModel* model) {
|
||||
// enforce length of all default userdata arrays
|
||||
@@ -501,7 +510,31 @@ void mjCDef::Compile(const mjCModel* model) {
|
||||
|
||||
|
||||
|
||||
// assignment operator (TODO: use overloading)
|
||||
// assignment operator
|
||||
mjCDef& mjCDef::operator=(const mjCDef& other) {
|
||||
if (this != &other) {
|
||||
name = other.name;
|
||||
parentid = other.parentid;
|
||||
childid = other.childid;
|
||||
joint = other.joint;
|
||||
geom = other.geom;
|
||||
site = other.site;
|
||||
camera = other.camera;
|
||||
light = other.light;
|
||||
flex = other.flex;
|
||||
mesh = other.mesh;
|
||||
material = other.material;
|
||||
pair = other.pair;
|
||||
equality = other.equality;
|
||||
tendon = other.tendon;
|
||||
actuator = other.actuator;
|
||||
}
|
||||
PointToLocal();
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void mjCDef::PointToLocal() {
|
||||
joint.PointToLocal();
|
||||
geom.PointToLocal();
|
||||
|
||||
Reference in New Issue
Block a user