Posted By

volvis on 08/19/10


Tagged

Material papervision pv3d dae


Versions (?)

Replace materials from DAE scene


 / Published in: ActionScript 3
 

Replacing materials in a DAE instance can be a real pain in the ass. This function iterates the children of a DAE instance and assigns materials by node name from MaterialsList.

  1. private function rebuildColladaMaterials(d:DisplayObject3D, matList:MaterialsList):void {
  2. for each(var child:DisplayObject3D in d.children ) {
  3. if ( matList.materialsByName[DisplayObject3D(child.parent).name] != undefined ) {
  4. child.material = matList.materialsByName[DisplayObject3D(child.parent).name]
  5. }
  6. rebuildColladaMaterials(child, matList);
  7. }
  8. }

Report this snippet  

You need to login to post a comment.