[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [945] trunk/py/scripts/addons: updates to blender rna api
Campbell Barton
ideasman42 at gmail.com
Wed Aug 25 03:22:51 CEST 2010
Revision: 945
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-extensions&revision=945
Author: campbellbarton
Date: 2010-08-25 03:22:50 +0200 (Wed, 25 Aug 2010)
Log Message:
-----------
updates to blender rna api
Modified Paths:
--------------
trunk/py/scripts/addons/io_import_images_as_planes.py
trunk/py/scripts/addons/io_import_scene_mhx.py
trunk/py/scripts/addons/object_cloud_gen.py
trunk/py/scripts/addons/space_view3d_materials_utils.py
Modified: trunk/py/scripts/addons/io_import_images_as_planes.py
===================================================================
--- trunk/py/scripts/addons/io_import_images_as_planes.py 2010-08-24 16:51:47 UTC (rev 944)
+++ trunk/py/scripts/addons/io_import_images_as_planes.py 2010-08-25 01:22:50 UTC (rev 945)
@@ -250,9 +250,7 @@
# ... 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
Modified: trunk/py/scripts/addons/io_import_scene_mhx.py
===================================================================
--- trunk/py/scripts/addons/io_import_scene_mhx.py 2010-08-24 16:51:47 UTC (rev 944)
+++ trunk/py/scripts/addons/io_import_scene_mhx.py 2010-08-25 01:22:50 UTC (rev 945)
@@ -779,11 +779,7 @@
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:
Modified: trunk/py/scripts/addons/object_cloud_gen.py
===================================================================
--- trunk/py/scripts/addons/object_cloud_gen.py 2010-08-24 16:51:47 UTC (rev 944)
+++ trunk/py/scripts/addons/object_cloud_gen.py 2010-08-25 01:22:50 UTC (rev 945)
@@ -461,7 +461,7 @@
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 @@
# 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 @@
#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'
Modified: trunk/py/scripts/addons/space_view3d_materials_utils.py
===================================================================
--- trunk/py/scripts/addons/space_view3d_materials_utils.py 2010-08-24 16:51:47 UTC (rev 944)
+++ trunk/py/scripts/addons/space_view3d_materials_utils.py 2010-08-25 01:22:50 UTC (rev 945)
@@ -398,25 +398,23 @@
#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
+ tex = bpy.data.textures.get(img.name)
- #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')
-
+ 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
More information about the Bf-extensions-cvs
mailing list