Change mj_sizeModel return type to mjtSize.

PiperOrigin-RevId: 831768095
Change-Id: I079fbadc403b32a3ce8a73fe21b2cd66391401c3
This commit is contained in:
Yuval Tassa
2025-11-13 02:31:15 -08:00
committed by Copybara-Service
parent a168b3ef7f
commit 042c5223a6
8 changed files with 9 additions and 8 deletions
+1
View File
@@ -29,6 +29,7 @@ General
- ``sidesite -> MjsSite|None`` - ``sidesite -> MjsSite|None``
- ``coef -> real`` - ``coef -> real``
- ``divisor -> real`` - ``divisor -> real``
- Non-breaking API change: :ref:`mj_sizeModel` now returns an :ref:`mjtSize` rather than an ``int``.
MJX MJX
^^^ ^^^
+1 -1
View File
@@ -3097,7 +3097,7 @@ mjModel* mj_copyModel(mjModel* dest, const mjModel* src);
void mj_saveModel(const mjModel* m, const char* filename, void* buffer, int buffer_sz); void mj_saveModel(const mjModel* m, const char* filename, void* buffer, int buffer_sz);
mjModel* mj_loadModel(const char* filename, const mjVFS* vfs); mjModel* mj_loadModel(const char* filename, const mjVFS* vfs);
void mj_deleteModel(mjModel* m); void mj_deleteModel(mjModel* m);
int mj_sizeModel(const mjModel* m); mjtSize mj_sizeModel(const mjModel* m);
mjData* mj_makeData(const mjModel* m); mjData* mj_makeData(const mjModel* m);
mjData* mj_copyData(mjData* dest, const mjModel* m, const mjData* src); mjData* mj_copyData(mjData* dest, const mjModel* m, const mjData* src);
mjData* mjv_copyData(mjData* dest, const mjModel* m, const mjData* src); mjData* mjv_copyData(mjData* dest, const mjModel* m, const mjData* src);
+1 -1
View File
@@ -216,7 +216,7 @@ MJAPI mjModel* mj_loadModel(const char* filename, const mjVFS* vfs);
MJAPI void mj_deleteModel(mjModel* m); MJAPI void mj_deleteModel(mjModel* m);
// Return size of buffer needed to hold model. // Return size of buffer needed to hold model.
MJAPI int mj_sizeModel(const mjModel* m); MJAPI mjtSize mj_sizeModel(const mjModel* m);
// Allocate mjData corresponding to given model. // Allocate mjData corresponding to given model.
// If the model buffer is unallocated the initial configuration will not be set. // If the model buffer is unallocated the initial configuration will not be set.
+1 -1
View File
@@ -856,7 +856,7 @@ FUNCTIONS: Mapping[str, FunctionDecl] = dict([
('mj_sizeModel', ('mj_sizeModel',
FunctionDecl( FunctionDecl(
name='mj_sizeModel', name='mj_sizeModel',
return_type=ValueType(name='int'), return_type=ValueType(name='mjtSize'),
parameters=( parameters=(
FunctionParameterDecl( FunctionParameterDecl(
name='m', name='m',
+2 -2
View File
@@ -671,8 +671,8 @@ void mj_deleteModel(mjModel* m) {
// size of buffer needed to hold model // size of buffer needed to hold model
int mj_sizeModel(const mjModel* m) { mjtSize mj_sizeModel(const mjModel* m) {
int size = ( mjtSize size = (
sizeof(int)*(NHEADER+getnint()) sizeof(int)*(NHEADER+getnint())
+ sizeof(mjtSize)*getnbuffer() + sizeof(mjtSize)*getnbuffer()
+ sizeof(mjOption) + sizeof(mjOption)
+1 -1
View File
@@ -76,7 +76,7 @@ mjModel* mj_loadModelBuffer(const void* buffer, int buffer_sz);
MJAPI void mj_deleteModel(mjModel* m); MJAPI void mj_deleteModel(mjModel* m);
// size of buffer needed to hold model // size of buffer needed to hold model
MJAPI int mj_sizeModel(const mjModel* m); MJAPI mjtSize mj_sizeModel(const mjModel* m);
// validate reference fields in a model; return null if valid, error message otherwise // validate reference fields in a model; return null if valid, error message otherwise
MJAPI const char* mj_validateReferences(const mjModel* m); MJAPI const char* mj_validateReferences(const mjModel* m);
+1 -1
View File
@@ -6448,7 +6448,7 @@ public static unsafe extern mjModel_* mj_loadModel([MarshalAs(UnmanagedType.LPSt
public static unsafe extern void mj_deleteModel(mjModel_* m); public static unsafe extern void mj_deleteModel(mjModel_* m);
[DllImport("mujoco", CallingConvention = CallingConvention.Cdecl)] [DllImport("mujoco", CallingConvention = CallingConvention.Cdecl)]
public static unsafe extern int mj_sizeModel(mjModel_* m); public static unsafe extern UInt64 mj_sizeModel(mjModel_* m);
[DllImport("mujoco", CallingConvention = CallingConvention.Cdecl)] [DllImport("mujoco", CallingConvention = CallingConvention.Cdecl)]
public static unsafe extern mjData_* mj_makeData(mjModel_* m); public static unsafe extern mjData_* mj_makeData(mjModel_* m);
+1 -1
View File
@@ -10114,7 +10114,7 @@ void mj_defaultVisual_wrapper(MjVisual& vis) {
mj_defaultVisual(vis.get()); mj_defaultVisual(vis.get());
} }
int mj_sizeModel_wrapper(const MjModel& m) { mjtSize mj_sizeModel_wrapper(const MjModel& m) {
return mj_sizeModel(m.get()); return mj_sizeModel(m.get());
} }