PsychoBoy
Member
|
Material doesn't change after update
Hi all, so yesterday I updated engine (didn't doing this for about 2 months) and I've noticed that manually setting material for object no longer works:
Code:
Game::ObjParamsPtr obj = Game::Objs.ptrRequire(getModelName(model));
obj()->material(1, "some.mtrl"); //this code don't works anymore after update :/
I have no idea why, this code was always working until yesterday :/
But when I change material for mesh:
Code:
MaterialPtr mat = new Material();
mat->color = ColorHue(Random.f()).asVec4();
obj()->mesh()->setMaterial(mat);
It works fine, but I'm using the same mesh for many objects so i can't do it this way..please, help me guys
|
|
02-23-2012 03:52 PM |
|
TBJokers
Member
|
RE: Material doesn't change after update
What about, obj()->material()->base_0()->set("YOURIMAGE.GFX")
Man, it's always that semicolon...
|
|
02-23-2012 08:43 PM |
|
PsychoBoy
Member
|
RE: Material doesn't change after update
Code:
obj()->material(1, Materials("Mtrl/snow.mtrl")); //NOT WORKS
obj()->mesh()->setMaterial("Mtrl/snow.mtrl"); //WORKS but for all objects
obj()->material()->load("Mtrl/snow.gfx"); //NOT
obj()->material()->base_0->Import("Mtrl/snow.gfx"); //NOT
I just noticed that when I try to set newly generated mtrl in Object Editor it is highlighted as red and says:
"Material is not compatible with default mesh material, texture count or technique doesn't match!"
o.O
(This post was last modified: 02-24-2012 11:13 PM by PsychoBoy.)
|
|
02-24-2012 11:04 PM |
|
TBJokers
Member
|
RE: Material doesn't change after update
Well, i've worked with MaterialPtrs and such alot, and i think you could do something like this
Code:
MeshPtr Test;
MaterialPtr Try;
Test->setMaterial(Try);
Try->base_0()->load("PATH FOR YOUR GFX");
This code works 100%, though i'm not sure how your reference for the Object is, but you should be able to figure it out with this code.
Man, it's always that semicolon...
(This post was last modified: 02-25-2012 07:58 AM by TBJokers.)
|
|
02-25-2012 07:58 AM |
|