« Return to Thread: DAE texture swap

Re: DAE texture swap

by Jonathon Stierman-2 :: Rate this Message:

Reply to Author | View in Thread

Some parts of this message have been removed. Learn more about Nabble's security policy.

That worked -- thanks, John!

 

Jonathon

 

 

From: papervision3d-bounces@... [mailto:papervision3d-bounces@...] On Behalf Of John Lindquist
Sent: Tuesday, July 07, 2009 12:45 PM
To: papervision3d@...
Subject: Re: [Papervision3D] DAE texture swap

 

I usually do something like this:

child = dae.getChildByName("whatever", true); //true recurses through the dae to find that child
child.material = new WhateverMaterial();


On Tue, Jul 7, 2009 at 11:26 AM, Jonathon Stierman <jonathon@...> wrote:

Is it possible to dynamically change the texture on a DAE instance? 

 

I’ve tried updating the materials MaterialList:

 

var texture:Bitmap = new LaptopTexture() as Bitmap;

                  var newMaterialList:MaterialsList = new MaterialsList();

                  newMaterialList.addMaterial(new BitmapMaterial(texture.bitmapData, true));

                  myDAE.materials = newMaterialList;

 

I also tried re-loading the DAE, and supplying my own materials list:

 

                  var texture:Bitmap = new LaptopTexture() as Bitmap;

                  var newMaterialList:MaterialsList = new MaterialsList();

                  newMaterialList.addMaterial(new BitmapMaterial(texture.bitmapData, true));

                  myDAE.load(new DaeModelData(), newMaterialList, true);

 

And also tried working through the SkinController:

 

var texture:Bitmap = new LaptopTexture() as Bitmap;

                  var newMaterialList:MaterialsList = new MaterialsList();

                  newMaterialList.addMaterial(new BitmapMaterial(texture.bitmapData, true));

 

                  var myControllers:Array = myDAE.controllers;

                  var i:int;

                  var loopUntil:int = myControllers.length;

                  var skinController:SkinController

                  for(i=0; i<loopUntil; i++)

                  {

                        if (myControllers[i] is SkinController)

                        {

                              skinController = myControllers[i];

                              skinController.target.materials = newMaterialList;

                              skinController.update();

                        }

                  }

 

Am I going about this completely wrong?

 

Jonathon


_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org

 


_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org

 « Return to Thread: DAE texture swap