Skip to content

Commit 45f4266

Browse files
committed
1_5_1
Added functions ds_sp_get_object_name and ds_sp_get_file_name
1 parent b2899ad commit 45f4266

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

ds_sp.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ def ds_sp_get_textures_path():
3939

4040
return _textures_path
4141

42+
def ds_sp_get_object_name():
43+
44+
return bpy.context.active_object.name
45+
46+
def ds_sp_get_file_name():
47+
48+
return bpy.path.basename(bpy.context.blend_data.filepath).replace('.blend','')
49+
4250
def ds_sp_get_texture_file(texture_path,mesh_name,mat_name,texture_name,texture_ext):
4351

4452
if path.exists(texture_path+mesh_name+'_'+mat_name+'_'+texture_name+'.'+texture_ext):
@@ -285,7 +293,7 @@ def execute(self, context):
285293

286294
def ds_sp_fbx_export_sel(self, context):
287295

288-
_export_name = bpy.context.active_object.name
296+
_export_name = ds_sp_get_object_name()
289297
_export_path = ds_sp_get_export_path()
290298
_export_file = _export_path + _export_name + '.fbx'
291299

@@ -309,7 +317,7 @@ def execute(self, context):
309317

310318
def ds_sp_fbx_export_scene(self, context):
311319

312-
_export_name = bpy.path.basename(bpy.context.blend_data.filepath).replace('.blend','')
320+
_export_name = ds_sp_get_file_name()
313321
_export_path = ds_sp_get_export_path()
314322
_export_file = _export_path + _export_name + '.fbx'
315323

@@ -333,7 +341,7 @@ def execute(self, context):
333341

334342
def ds_sp_obj_export_sel(self, context):
335343

336-
_export_name = bpy.context.active_object.name
344+
_export_name = ds_sp_get_object_name()
337345
_export_path = ds_sp_get_export_path()
338346
_export_file = _export_path + _export_name + '.obj'
339347

@@ -357,7 +365,7 @@ def execute(self, context):
357365

358366
def ds_sp_obj_export_scene(self, context):
359367

360-
_export_name = bpy.path.basename(bpy.context.blend_data.filepath).replace('.blend','')
368+
_export_name = ds_sp_get_file_name()
361369
_export_path = ds_sp_get_export_path()
362370
_export_file = _export_path + _export_name + '.obj'
363371

@@ -387,7 +395,7 @@ class ds_sp_export_sel(bpy.types.Operator):
387395

388396
def execute(self, context):
389397

390-
_object_name = bpy.context.active_object.name
398+
_object_name = ds_sp_get_object_name()
391399
_export_path = bpy.path.abspath('//')
392400
_export_project = _export_path + _object_name + '.spp'
393401
_textures_path = ds_sp_get_textures_path()
@@ -418,7 +426,7 @@ class ds_sp_export_scene(bpy.types.Operator):
418426

419427
def execute(self, context):
420428

421-
_export_name = bpy.path.basename(bpy.context.blend_data.filepath).replace('.blend','')
429+
_export_name = ds_sp_get_file_name()
422430
_export_path = bpy.path.abspath('//')
423431
_export_project = _export_path + _export_name + '.spp'
424432
_textures_path = ds_sp_get_textures_path()

0 commit comments

Comments
 (0)