From BlenderWiki

Jump to: navigation, search
Note: This is an archived version of the Blender Developer Wiki. The current and active wiki is available on wiki.blender.org.

GSoC 2008 - Week 8 report

This week

I completed half of the SWIG replacement this week. The beginning of the week started pretty slow, as I was still learning all the nitty gritty details about using the Python/C API. I had to modify part of last week's work to support the expected behavior (having Freestyle class types available as instantiated objects rather than submodules). I also faced issues with supporting subclassing but I got that figured out. On Tuesday, I accomplished a proof-of-concept of my approach to removing SWIG (basically, wrapping a C++ class with a Python object of the same public methods).

I have been conscientious about making sure that my code works, having written test cases to verify that different input parameters work on the API. These test cases have allowed me to detect future potential bugs and I have since understood the appropriate way to code Freestyle's Python API. Testing is no doubt slowing me down but it is also the best way to validate my code.

I am trying to commit my work at least every other day to make sure people doing custom builds can test the API. I am not sure anyone is doing it yet (since the API or usage examples aren't released yet).


Next week

Porting the first classes was a trial-and-error process. It took me quite some testing and documentation reading to get it right. I am now running full-steam and I expect to have the remaining classes ported in the next few days. To set myself a clear goal, I want to have that process finished no later than for the next weekly report. Once that's done, I'll gather up the API and the test cases on my blog and will test heavily to make sure that SWIG-less Freestyle works as expected.


Issues

My whole approach is to favor code factoring and reuse. I am facing a challenge due to C++ templating: porting certain groups of C++ classes to Python is not as direct as it was for simpler cases. I have found a possible approach to the problem but I have not gotten around to code it or test it. I will see try to have it determined by the end of the week-end.

Another issue is making the API "Pythonic" while still allowing the underlaying (C++) calculations to be achieved. One example is rewriting all iterator-related code to a list-based approach. Exporting to lists is easy but converting back to iterators is problematic, for performance reasons. An intuitive solution is to always keep both representations in a Python class subclassing the list type, and having methods converting from one format to another.


Schedule

I am still behind as far as schedule goes but I do not know how I could have gone faster this week. I have worked really hard to complete this SWIG removal but I had to learn some low-level information to make things right. I wish to have it done for next week.

After discussing with Jean-Luc, contrary to former plans, I'll move on to removing lib3ds next (instead of making the rendering OpenGL-free). lib3ds is an important show-stopper, limiting our scene to around 65000 vertices before it crashes. Even though I have not studied this area of Freestyle yet, Jean-Luc and I have decided to remove SWIG completely first before moving on to it.