From afa9b939b611f2023c321075618245bd960f829d Mon Sep 17 00:00:00 2001 From: Johan Walles Date: Tue, 27 Jun 2023 10:14:11 +0200 Subject: [PATCH 1/2] Fix #104573: node wrangler no matching images found error Skip removal of common prefix if there's only a single file. Pull Request: https://projects.blender.org/blender/blender-addons/pulls/104582 --- node_wrangler/utils/paths.py | 2 +- node_wrangler/utils/paths_test.py | 32 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/node_wrangler/utils/paths.py b/node_wrangler/utils/paths.py index b3425c85d..9f2375e9f 100644 --- a/node_wrangler/utils/paths.py +++ b/node_wrangler/utils/paths.py @@ -101,7 +101,7 @@ def files_to_clean_file_names_for_sockets(files, sockets): socket_tags = socket[1] all_tags.update(socket_tags) - while True: + while len(names_to_tag_lists) > 1: something_changed = False # Common prefixes / suffixes provide zero information about what file diff --git a/node_wrangler/utils/paths_test.py b/node_wrangler/utils/paths_test.py index ae19267f7..455482f2d 100755 --- a/node_wrangler/utils/paths_test.py +++ b/node_wrangler/utils/paths_test.py @@ -253,6 +253,38 @@ class TestPutFileNamesInSockets(unittest.TestCase): }, ) + def test_single_file_good(self): + """Regression test for https://projects.blender.org/blender/blender-addons/issues/104573""" + + files = [ + MockFile("banana-color.webp"), + ] + sockets = sockets_fixture() + match_files_to_socket_names(files, sockets) + + assert_sockets( + self, + sockets, + { + "Base Color": "banana-color.webp", + }, + ) + + def test_single_file_bad(self): + """Regression test for https://projects.blender.org/blender/blender-addons/issues/104573""" + + files = [ + MockFile("README-banana.txt"), + ] + sockets = sockets_fixture() + match_files_to_socket_names(files, sockets) + + assert_sockets( + self, + sockets, + {}, + ) + if __name__ == "__main__": unittest.main(verbosity=2) -- 2.30.2 From 9b4dede1daa9e44e20491c45af5a4a39d4b786fd Mon Sep 17 00:00:00 2001 From: Sebastian Sille Date: Wed, 5 Jul 2023 09:11:06 +0200 Subject: [PATCH 2/2] Import_3ds: Fixed bytes read in loop There were calculated 2 bytes too much per track chunk causing the loop ended before reading the comlpete 3ds file This is fixed now --- io_scene_3ds/import_3ds.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/io_scene_3ds/import_3ds.py b/io_scene_3ds/import_3ds.py index ebcabd438..459c743d0 100644 --- a/io_scene_3ds/import_3ds.py +++ b/io_scene_3ds/import_3ds.py @@ -593,7 +593,6 @@ def process_next_chunk(context, file, previous_chunk, imported_objects, CONSTRAI def read_track_data(temp_chunk): """Trackflags 0x1, 0x2 and 0x3 are for looping. 0x8, 0x10 and 0x20 locks the XYZ axes. 0x100, 0x200 and 0x400 unlinks the XYZ axes""" - new_chunk.bytes_read += SZ_U_SHORT temp_data = file.read(SZ_U_SHORT) tflags = struct.unpack('