1 # SPDX-License-Identifier: GPL-2.0-or-later
3 from bpy_extras
.io_utils
import (
9 from bpy
.props
import (
17 "name": "Autodesk 3DS format",
18 "author": "Bob Holcomb, Campbell Barton, Andreas Atteneder, Sebastian Schrand",
21 "location": "File > Import",
22 "description": "3DS Import/Export meshes, UVs, materials, textures, "
24 "warning": "Images must be in file folder, "
25 "filenames are limited to DOS 8.3 format",
26 "doc_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"
27 "Scripts/Import-Export/Autodesk_3DS",
28 "category": "Import-Export",
33 if "import_3ds" in locals():
34 importlib
.reload(import_3ds
)
35 if "export_3ds" in locals():
36 importlib
.reload(export_3ds
)
39 @orientation_helper(axis_forward
='Y', axis_up
='Z')
40 class Import3DS(bpy
.types
.Operator
, ImportHelper
):
41 """Import from 3DS file format (.3ds)"""
42 bl_idname
= "import_scene.autodesk_3ds"
43 bl_label
= 'Import 3DS'
47 filter_glob
: StringProperty(default
="*.3ds", options
={'HIDDEN'})
49 constrain_size
: FloatProperty(
50 name
="Size Constraint",
51 description
="Scale the model by 10 until it reaches the "
52 "size constraint (0 to disable)",
54 soft_min
=0.0, soft_max
=1000.0,
57 use_image_search
: BoolProperty(
59 description
="Search subdirectories for any associated images "
60 "(Warning, may be slow)",
63 use_apply_transform
: BoolProperty(
64 name
="Apply Transform",
65 description
="Workaround for object transformations "
66 "importing incorrectly",
69 read_keyframe
: bpy
.props
.BoolProperty(
71 description
="Read the keyframe data",
74 use_world_matrix
: bpy
.props
.BoolProperty(
76 description
="Transform to matrix world",
80 def execute(self
, context
):
81 from . import import_3ds
83 keywords
= self
.as_keywords(ignore
=("axis_forward",
88 global_matrix
= axis_conversion(from_forward
=self
.axis_forward
,
91 keywords
["global_matrix"] = global_matrix
93 return import_3ds
.load(self
, context
, **keywords
)
96 @orientation_helper(axis_forward
='Y', axis_up
='Z')
97 class Export3DS(bpy
.types
.Operator
, ExportHelper
):
98 """Export to 3DS file format (.3ds)"""
99 bl_idname
= "export_scene.autodesk_3ds"
100 bl_label
= 'Export 3DS'
102 filename_ext
= ".3ds"
103 filter_glob
: StringProperty(
108 use_selection
: BoolProperty(
109 name
="Selection Only",
110 description
="Export selected objects only",
114 def execute(self
, context
):
115 from . import export_3ds
117 keywords
= self
.as_keywords(ignore
=("axis_forward",
122 global_matrix
= axis_conversion(to_forward
=self
.axis_forward
,
125 keywords
["global_matrix"] = global_matrix
127 return export_3ds
.save(self
, context
, **keywords
)
131 def menu_func_export(self
, context
):
132 self
.layout
.operator(Export3DS
.bl_idname
, text
="3D Studio (.3ds)")
135 def menu_func_import(self
, context
):
136 self
.layout
.operator(Import3DS
.bl_idname
, text
="3D Studio (.3ds)")
140 bpy
.utils
.register_class(Import3DS
)
141 bpy
.utils
.register_class(Export3DS
)
143 bpy
.types
.TOPBAR_MT_file_import
.append(menu_func_import
)
144 bpy
.types
.TOPBAR_MT_file_export
.append(menu_func_export
)
148 bpy
.utils
.unregister_class(Import3DS
)
149 bpy
.utils
.unregister_class(Export3DS
)
151 bpy
.types
.TOPBAR_MT_file_import
.remove(menu_func_import
)
152 bpy
.types
.TOPBAR_MT_file_export
.remove(menu_func_export
)
155 # why add 1 extra vertex? and remove it when done? -
156 # "Answer - eekadoodle - would need to re-order UV's without this since face
157 # order isnt always what we give blender, BMesh will solve :D"
159 # disabled scaling to size, this requires exposing bb (easy) and understanding
160 # how it works (needs some time)
163 if __name__
== "__main__":