Hello.
I try to activate / deactivate textures in my materials with python:
I have many images (3), each at a diferent resolution, and I want to have 3 different games, each one using a set of textures at a specific resolution.
(HDxxx.png for HD game, LDxxx for Low res game…
I do not know the syntax and cannot find it in the API
here is my code:
from Blender import Texture,Image,Material # pour pouvoir modifier l'interface blender
OptionTextures = 2
# 1 pour rendu 2 pour jeu en basse def, 3 pour jeu en moyenne def et 4 pour ju en haute def
Materiaux = Material.Get() # Obtient la liste de tous les materiaux de notre projet
print "Voici la liste des materiaux du Fort" # résultat sur console
for LeMateriau in Materiaux: # pour chaque materiau de la liste Materiaux
print LeMateriau
MesTextures = LeMateriau.getTextures() # obtient la liste des textures du materiau en cours
for TextureEnCours in MesTextures: # Pour chaque texture du materiau en cours
if TextureEnCours is not None: # Si une texture existe
if TextureEnCours.tex.type == Texture.Types.IMAGE: # et si c'est une image
if OptionTextures == 1:
print dir(TextureEnCours)
# switch des textures en HD Rendu
# fin boucle option 1
if OptionTextures == 2:
#print dir(TextureEnCours)
print TextureEnCours.tex
print dir(TextureEnCours.tex)
TextureEnCours.tex.weight1 = 0
# switch des textures en jeu basse def
# fin boucle option 2
if OptionTextures == 3:
print dir(TextureEnCours)
# switch des textures en jeu moyenne def
# fin boucle option 3
if OptionTextures == 4:
print dir(TextureEnCours)
# switch des textures en jeu haute def
# fin boucle option 4
print TextureEnCours.tex.image.filename # print nom de l'image
# fin boucle si c'est une image
#fin boucle si une texture existe
#fin boucle pour chaque texture
print "--------------------------------"
#fin boucle pour chaque materiau
If someone knows How to
(code would replace " # switch des textures lines")
the
print dir(TextureEnCours)
does not help a lot
Thanks in advance