It’s been a while since I’ve touched Panda3D so I’m starting again to get the grip of it. Lets see if I can get up to it again
Not sure if this has been posted already… but there it goes anyway…
Ok I’ve been tinkering with Pydev searching for a way to enable code completition, and I’ve found this might work for many people and prove to be useful for learning panda:
- Go to Window -> Preferences
- Head to Pydev -> Interpreter - Python
I suppose you added the ppython installation from panda, (not sure if it works with other python installations… but with the ppython, python, or wpython from panda works fine)
In the python path window, you have to add the main Panda3D installation folder (e.g c:\panda.1.x.x) and the bin diretory (e.g c:\panda.1.x.x\bin for example) as new folders, in addition to the other panda folders
Go to the “forced builtin libs” window, click on “New…” and add the keyword direct, repeat the process but instead add the pandac keyword.
Click on Apply and then and after the code analysis click Ok… as far as I know this enables auto complete with panda…
However at this point it won’t recognize all panda libraries, (no idea why, it will recognize some like gui or fsm), but you can fix it if you copy all the folders that are in your direct\scr folder (e.g c:\panda.1.x.x.\direct\src) to the direct folder (c:\panda.1.x.x\direct)
That’s too bad since I did not want to hack the panda installation to make it work… maybe its something I am not doing?
- Code completion from pandac modules and direct modules are correctly identified, included inherited ones like DirectObject (Ctrl-Space for code completition)
*The code completition shows documentation with parameters and reutrn value, if any
*Pydev will import libraries if not found (Ctrl-1 to fix the error will show Import…“specific library”)
What doesn’t work:
Certain variables like base, render and render2d can’t be identified
Some imports wont be recognized (Examples like DirectObject and Actor) when instantiated (Example: act = Actor.Actor() and DirectObject.DirectObject) BUT after that their variables will detect their methods without trouble (act will recognize code completition for example).
You can export directly the modules apparently, but I recommend to use the panda standard
*Importing import direct.directbase.DirectStart with code completition will make a panda instance to run
*It takes time to search all libraries and Eclipse freezes for like 6 seconds roughly the frs time it looks for something (like Actor class methods)
And done and done, this was what I wanted to say for now
Couldn’t believe it was so simple (well not that simple)… the forced built ins in Pydev exist because many modules (not just panda) have their imports generated at runtime… quoting from the Pydev FAQ
However I might have done something else that I did not notice, so I you can’t auto complete yet please tell me, so I’ll keep searching if I have done something else…
PD: It seems this is pretty standard for many python modules (like wxPython) for this to happen… so I suppose there might be an equivalent in other Python editors?
Italo F. Capasso B.
AKA “Edwood Grant”