I just set up Eclipse to work with Maya to write tools using pyMel. I got the auto-complete working but I’m running into some issues with it. Some things work fine, autocomplete gives me the options i have to choose from the available methods, but doesn’t give the options for the list of flags within that method.
I had to look up the docs for the title,width and height flags
also, if I use the object win again, eclipse does not identify it as an object of the pymel.core.uitypes.Window() class (what it really is, right?), so if I have to find any of its methods I have to reference the docs again.
ya a pain in the ass, but with how you are importing pymel.core, you could just use “Window()” with a capital W, which will get you the proper auto corrections for those. but you will have to change it to “window()” when done or it wont run.
i believe it does this for 1 reason. There are commands like selected() which return different classes depending on the selection in the scene, which are only known at run time.
i good work around i found is this. Say i know i need access to methods of the Transform node i could write my code like this.
import pymel.core as pm
import pymel.core.nodetypes as nt
sel = pm.selected()
sel[0].;nt.Transform().
that way i can get auto completion options from the Transform class, than once i found the method i want i can simply delete the “;nt.Transform”
uber pain in the ass i know, but better than nothing. If i had a lot of time i prolly would take the trouble of forking the auto complete modual of my editor, and adding a hack for working with pymel.
[QUOTE=passerby;21665] There are commands like selected() which return different classes depending on the selection in the scene, which are only known at run time.
[/QUOTE]
From my experience, this is a common occurrence in a lot of programming languages. Usually, you would initialize a known empty class and assign the unknown returned object to it - given that you know what the type of that returned object is. If you don't know the return type, you can always do some sort of class check before the assignment ( using pymel.core.general.nodeType?)
#initialize empty
KnownClass knownClassObject
#assign to empty
knownClassObject = pm.selected()
The thing is, if you write code this way, the maya python interpreter throws an error, even though this works in eclipse and gives no syntax error.