BlenderToIndigo: Yet another Blender to Indigo exporter
Posted: Sun May 27, 2007 1:38 pm
Hi blender/indigo folks
In other threads I already declared that I wanted to contribute to the blender to indigo exporter. What kept me back was the lack of version control or other kinds of cooperative tools. Another thing was that I didn't like the way the original exporter was written: a lot of global variables, hardcoded gui stuff, no object oriented design, hardcoded export code, kinky python/math expressions, etc.
When Wedge declared on thread http://www2.indigorenderer.com/joomla/f ... php?t=1817 that he is no longer able to invest time in the exporter, I saw my chance to jump in. I decided to do a complete rewrite of the exporter. After a week working on it I dare to present it on this forum. Most of the changes are under the hood (actually there is hardly anything left from the original code). I opted for an object oriented design, both in the exporter code and gui code. The benefits of this is to make it easier in the long term to support different Indigo version with the same script (e.g. subclassing old exporter classes and only overloading the things that changed). At this point only Indigo 0.8 stable is supported, however.
Another problem with the old version is the very complicated material exporting. How a Blender material is mapped to an Indigo material and its properties was done based with hackish rules (like "if alpha<1 then use a uniform spectrum and a rgb spectrum otherwise"). This is very difficult for the code mainainers and I think not very user friendly too. Moreover, when additional Indigo material types or medium options would be added, it would be increasingly difficult to add these in the exporter without breaking something. I choose a different approach that was already suggested in the code of the old exporter: the name of the material defines the type (diffuse, phong, specular). The settings of the material and medium can also be defined with strings: the names of the textures in the material. See further for the manual, which should make things more clear if this sounds mysterious.
Another feature of this new version is that you can export the material code to a Blender buffer and edit it in Blender. After editing it is possible to export your scene with this edited materials. This way you can store custom Indigo material settings within your Blender file and keep these for future exports.
I chose to create a page on the Blender wiki for hosting the script an a manual (under construction): http://wiki.blender.org/index.php/BlenderToIndigo
The current version of this script (2.43 at the time of this writing) is still beta and not thouroughly tested, but I invite you to test it.
Please reply in this thread if things don't work as expected, if things are unclear, if you have patches or other ideas. I'm happy to help.
(I should get some sleep now)
In other threads I already declared that I wanted to contribute to the blender to indigo exporter. What kept me back was the lack of version control or other kinds of cooperative tools. Another thing was that I didn't like the way the original exporter was written: a lot of global variables, hardcoded gui stuff, no object oriented design, hardcoded export code, kinky python/math expressions, etc.
When Wedge declared on thread http://www2.indigorenderer.com/joomla/f ... php?t=1817 that he is no longer able to invest time in the exporter, I saw my chance to jump in. I decided to do a complete rewrite of the exporter. After a week working on it I dare to present it on this forum. Most of the changes are under the hood (actually there is hardly anything left from the original code). I opted for an object oriented design, both in the exporter code and gui code. The benefits of this is to make it easier in the long term to support different Indigo version with the same script (e.g. subclassing old exporter classes and only overloading the things that changed). At this point only Indigo 0.8 stable is supported, however.
Another problem with the old version is the very complicated material exporting. How a Blender material is mapped to an Indigo material and its properties was done based with hackish rules (like "if alpha<1 then use a uniform spectrum and a rgb spectrum otherwise"). This is very difficult for the code mainainers and I think not very user friendly too. Moreover, when additional Indigo material types or medium options would be added, it would be increasingly difficult to add these in the exporter without breaking something. I choose a different approach that was already suggested in the code of the old exporter: the name of the material defines the type (diffuse, phong, specular). The settings of the material and medium can also be defined with strings: the names of the textures in the material. See further for the manual, which should make things more clear if this sounds mysterious.
Another feature of this new version is that you can export the material code to a Blender buffer and edit it in Blender. After editing it is possible to export your scene with this edited materials. This way you can store custom Indigo material settings within your Blender file and keep these for future exports.
I chose to create a page on the Blender wiki for hosting the script an a manual (under construction): http://wiki.blender.org/index.php/BlenderToIndigo
The current version of this script (2.43 at the time of this writing) is still beta and not thouroughly tested, but I invite you to test it.
Please reply in this thread if things don't work as expected, if things are unclear, if you have patches or other ideas. I'm happy to help.
(I should get some sleep now)