Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2022-06-06 15:51:59 +0300
committerBrecht Van Lommel <brecht@blender.org>2022-06-06 15:53:29 +0300
commitd990559d7b19593cbaff17ba59b8dd9d0d60e615 (patch)
tree45eb286b239ac3c1376fceae3fa962585e815c9a /node_wrangler.py
parent6a318b22d143f675ad489171a2b9aa56d9a6c1b6 (diff)
Fix T98610, T57542: missing relative path option for image sequences
Diffstat (limited to 'node_wrangler.py')
-rw-r--r--node_wrangler.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/node_wrangler.py b/node_wrangler.py
index 4890c14d..f2280f2c 100644
--- a/node_wrangler.py
+++ b/node_wrangler.py
@@ -3861,6 +3861,17 @@ class NWAddSequence(Operator, NWBase, ImportHelper):
type=bpy.types.OperatorFileListElement,
options={'HIDDEN', 'SKIP_SAVE'}
)
+ relative_path: BoolProperty(
+ name='Relative Path',
+ description='Set the file path relative to the blend file, when possible',
+ default=True
+ )
+
+ def draw(self, context):
+ layout = self.layout
+ layout.alignment = 'LEFT'
+
+ layout.prop(self, 'relative_path')
def execute(self, context):
nodes, links = get_nodes_links(context)
@@ -3936,7 +3947,15 @@ class NWAddSequence(Operator, NWBase, ImportHelper):
node = nodes.active
node.label = name_with_hashes
- img = bpy.data.images.load(directory+(without_ext+'.'+extension))
+ filepath = directory+(without_ext+'.'+extension)
+ if self.relative_path:
+ if bpy.data.filepath:
+ try:
+ filepath = bpy.path.relpath(filepath)
+ except ValueError:
+ pass
+
+ img = bpy.data.images.load(filepath)
img.source = 'SEQUENCE'
img.name = name_with_hashes
node.image = img