Check that there are no pending keyframes while writing a spec.

This can happen when a body is detached without compiling or recompiling.

Also added error catching when trying to delete a body instead of detaching it.

Fixes #2327

PiperOrigin-RevId: 712526730
Change-Id: I4b48df83120fca12d475c85b3a54893841449653
This commit is contained in:
Alessio Quaglino
2025-01-06 07:49:35 -08:00
committed by Copybara-Service
parent b5df2c10bf
commit f607d9554e
9 changed files with 37 additions and 15 deletions
+3 -3
View File
@@ -121,7 +121,7 @@ MJAPI void mj_freeLastXML(void);
// If length of the output buffer is too small, returns the required size.
MJAPI int mj_saveXMLString(const mjSpec* s, char* xml, int xml_sz, char* error, int error_sz);
// Save spec to XML file, return 1 on success, 0 otherwise.
// Save spec to XML file, return 0 on success, -1 otherwise.
MJAPI int mj_saveXML(const mjSpec* s, const char* filename, char* error, int error_sz);
@@ -1453,8 +1453,8 @@ MJAPI mjsLight* mjs_addLight(mjsBody* body, const mjsDefault* def);
// Add frame to body.
MJAPI mjsFrame* mjs_addFrame(mjsBody* body, mjsFrame* parentframe);
// Delete object corresponding to the given element.
MJAPI void mjs_delete(mjsElement* element);
// Delete object corresponding to the given element, return 0 on success.
MJAPI int mjs_delete(mjsElement* element);
//---------------------------------- Non-tree elements ---------------------------------------------