Skip to content
Snippets Groups Projects
Commit a695741a authored by Campbell Barton's avatar Campbell Barton
Browse files

updates to blender rna api

parent 980d7fe3
No related branches found
No related tags found
No related merge requests found
......@@ -250,9 +250,7 @@ def getTexture(path, img):
# ... otherwise create a new one and apply mapping.
if not tex:
name = path.rpartition('\\')[2].rpartition('.')[0]
tex = bpy.data.textures.new(name=name)
tex.type = 'IMAGE'
tex = tex.recast_type()
tex = bpy.data.textures.new(name=name, type='IMAGE')
tex.image = img
return tex
......
......@@ -779,11 +779,7 @@ def parseTexture(args, tokens):
global todo
if verbosity > 2:
print( "Parsing texture %s" % args )
name = args[0]
tex = bpy.data.textures.new(name)
typ = args[1]
tex.type = typ
tex = tex.recast_type()
tex = bpy.data.textures.new(name=args[0], type=args[1])
loadedData['Texture'][name] = tex
for (key, val, sub) in tokens:
......
......@@ -461,7 +461,7 @@ class GenerateCloud(bpy.types.Operator):
bpy.ops.object.particle_system_add()
#Particle settings setting it up!
cloudParticles = cloud.active_particle_system
cloudParticles = cloud.particle_systems.active
cloudParticles.name = "CloudParticles"
cloudParticles.settings.frame_start = 0
cloudParticles.settings.frame_end = 0
......@@ -507,11 +507,10 @@ class GenerateCloud(bpy.types.Operator):
# Add a texture
vMaterialTextureSlots = cloudMaterial.texture_slots
cloudtex = main.textures.new("CloudTex")
cloudMaterial.add_texture(cloudtex, 'ORCO')
cloudtex.type = 'CLOUDS'
cloudtex = main.textures.new("CloudTex", type='CLOUDS')
cloudtex.noise_type = 'HARD_NOISE'
cloudtex.noise_scale = 2
cloudMaterial.add_texture(cloudtex, 'ORCO')
# Add a force field to the points.
cloudField = bounds.field
......@@ -528,10 +527,8 @@ class GenerateCloud(bpy.types.Operator):
#bpy.ops.ptcache.bake(bake=False)
# Add a Point Density texture
cloudPointDensity = main.textures.new("CloudPointDensity")
cloudPointDensity.type = 'POINT_DENSITY'
cloudMaterial.add_texture(cloudPointDensity, 'ORCO')
pDensity = vMaterialTextureSlots[1].texture
pDensity = main.textures.new("CloudPointDensity", 'POINT_DENSITY')
cloudMaterial.add_texture(pDensity, 'ORCO')
vMaterialTextureSlots[1].use_map_density = True
vMaterialTextureSlots[1].use_rgb_to_intensity = True
vMaterialTextureSlots[1].texture_coords = 'GLOBAL'
......
......@@ -398,25 +398,23 @@ def check_texture(img,mat):
#makes a texture if needed
#adds it to the material if it isn't there already
try:
tex = bpy.data.textures[img.name]
except:
tex = bpy.data.textures.new(name=img.name)
finally:
tex.type = 'IMAGE'
tex = tex.recast_type()
tex.image = img
#see if the material already uses this tex
#add it if needed
found = False
for m in mat.texture_slots:
if m and m.texture == tex:
found = True
break
if not found and mat:
mat.add_texture(tex, texture_coordinates='UV', map_to='COLOR')
tex = bpy.data.textures.get(img.name)
if tex is None:
tex = bpy.data.textures.new(name=img.name, type='IMAGE')
tex.image = img
#see if the material already uses this tex
#add it if needed
found = False
for m in mat.texture_slots:
if m and m.texture == tex:
found = True
break
if not found and mat:
mat.add_texture(tex, texture_coordinates='UV', map_to='COLOR')
def texface_to_mat():
# editmode check here!
editmode = False
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment