1

I recently added jedi-vim to my plug-in arsenal. It works just fine for the standard modules, but is unable to find bpy and bmesh stuff.

So in the blender console I took the output of print(sys.path) and added it to a vimscript function in a .lvimrc file, like this:

function BpyPath()
    python sys.path.append('/home/john/src/blender-2.77-linux-glibcl211-x86_64/2.77/python/lib/python3.5')
    ...
endfunction

Now it works better. Typing bpy. gives me:

enter image description here

But typing bpy.context. still gives me: -- Omni completion (^O^N^P) Pattern not found

Versions:

  • Blender: 2.77a 64-bit linux
  • OS: Fedora 22
  • Python: 2.7.10
  • Vim: 7.4

I am not a very advanced python or vim user, so any help is appreciated.

4

3 回答 3

2

I just realized that there's not a lot of hope, because you're already talking to a compiled (C/C++) module.

If dir(bpy.context) (in a Python shell) doesn't give you the completions that you want, Jedi will also not be able to infer this information. If dir gives you something reasonable, just create an issue in the Jedi issue tracker. It would be a bug, IMO.

I'm planning a plugin system for Jedi, to make it possible to use Jedi with such use cases as well. But this will probably take two years.

于 2016-06-13T17:18:07.823 回答
2

This often catches people out. Blender's bpy module is a compiled module created from source code within blender. The binary for the module is merged into blender's binary and is not made available outside of the python interpreter within blender.

It is possible to compile blender yourself and enable an option to build blender as a python module that you can import into any python interpreter, and will probably be the solution you are looking for.

In this answer you can also find some links to other answers that have tips for using eclipse and pycharm with blender that may be of some help.

于 2016-06-14T10:11:40.787 回答
-1

Blender Python Text Editor, IDE there is this new tool Bacutor, has intellisense, syntax Highlight and more

http://bacutor.freeiz.com

于 2018-12-12T07:32:55.513 回答