Change mjs_nextChild to be DFS to match XML parsing.

PiperOrigin-RevId: 778915232
Change-Id: I5e290f47b7d2530597bb6c85b66ff2ae807e5510
This commit is contained in:
Alessio Quaglino
2025-07-03 10:05:46 -07:00
committed by Copybara-Service
parent 67f9ffddbd
commit af7d20c035
4 changed files with 49 additions and 43 deletions
+4 -2
View File
@@ -475,7 +475,7 @@ class mjCBody : public mjCBody_, private mjsBody {
// returns nullptr if the next child is not found or if `child` is the last element, returns
// the next child after the input `child` otherwise
mjsElement* NextChild(const mjsElement* child, mjtObj type = mjOBJ_UNKNOWN,
bool recursive = false, bool* found = nullptr);
bool recursive = false);
// reset keyframe references for allowing self-attach
void ForgetKeyframes() const;
@@ -534,7 +534,9 @@ class mjCBody : public mjCBody_, private mjsBody {
// gets next child of the same type in this body
template <class T>
mjsElement* GetNext(const std::vector<T*>& list, const mjsElement* child, bool* found);
mjsElement* GetNext(const std::vector<T*>& list, const mjsElement* child);
bool IsAncestor(const mjCBody* child) const; // true if child is a descendant of this body
};