Skip to content

Releases: blurstudio/Py3dsMax

Added TypedFloat to preserve maxscript double/float

22 Nov 23:07
Compare
Choose a tag to compare

In some cases maxscript expects a float value or a double value. Because python does not differentiate, we needed to preserve this relationship in our wrapper functions. Now instead of converting a maxscript double or float to python's float, it converts it to a Py3dsMax.TypedFloat object. You can check if it's a float by checking myFloat.isFloat. True means its a float, False means its a double.

In practice, all you need to do is call mxs.Float(value) if the maxscript function requires a float:

mxs.mixdown(nativeRoot.controller.mixer, False, False, 6, False, mxs.Float(166.15))

Here is a quick unit test:

# Floats:
y = mxs.Float(1.5)
assert(y == 1.5)
assert(str(mxs.classOf(y)) == 'Float')
y = Py3dsMax.TypedFloat(1.5, True)
assert(y == 1.5)
assert(str(mxs.classOf(y)) == 'Float')
# Doubles
y = mxs.Double(1.5)
assert(y == 1.5)
assert(str(mxs.classOf(y)) == 'Double')
y = Py3dsMax.TypedFloat(1.5)
assert(y == 1.5)
assert(str(mxs.classOf(y)) == 'Double')

Py3dsMax for Max 2015/2016

12 May 23:57
Compare
Choose a tag to compare

Thanks to jjayakumar for updating this to work with Max 2015.

Max 2016 is compatible with 2015 plugins, so this should work for that release, though it hasn't been thoroughly tested yet.