Creighton, Gerry
2010-09-07 20:34:04 UTC
Anybody else having issues when changing materials with DAE files lately? I exported several from Sketchup 7 Pro and those DAEs and my DAE parsing code work great, however, that trial has since expired so I can no longer export kmz or dae files that work with PV3D DAE parsing. I sought older Mac Sketchup versions but no luck. I now have two 3D files that I need to export and their materials arent being replaced like my previous sample.
I can trace out the materials in the dae and have looked through the dae structure to get the material ids but can not replace those materials now.
Here is my function so you can see what Im doing, nothing special but it works with DAEs exported from Sketchup 7 Pro but not any other versions.
Any insight would be appreciated.
-Gerry
The following function is called each time a DAE file is loaded. I have an array of two DAE path strings to pull from.
var count:Number = 0;
private function setDAE(e:FileLoadEvent):void{
//
var daeModel:DisplayObject3D = e.target as DisplayObject3D;
var backDAE:DisplayObject3D = new DisplayObject3D();
var frontDAE:DisplayObject3D = new DisplayObject3D();
// color materials in 3D object
var whtMat:ColorMaterial = new ColorMaterial(0xEDEDED,.5);
var blkMat:ColorMaterial = new ColorMaterial(0x000000,1);
var redMat:ColorMaterial = new ColorMaterial(0x990000,.6);//color mat to use for testing to show dae layers
trace("/////////////////////////// count: +count+ | dae materials: \n"+daeModel.materials+"\n/////////////////////////// count:\n"+count);
if(count == 0){
/* Lid */
daeModel.replaceMaterialByName(whtMat,"ID5");
FrontDO = new DisplayObject3D();
FrontDO.addChild(daeModel);
count = count+1;
loadDAEFiles(count);
//
}else if(count == 1){
/* Tray */
if(packageType == "PKG120-00004"){
//black tray
daeModel.replaceMaterialByName(blkMat,"ID5");
}else{
//clear tray - should show traycard art on both sides
daeModel.replaceMaterialByName(redMat,"ID5");
}
BackDO = new DisplayObject3D();
BackDO.addChild(daeModel);
//There is a call here to another method that does some other things to load other assets then adds the FrontDO and BackDO to the stage.
}
}
I can trace out the materials in the dae and have looked through the dae structure to get the material ids but can not replace those materials now.
Here is my function so you can see what Im doing, nothing special but it works with DAEs exported from Sketchup 7 Pro but not any other versions.
Any insight would be appreciated.
-Gerry
The following function is called each time a DAE file is loaded. I have an array of two DAE path strings to pull from.
var count:Number = 0;
private function setDAE(e:FileLoadEvent):void{
//
var daeModel:DisplayObject3D = e.target as DisplayObject3D;
var backDAE:DisplayObject3D = new DisplayObject3D();
var frontDAE:DisplayObject3D = new DisplayObject3D();
// color materials in 3D object
var whtMat:ColorMaterial = new ColorMaterial(0xEDEDED,.5);
var blkMat:ColorMaterial = new ColorMaterial(0x000000,1);
var redMat:ColorMaterial = new ColorMaterial(0x990000,.6);//color mat to use for testing to show dae layers
trace("/////////////////////////// count: +count+ | dae materials: \n"+daeModel.materials+"\n/////////////////////////// count:\n"+count);
if(count == 0){
/* Lid */
daeModel.replaceMaterialByName(whtMat,"ID5");
FrontDO = new DisplayObject3D();
FrontDO.addChild(daeModel);
count = count+1;
loadDAEFiles(count);
//
}else if(count == 1){
/* Tray */
if(packageType == "PKG120-00004"){
//black tray
daeModel.replaceMaterialByName(blkMat,"ID5");
}else{
//clear tray - should show traycard art on both sides
daeModel.replaceMaterialByName(redMat,"ID5");
}
BackDO = new DisplayObject3D();
BackDO.addChild(daeModel);
//There is a call here to another method that does some other things to load other assets then adds the FrontDO and BackDO to the stage.
}
}