, Sr. Member
Been playin with the DAE Parser..
That also messes up mesh names and for some reason creates ObjectContainer3D for every mesh :o
If you replace these two functions in DAEParser I get whats expected from the scene heirachy in Maya
It also matches the scene heirachy when exporting an AWD2 (pre 4.0 version) from Maya
Not tested with animation but works for me with groups and mesh with children.
private function parseSceneGraph(node : DAENode, parent : ObjectContainer3D) : void
{
if (node.type != "JOINT") {
if (node.instance_geometries.length>0)
{
// trace("Should be a mesh "+node.name)
processGeometries(node, parent)
}
else if (node.instance_controllers.length >0)
{
processControllers(node, parent); //? no idea with animation
}
else
{
// trace("Should be a container " + node.id)
var container : ObjectContainer3D;
container = new ObjectContainer3D();
container.name = node.id;
container.transform = node.matrix;
finalizeAsset(container, node.id);
if (parent) parent.addChild(container);
}
if (parent.numChildren > 0)
parent = parent.getChildAt(parent.numChildren - 1)
}
for (var i : uint = 0; i < node.nodes.length; i++)
{
parseSceneGraph(node.nodes[i], parent);
}
}
private function processGeometries(node : DAENode, container : ObjectC : void
{
var instance : DAEInstanceGeometry;
var daeGeometry : DAEGeometry;
var effects : Vector.<DAEEffect>;
var mesh : Mesh;
var geometry : Geometry;
var i : uint, j : uint;
for (i = 0; i < node.instance_geometries.length; i++) {
instance = node.instance_geometries[i];
daeGeometry = _libGeometries[instance.url] as DAEGeometry;
if (daeGeometry && daeGeometry.mesh) {
geometry = getGeometryByName(instance.url);
effects = getMeshEffects(instance.bind_material, daeGeometry.mesh);
if (geometry) {
mesh = new Mesh(geometry);
//if (daeGeometry.meshName && daeGeometry.meshName != "")
//daeGeometry.meshName;
if (node.name != "")
mesh.name = node.name;
if (effects.length == geometry.subGeometries.length) {
for (j = 0; j < mesh.subMeshes.length; j++) {
mesh.subMeshes[j].material = effects[j].material;
}
}
mesh.transform = node.matrix;
container.addChild(mesh);
finalizeAsset(mesh);
}
}
}
}