Hello ben, i tried your code, but iç'm a big noob, so i dont find the way to use it, also i'm working only with colormaterial... But i find a way to do what i'm looking for by creating group in sketchup and set name of service on them. This work fine. thanks for your help.
On 11 juil, 16:41, Away3D <[email protected]> wrote: > Thanks Ben for your work > i m hurry to try your code > for now i m in hollidays so i Will try this soon as i come back > i give you news in 1week > thank you again > > ps: for my name i dont know why is away3d...is this name when i repply > directly in Google group > > On Jul 10, 5:08 pm, ben <[email protected]> wrote: > > > Away3D (did you copyrighted this nickname???) > > > Your question was puzzling me, hope someone else will give you a > > better answer...), > > so I decide to create a method that make you access to a used > > bitmapMaterial from the name of the texture used, so you don't have to > > think about the name in sketchup: > > materialLibrary.getTextureByName(string):IMaterial; > > > - How to call: > > just when your collada loader is complete : > > > var surgeryMaterial:BitmapMaterial = (e.loader.handle as > > Object3D).materialLibrary.getTextureByName("surgery.jpg") as > > BitmapMaterial; > > > now you can concentrate on adding new mouse Event to that > > bitmapmaterial. > > > - How to implement : > > paste those few lines in your MaterialLibrary class : > > > public function getTextureByName(id:String):IMaterial > > { > > var materialName:Array =new Array(); > > var materialType:Array =new Array(); > > for each (_materialData in this) > > { > > > > materialName.push(_materialData.textureFileName); > > } > > for each (_materialData in this) > > { > > materialType.push(_materialData.material); > > } > > return materialType[materialName.indexOf(id)]; > > } > > > now you have access of the material imported from collada depending on > > the name of the picture file used. > > > before, if you wan't to have access to all the filename of texture in > > your imported collada scene, add this method in the same > > MaterialLibrary class : > > > public function getTextureFileNames():Array > > { > > var MaterialName:Array =new Array(); > > for each (_materialData in this) > > { > > > > MaterialName.push(_materialData.textureFileName); > > } > > return MaterialName; > > } > > > and call it. > > > Hope this is USEFULL !!
