use of 3rd party APIs through blender's python implementatio

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

ashinms
Posts: 3
Joined: Thu Mar 15, 2012 3:53 am
Location: JBAB, DC

use of 3rd party APIs through blender's python implementatio

Postby ashinms » Sun Nov 04, 2012 2:16 am

Subject pretty much says it all. Is there anything special I would need to do to get PyOpencl, numpy, things of that nature, working properly in blender. I've also been reading up on using higher performance languages from within python such as C in the more performance critical sections of code. Would there be any abnormal challenges associated with this? Finally, how much trouble would it be to completely replace the standard python interpreter with a completely different one, such as JPython?

INeedMySpace
Posts: 4
Joined: Sat Oct 15, 2011 9:57 am

Postby INeedMySpace » Wed Nov 07, 2012 9:37 pm

Hi! There is no problem at all to use numpy in your Blender plugin. Place it in scripts/addons/modules and then type "import numpy" in Blender python console. It should be the same bit version (32 or 64) as your Blender installation. You can write your own python module that uses external C lib. Can say nothing about replacing standart python with jpython.

stiv
Posts: 3646
Joined: Tue Aug 05, 2003 7:58 am
Location: 45N 86W

Postby stiv » Wed Nov 07, 2012 11:12 pm

The only catch for using external py modules is they must be Python 3. As long as they are in your PYTHONPATH (or sys.path), they can be imported.

One of the nice things about Python is that you can easily extend it with C/C++ modules to do the heavy lifting. Numpy is a fine example of this. So is Blender!

Replacing Blender's embedded Python interpreter with something can be done, but it would be "non-trivial", if you get my meaning.


Return to “Python”

Who is online

Users browsing this forum: No registered users and 0 guests