Yes, it's possible.
To make it callable from other python engines (in example, Blender), it must be compiled as python module, mh.pyd
So you can use it anywhere, just importing it with:
import mh
I've just cooked for you a special example:
http://www.dedalo-3d.com/lab/makehuman_ ... module.zipthere are 2 folders:
1) Example of mh as module usage
2) Example about how to compile it as python module instead executable.
Of course, both need a full python installed on your machine.
About (2), it's a very custom script, quickly done to work on windows...I've no time to port it on ubuntu,
but it should be even more simple :
- Code: Select all
from distutils.core import setup, Extension
module1 = Extension('mh',
define_macros = [('FREEGLUT_STATIC', '1')],
include_dirs = ['C:\Python25\include','include','C:\MinGW\include'],
libraries = ['python25','freeglut','glu32','opengl32','winmm','gdi32'],
library_dirs = ['C:\MinGW\lib','C:\Python25\libs'],
sources = ['src/gltexture.c','src/core.c','src/glmodule.c','src/main2.c'])
setup (name = 'PackageName',
version = '0.1',
description = 'MakeHuman 3D proto library',
author = 'Manuel Bastioni',
author_email = 'mb@makehuman.org',
url = 'http://www.makehuman.org',
long_description = '''
A library to quick make 3d objects and 3d GUI.
''',
ext_modules = [module1])
I call it with:
- Code: Select all
python compile_pyd.py build --compiler=mingw32
Nothe that I've modified only the code of main.c, saving it as main2.c, for comparison.
I've copied the result (mh.pyd) is in the folder (1). If you have python on your machine, you are able to launch it with a double click on test.py...but, a more important thing for your question, you can place mh.pyd into a Blender directory, and use test.py as Blender script!
Cool, right?
If you have problems, just tell me...(maybe I reply in late, because in these days we are strognly working with some antrhopologist about MH ethcnic feature, and the GUI tu use it...)
Regards,
Manuel