diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-01-17 23:06:34 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-01-17 23:06:34 +0300 |
commit | c7dfa96aeac0940b093efed9b818e0c0d3c9feba (patch) | |
tree | 23d24587f9c83a8d69315b44d47781cfcd5c7064 /release | |
parent | 55756719fbebf4ffdf0485de58532c73f84ecaac (diff) |
bugfix [#20639] BF25_SVN_25888 and below - OBJ and 3DS import fails
blender supports type changing for textures in a way that python doesnt.
add a new general function.
Example usage:
tex = bpy.data.textures.new("Foo")
tex.type = 'IMAGE'
tex = tex.recast_type()
Macro to give the number of users accounting for fake user.
ID_REAL_USERS(id)
Use this so you can remove a datablock if it has a fake users as well as apply transformations to it in the 3D view.
Move api function bpy.data.add_texture() --> bpy.data.textures.new()/remove()
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/io/import_scene_3ds.py | 3 | ||||
-rw-r--r-- | release/scripts/io/import_scene_obj.py | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/release/scripts/io/import_scene_3ds.py b/release/scripts/io/import_scene_3ds.py index ed94d133ccb..971d62d8e15 100644 --- a/release/scripts/io/import_scene_3ds.py +++ b/release/scripts/io/import_scene_3ds.py @@ -507,8 +507,9 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH): return [float(col)/255 for col in struct.unpack('<3B', temp_data)] # data [0,1,2] == rgb def read_texture(new_chunk, temp_chunk, name, mapto): - new_texture = bpy.data.add_texture('Diffuse') + new_texture = bpy.data.textures.new('Diffuse') new_texture.type = 'IMAGE' + new_texture = new_texture.recast_type() img = None while (new_chunk.bytes_read < new_chunk.length): diff --git a/release/scripts/io/import_scene_obj.py b/release/scripts/io/import_scene_obj.py index 5d2d475c7c6..c703a9789bf 100644 --- a/release/scripts/io/import_scene_obj.py +++ b/release/scripts/io/import_scene_obj.py @@ -367,8 +367,9 @@ def create_materials(filepath, material_libs, unique_materials, unique_material_ #==================================================================================# def load_material_image(blender_material, context_material_name, imagepath, type): - texture= bpy.data.add_texture(type) + texture= bpy.data.textures.new(type) texture.type= 'IMAGE' + texture = texture.recast_type() # Workaround for limitation in rna api. # texture= bpy.data.textures.new(type) # texture.setType('Image') |