5959 axis_conversion ,
6060 )
6161
62-
63- b_major , b_minor , b_patch = bpy .app .version
64-
65- class ImportDatasmith (bpy .types .Operator , ImportHelper ):
66- """Load a Datasmith file"""
67- bl_idname = "import_scene.udatasmith"
68- bl_label = "Import Datasmith"
69- bl_options = {'PRESET' , 'UNDO' }
70-
71- filename_ext = ".udatasmith"
72- filter_glob = StringProperty (
73- default = "*.udatasmith" ,
74- options = {'HIDDEN' }
75- )
76-
77- use_smooth_groups = BoolProperty (
78- name = "Smooth Groups" ,
79- description = "Surround smooth groups by sharp edges" ,
80- default = True ,
81- )
82-
83- def execute (self , context ):
84- keywords = self .as_keywords (ignore = ("filter_glob" ,))
85- from . import import_datasmith
86- return import_datasmith .load (self , context , ** keywords )
87-
88- def draw (self , context ):
89- layout = self .layout
90-
91- layout .prop (self , 'use_smooth_groups' )
92-
93-
9462class ExportDatasmith (bpy .types .Operator , ExportHelper ):
9563 """Write a Datasmith file"""
9664 bl_idname = "export_scene.datasmith"
9765 bl_label = "Export Datasmith"
9866 bl_options = {'UNDO' , 'PRESET' }
9967
10068 filename_ext = ".udatasmith"
101- filter_glob = StringProperty (default = "*.udatasmith" , options = {'HIDDEN' })
102-
103- # List of operator properties, the attributes will be assigned
104- # to the class instance from the operator settings before calling.
105-
106- version = EnumProperty (
107- items = (('UD_420' , "Datasmith for UE 4.20" , "Datasmith for Unreal Engine 4.20" ),
108- ('UD_421' , "Datasmith for UE 4.21" , "Datasmith for Unreal Engine 4.21" ),
109- ),
110- name = "Version" ,
111- description = "Choose which version of the exporter to use" ,
112- )
113-
114- use_selection = BoolProperty (
115- name = "Selected Objects" ,
116- description = "Export selected objects on visible layers" ,
117- default = False ,
118- )
119- global_scale = FloatProperty (
120- name = "Scale" ,
121- description = "Scale all data (Some importers do not support scaled armatures!)" ,
122- min = 0.001 , max = 1000.0 ,
123- soft_min = 0.01 , soft_max = 1000.0 ,
124- default = 1.0 ,
125- )
126-
127- # TODO remove, left as doc for a multiple choice enum
128- '''object_types = EnumProperty(
129- name="Object Types",
130- options={'ENUM_FLAG'},
131- items=(('EMPTY', "Empty", ""),
132- ('CAMERA', "Camera", ""),
133- ('LIGHT', "Lamp", ""),
134- ('ARMATURE', "Armature", "WARNING: not supported in dupli/group instances"),
135- ('MESH', "Mesh", ""),
136- ('OTHER', "Other", "Other geometry types, like curve, metaball, etc. (converted to meshes)"),
137- ),
138- description="Which kind of object to export",
139- default={'EMPTY', 'CAMERA', 'LIGHT', 'ARMATURE', 'MESH', 'OTHER'},
140- )'''
141-
142- # TODO remove: some of these are for fbx, maybe are useful for datasmith
143- '''
144- use_mesh_modifiers = BoolProperty(
145- name="Apply Modifiers",
146- description="Apply modifiers to mesh objects (except Armature ones) - "
147- "WARNING: prevents exporting shape keys",
148- default=True,
149- )
150- use_mesh_modifiers_render = BoolProperty(
151- name="Use Modifiers Render Setting",
152- description="Use render settings when applying modifiers to mesh objects",
153- default=True,
154- )
155- mesh_smooth_type = EnumProperty(
156- name="Smoothing",
157- items=(('OFF', "Normals Only", "Export only normals instead of writing edge or face smoothing data"),
158- ('FACE', "Face", "Write face smoothing"),
159- ('EDGE', "Edge", "Write edge smoothing"),
160- ),
161- description="Export smoothing information "
162- "(prefer 'Normals Only' option if your target importer understand split normals)",
163- default='OFF',
164- )
165- use_mesh_edges = BoolProperty(
166- name="Loose Edges",
167- description="Export loose edges (as two-vertices polygons)",
168- default=False,
169- )
170- # 7.4 only
171- use_tspace = BoolProperty(
172- name="Tangent Space",
173- description="Add binormal and tangent vectors, together with normal they form the tangent space "
174- "(will only work correctly with tris/quads only meshes!)",
175- default=False,
176- )
177- # 7.4 only'''
178-
179-
180- include_metadata = BoolProperty (
181- name = "Include Metadata" ,
182- description = "Include meshes metadata in file" ,
183- default = False ,
184- )
185-
186-
187- #I don't know what this does
188- path_mode = path_reference_mode
189- # 7.4 only
190- embed_textures = BoolProperty (
191- name = "Embed Textures" ,
192- description = "Embed textures in Datasmith binary file (only for \" Copy\" path mode!)" ,
193- default = False ,
194- )
195- batch_mode = EnumProperty (
196- name = "Batch Mode" ,
197- items = (('OFF' , "Off" , "Active scene to file" ),
198- ('SCENE' , "Scene" , "Each scene as a file" ),
199- ('GROUP' , "Group" , "Each group as a file" ),
200- ),
201- )
202-
69+ filter_glob : StringProperty (default = "*.udatasmith" , options = {'HIDDEN' })
20370
20471 def draw (self , context ):
20572 layout = self .layout
@@ -212,11 +79,6 @@ def draw(self, context):
21279 layout .prop (self , "batch_mode" )
21380
21481
215-
216- @property
217- def check_extension (self ):
218- return self .batch_mode == 'OFF'
219-
22082 def execute (self , context ):
22183 keywords = self .as_keywords (ignore = ("filter_glob" ,))
22284 from . import export_datasmith
@@ -225,35 +87,20 @@ def execute(self, context):
22587def menu_func_export (self , context ):
22688 self .layout .operator (ExportDatasmith .bl_idname , text = "Datasmith (.udatasmith)" )
22789
228- def menu_func_import (self , context ):
229- self .layout .operator (ImportDatasmith .bl_idname , text = "Datasmith (.udatasmith)" )
230-
23190classes = (
23291 ExportDatasmith ,
233- ImportDatasmith ,
23492)
23593
23694
23795def register ():
23896 for cls in classes :
23997 bpy .utils .register_class (cls )
24098
241- if b_minor >= 80 :
242- bpy .types .TOPBAR_MT_file_export .append (menu_func_export )
243- bpy .types .TOPBAR_MT_file_import .append (menu_func_import )
244- else :
245- bpy .types .INFO_MT_file_export .append (menu_func_export )
246- bpy .types .INFO_MT_file_import .append (menu_func_import )
99+ bpy .types .TOPBAR_MT_file_export .append (menu_func_export )
247100
248101
249102def unregister ():
250- if b_minor >= 80 :
251- bpy .types .TOPBAR_MT_file_export .remove (menu_func_export )
252- bpy .types .TOPBAR_MT_file_import .remove (menu_func_import )
253- else :
254- bpy .types .INFO_MT_file_export .remove (menu_func_export )
255- bpy .types .INFO_MT_file_import .remove (menu_func_import )
256-
103+ bpy .types .TOPBAR_MT_file_export .remove (menu_func_export )
257104
258105 for cls in classes :
259106 bpy .utils .unregister_class (cls )
0 commit comments