Change mjSpec and mjModel signature mechanism.
The signature now contains the necessary information to safely perform `bind`. The private UIDs are now removed. Fixes an issue of changing signature when compiling a copy of an mjSpec. PiperOrigin-RevId: 744670626 Change-Id: Id3c66419cf2afbe78e91bc4b37d2299f5ec00ab1
This commit is contained in:
committed by
Copybara-Service
parent
93251f07d9
commit
cc2f57d820
@@ -818,6 +818,7 @@ mjCBody::mjCBody(mjCModel* _model) {
|
||||
mjuu_zerovec(xpos0, 3);
|
||||
mjuu_setvec(xquat0, 1, 0, 0, 0);
|
||||
last_attached = nullptr;
|
||||
mocapid = -1;
|
||||
|
||||
// clear object lists
|
||||
bodies.clear();
|
||||
@@ -840,7 +841,6 @@ mjCBody::mjCBody(mjCModel* _model) {
|
||||
|
||||
mjCBody::mjCBody(const mjCBody& other, mjCModel* _model) {
|
||||
model = _model;
|
||||
uid = other.uid;
|
||||
mjSpec* origin = model->FindSpec(other.compiler);
|
||||
compiler = origin ? &origin->compiler : &model->spec.compiler;
|
||||
*this = other;
|
||||
@@ -944,7 +944,6 @@ mjCBody& mjCBody::operator+=(const mjCFrame& other) {
|
||||
frames.back()->frame = other.frame;
|
||||
if (model->deepcopy_) {
|
||||
frames.back()->NameSpace(other_model);
|
||||
frames.back()->uid = other.uid;
|
||||
} else {
|
||||
frames.back()->AddRef();
|
||||
}
|
||||
@@ -1037,8 +1036,6 @@ void mjCBody::CopyList(std::vector<T*>& dst, const std::vector<T*>& src,
|
||||
// increment refcount if shallow copy is made
|
||||
if (!model->deepcopy_) {
|
||||
dst.back()->AddRef();
|
||||
} else {
|
||||
dst.back()->uid = src[i]->uid;
|
||||
}
|
||||
|
||||
// set namespace
|
||||
@@ -1256,7 +1253,6 @@ mjCBody* mjCBody::AddBody(mjCDef* _def) {
|
||||
obj->parent = this;
|
||||
|
||||
// update signature
|
||||
obj->uid = model->GetUid();
|
||||
model->spec.element->signature = model->Signature();
|
||||
return obj;
|
||||
}
|
||||
@@ -1271,7 +1267,6 @@ mjCFrame* mjCBody::AddFrame(mjCFrame* _frame) {
|
||||
model->MakeTreeLists();
|
||||
|
||||
// update signature
|
||||
obj->uid = model->GetUid();
|
||||
model->spec.element->signature = model->Signature();
|
||||
return obj;
|
||||
}
|
||||
@@ -1295,7 +1290,6 @@ mjCJoint* mjCBody::AddFreeJoint() {
|
||||
|
||||
|
||||
// update signature
|
||||
obj->uid = model->GetUid();
|
||||
model->spec.element->signature = model->Signature();
|
||||
return obj;
|
||||
}
|
||||
@@ -1318,7 +1312,6 @@ mjCJoint* mjCBody::AddJoint(mjCDef* _def) {
|
||||
|
||||
|
||||
// update signature
|
||||
obj->uid = model->GetUid();
|
||||
model->spec.element->signature = model->Signature();
|
||||
return obj;
|
||||
}
|
||||
@@ -1341,7 +1334,6 @@ mjCGeom* mjCBody::AddGeom(mjCDef* _def) {
|
||||
|
||||
|
||||
// update signature
|
||||
obj->uid = model->GetUid();
|
||||
model->spec.element->signature = model->Signature();
|
||||
return obj;
|
||||
}
|
||||
@@ -1364,7 +1356,6 @@ mjCSite* mjCBody::AddSite(mjCDef* _def) {
|
||||
|
||||
|
||||
// update signature
|
||||
obj->uid = model->GetUid();
|
||||
model->spec.element->signature = model->Signature();
|
||||
return obj;
|
||||
}
|
||||
@@ -1387,7 +1378,6 @@ mjCCamera* mjCBody::AddCamera(mjCDef* _def) {
|
||||
|
||||
|
||||
// update signature
|
||||
obj->uid = model->GetUid();
|
||||
model->spec.element->signature = model->Signature();
|
||||
return obj;
|
||||
}
|
||||
@@ -1410,7 +1400,6 @@ mjCLight* mjCBody::AddLight(mjCDef* _def) {
|
||||
|
||||
|
||||
// update signature
|
||||
obj->uid = model->GetUid();
|
||||
model->spec.element->signature = model->Signature();
|
||||
return obj;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user