Hi
I try to make a small script for the alpha layer texture / image creation.
Script reads the selected object UV-texture name and creates 1:1 size and similar named alpha layer texture / image for it.
At the end the script would open the ‘Alpha-painting’ window for the alpha layer editing & render result viewing.
Microversion 0.000001
import Blender
from Blender import*
img = ''
sel = Object.GetSelected() #get selected object
if sel: #if we have an existing object
if sel[0].type=='Mesh': #and it is a mesh
me = sel[0].getData(mesh=True) #get the mesh dat
for f in me.faces:
try:
if f.image:
img = f.image.name
size = f.image.getSize()
break #
except ValueError:
pass
name = img[:img.find('.')]+'_a'+img[img.find('.'):] # create a name for the alpha texture image
timg = Texture.New(img[:img.find('.')]+'_a') # create a name for the alpha texture
timg.setType('Image')
limg = Image.Load(name)
timg.image = limg
mat = Material.Get('alpha') # pre made material name
mtextures = mat.setTexture(0,timg)
Problem
How I can do a needed ‘Map To’ settings for the texture from python? Marked with yellow color in linked picture:
http://www.warezhouze.1g.fi/kuvat/Blender_python/ALIT01.jpg/full
I have been reading the API docs about the Texture module and MTex class, but I really don’t know how to use it.
http://www.blender.org/documentation/244PythonDoc/Texture-module.html