Notifications
Clear all

[Closed] [pymxs] WM3_MC_SetValue strange bug

Hello everyone,

I’m currently developping tools in python using the pymxs library and i’m facing a strange bug, when doing this in maxscript works as expected :

morpher_mod = selection[1].modifiers[#morpher]
WM3_MC_SetValue morpher_mod 1 50.0

The same things in python :

from pymxs import runtime as rt

morpher_mod = rt.selection[0].modifiers[rt.Name('morpher')]

rt.WM3_MC_SetValue(morpher_mod, 1, 50)
rt.WM3_MC_SetValue(morpher_mod, 1, 50.0)
rt.WM3_MC_SetValue(morpher_mod, 1, rt.float(50))

Output the same type of error :

-- Type error: WM3_MC_SetValue [Morpher Modifier] [Channel Index] [Value] requires Float, got: 50

or

-- Type error: WM3_MC_SetValue [Morpher Modifier] [Channel Index] [Value] requires Float, got: 50.0d0

Is there something i did wrong ?

Thanks

Edit :

I found a crappy way to do this :

from pymxs import runtime as rt

rt.execute('fn WM3_MC_SetValue_Hack morpher_mod i value = WM3_MC_SetValue morpher_mod i (value as float)')

morpher_mod = rt.selection[0].modifiers[rt.Name('morpher')]
rt.WM3_MC_SetValue_Hack(morpher_mod, 1, 50)

Is there any way cleaner than that ?