From fe12f8b97589baf56bf02a53cd73fc495a89909f Mon Sep 17 00:00:00 2001 From: Iyad Ahmed Date: Tue, 24 Aug 2021 18:40:55 +0200 Subject: Fix T77022: node wranger error with texture files on different drives Principled texture setup with relative path option would lead to this, silently use an absolute path instead like other Blender operators. Differential Revision: https://developer.blender.org/D12221 --- node_wrangler.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'node_wrangler.py') diff --git a/node_wrangler.py b/node_wrangler.py index 09d9b06f..4b77d109 100644 --- a/node_wrangler.py +++ b/node_wrangler.py @@ -3176,7 +3176,7 @@ class NWAddPrincipledSetup(Operator, NWBase, ImportHelper): relative_path: BoolProperty( name='Relative Path', - description='Select the file relative to the blend file', + description='Set the file path relative to the blend file, when possible', default=True ) @@ -3276,10 +3276,10 @@ class NWAddPrincipledSetup(Operator, NWBase, ImportHelper): import_path = self.directory if self.relative_path: if bpy.data.filepath: - import_path = bpy.path.relpath(self.directory) - else: - self.report({'WARNING'}, 'Relative paths cannot be used with unsaved scenes!') - print('Relative paths cannot be used with unsaved scenes!') + try: + import_path = bpy.path.relpath(self.directory) + except ValueError: + pass # Add found images print('\nMatched Textures:') -- cgit v1.2.3