From c4a988936619a1b8873675f908fbda4db46ad472 Mon Sep 17 00:00:00 2001 From: "julius.stotz" Date: Mon, 27 Mar 2023 23:59:19 +0200 Subject: [PATCH 1/2] Added an array for the current file sequences that is only updated when the directory updates --- bseq/callback.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/bseq/callback.py b/bseq/callback.py index a2c6ece..9447880 100644 --- a/bseq/callback.py +++ b/bseq/callback.py @@ -3,6 +3,7 @@ # Code here are mostly about the callback/update/items functions used in properties.py +file_sequences = [] def update_path(self, context): # When the path has been changed, reset the selected sequence to None @@ -10,12 +11,6 @@ def update_path(self, context): context.scene.BSEQ.use_pattern = False context.scene.BSEQ.pattern = "" - -def item_fileseq(self, context): - ''' - Detects all the file sequences in the directory - ''' - p = context.scene.BSEQ.path try: f = fileseq.findSequencesOnDisk(p) @@ -24,15 +19,22 @@ def item_fileseq(self, context): if not f: return [("None", "No sequence detected", "", 1)] - file_seq = [] + + file_sequences.clear() if len(f) >= 20: - file_seq.append(("None", "Too much sequence detected, could be false detection, please use pattern below", "", 1)) + file_sequences.append(("None", "Too much sequence detected, could be false detection, please use pattern below", "", 1)) else: count = 1 for seq in f: - file_seq.append((str(seq), seq.basename() + "@" + seq.extension(), "", count)) + file_sequences.append((str(seq), seq.basename() + "@" + seq.extension(), "", count)) count += 1 - return file_seq + + +def item_fileseq(self, context): + ''' + Detects all the file sequences in the directory + ''' + return file_sequences def update_selected_obj_num(self, context): From a81d7b677b647cf45613572c71a4189cc69fafe6 Mon Sep 17 00:00:00 2001 From: "julius.stotz" Date: Tue, 28 Mar 2023 00:07:19 +0200 Subject: [PATCH 2/2] Updated comment --- bseq/callback.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bseq/callback.py b/bseq/callback.py index 9447880..e89bb6b 100644 --- a/bseq/callback.py +++ b/bseq/callback.py @@ -11,6 +11,10 @@ def update_path(self, context): context.scene.BSEQ.use_pattern = False context.scene.BSEQ.pattern = "" + ''' + Detects all the file sequences in the directory + ''' + p = context.scene.BSEQ.path try: f = fileseq.findSequencesOnDisk(p) @@ -31,9 +35,6 @@ def update_path(self, context): def item_fileseq(self, context): - ''' - Detects all the file sequences in the directory - ''' return file_sequences