Hi.
I am new to Blender.
I foud a world map made in blender on the internet.
I want to be able to change color for all the countries in Europe.
In my blender file, in Outliner, you will see all the curves.
I renamed 2 curves ( 2 countries), and triend to change their collor.
A print screen:
Here is the code i am tring to use :
import bpy
def makeMaterial(name, diffuse, specular, alpha):
mat = bpy.data.materials.new(name)
mat.diffuse_color = diffuse
mat.diffuse_shader = ‘LAMBERT’
mat.diffuse_intensity = 1.0
mat.specular_color = specular
mat.specular_shader = ‘COOKTORR’
mat.specular_intensity = 0.5
mat.alpha = alpha
mat.ambient = 1
return mat
scene = bpy.context.scene
for ob in scene.objects:
if ob.type == ‘MESH’ and ob.name.startswith(“Last”):
ob.select = True
#if i write : print(ob.name), i will see in the console the name of the 2 curves.
print(ob.name)
def setMaterial(ob, mat):
me = ob.data
me.materials.append(mat)
red = makeMaterial( 'NewMat' ,(1,0,0), (1, 1, 1), 0.5)
setMaterial(ob, red)
Please give me a hint.
I also found a script :
import bpy
for item in bpy.data.materials:
#Enable “use_shadeless”
item.use_shadeless = True
#Set the material Emit value to 1
item.emit = 1
#Change diffuse color
item.diffuse_color = (1,0,1)
#Change diffuse shader to toon
item.diffuse_shader = 'TOON'
item.use_transparency = True
item.transparency_method = 'RAYTRACE'
but this changes the color for all my curves.
Can it be modified so it will change color for example, for all countries in North America?