Hi, I am trying to find a way to enable and disable texture channels of a material on an object inside a game using python. However I can’t seem to yield anything straight forward from google. Does anyone know any good tutorials around? thank you very much.
Also Is there a way I can change the opacity of an entire object without having to go through every materials on it?
Thank you very much in advance and please excuse my lack of knowledge if I am not using the correct terms
Texture control through python is fairly limited. You could look at the videoTexture module, I’ve never used it so can’t help you there.
Opacity can be controlled through ipo curves, which in turn can be manipulated with python, and it might be possible to control texture channels the same way.
I think that you should be able to create ‘dummy’ textures in all of the other objects, and point those textures’ sources to the first object’s texture source. I think it would look like:
Sorry but would you be able to explain this to me please
I am guessing “dummytexture” is an attribute/property you assign to the object that is to be changed and it holds the reference to a texture, but as far as I am aware .source points to the image to be used for the texture, and I am not sure what logic.grouptexture really does…
Is there any way to declare a new material base on an existing one…?
I have tried every source and documentation that I can find on google but none of them actually helped my dilemma. But I have a feeling that it must be a technique that is somewhat common and people are using it all the time, not necessarily via the videoTexture module.
logic.grouptexture is the texture source from the first object. It might be best if I made a blend for this… By the way, an easy way to implement this might be to just make (Alt-D) instance duplicates of the first object - all other objects will share the mesh, so they should all share textures. Do you want to be able to select the texture on a case-by-case process, or do you just want all the ‘secondary’ objects to share the same texture as the first, ‘base’ object?
Ooh… Well, you’ll have to separate the materials for each individual object - since they all share materials (and so all share images), changing one will (naturally) change them all.
EDIT: So, you should create a new material (and a new image) for each object.