Create list_dependencies sample to list all dependencies for an MCJF file.

PiperOrigin-RevId: 814816067
Change-Id: Idc6232e5d1ef1ff0318aeacd0e3d4b4a5a303485
This commit is contained in:
Sam Haves
2025-10-03 13:46:20 -07:00
committed by Copybara-Service
parent 6ae9cc8061
commit e4704cd28b
8 changed files with 97 additions and 29 deletions
+11
View File
@@ -127,6 +127,17 @@ the required size. XML saving automatically compiles the spec before saving.
Save spec to XML file, return 0 on success, -1 otherwise. XML saving requires that the spec first be compiled.
.. _mju_getXMLDependencies:
`mju_getXMLDependencies <#mju_getXMLDependencies>`__
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. mujoco-include:: mju_getXMLDependencies
Given MJCF filename, fills dependencies with a list of all other asset files it depends on.
The search is recursive, and the list includes the filename itself.
.. _Mainsimulation:
Main simulation
+4
View File
@@ -24,6 +24,10 @@ General
:ref:`visual/rgba/constraint<visual-rgba-constraint>`. For spatial tendons, this visualization aid is active only if
no :ref:`material<tendon-spatial-material>` is set and :ref:`rgba<tendon-spatial-rgba>` is default.
- Added :ref:`mju_getXMLDependencies` for computing a list of unique asset dependencies from an MJCF file.
- Added the code sample ``dependencies`` which provides command line utility for printing the result of :ref:`mju_getXMLDependencies`.
MJX
^^^
+1 -1
View File
@@ -3021,6 +3021,7 @@ int mj_saveLastXML(const char* filename, const mjModel* m, char* error, int erro
void mj_freeLastXML(void);
int mj_saveXMLString(const mjSpec* s, char* xml, int xml_sz, char* error, int error_sz);
int mj_saveXML(const mjSpec* s, const char* filename, char* error, int error_sz);
void mju_getXMLDependencies(const char* filename, mjStringVec* dependencies);
void mj_step(const mjModel* m, mjData* d);
void mj_step1(const mjModel* m, mjData* d);
void mj_step2(const mjModel* m, mjData* d);
@@ -3182,7 +3183,6 @@ mjtNum mju_rayFlex(const mjModel* m, const mjData* d, int flex_layer, mjtByte fl
const mjtNum* pnt, const mjtNum* vec, int vertid[1]);
mjtNum mju_raySkin(int nface, int nvert, const int* face, const float* vert,
const mjtNum pnt[3], const mjtNum vec[3], int vertid[1]);
void mju_getXMLDependencies(const char* filename, mjStringVec* dependencies);
void mjv_defaultCamera(mjvCamera* cam);
void mjv_defaultFreeCamera(const mjModel* m, mjvCamera* cam);
void mjv_defaultPerturb(mjvPerturb* pert);