diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-05-26 12:45:31 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-05-26 12:45:31 +0400 |
commit | 591821c92254b03a64113c077e258d50ff20cca5 (patch) | |
tree | 015c5371810437ff4e23443a994a67dd0bab9523 /io_scene_3ds/import_3ds.py | |
parent | de95cf99c641fed6c5aa7cb394ae71d4206b1638 (diff) |
added axis settings to 3ds import/export
Diffstat (limited to 'io_scene_3ds/import_3ds.py')
-rw-r--r-- | io_scene_3ds/import_3ds.py | 42 |
1 files changed, 32 insertions, 10 deletions
diff --git a/io_scene_3ds/import_3ds.py b/io_scene_3ds/import_3ds.py index d66ace47..f054033d 100644 --- a/io_scene_3ds/import_3ds.py +++ b/io_scene_3ds/import_3ds.py @@ -339,18 +339,12 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH): ob = bpy.data.objects.new(contextObName, bmesh) object_dictionary[contextObName] = ob SCN.objects.link(ob) - - ''' - if contextMatrix_tx: - ob.setMatrix(contextMatrix_tx) - ''' + importedObjects.append(ob) if contextMatrix_rot: ob.matrix_local = contextMatrix_rot object_matrix[ob] = contextMatrix_rot.copy() - importedObjects.append(ob) - #a spare chunk new_chunk = chunk() temp_chunk = chunk() @@ -667,6 +661,7 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH): if child is None: child = bpy.data.objects.new(object_name, None) # create an empty object SCN.objects.link(child) + importedObjects.append(child) object_list.append(child) object_parent.append(hierarchy) @@ -779,7 +774,12 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH): ob.data.transform(pivot_matrix) -def load_3ds(filepath, context, IMPORT_CONSTRAIN_BOUNDS=10.0, IMAGE_SEARCH=True, APPLY_MATRIX=True): +def load_3ds(filepath, + context, + IMPORT_CONSTRAIN_BOUNDS=10.0, + IMAGE_SEARCH=True, + APPLY_MATRIX=True, + global_matrix=None): global SCN # XXX @@ -838,6 +838,13 @@ def load_3ds(filepath, context, IMPORT_CONSTRAIN_BOUNDS=10.0, IMAGE_SEARCH=True, me = ob.data me.transform(ob.matrix_local.inverted()) + # print(importedObjects) + if global_matrix: + for ob in importedObjects: + if ob.parent is None: + ob.matrix_world = ob.matrix_world * global_matrix + + # Done DUMMYVERT """ if IMPORT_AS_INSTANCE: @@ -903,6 +910,21 @@ def load_3ds(filepath, context, IMPORT_CONSTRAIN_BOUNDS=10.0, IMAGE_SEARCH=True, file.close() -def load(operator, context, filepath="", constrain_size=0.0, use_image_search=True, use_apply_transform=True): - load_3ds(filepath, context, IMPORT_CONSTRAIN_BOUNDS=constrain_size, IMAGE_SEARCH=use_image_search, APPLY_MATRIX=use_apply_transform) +def load(operator, + context, + filepath="", + constrain_size=0.0, + use_image_search=True, + use_apply_transform=True, + global_matrix=None, + ): + + load_3ds(filepath, + context, + IMPORT_CONSTRAIN_BOUNDS=constrain_size, + IMAGE_SEARCH=use_image_search, + APPLY_MATRIX=use_apply_transform, + global_matrix=global_matrix, + ) + return {'FINISHED'} |