-
Notifications
You must be signed in to change notification settings - Fork 9
/
dks_sp.py
624 lines (423 loc) · 26.5 KB
/
dks_sp.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
import bpy
from subprocess import Popen
from os import system, path, makedirs, sep
def dks_sp_get_export_path():
_export_path = bpy.path.abspath('//') + bpy.context.preferences.addons[__package__].preferences.option_export_folder + sep
if not path.exists(_export_path):
makedirs(_export_path)
return _export_path
def dks_sp_get_textures_path():
_textures_path = bpy.path.abspath('//') + bpy.context.preferences.addons[__package__].preferences.option_textures_folder + sep
if not path.exists(_textures_path):
makedirs(_textures_path)
return _textures_path
def dks_sp_get_object_name():
return bpy.context.active_object.name
def dks_sp_get_collection_name():
return bpy.context.view_layer.active_layer_collection.name
def dks_sp_get_file_name():
return bpy.path.basename(bpy.context.blend_data.filepath).replace('.blend','')
def dks_sp_get_texture_file(texture_path,mesh_name,mat_name,texture_name,texture_ext):
if path.exists(texture_path+mesh_name+'_'+mat_name+'_'+texture_name+'.'+texture_ext):
if bpy.context.preferences.addons[__package__].preferences.option_relative:
texture_path=bpy.path.relpath(texture_path)+sep
return texture_path+mesh_name+'_'+mat_name+'_'+texture_name+'.'+texture_ext
elif path.exists(texture_path+mat_name+'_'+texture_name+'.'+texture_ext):
if bpy.context.preferences.addons[__package__].preferences.option_relative:
texture_path=bpy.path.relpath(texture_path)+sep
return texture_path+mat_name+'_'+texture_name+'.'+texture_ext
else:
_blend=dks_sp_get_file_name()
if path.exists(texture_path+_blend+'_'+mesh_name+'_'+texture_name+'.'+texture_ext):
if bpy.context.preferences.addons[__package__].preferences.option_relative:
texture_path=bpy.path.relpath(texture_path)+sep
return texture_path+_blend+'_'+mesh_name+'_'+texture_name+'.'+texture_ext
elif path.exists(texture_path+_blend+'_'+mat_name+'_'+texture_name+'.'+texture_ext):
if bpy.context.preferences.addons[__package__].preferences.option_relative:
texture_path=bpy.path.relpath(texture_path)+sep
return texture_path+_blend+'_'+mat_name+'_'+texture_name+'.'+texture_ext
else:
return ""
class dks_sp_pbr_nodes(bpy.types.Operator):
bl_idname = "dks_sp.pbr_nodes"
bl_label = "Import Textures"
bl_context = "material"
bl_description = "Import from Substance Painter"
import_setting : bpy.props.StringProperty(
name="import_setting",
default = 'scene'
)
def execute(self, context):
if self.import_setting == 'scene':
_objects = bpy.context.scene.objects
elif self.import_setting == 'collection':
_objects = bpy.data.collections[dks_sp_get_collection_name()].all_objects
elif bpy.context.active_object:
_objects = {bpy.context.active_object}
_textures_path = dks_sp_get_textures_path()
_texture_ext=bpy.context.preferences.addons[__package__].preferences.option_import_ext
for _obj in _objects:
if _obj.type=='MESH':
_obj_name = _obj.name
_materials = _obj.data.materials
for _material in _materials:
_material_name = _material.name
_file_Base_Color = dks_sp_get_texture_file(_textures_path,_obj_name,_material_name,'Base_Color',_texture_ext)
if _file_Base_Color=="":
_file_Base_Color = dks_sp_get_texture_file(_textures_path,_obj_name,_material_name,'BaseColor',_texture_ext)
_file_Diffuse = dks_sp_get_texture_file(_textures_path,_obj_name,_material_name,'Diffuse',_texture_ext)
_file_Ambient_occlusion = dks_sp_get_texture_file(_textures_path,_obj_name,_material_name,'Ambient_occlusion',_texture_ext)
_file_Metallic = dks_sp_get_texture_file(_textures_path,_obj_name,_material_name,'Metallic',_texture_ext)
_file_Specular = dks_sp_get_texture_file(_textures_path,_obj_name,_material_name,'Specular',_texture_ext)
_file_Glossiness = dks_sp_get_texture_file(_textures_path,_obj_name,_material_name,'Glossiness',_texture_ext)
_file_Roughness = dks_sp_get_texture_file(_textures_path,_obj_name,_material_name,'Roughness',_texture_ext)
_file_ORM = dks_sp_get_texture_file(_textures_path,_obj_name,_material_name,'OcclusionRoughnessMetallic',_texture_ext)
_file_Opacity = dks_sp_get_texture_file(_textures_path,_obj_name,_material_name,'Opacity',_texture_ext)
_file_Height = dks_sp_get_texture_file(_textures_path,_obj_name,_material_name,'Height',_texture_ext)
_file_Normal = dks_sp_get_texture_file(_textures_path,_obj_name,_material_name,'Normal_OpenGL',_texture_ext)
if _file_Normal=="":
_file_Normal = dks_sp_get_texture_file(_textures_path,_obj_name,_material_name,'Normal',_texture_ext)
_file_Emissive = dks_sp_get_texture_file(_textures_path,_obj_name,_material_name,'Emissive',_texture_ext)
if _file_Base_Color or _file_Diffuse:
if _material:
_material.use_nodes = True
# Clear Nodes
if _material and _material.node_tree:
_nodes = _material.node_tree.nodes
for node in _nodes:
_nodes.remove(node)
_material_links = _material.node_tree.links
_nodes = _material.node_tree.nodes
# Output Material
_material_output = _nodes.new('ShaderNodeOutputMaterial')
if not _file_Emissive:
_material_output.location = 800,0
else:
_material_output.location = 1600,0
_material_output.name='dks_pbr_output'
if _file_Emissive:
# Add Shader
_node_add_shader=_nodes.new('ShaderNodeAddShader')
_node_add_shader.location = 1400,0
_node_add_shader.name = 'dks_pbr_add_shader'
_material_links.new(_node_add_shader.outputs['Shader'], _material_output.inputs['Surface'])
# Shader Emission
_node_emission=_nodes.new('ShaderNodeEmission')
_node_emission.location = 1200,-100
_node_emission.name = 'dks_pbr_emission'
_material_links.new(_node_emission.outputs['Emission'], _node_add_shader.inputs[1])
# Emissive
node=_nodes.new('ShaderNodeTexImage')
node.location = 800,-100
node.name='dks_pbr_texture_emissive'
_material_links.new(node.outputs['Color'], _node_emission.inputs['Color'])
node.image = bpy.data.images.load(_file_Emissive)
# Shader
node_shader = _nodes.new('ShaderNodeBsdfPrincipled')
node_shader.location = 400,0
node_shader.name='dks_pbr_shader'
if not _file_Emissive:
_material_links.new(node_shader.outputs['BSDF'], _material_output.inputs['Surface'])
else:
_material_links.new(node_shader.outputs['BSDF'], _node_add_shader.inputs[0])
# UE4 - Occlusion, Roughness, Metallic
if _file_ORM:
# Mix RGB
node_mix=_nodes.new('ShaderNodeMixRGB')
node_mix.location = 200,100
node_mix.blend_type = 'MULTIPLY'
node_mix.name='dks_pbr_mix_rgb'
_material_links.new(node_mix.outputs['Color'], node_shader.inputs['Base Color'])
# Base Color
node=_nodes.new('ShaderNodeTexImage')
node.location = -200,250
node.name='dks_pbr_texture_base_color'
_material_links.new(node.outputs['Color'], node_mix.inputs['Color1'])
node.image = bpy.data.images.load(_file_Base_Color)
node.image.colorspace_settings.name = 'sRGB'
node_orm=_nodes.new('ShaderNodeTexImage')
node_orm.location = -500,-200
node_orm.name='dks_pbr_texture_orm'
node_orm.image = bpy.data.images.load(_file_ORM)
node_orm.image.colorspace_settings.name = 'Non-Color'
node_sep_rgb=_nodes.new('ShaderNodeSeparateRGB')
node_sep_rgb.location = -200,-200
node_sep_rgb.name='dks_pbr_texture_sep_rgb'
_material_links.new(node_orm.outputs['Color'], node_sep_rgb.inputs['Image'])
_material_links.new(node_sep_rgb.outputs['R'], node_mix.inputs['Color2'])
_material_links.new(node_sep_rgb.outputs['G'], node_shader.inputs['Roughness'])
_material_links.new(node_sep_rgb.outputs['B'], node_shader.inputs['Metallic'])
elif _file_Ambient_occlusion:
# Mix RGB
node_mix=_nodes.new('ShaderNodeMixRGB')
node_mix.location = 200,100
node_mix.blend_type = 'MULTIPLY'
node_mix.name='dks_pbr_mix_rgb'
_material_links.new(node_mix.outputs['Color'], node_shader.inputs['Base Color'])
# Base Color
node=_nodes.new('ShaderNodeTexImage')
node.location = -140,261
node.name='dks_pbr_texture_base_color'
_material_links.new(node.outputs['Color'], node_mix.inputs['Color1'])
if _file_Base_Color:
node.image = bpy.data.images.load(_file_Base_Color)
elif _file_Diffuse:
node.image = bpy.data.images.load(_file_Diffuse)
node.image.colorspace_settings.name = 'sRGB'
# Ambient Occlusion
node=_nodes.new('ShaderNodeTexImage')
node.location = -140,0
node.name='dks_pbr_texture_ao'
_material_links.new(node.outputs['Color'], node_mix.inputs['Color2'])
node.image = bpy.data.images.load(_file_Ambient_occlusion)
node.image.colorspace_settings.name = 'Non-Color'
else:
# Base Color
node=_nodes.new('ShaderNodeTexImage')
node.location = 0,250
node.name='dks_pbr_texture_base_color'
_material_links.new(node.outputs['Color'], node_shader.inputs['Base Color'])
if _file_Base_Color:
node.image = bpy.data.images.load(_file_Base_Color)
elif _file_Diffuse:
node.image = bpy.data.images.load(_file_Diffuse)
node.image.colorspace_settings.name = 'sRGB'
# Metallic
if _file_Metallic:
node=_nodes.new('ShaderNodeTexImage')
node.location = 0,-250
node.name='dks_pbr_texture_metallic'
_material_links.new(node.outputs['Color'], node_shader.inputs['Metallic'])
node.image = bpy.data.images.load(_file_Metallic)
node.image.colorspace_settings.name = 'Non-Color'
# Specular
if _file_Specular:
node=_nodes.new('ShaderNodeTexImage')
node.location = -280,-180
node.name='dks_pbr_texture_Specular'
_material_links.new(node.outputs['Color'], node_shader.inputs['Specular'])
node.image = bpy.data.images.load(_file_Specular)
if _file_Glossiness:
# Roughness Invert
node_invert=_nodes.new('ShaderNodeInvert')
node_invert.location = 100,-520
node_invert.name='dks_pbr_invert'
_material_links.new(node_invert.outputs['Color'], node_shader.inputs['Roughness'])
# Roughness
if _file_Roughness!="":
node=_nodes.new('ShaderNodeTexImage')
node.location = -280,-520
node.name='dks_pbr_texture_roughness'
_material_links.new(node.outputs['Color'], node_invert.inputs['Color'])
node.image = bpy.data.images.load(_file_Glossiness)
else:
# Roughness
if _file_Roughness:
node=_nodes.new('ShaderNodeTexImage')
node.location = 0,-500
node.name='dks_pbr_texture_roughness'
_material_links.new(node.outputs['Color'], node_shader.inputs['Roughness'])
node.image = bpy.data.images.load(_file_Roughness)
node.image.colorspace_settings.name = 'Non-Color'
# Opacity
if _file_Opacity:
node=_nodes.new('ShaderNodeTexImage')
node.location = 0,-600
node.name='dks_pbr_texture_opacity'
_material_links.new(node.outputs['Color'], node_shader.inputs['Alpha'])
node.image = bpy.data.images.load(_file_Opacity)
node.image.colorspace_settings.name = 'Non-Color'
_material.blend_method = 'BLEND'
# Height
if bpy.context.preferences.addons[__package__].preferences.option_use_height_maps and _file_Height:
frame_1= _nodes.new('NodeFrame')
frame_1.location = -390, -837
frame_1.width = 802
frame_1.height = 628
frame_1.label = 'Normal and Height'
node_Bump=_nodes.new('ShaderNodeBump')
node_Bump.location = 250,-870
node_Bump.name='dks_pbr_Bump'
_material_links.new(node_Bump.outputs['Normal'], node_shader.inputs['Normal'])
node_map=_nodes.new('ShaderNodeNormalMap')
node_map.location = -20,-1150
node_map.name='dks_pbr_normal_map'
_material_links.new(node_map.outputs['Normal'], node_Bump.inputs['Normal'])
node=_nodes.new('ShaderNodeTexImage')
node.location = -360,-1180
node.name='dks_pbr_texture_normal'
_material_links.new(node.outputs['Color'], node_map.inputs['Color'])
node.image = bpy.data.images.load(_file_Normal)
node.image.colorspace_settings.name = 'Non-Color'
node=_nodes.new('ShaderNodeTexImage')
node.location = -360,-870
node.name='dks_pbr_texture_Height'
_material_links.new(node.outputs['Color'], node_Bump.inputs['Height'])
node.image = bpy.data.images.load(_file_Height)
node.image.colorspace_settings.name = 'Non-Color'
else:
# Normal
node_map=_nodes.new('ShaderNodeNormalMap')
node_map.location = 200,-700
node_map.name='dks_pbr_normal_map'
_material_links.new(node_map.outputs['Normal'], node_shader.inputs['Normal'])
node=_nodes.new('ShaderNodeTexImage')
node.location = -100,-750
node.name='dks_pbr_texture_normal'
_material_links.new(node.outputs['Color'], node_map.inputs['Color'])
node.image = bpy.data.images.load(_file_Normal)
node.image.colorspace_settings.name = 'Non-Color'
return {'FINISHED'}
def dks_sp_create_material(mesh_obj):
_material = bpy.data.materials.new(name="Material")
mesh_obj.data.materials.append(_material)
return True
def dks_sp_check_material():
_obj = bpy.context.active_object
if _obj.type=='MESH':
if len(_obj.data.materials)==0:
_created = dks_sp_create_material(_obj)
return True
def dks_sp_check_materials():
for _obj in bpy.context.scene.objects:
if _obj.type=='MESH':
if len(_obj.data.materials)==0:
_created = dks_sp_create_material(_obj)
return True
def dks_sp_fbx_export_sel(self, context, export_name):
_export_path = dks_sp_get_export_path()
_export_file = _export_path + export_name + '.fbx'
if bpy.context.preferences.addons[__package__].preferences.option_save_before_export:
bpy.ops.wm.save_mainfile()
bpy.ops.export_scene.fbx(filepath=_export_file, use_selection=True, check_existing=False, axis_forward='-Z', axis_up='Y', filter_glob="*.fbx", global_scale=1.0, apply_unit_scale=True, bake_space_transform=False, object_types={'ARMATURE', 'MESH'}, use_mesh_modifiers=True, mesh_smooth_type='OFF', use_mesh_edges=False, use_tspace=False, use_custom_props=False, add_leaf_bones=False, primary_bone_axis='Y', secondary_bone_axis='X', use_armature_deform_only=False, bake_anim=True, bake_anim_use_all_bones=True, bake_anim_use_nla_strips=True, bake_anim_use_all_actions=True, bake_anim_force_startend_keying=True, bake_anim_step=1.0, bake_anim_simplify_factor=1.0, path_mode='AUTO', embed_textures=False, batch_mode='OFF', use_batch_own_dir=True, use_metadata=True)
return _export_file
def dks_sp_fbx_export_scene(self, context):
_export_name = dks_sp_get_file_name()
_export_path = dks_sp_get_export_path()
_export_file = _export_path + _export_name + '.fbx'
if bpy.context.preferences.addons[__package__].preferences.option_save_before_export:
bpy.ops.wm.save_mainfile()
bpy.ops.export_scene.fbx(filepath=_export_file, use_selection=False, check_existing=False, axis_forward='-Z', axis_up='Y', filter_glob="*.fbx", global_scale=1.0, apply_unit_scale=True, bake_space_transform=False, object_types={'ARMATURE', 'MESH'}, use_mesh_modifiers=True, mesh_smooth_type='OFF', use_mesh_edges=False, use_tspace=False, use_custom_props=False, add_leaf_bones=False, primary_bone_axis='Y', secondary_bone_axis='X', use_armature_deform_only=False, bake_anim=True, bake_anim_use_all_bones=True, bake_anim_use_nla_strips=True, bake_anim_use_all_actions=True, bake_anim_force_startend_keying=True, bake_anim_step=1.0, bake_anim_simplify_factor=1.0, path_mode='AUTO', embed_textures=False, batch_mode='OFF', use_batch_own_dir=True, use_metadata=True)
return _export_file
def dks_sp_obj_export_sel(self, context, export_name):
_export_path = dks_sp_get_export_path()
_export_file = _export_path + export_name + '.obj'
if bpy.context.preferences.addons[__package__].preferences.option_save_before_export:
bpy.ops.wm.save_mainfile()
bpy.ops.export_scene.obj(filepath=_export_file, check_existing=False, use_selection=True, axis_forward='-Z', axis_up='Y', global_scale=1.0, keep_vertex_order=True)
return _export_file
def dks_sp_obj_export_scene(self, context):
_export_name = dks_sp_get_file_name()
_export_path = dks_sp_get_export_path()
_export_file = _export_path + _export_name + '.obj'
if bpy.context.preferences.addons[__package__].preferences.option_save_before_export:
bpy.ops.wm.save_mainfile()
bpy.ops.export_scene.obj(filepath=_export_file, check_existing=False, use_selection=False, axis_forward='-Z', axis_up='Y', global_scale=1.0, keep_vertex_order=True)
return _export_file
def dks_sp_open(export_file, export_project):
_textures_path = dks_sp_get_textures_path()
if bpy.context.preferences.addons[__package__].preferences.option_no_new:
if not path.exists(export_project):
Popen([bpy.context.preferences.addons[__package__].preferences.option_sp_exe, "--disable-version-checking", "--mesh", export_file, "--export-path", _textures_path])
else:
Popen([bpy.context.preferences.addons[__package__].preferences.option_sp_exe, "--disable-version-checking", "--mesh", export_file, "--export-path", _textures_path, export_project])
else:
Popen([bpy.context.preferences.addons[__package__].preferences.option_sp_exe, "--disable-version-checking", "--mesh", export_file, "--export-path", _textures_path, export_project])
class dks_sp_export_sel(bpy.types.Operator):
bl_idname = "dks_sp.export_sel"
bl_label = "Substance Painter (Selected)"
bl_description = "Export to Substance Painter (Selected)"
open_sp : bpy.props.BoolProperty(
name="open_sp",
default = True
)
def execute(self, context):
_export_name = dks_sp_get_object_name()
_export_path = bpy.path.abspath('//')
_export_project = _export_path + _export_name + '.spp'
if bpy.context.preferences.addons[__package__].preferences.option_create_materials:
_checked = dks_sp_check_material()
if bpy.context.preferences.addons[__package__].preferences.option_export_type=='obj':
_export_file = dks_sp_obj_export_sel(self, context, _export_name)
elif bpy.context.preferences.addons[__package__].preferences.option_export_type=='fbx':
_export_file = dks_sp_fbx_export_sel(self, context, _export_name)
if self.open_sp:
dks_sp_open(_export_file, _export_project)
return {'FINISHED'}
class dks_sp_export_scene(bpy.types.Operator):
bl_idname = "dks_sp.export_scene"
bl_label = "Substance Painter (Scene)"
bl_description = "Export to Substance Painter (Scene)"
open_sp : bpy.props.BoolProperty(
name="open_sp",
default = True
)
def execute(self, context):
_export_name = dks_sp_get_file_name()
_export_path = bpy.path.abspath('//')
_export_project = _export_path + _export_name + '.spp'
if bpy.context.preferences.addons[__package__].preferences.option_create_materials:
_checked = dks_sp_check_materials()
if bpy.context.preferences.addons[__package__].preferences.option_export_type=='obj':
_export_file = dks_sp_obj_export_scene(self, context)
elif bpy.context.preferences.addons[__package__].preferences.option_export_type=='fbx':
_export_file = dks_sp_fbx_export_scene(self, context)
if self.open_sp:
dks_sp_open(_export_file, _export_project)
return {'FINISHED'}
class dks_sp_export_col(bpy.types.Operator):
bl_idname = "dks_sp.export_col"
bl_label = "Substance Painter (Collection)"
bl_description = "Export to Substance Painter (Collection)"
open_sp : bpy.props.BoolProperty(
name="open_sp",
default = True
)
def execute(self, context):
_export_name = dks_sp_get_collection_name()
_export_path = bpy.path.abspath('//')
_export_project = _export_path + _export_name + '.spp'
for _obj in bpy.data.collections[_export_name].all_objects:
if _obj.type=='MESH':
_obj.select_set(True)
if bpy.context.preferences.addons[__package__].preferences.option_create_materials:
if len(_obj.data.materials)==0:
_created = dks_sp_create_material(_obj)
if bpy.context.preferences.addons[__package__].preferences.option_export_type=='obj':
_export_file = dks_sp_obj_export_sel(self, context, _export_name)
elif bpy.context.preferences.addons[__package__].preferences.option_export_type=='fbx':
_export_file = dks_sp_fbx_export_sel(self, context, _export_name)
if self.open_sp:
dks_sp_open(_export_file, _export_project)
return {'FINISHED'}
classes = (
dks_sp_export_scene,
dks_sp_export_sel,
dks_sp_export_col,
dks_sp_pbr_nodes,
)
def register():
from bpy.utils import register_class
for cls in classes:
register_class(cls)
def unregister():
from bpy.utils import unregister_class
for cls in reversed(classes):
unregister_class(cls)