Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help! #1

Open
mottosso opened this issue Apr 5, 2021 · 2 comments
Open

Help! #1

mottosso opened this issue Apr 5, 2021 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@mottosso
Copy link
Owner

mottosso commented Apr 5, 2021

Hello, welcome to cmdc where we attempt to reproduce Maya Python API 2.0 (i.e. maya.api.OpenMaya) in open source form, fix all bugs and add all of the things missing from it. Autodesk has shown little to no interest in continuing with API 2.0, and I was surprised to find nobody had yet taken matters into their own hands.

So let's do that!

I've put together a few source files demonstrating the fundamentals of how to bind the API, along with commonly used types like MVector and MMatrix and a function set, MFnDependencyNode for manipulating the scene graph.

Here's the simplest example.

The syntax is a little cryptic, because it's doing a lot of automatic detection of argument types and return values. Things we'd otherwise have to do ourselves if manually binding via e.g. Python.h. But it's fairly consistent and only consists of a few key functions, most if not all of them are already present in this repository.


Help Wanted

But I need help. There is too much of an API to wrap for one person, and the task of actually binding a new C++ member is of intern-level complexity. That is, anyone can do it. The hard part is patience and diligence. We need to match function signatures, convert all MStatuses to exceptions and write tests for each newly added member.

As soon as I spot some interest in the project, and interest in helping out, I'll expand upon the test suite and CI mechanism to automatically produce compiled versions for all platforms and versions of Maya, along with automatic upload to PyPI. From there, anyone can add or improve upon any member and we'll never have to struggle with maya.api.OpenMaya again.


How can I help?

Glad you asked!

  1. Get the project built on your machine
  2. Pick your favourite member from the C++ documentation
  3. Make a new MYourMember.inl file
  4. Add it to main.cpp

Remember to keep the name of arguments as documented, so users of cmdc can refer to this documentation for help on how to use cmdc. And ditch the M prefix that all classes have, Python don't need that.

MVector -> Vector

Any questions or concerns, post here or in a new issue and let's fix this thing once and for all!

@mottosso mottosso added the help wanted Extra attention is needed label Apr 5, 2021
@scottenglert
Copy link
Collaborator

Just came across this and I think this is a great idea. It's funny because I was just thinking about doing some of this myself. I have already forked the repo and started adding some classes. I do agree the size of the API is going to take a while, so I am focusing on classes I frequently use in my own tools which is mostly centered around animation and rigging.

I'll send a message and a pull request when I get to a good stopping point so you can see. Thanks again for taking the first steps. Hope to talk with you more about how we can improve the API experience.

@mottosso
Copy link
Owner Author

Awesome, welcome aboard. 🥳

Have a look at the most recent PRs for how far we got; the next thing we/I wanted to pursue was porting some of the real examples that ship with the API. I'd imagine they would make for good coverage.

On my side, the reason for stopping was that I've learnt to live with the pain of the original OpenAPI 2.0. 😢 But I'm still quite confident we could rather easily outperform it, in both API comfort and CPU performance, so go nuts. And if you can, I'd be happy to overlook any PRs you make to here and provide what I can to grow this project further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants