Hello.
I Want to get the material of a node and manipulate it, but not with the reference returned with getMaterial, I think you will understand better with some sample code:
SMaterial *pointerMaterial;
SMaterial &nodeMaterial = node->getMaterial(0);
pointerMaterial = nodeMaterial;
//Now I want to modify the material but using pointerMaterial
pointerMaterial->Texture1 = ...
I thought that modifying pointerMaterial I could modify the node material also but it's not working. I know it is something with pointers and indirections but It's my weak point, so any help is apreciated, thank you.
SMaterial *myMaterial = new SMaterial();
myMaterial->Texture1 = myTexture;
SMaterial &nodeMaterial = node->getMaterial(0);
//now I want to replace nodeMaterial with myMaterial,
//this works in my code and node shows the new material
nodeMaterial = *myMaterial;
//But if I modify myMaterial, changes are not reflected in the
//node
myMaterial->Texture1 = anotherTexture;
//I want anotherTexture to be shown in the node but it's
//not working.
The first assignment copies all values from myMaterial to nodeMaterial. Thus, any changes to myMaterial will still be local to myMaterial. You have to change nodeMaterial all the time.