Skip to content

Commit

Permalink
1_4_0
Browse files Browse the repository at this point in the history
Added option to preferences "2018.0.1+ Project File Fix" to avoid having the project file added to the textures path for new projects.
  • Loading branch information
DigiKrafting committed Oct 1, 2018
1 parent 84756c4 commit 24df356
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
11 changes: 9 additions & 2 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"name": "Substance Painter",
"description": "Substance Painter Tools",
"author": "Digiography.Studio",
"version": (1, 3, 0),
"version": (1, 4, 0),
"blender": (2, 79, 0),
"location": "Info Toolbar, File -> Import, File -> Export",
"wiki_url": "https://github.com/Digiography/blender_addon_substance_painter/wiki",
Expand Down Expand Up @@ -83,7 +83,12 @@ class ds_sp_addon_prefs(bpy.types.AddonPreferences):
name="Relative Paths",
description="Use Relative Paths for images.",
default = True
)
)
option_no_new = bpy.props.BoolProperty(
name="2018.0.1+ Project File Fix",
description="Exclude from path for SP 2018.0.1+ to avoid it being added to the textures path.",
default = False
)
def draw(self, context):

layout = self.layout
Expand All @@ -97,6 +102,8 @@ def draw(self, context):
box.prop(self, 'option_export_folder')
box.prop(self, 'option_textures_folder')
box.prop(self, 'option_relative')
box.prop(self, 'option_no_new')

box.label('Automatically created as a sub folder relative to the saved .blend file. * Do NOT include any "\\".',icon='INFO')
box.prop(self, 'option_save_before_export')

Expand Down
23 changes: 20 additions & 3 deletions ds_sp.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,16 @@ def execute(self, context):
elif bpy.context.user_preferences.addons[__package__].preferences.option_export_type=='fbx':
_export_file = ds_sp_fbx_export_sel(self, context)

Popen('"' + bpy.context.user_preferences.addons[__package__].preferences.option_sp_exe + '" --disable-version-checking --mesh "' + _export_file + '" --export-path "' + _textures_path + '" "' + _export_project + '"')
if bpy.context.user_preferences.addons[__package__].preferences.option_no_new:

if not path.exists(_export_project):
Popen([bpy.context.user_preferences.addons[__package__].preferences.option_sp_exe, "--disable-version-checking", "--mesh", _export_file, "--export-path", _textures_path])
else:
Popen([bpy.context.user_preferences.addons[__package__].preferences.option_sp_exe, "--disable-version-checking", "--mesh", _export_file, "--export-path", _textures_path, _export_project])

else:

Popen([bpy.context.user_preferences.addons[__package__].preferences.option_sp_exe, "--disable-version-checking", "--mesh", _export_file, "--export-path", _textures_path, _export_project])

return {'FINISHED'}

Expand All @@ -409,8 +418,16 @@ def execute(self, context):
elif bpy.context.user_preferences.addons[__package__].preferences.option_export_type=='fbx':
_export_file = ds_sp_fbx_export_scene(self, context)

#Popen([bpy.context.user_preferences.addons[__package__].preferences.option_sp_exe, "--disable-version-checking", "--mesh", _export_file, "--export-path", _textures_path, _export_project])
Popen('"' + bpy.context.user_preferences.addons[__package__].preferences.option_sp_exe + '" --disable-version-checking --mesh "' + _export_file + '" --export-path "' + _textures_path + '" "' + _export_project + '"')
if bpy.context.user_preferences.addons[__package__].preferences.option_no_new:

if not path.exists(_export_project):
Popen([bpy.context.user_preferences.addons[__package__].preferences.option_sp_exe, "--disable-version-checking", "--mesh", _export_file, "--export-path", _textures_path])
else:
Popen([bpy.context.user_preferences.addons[__package__].preferences.option_sp_exe, "--disable-version-checking", "--mesh", _export_file, "--export-path", _textures_path, _export_project])

else:

Popen([bpy.context.user_preferences.addons[__package__].preferences.option_sp_exe, "--disable-version-checking", "--mesh", _export_file, "--export-path", _textures_path, _export_project])

return {'FINISHED'}

Expand Down

0 comments on commit 24df356

Please sign in to comment.