Skip to content

Commit 7a0aea6

Browse files
Don't create PNG if already exists
1 parent 33753ce commit 7a0aea6

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

idTech 2 BSP Blender Importer.zip

-11 KB
Binary file not shown.

idTech 2 BSP Blender Importer/idtech2_bsp.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,9 @@ def get_texture_images(search_from_parent):
284284
# Need to write a normal image because even if we can parse it, blender won't load a .wal as a texture
285285
base_texture_path, _ = os.path.splitext(actual_texture_path)
286286
new_texture_path = base_texture_path + ".png"
287-
print(f".WAL image, writing .PNG copy for Blender: {new_texture_path}")
288-
img.save(new_texture_path)
287+
if not os.path.exists(new_texture_path):
288+
print(f".WAL image, writing .PNG copy for Blender: {new_texture_path}")
289+
img.save(new_texture_path)
289290
final_texture_path = new_texture_path
290291

291292
else:

idTech 2 BSP Blender Importer/wal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def __init__(self, file_path):
127127

128128
if __name__ == "__main__":
129129
# TEST CASE #
130-
wal_path = '/home/q/Documents/test/textures/e3u2/sflr1_1.wal'
130+
wal_path = '/home/q/Documents/quake2_test/textures/e3u2/sflr1_1.wal'
131131
wal_object = wal_image(wal_path)
132132

133133
print("--------------- .WAL HEADER VALUES -------------------")

0 commit comments

Comments
 (0)