diff --git a/__init__.py b/__init__.py index a037223..df27340 100644 --- a/__init__.py +++ b/__init__.py @@ -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", @@ -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 @@ -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') diff --git a/ds_sp.py b/ds_sp.py index dc3336a..3c572d6 100644 --- a/ds_sp.py +++ b/ds_sp.py @@ -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'} @@ -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'}