Collada to Prefab. Mesh name

Software: Prefab3D

John Brookes, Sr. Member
Posted: 12 November 2012 11:15 AM   Total Posts: 732

Shouldnt prefab use the node id name?

<node id=“TruckBody” name=“TruckBody” type=“NODE”>
      <matrix sid=“transform”>1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1</matrix>
      <instance_geometry url=”#TruckBodyShape”>

Its using TruckBodyShape instead of TruckBody for the name.

   

John Brookes, Sr. Member
Posted: 27 November 2012 11:51 AM   Total Posts: 732   [ # 1 ]

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 DAENodeparent ObjectContainer3D) : void
  {
   
if (node.type != "JOINT"{
    
if (node.instance_geometries.length>0)
    
{
    
// trace("Should be a mesh "+node.name)
     
processGeometries(nodeparent)
    

    
else if (node.instance_controllers.length >0)
    
{
     processControllers
(nodeparent); //? 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(containernode.id);
     if (
parentparent.addChild(container);
    
}

    
if (parent.numChildren 0)
    
parent parent.getChildAt(parent.numChildren 1)

   
}
   
for (var uint 0node.nodes.lengthi++)
   
{
    
    parseSceneGraph
(node.nodes[i]parent);
    
   
}
  } 
private function processGeometries(node DAENodecontainer ObjectC void
  {
   
var instance DAEInstanceGeometry;
   var 
daeGeometry DAEGeometry;
   var 
effects Vector.<DAEEffect>;
   var 
mesh Mesh;
   var 
geometry Geometry;
   var 
uintuint;

   for (
0node.instance_geometries.lengthi++) {
    instance 
node.instance_geometries[i];
    
daeGeometry _libGeometries[instance.url] as DAEGeometry;

    if (
daeGeometry && daeGeometry.mesh{
     geometry 
getGeometryByName(instance.url);
     
effects getMeshEffects(instance.bind_materialdaeGeometry.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 (0mesh.subMeshes.lengthj++) {
        mesh
.subMeshes[j].material effects[j].material;
       
}
      }
     mesh
.transform node.matrix;
      
container.addChild(mesh);
     
      
finalizeAsset(mesh);
     
}
    }
   }
  } 
   

John Brookes, Sr. Member
Posted: 28 November 2012 01:19 PM   Total Posts: 732   [ # 2 ]

To add another bit.
Why is the material added to submeshes?
Cant think how you would even get a subgeometry from dae

if (effects.length == geometry.subGeometries.length) {
    for (j = 0; j < mesh.subMeshes.length; j++) {
      mesh.subMeshes[j].material = effects[j].material;
    }
Doing that means I cant do
mymesh.material = newmaterial

shirley
mesh.material = effects[0].material

again works for me.

comment would be nice fab wink

   

Avatar
Fabrice Closier, Administrator
Posted: 28 November 2012 03:55 PM   Total Posts: 1265   [ # 3 ]

Multiple material support is something we’re looking at implementing for all the parsers. I can’t really answer you on the “why is the parser setting materials this way”, as it’s a descision that the original author made, probably he was thinking about multiple material support at the time…
On my part, I’ve only ported it and updated a few methods that were failing.
Personnaly I avoid this format, so can’t really see in dayly work what could be improved with it. You should post an issue on Github.

   

John Brookes, Sr. Member
Posted: 28 November 2012 05:45 PM   Total Posts: 732   [ # 4 ]

Cant say I want to use collada either but theres no way of getting stuff (multiple mesh/groups) from maya into Prefab to then finally get to awd.
Ive run out of ways to get to awd ever since the Maya awd plugin was updated/broken.

OBJ is worse than collada for what it supports and the opencollada plugin is far better in Maya than obj.

To add to that kronos are now working on opencollada for maya/max 2012/13

If those fixes above were in prefab then I would be a happy bunny.
Would be even happier if the Maya awd plugin worked.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X