C4D脚本自动接口完成脚本 Python Cinema 4D API auto completion (fake package)
- The combination of Eclipse and PyDev makes an excellent development environment for coding Cinema 4D python plugins.
- Sadly, there was this one – major – feature of PyDev I just couldn’t get to work… completions.
- And that was a shame, because this is probably the most awesome feature of PyDev and speeds things up a lot.
- Now it’s finally usable! (well… mostly)
- Why?
- And there was this other issue… since your interpreter and PyDev know nothing of the Cinema 4D API, PyDev marks every import and call as error.
- Before long, you don’t even bother looking at the ‘Problems’-tab anymore – there’s just errors everywhere!
- If that feature was working, it would greatly reduce the number of plugin-reloads or Cinema 4D restarts as one would be able to catch many typos, syntax errors and alike before actually executing the code.
- How?
- After some failed tries, I finally managed to pull most of what I needed from the API via introspection:
- attributes, classes, methods…
- What I didn’t manage to extract are method arguments – sorry, it just can’t be done that way…
- But still this is way better than nothing or what I had initially hoped for – I ended up with a neat little fake ‘c4d’ package including all sub modules.
- I moved it to the ‘/Libs/site-packages/’ folder of my external interpreter (DONT! try that with the Cinema 4D interpreter – just install a second), fired up Eclipse… opened a fairly complex plugin project… and bäm! no errors – working auto completion – happiness!
- Oh and the best part? This should work with any other python IDE that do not rely on predefined completion libraries.
- Where?
- So I updated the Advanced Python plugin coding for Cinema 4D post (that will help you to setup your Eclipse+PyDev developing environment – if you don’t already use one, just head over) accordingly and uploaded the package…
- -> You can grab the fake package here! <-
- But hear me out first!
- There is some disclaimer stuff that I would really like you to read before you use it:
- These are FAKE! modules – they may N E V E R go out into the wild – please make really sure you don’t accidently ship them with your plugin etc.
- Everything is extracted from the Cinema 4D R14.025 Python API – if you use any other build, you might/will see inconsistencies. I would supply the script to extract them but it’s not that simple, a good deal of manual labour went into this…
- This is slapped together with a lot of tape, voodoo, coffee and good intentions – I am sure there are a lot of areas where I messed up, so A L W A Y S (sry 4 caps lock) make sure you use the documentation.
- N E V E R rely on the docstings of these modules.
复制代码
|
|