Code Monkey home page Code Monkey logo

pymxs_stubs's Introduction

PyMXS Stubs generator

What

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.

Generate stubs

Run generate_pymax_pyi.py in 3DsMax to generate stubs. Tested with 3DsMax 2021 (Python3).

Use stubs

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.

Development

  • 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 on generate_pymax_pyi.py file

Current scope

  • Works in 3Ds Max 2021
  • Works with Python 3
  • Gets properties of most 3DsMax objects

Missing from current version (to do)

  • 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

Contributing

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.

Thanks

Autodesk License

3Ds Max, the maxscript API, pymxs and all other items belong to Autodesk.

pymxs_stubs's People

Contributors

friedererdmann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pymxs_stubs's Issues

Clean up discarding invalid class and attribute names

Currently checking for invalid class and attribute names happens in at least two different places and makes no use of any good logic. See if there's an easy regex or similar to sort out illegal names (starting with digit or special character) as well as discarding any attributes and class names that double with Python internal reserved words.

Fix capitalization for class names

Currently inheritance can break between classes as classes might be capitalized or not. This leads to classes inheriting from Color but the class color was not capitalized. By default all class names should be CamelCased, also to avoid clashes with built-ins (like set and Set).

Streamline development process

  1. See if attaching debugger and starting pymxscom can be summarized in one launch profile.
  2. See if deploying pymxscom startup script can be automated
  3. See if linking VSCode workspace Python compiler to Max can be automated

Make stub generation repeatable and less memory hungry

Optimize stub generation by cleaning the scene before and after the generation of the stubs. Investigate if turning off UI/Viewport elements can improve generation speed as well. Provide visual feedback how far along the stub generation is.

Find and catalogue missing/broken properties

A number of current properties default to None or its not possible to construct the base object without some signature, so they are ignored. Catalogue the missing or broken properties and create follow up tasks to fix them.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.