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
This commit is contained in:
parent
a8c700d4eb
commit
fe12f8b975
Notes:
blender-bot
2023-02-14 18:55:32 +01:00
Referenced by issue blender/blender#88449: Blender LTS: Maintenance Task 2.93 Referenced by issue blender/blender#77348: Blender LTS: Maintenance Task 2.83 Referenced by issue blender/blender#88449, Blender LTS: Maintenance Task 2.93 Referenced by issue blender/blender#77348, Blender LTS: Maintenance Task 2.83 Referenced by issue #77022, Node Wrangler - Principled Texture Setup error (with Relative Path option and blendfile and textures are on different drives)
|
@ -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:')
|
||||
|
|
Loading…
Reference in New Issue