chalk
March 4, 2018, 6:07am
1
Anyone been able to get PyCharm 2017 to recognize Maya Python API 2.0 with proper introspection? Importing to the protected member works:
import maya.api._OpenMaya_py2 as apiOM
but
import maya.api.OpenMaya as apiOM
doesn’t - it’ll throw unexpected argument warnings on parsed values for things like MMatrix.
I’m doing the standard setup using the devkit for code completion.
leocov
March 4, 2018, 9:50pm
2
this link shows you how:
Abbreviated version:
Get the devkit.
Link pymel completions to your interpreter in PyCharm.
Remove the \Maya201X\Python\Lib\site-packages path from the interpreter in the same window.
I just did these steps from scratch and they worked fine!
1 Like
chalk
March 5, 2018, 1:54am
3
Yep - exactly what I’ve got here. Most things complete correctly cmds, mel etc… just no go with the api 2.0.
leocov
March 5, 2018, 3:01am
4
FWIW this is my setup and I’ve got full completion… Maybe try invalidating your caches and restarting?
I get similar argument warnings. It’s not something I like getting used to, but I’ve dealt with. If anyone knows a fix, I’d also like to know.
@leocov - this appears to be less about auto-complete , as that does work when importing the API module. Introspection seems to be the annoyance after it’s imported.
imp99
March 9, 2018, 6:15am
6
\devkit\other\pymel\extras\completion\py\maya\api\OpenMaya.py file content must be:
from _OpenMaya_py2 import *
Then you can use:
import maya.api.OpenMaya as om
Follow the same way for the other files.
chalk
March 10, 2018, 6:11am
7
Importing everything isn’t the best idea as well as protected members (not valid PEP8).
Also isn’t _OpenMaya_py2
just the stubs?