|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
DAE texture swapIs 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 |
|
|
Re: DAE texture swapI 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:
_______________________________________________ Papervision3D mailing list Papervision3D@... http://osflash.org/mailman/listinfo/papervision3d_osflash.org |
|
|
Re: DAE texture swapThat worked -- thanks, John! Jonathon From:
papervision3d-bounces@... [mailto:papervision3d-bounces@...] On
Behalf Of John Lindquist I usually do something like
this: 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 |
|
|
Re: DAE texture swapI have the same problem. I was able to change texture dynamically before Papervision 2.1, but now I can't. In papervision 2.0 half of my animation don't work. So I'm kinda stuck.
I tried this solution: child = dae.getChildByName("whatever", true); //true recurses through the dae to find that child child.material = new WhateverMaterial(); But it doesn't work; when I do this trace (dae.numchildren) it trace 0; Also in the trace panel I get this message INFO: DisplayObject3D: myModel and myModel is the displayObject I want to change the texture but I can't seem to be able to access it. Any thoughts? thank you
|
|
|
Re: DAE texture swapAloha,
child = dae.getChildByName("whatever", true); //true recurses through the dae to find that child Bit obvious but, did you change the "whatever" to the correct name ?:)
|
|
|
Re: DAE texture swapYah I did, I tried kinda every name I could find in the collada file, without succes my DAE object seems to have no children, is that normal?
|
| Free embeddable forum powered by Nabble | Forum Help |