[Bf-extensions-cvs] [cc971e50] blender-v2.93-release: Fix T77022: node wranger error with texture files on different drives

Iyad Ahmed noreply at git.blender.org
Tue Dec 14 17:57:11 CET 2021


Commit: cc971e509d26484cc00bf89af7d2599d7dcab34e
Author: Iyad Ahmed
Date:   Tue Aug 24 18:40:55 2021 +0200
Branches: blender-v2.93-release
https://developer.blender.org/rBAcc971e509d26484cc00bf89af7d2599d7dcab34e

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

===================================================================

M	node_wrangler.py

===================================================================

diff --git a/node_wrangler.py b/node_wrangler.py
index 118408c4..10b52967 100644
--- a/node_wrangler.py
+++ b/node_wrangler.py
@@ -3171,7 +3171,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
     )
 
@@ -3271,10 +3271,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:')



More information about the Bf-extensions-cvs mailing list