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:
1. Go to Window -> Preferences
2. 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)
3. 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
4. Go to the "forced builtin libs" window, click on "New..." and add the keyword direct, repeat the process but instead add the pandac keyword.
5. 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
Code completion is not working correctly for some library
Well, code completion works by default by analyzing the source code, but, sometimes, most information is only really available at runtime (the os module and wxPython are good examples here). So, you can specify that you want to treat those as builtin libraries. For that, go to the python interpreters and add it as a 'forced builtin lib'. More information may be found at the faq:
'What is that 'Forced builtin libs' in the Python Interpreters preferences?'
What is that 'Forced builtin libs' in the Python Interpreters preferences?
Well, some libraries once installed do not really show in code completion because they do not have a corresponding module (such as __builtin__ and datetime) or they do have a corresponding module but it cannot be really used in code completion because most of its information is only gotten at runtime (such as sys and os), so, in order for code completion to get its information, you have to manually add it to those libs (and by doing so, its information is gotten with a python shell).
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"