From 173d775fc8fc8dab35f912d0ae393a82038c5cc4 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 2 Jan 2012 09:50:07 +0000 Subject: formatting edits only --- io_scene_3ds/import_3ds.py | 83 +++++++++++++++++++++++----------------------- 1 file changed, 41 insertions(+), 42 deletions(-) (limited to 'io_scene_3ds') diff --git a/io_scene_3ds/import_3ds.py b/io_scene_3ds/import_3ds.py index 2947ec11..7c590230 100644 --- a/io_scene_3ds/import_3ds.py +++ b/io_scene_3ds/import_3ds.py @@ -365,7 +365,7 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH): #print 'MAT_TEXTURE_MAP..while', new_chunk.bytes_read, new_chunk.length read_chunk(file, temp_chunk) - if (temp_chunk.ID == MAT_MAP_FILEPATH): + if temp_chunk.ID == MAT_MAP_FILEPATH: texture_name, read_str_len = read_string(file) img = TEXTURE_DICT[contextMaterial.name] = load_image(texture_name, dirname) new_chunk.bytes_read += read_str_len # plus one for the null character that gets removed @@ -389,8 +389,8 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH): read_chunk(file, new_chunk) #is it a Version chunk? - if (new_chunk.ID == VERSION): - #print 'if (new_chunk.ID == VERSION):' + if new_chunk.ID == VERSION: + #print 'if new_chunk.ID == VERSION:' #print 'found a VERSION chunk' #read in the version of the file #it's an unsigned short (H) @@ -398,12 +398,12 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH): version = struct.unpack(' 3): + if version > 3: print('\tNon-Fatal Error: Version greater than 3, may not load correctly: ', version) #is it an object info chunk? - elif (new_chunk.ID == OBJECTINFO): - #print 'elif (new_chunk.ID == OBJECTINFO):' + elif new_chunk.ID == OBJECTINFO: + #print 'elif new_chunk.ID == OBJECTINFO:' # print 'found an OBJECTINFO chunk' process_next_chunk(file, new_chunk, importedObjects, IMAGE_SEARCH) @@ -411,7 +411,7 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH): new_chunk.bytes_read += temp_chunk.bytes_read #is it an object chunk? - elif (new_chunk.ID == OBJECT): + elif new_chunk.ID == OBJECT: if CreateBlenderObject: putContextMesh(contextMesh_vertls, contextMesh_facels, contextMeshMaterials) @@ -431,15 +431,15 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH): new_chunk.bytes_read += read_str_len #is it a material chunk? - elif (new_chunk.ID == MATERIAL): + elif new_chunk.ID == MATERIAL: # print("read material") - #print 'elif (new_chunk.ID == MATERIAL):' + #print 'elif new_chunk.ID == MATERIAL:' contextMaterial = bpy.data.materials.new('Material') - elif (new_chunk.ID == MAT_NAME): - #print 'elif (new_chunk.ID == MAT_NAME):' + elif new_chunk.ID == MAT_NAME: + #print 'elif new_chunk.ID == MAT_NAME:' material_name, read_str_len = read_string(file) # print("material name", material_name) @@ -450,15 +450,15 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH): contextMaterial.name = material_name.rstrip() # remove trailing whitespace MATDICT[material_name] = contextMaterial - elif (new_chunk.ID == MAT_AMBIENT): - #print 'elif (new_chunk.ID == MAT_AMBIENT):' + elif new_chunk.ID == MAT_AMBIENT: + #print 'elif new_chunk.ID == MAT_AMBIENT:' read_chunk(file, temp_chunk) - if (temp_chunk.ID == MAT_FLOAT_COLOR): + if temp_chunk.ID == MAT_FLOAT_COLOR: contextMaterial.mirror_color = read_float_color(temp_chunk) # temp_data = file.read(struct.calcsize('3f')) # temp_chunk.bytes_read += 12 # contextMaterial.mirCol = [float(col) for col in struct.unpack('<3f', temp_data)] - elif (temp_chunk.ID == MAT_24BIT_COLOR): + elif temp_chunk.ID == MAT_24BIT_COLOR: contextMaterial.mirror_color = read_byte_color(temp_chunk) # temp_data = file.read(struct.calcsize('3B')) # temp_chunk.bytes_read += 3 @@ -467,15 +467,15 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH): skip_to_end(file, temp_chunk) new_chunk.bytes_read += temp_chunk.bytes_read - elif (new_chunk.ID == MAT_DIFFUSE): - #print 'elif (new_chunk.ID == MAT_DIFFUSE):' + elif new_chunk.ID == MAT_DIFFUSE: + #print 'elif new_chunk.ID == MAT_DIFFUSE:' read_chunk(file, temp_chunk) - if (temp_chunk.ID == MAT_FLOAT_COLOR): + if temp_chunk.ID == MAT_FLOAT_COLOR: contextMaterial.diffuse_color = read_float_color(temp_chunk) # temp_data = file.read(struct.calcsize('3f')) # temp_chunk.bytes_read += 12 # contextMaterial.rgbCol = [float(col) for col in struct.unpack('<3f', temp_data)] - elif (temp_chunk.ID == MAT_24BIT_COLOR): + elif temp_chunk.ID == MAT_24BIT_COLOR: contextMaterial.diffuse_color = read_byte_color(temp_chunk) # temp_data = file.read(struct.calcsize('3B')) # temp_chunk.bytes_read += 3 @@ -487,15 +487,15 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH): new_chunk.bytes_read += temp_chunk.bytes_read - elif (new_chunk.ID == MAT_SPECULAR): - #print 'elif (new_chunk.ID == MAT_SPECULAR):' + elif new_chunk.ID == MAT_SPECULAR: + #print 'elif new_chunk.ID == MAT_SPECULAR:' read_chunk(file, temp_chunk) - if (temp_chunk.ID == MAT_FLOAT_COLOR): + if temp_chunk.ID == MAT_FLOAT_COLOR: contextMaterial.specular_color = read_float_color(temp_chunk) # temp_data = file.read(struct.calcsize('3f')) # temp_chunk.bytes_read += 12 # contextMaterial.mirCol = [float(col) for col in struct.unpack('<3f', temp_data)] - elif (temp_chunk.ID == MAT_24BIT_COLOR): + elif temp_chunk.ID == MAT_24BIT_COLOR: contextMaterial.specular_color = read_byte_color(temp_chunk) # temp_data = file.read(struct.calcsize('3B')) # temp_chunk.bytes_read += 3 @@ -504,20 +504,20 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH): skip_to_end(file, temp_chunk) new_chunk.bytes_read += temp_chunk.bytes_read - elif (new_chunk.ID == MAT_TEXTURE_MAP): + elif new_chunk.ID == MAT_TEXTURE_MAP: read_texture(new_chunk, temp_chunk, "Diffuse", "COLOR") - elif (new_chunk.ID == MAT_SPECULAR_MAP): + elif new_chunk.ID == MAT_SPECULAR_MAP: read_texture(new_chunk, temp_chunk, "Specular", "SPECULARITY") - elif (new_chunk.ID == MAT_OPACITY_MAP): + elif new_chunk.ID == MAT_OPACITY_MAP: read_texture(new_chunk, temp_chunk, "Opacity", "ALPHA") - elif (new_chunk.ID == MAT_BUMP_MAP): + elif new_chunk.ID == MAT_BUMP_MAP: read_texture(new_chunk, temp_chunk, "Bump", "NORMAL") - elif (new_chunk.ID == MAT_TRANSPARENCY): - #print 'elif (new_chunk.ID == MAT_TRANSPARENCY):' + elif new_chunk.ID == MAT_TRANSPARENCY: + #print 'elif new_chunk.ID == MAT_TRANSPARENCY:' read_chunk(file, temp_chunk) temp_data = file.read(STRUCT_SIZE_UNSIGNED_SHORT) @@ -525,7 +525,7 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH): contextMaterial.alpha = 1 - (float(struct.unpack('