On Apr 15, 2:55 am, Chad Dombrova <[email protected]> wrote:

> this is getting a bit off topic, but if you're into ctypes, you should check 
> out cython. it's a python-like language that allows you to write hybrid 
> python and c code.  it can be used for about any conceivable purpose where 
> python and c need to interact:  c/c++ python bindings, fast compiled modules, 
> exposing python libraries to c, even statically typing pure python code for 
> speed.  pretty slick and very easy to write.

You're right that it's getting a bit off-topic, but I hope I'll be
forgiven another post in this direction. My problem with Python in
Maya right now is writing a deformer in Python. Maya allows you to
write plug-ins in Python, but it is very difficult to make them
efficient, even if you push all the heavy lifting onto C, using
ctypes, or something like cython/pyrex/etc. The basic problem here is
that you have to convert to CPython types in order to pass the data
along (unless you really do want to write an entirely new binding to
the Maya API,) and object creation/destruction with CPython is
insanely expensive- maybe 100 times too expensive for our purposes. I
would love to have our top-level deformer logic be in Python, and the
expensive bits be in C, or Pyrex, or cython, but just creating (and
destroying) the Swigged objects that the Maya Python API requires is
much more expensive than the very heavy math our deformer does in C.

We've decided to ship our plugin in two pieces- a deformer in C/C++
and the rest of what we do in Python that calls out to a C dll. You
seem very knowledgeable about this, so I wonder if you might know of
some way of passing data from ctypes, or cython, to Maya without
having to create all that expensive intermediate garbage.

Thsnks
Tagore Smith

-- 
http://groups.google.com/group/python_inside_maya

Reply via email to