Pymxs, the 3DsMax bindings of Maxscript to Python doesn't come with any stubs. This is an attempt at generating stubs automatically by inspecting running code.
Run generate_pymax_pyi.py
in 3DsMax to generate stubs. Tested with 3DsMax 2021 (Python3).
Copy the pymxs.pyi
file to a path where you'd usually be able to call import pymxs
from.
These Stubs come as they are: I make no promises that they work or cover all your needs.
- Open Directory in VSCode
- Pick the 3Ds Max Python as your interpreter
- Unzip latest MXSPyCom Release into
/mxspycom
- Run
debug/start_debug.py
in Max - Run Debug configuration
Python: Remote Attach
- Run task
Execute Script in 3Ds Max
ongenerate_pymax_pyi.py
file
- Works in 3Ds Max 2021
- Works with Python 3
- Gets properties of most 3DsMax objects
- Signatures for max script calls (need to go into
__new__
constructors of the objects) - Some properties get skipped as the object they belong to can't be generated without the correct signature
- No
#Struct
object types - No properties for regular object types (like Array)
- Not all properties have the right hint (alot will still say
None
because they need initialization) - Some Max Scene clean up before, after, during script exectuion (this creates a TON of objects in your Max Scene)
- Check other performance optimizations like turn off viewport rendering as applicable
- Checking if everything is correct, including order of the pyi
- Captialization rules - right now names are read as is, but might be worth enforcing some lowercase or CamelCase rules
- Less hacky code
- Streamline debug/development process
- Encoding definition of pyi file
Callable
for properties/arguments that need it
Please feel free to fork and push Pull Requests my way. Also issues are welcome - in that case please include as much detail as possible.
- MXSPyCOM for easy debugging
- TechArt.org for the constant help
3Ds Max, the maxscript API, pymxs and all other items belong to Autodesk.