diff --git a/release/scripts/io/import_scene_3ds.py b/release/scripts/io/import_scene_3ds.py index 971d62d8e15..7ba5010e1c8 100644 --- a/release/scripts/io/import_scene_3ds.py +++ b/release/scripts/io/import_scene_3ds.py @@ -146,41 +146,9 @@ from import_scene_obj import unpack_face_list, load_image import bpy import Mathutils -# import Blender -# from Blender import Mesh, Object, Material, Image, Texture, Lamp, Mathutils -# from Blender.Mathutils import Vector -# import BPyImage - -# import BPyMessages - -# try: -# from struct import calcsize, unpack -# except: -# calcsize= unpack= None - - - -# # If python version is less than 2.4, try to get set stuff from module -# try: -# set -# except: -# from sets import Set as set - BOUNDS_3DS = [] -#this script imports uvcoords as sticky vertex coords -#this parameter enables copying these to face uv coords -#which shold be more useful. - -def createBlenderTexture(material, name, image): - texture = bpy.data.textures.new(name) - texture.setType('Image') - texture.image = image - material.setTexture(0, texture, Texture.TexCo.UV, Texture.MapTo.COL) - - - ###################################################### # Data Structures ###################################################### @@ -294,11 +262,8 @@ def read_chunk(file, chunk): def read_string(file): #read in the characters till we get a null character s = b'' -# s = '' while not s.endswith(b'\x00'): -# while not s.endswith('\x00'): s += struct.unpack('mtex[slot]) { ma->mtex[slot]->tex->id.us--; } @@ -69,8 +69,9 @@ static void rna_Material_add_texture(Material *ma, Tex *tex, int mapto, int texc mtex= ma->mtex[slot]; mtex->tex= tex; - id_us_plus(&tex->id); - + if (tex) + id_us_plus(&tex->id); + mtex->texco= mapto; mtex->mapto= texco; } @@ -117,7 +118,8 @@ void RNA_api_material(StructRNA *srna) func= RNA_def_function(srna, "add_texture", "rna_Material_add_texture"); RNA_def_function_ui_description(func, "Add a texture to material's free texture slot."); - parm= RNA_def_pointer(func, "texture", "Texture", "", "Texture to add."); + parm= RNA_def_pointer(func, "texture", "Texture", "Texture", "Texture to add."); + RNA_def_property_flag(parm, PROP_REQUIRED); parm= RNA_def_enum(func, "texture_coordinates", prop_texture_coordinates_items, TEXCO_UV, "", "Source of texture coordinate information."); /* optional */ parm= RNA_def_enum(func, "map_to", prop_texture_mapto_items, MAP_COL, "", "Controls which material property the texture affects."); /* optional */ }