Skip to content

Commit

Permalink
Ignore Dublicates Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Aspirata committed Jun 15, 2024
1 parent 134090e commit f5b2c7c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Mcblend Source/Materials/Materials.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,18 @@ def update_texture(new_image_path, image_texture, texture_node=None, colorspace=

if image_texture in bpy.data.images:
Users = find_texture_users(bpy.data.images[image_texture])
if not r_props.ignore_dublicates:
simillar_textures = []
for texture in bpy.data.images:
if image_texture in texture.name:
simillar_textures.append(texture.name)

for simillar_texture in simillar_textures:
parts = simillar_texture.split(".")
if len(parts) > 1 and parts[-1].isdigit() and simillar_texture.replace("." + str(parts[-1]), "") == image_texture:
Users.extend(find_texture_users(bpy.data.images[simillar_texture]))
bpy.data.images.remove(bpy.data.images[simillar_texture])

bpy.data.images.remove(bpy.data.images[image_texture], do_unlink=True)

if texture_node != None:
Expand Down
Binary file modified Mcblend.blend
Binary file not shown.

0 comments on commit f5b2c7c

Please sign in to comment.