Throw an error if a child attached by reference to a parent is compiled.

Fixes #2482.

PiperOrigin-RevId: 735665098
Change-Id: Ia3436fdd2ff572f8f0c1ded434742a4a9186f2f7
This commit is contained in:
Alessio Quaglino
2025-03-11 01:23:31 -07:00
committed by Copybara-Service
parent 14dc6fd33b
commit 019e0a806c
5 changed files with 38 additions and 2 deletions
+4
View File
@@ -317,6 +317,9 @@ class mjCModel : public mjCModel_, private mjSpec {
// set deepcopy flag
void SetDeepCopy(bool deepcopy) { deepcopy_ = deepcopy; }
// set attached flag
void SetAttached(bool deepcopy) { attached_ |= !deepcopy; }
private:
// settings for each defaults class
std::vector<mjCDef*> defaults_;
@@ -428,5 +431,6 @@ class mjCModel : public mjCModel_, private mjSpec {
mjCError errInfo; // last error info
std::vector<mjKeyInfo> key_pending_; // attached keyframes
bool deepcopy_; // copy objects when attaching
bool attached_ = false; // true if model is attached to a parent model
};
#endif // MUJOCO_SRC_USER_USER_MODEL_H_