diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-08-25 05:20:50 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-08-25 05:20:50 +0400 |
commit | c09ed7769715932df9294ab38e7a03de4fcdf471 (patch) | |
tree | 3010ec7d1e10d37e98b51433462a2f4c7622f34d /release/scripts/io | |
parent | 6b45d94c9965daecda970322548c550b7f2ef3c0 (diff) |
bugfix/aviodance for [#23488] bpy.types.Texture.type donĀ“t update the parameters of texture
bpy.data.textures.new() now has a type argument since changing the type after forces the hacky use of recast_type().
Diffstat (limited to 'release/scripts/io')
-rw-r--r-- | release/scripts/io/import_scene_3ds.py | 9 | ||||
-rw-r--r-- | release/scripts/io/import_scene_obj.py | 11 |
2 files changed, 6 insertions, 14 deletions
diff --git a/release/scripts/io/import_scene_3ds.py b/release/scripts/io/import_scene_3ds.py index f956f29b0e7..95da2637ed5 100644 --- a/release/scripts/io/import_scene_3ds.py +++ b/release/scripts/io/import_scene_3ds.py @@ -266,12 +266,10 @@ def read_string(file): s += struct.unpack('<c', file.read(1))[0] #print 'string: ',s + #remove the null character from the string s = str(s[:-1], 'ASCII') # print("read string", s) - - #remove the null character from the string return s -# return s[:-1] ###################################################### # IMPORT @@ -300,7 +298,6 @@ def add_texture_to_material(image, texture, material, mapto): if image: texture.image = image -# if image: texture.setImage(image) # double check its an image. material.add_texture(texture, "UV", mapto) @@ -414,9 +411,7 @@ 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.textures.new(name) - new_texture.type = 'IMAGE' - new_texture = new_texture.recast_type() + new_texture = bpy.data.textures.new(name, type='IMAGE') 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 f20652a6b0a..17ac4c5dee6 100644 --- a/release/scripts/io/import_scene_obj.py +++ b/release/scripts/io/import_scene_obj.py @@ -356,18 +356,15 @@ def create_materials(filepath, material_libs, unique_materials, unique_material_ #==================================================================================# def load_material_image(blender_material, context_material_name, imagepath, 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') + texture= bpy.data.textures.new(name=type, type='IMAGE') # Absolute path - c:\.. etc would work here - image= obj_image_load(imagepath, DIR, IMAGE_SEARCH) - has_data = image.has_data if image else False + image = obj_image_load(imagepath, DIR, IMAGE_SEARCH) + has_data = False if image: texture.image = image + has_data = image.has_data # Adds textures for materials (rendering) if type == 'Kd': |