Since in DAE only a matrix is stored per bone, some tricks have to be applied to build an armature from it:
- direction for "leaf" bones is hard-coded to Y vector. This will be changed to bone matrix orientation, somehow code will need to
derive the bone "forward" axis
- for "leaf" bones length cannot be determined, currently it is hard-coded (second screenshot), but I think changing it to the average
length of all non-leaf bones is ok
- parent bones get their tail at last child's head, this is not good (first screenshot). For bones with more than one child Chingiz
suggested not to link it with any child, I think it's a good idea. Length will be the same as for leaf bones.
Screenshots:
http://img232.imageshack.us/img232/8905/screenfhy.pnghttp://img406.imageshack.us/img406/3004/tobaggan.png
supported: phong and blinn all others are exported as <lambert>. Here is
the list of supported shader options: emission, ambient, diffuse,
specular, shininess, reflective, reflectivity, transparency, index of
refraction.
Turned off texture exporting - needs fixing.
* Objects are created and linked to meshes.
* Since I don't know how to import per-face normals, they are generated automatically by mesh_calc_normals.
* Objects are imported with transformations but without rotation yet.
* removed code duplication for object and material traversing
* removed geometry, material, image duplication in produced DAE
TODO:
* UVs export still needs fixing/improvments
* Material/texcoord binding is not done
<instance_material>. I used here more suitable Blender's api. Now exporter
exports all materials in the scene. Todo: if material has textures export them.
Spen't lots of time debugging the misbehaving COLLADASW::URI
constructor. The problem is although I pass correct parameters to it,
the resulting file ends up having empty url attributes. It is either a
bug in OpenCollada or my code - couldn't figure this out.
OpenCollada and pcre are added as 3rd party libraries collada module
depends on.
I now build Blender with:
scons BF_DEBUG=1 BF_OPENCOLLADA_LIBPATH=/home/chin/src/opencollada/ BF_OPENCOLLADA=/home/chin/src/opencollada
- setup SConscript, not sure about these values: libtype='core', priority=150
- only scons build on linux is set up
- not configured to link to OpenCollada yet