Page MenuHome

Collada export-side patch
Closed, ArchivedPublicPATCH

Description

Hi,

I'm attaching the transform/animation export-side patch, small changes since in general the code and the files exported seemed ok. Issues with export in this area are mainly what to do with baking animation if/when necessary (+tweening existing matrix outputs), bone parenting, single matrix option for completeness and probably a bunch of other stuff which usually crops up when something gets fixed. Importing is restricted by possible skew in transforms, arbitrary rest pose matrices and made more difficult by skinning joints not having to be related to each other.

- (#27598) Adds the Second Life- compatibility for armatures (UI/pyapi), alters restpose by removing rotation vs armature (as before, it also changes the collada animation to match this change so the file should be compatible with other collada-viewers). SL uses BVH and apparently a custom .anim format for animation so this is a compatibility mode because we're exporting to accommodate SL (could still be the default of course).

For skinning the original rotation is irrelevant, but if the restpose is not tampered with blender could export bone transforms as tail + rest rotation followed by the pose channel? (loc/rot/scale) Small bonus is that this would allow use of original curves in animation exports -> better quality since the curves can carry original interpolation information.

- Adds objects parentinverse to exported transform if it's non-identity; probably affects #29196 though haven't yet tested this, have to try it later. Also allows use of original curves in exported animation.

- ArmatureExporter.cpp: line 224, when a bone without a parent is exported it was being multiplied by the armatures obmat, I think this is incorrect since the bone will be the parent's child node in collada.

- ArmatureExporter.cpp: line 344, mistmatch between add_inv_bind_mats vs add_joints_source "accessor counts". (Unlikely, but) possibly related to #29465 claim that the file there does not import correctly to 3ds Max.

Event Timeline

I would like to see this patch committed. I propose to make a small change as follows>:

1.) Make the "Second Life" behaviour the default case (as it is comparable to what Blender 2.49 does.

2.) Change the switch name form "Second Life" to something like "global_rot90" and disable that switch by default.
When this switch is enabled then blender behaves like in 2.61 (regarding the rotation)

I believe that having this patch applied to Blender will get a very positive response.

Hi,

Is there another software which requires the compatibility-mode as it is and does the patch work? If so, I think the name should be something in the lines of "compatibility mode" and just have it on by default. To be honest haven't had much time for testing or thinking about this, I'll try and see if I can get a trial version of 3ds Max or something at the start of the week to get some idea how good the competition is at collada.

I don't mind this being committed by someone else, one thing less/more to worry about for the near future :)

Domino Marama (domino) changed the task status from Unknown Status to Unknown Status.Feb 5 2012, 5:53 PM

Congratulations! Your patch has been committed to the official
Blender SVN Tree!

I'm currently trying to change/fix bone parenting in the COLLADA export based on your changes. Imaging this scenario:

+ Armature
+ Bone 1
+ Bone 2
+ ...
+ Human Body (Object w/ mesh)
+ Ring (Object w/ mesh)


- The body mesh is controlled by the armature, so nothing special
- The Ring object is independent of the mesh deformation but should be attached to a finger bone (ie Bone 2)

If I attach it to the bone it get's partype=PAR_BONE.

I would expect the following COLLADA then:

<node sid="Armature">
<matrix/>
<node sid="Bone 1" type="JOINT">
<matrix/>
<node sid="Bone 2" type="JOINT">
<matrix/>
<node sid="Ring"> <-- object attached to bone
<loc+rot+scale...>
</node>
...
</node> <-- end of bone 1
<node sid="Human"> <- skinned object w/ armature as parent
<loc rot scale/>
...
</node>

I hacked that yesterday evening (moving all bone-parent nodes into the armature) but got a strange offset (looks like bone orient+length) for all parented objects. I'm going to provide it as a patch incl. test data in a few days.