I did not use it for soft plugins, it was more for a pure python library. Some of the functions involved geometry operations like line-line intersection, some ray tracing algorithms etc. For these specific functions I used Cython to build extension and then used them in my python modules. I mixed everything using cython. Some code was all python just got converted. Some other code pure C functions. And some was a mix (thourgh pyrex code).

You are right, basically the idea is to inject python code with some steroids. For Softimage plugins, if I have huge data sets to  work with like point position arrays etc. I would rather use C++ API.  But for all other needs, specially concerning file browsing and other stuff, Python provides an easy, fast and more maintainable code.

So it depends on your use case scenario what would be a better implementation.

Also, if you have python functions and you just want to convert them to C code, it will not always be fast, unless you type cast and take care of a few other things, like porting all of your loops in C. You can find a little more about this here : http://www.perrygeo.net/wordpress/?p=116

Also remember that though Cython Site says that you can use MinGW to compile, I had some problems with it, so I finally switched to Visual Studio compiler.

Hope that helps,

Cheers !!




On 4/17/2012 2:12 PM, Eugen Sares wrote:
Thanks for the replies, guys!
I stumbled across all this today, so I have no idea yet what and how can be done. That's why I'm asking.

I do my operator-prototyping in JScript at the moment, and planned to port it to C++ when they are fully working.
Yet the idea not having to do the port to C++ is appealing, of course. Prototype in Python, compile when finished, and lean back...


Alok, did you just compile specific functions, or whole Softimage plugins with it?
Would that be possible, compile all the usual SI callbacks for an operator? There are many differences in the SI Scripting and C++ API, after all.
A fact you have to deal with when porting from JScript to C++, too.

As I understand it, you rarely touch the C code generated by Cython, right? You could, but mainly it's just a means to get to a fast compile of a Python program.


Regarding UI widgets:
the idea is NOT to use PyQt, but somehow call those .net-windows-libs from Cython somehow. Sounds complicated, though.


On Tue, 17 Apr 2012 19:56:17 +0200, Alok Gandhi <alok.gandhi2...@gmail.com> wrote:

Hi Eugen,

I used cython. It is really cool. But to use it efficiently you have to
really optimize your pyrex code, also use strongly caste your data type. I
think out of the box also it works pretty well for some less complicated
function prototypes.


-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.1831 / Virus Database: 2090/4557 - Release Date: 10/17/11
Internal Virus Database is out of date.

Reply via email to