Simple prob I hope. I am simply just trying to change the material applied on one box to another using the setMaterialName();
I have 2 Boxes in my scene. I try to change the left box to use the right boxes Material but it always goes white and the error log always says that the material does not exsist. But it does as the right box is using it in the first place. I have checked that the name is correct. When changing the material to an already created entity is there anything you have to do for it to take effect?
Here is a pic. Trying to chnge 1 sub entity to the Box 2 material
And just to be completely exact. Here is the simple Material file beeing used. Know to OGRE as it uses them to begin with during loading.
If you only change the colours, you can:
1. Get the pointer to a specific material, using the MaterialManager and the getByName ("Box2");
2. Get the pass using Pass* pass = material->getTechnique(0)->getPass(0);
3. Set colours, i.e. pass-setAmbient()...
Thanks but that is just a simple test case. I will need it to support changing an actuall material file. The only thing I can think of is that when loading a .scene file it has put the relative paths out. So the paths that i have set up in the resources.cfg file are no longer correct and OGRE cannot find the Material anymore. I dunno it has to be somthing simple but its driving me nuts
Ok with a little more testing I have found that if I am changing my entity to use a material that contains a Texture then it works fine.
But if I try to change it to any material that is simply using the colour techniqe as above it doesnt work and Ogre always complains that it cant find the material. Anyone got any thoughts?
HA HA HA HA HA I Knew it had to be something simple.
Getting the name from the CEGUI edit box would always return one piece of WhiteSpace on the end of my string. So instead of looking for
"Box2" It was looking for "Box2 " <-- Space at end. That nasty little whitespace you kinda dont notice when your logging it out