Hi,
I am quit a newby in Blender and also in python scripting. I find the function in blender “Remove double” very usefull and powerfull when I import 3d files in Blender.
My problem is that there is no tool to change/replace material and proceed some operations on a selection of meshes.
I wrote a small script to change the material but it it wont remove the old material from the mesh and I am searching the functrion/object call to access the “remove Double” (WKEY 5) functionnality.
Is it any one that had done such a script? ( I actually work with the Blender 2.36 )
#python script
import Blender
from Blender import *
from Blender.Draw import *
from Blender.BGL import *
mat=[]
mat_name=“Verre”
for O in Blender.Object.GetSelected():
mes = O.getData()
#print “—%s”%(mes.materials[0].name)
mat=[]
if mes is not None:
for mt in mes.materials:
print “—%s”%(mt.name)
del mt
O.setMaterials([])
mat.append( Blender.Material.Get(mat_name) )
O.setMaterials(mat)
#print mat[0].name
print "---%s"%(mes.name) # this should be empty
mes.materials.append(Blender.Material.Get(mat_name))
print "---%s"%(mes.materials[0].name)
mes.update
#python script
Thanks in advance