[Bf-committers] Split Collada into a python frontend and a C++ backend

Gaia gaia.clary at machinimatrix.org
Sun May 20 15:45:57 CEST 2012


On 20.05.2012 14:37, Brecht Van Lommel wrote:
> I don't think it's a good idea to do this.
Is there any good reason to have the Collada User interface implemented
in C++ instead of separating it out to a Python ADDON ? The only reason
i can think of is "its working, why change it ?" ...

The benefit of having the user interface separated would be that
the Collada io behaves more like all other exporters do... (can be 
enabled/disabled
from user preferences for example)

> If you want to add more
> exporting features, having this done partially in python and partially
> in C is going to make things quite complicated, it's going to lead to
> code duplication and some quite complex interaction between the python
> and C exporter code.

I do not want to add new (standard) features in Python. In fact i would 
like to
keep working on the existing implementation and help making it more
feature complete over the time.

The "extra care" should be very target specific and just something that sits
in between the user's decision to export the selected object(s),
and the technical export to Collada. Having this sorted out into a target
specific addon seems to be an easy way to achieve that "extra care"
without need to deal with it in the center of the Collada exporter.
> Simply feeding the mesh objects to the collada exporter might seem
> simple but I don't think it is, because they are also tied to objects.
> You'd need to shuffle around mesh datablocks, adjust modifiers, take
> selection into account, etc to make it all work together.
Again, the goal is NOT to provide features for "implementing" my own
Collada exporter. Its just an idea to allow dealing with very target 
specific issues
without needing to re implement the entire Collada exporter.

BTW: For Mesh objects the Geometry_exporter only works on the Mesh data.
So that's why i came to the idea to provide a Mesh export option. Of course
there are other ways to deal with this right now already. I just thought 
about
convenience here. If providing this access is too complex, then lets forget
about that part.

Gaia

> Brecht.
>
> On Sun, May 20, 2012 at 12:47 PM, Gaia<gaia.clary at machinimatrix.org>  wrote:
>> Hi.
>>
>> I'd like to propose and offer the implementation of a simple change
>> to the Collada module:
>>
>> * I want to replace the user interface of the Collada module by a
>> python based io addon and then simply call the internal Collada
>> module from that addon. (I have this addon already finished)
>>
>> This allow us to enable/disable Collada like all other io modules.
>>
>> * I want to add the ability to export a collection of Mesh instances
>> for special purposes like:
>>
>> - add target specific checks
>> - modify objects to satisfy constraints of the target system
>>
>> ===================================
>> The implementation is straight forward:
>> ===================================
>>
>> - Make the existing COLLADA entries invisible
>>
>>    I can get them out of the way by removing these lines from
>>    wm:operators.c
>>
>>    #ifdef WITH_COLLADA
>>        /* XXX: move these */
>>        WM_operatortype_append(WM_OT_collada_export);
>>        WM_operatortype_append(WM_OT_collada_import);
>>     #endif
>>
>>    My problem here: When i remove these lines, then i no longer
>>    know how i can access the Collada Importer/Exporter
>>    from a Python script since the operators are no longer available.
>>
>> - Create the python based "Blender Collada" addon
>>
>>    Just for the GUI. The addon does nothing else (at the moment)
>>    than calling the Blender importer/exporter (works for me as long
>>    as the "official" Collada exporter is also available, see above)
>>
>> - auto enable the "Blender Collada" addon
>>
>>    I think this is just done by modifying the default start blend file ?
>>
>> - Also allow to export Mesh instances instead of Objects:
>>
>>       Mesh new_mesh = object.to_mesh()
>>       # manipulate the new_mesh
>>       export it to collada (here we need an access function which
>>       allows to feed the collada exporter with Mesh objects from python )
>>
>> ========
>>
>> I would only need some help when it comes to defining the
>> access functions from Python to the internal Collada module.
>> I can do all the rest by myself.
>>
>> Opinions ?
>>
>> thanks,
>> Gaia
>> _______________________________________________
>> Bf-committers mailing list
>> Bf-committers at blender.org
>> http://lists.blender.org/mailman/listinfo/bf-committers
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers



More information about the Bf-committers mailing list