3
11

io_scene_3ds: cleanup texture handling #10

Merged
Sebastian Sille merged 5 commits from :main into main 2023-02-28 18:43:57 +01:00
Showing only changes of commit 616f47fd51 - Show all commits

View File

@ -302,6 +302,20 @@ def add_texture_to_material(image, contextWrapper, pct, extend, alpha, scale, of
elif extend == 'noWrap': elif extend == 'noWrap':
img_wrap.extension = 'CLIP' img_wrap.extension = 'CLIP'
if alpha == 'alpha': if alpha == 'alpha':
for link in links:
if link.from_node.type == 'TEX_IMAGE' and link.to_node.type == 'MIX_RGB':
tex = link.from_node.image.name
own_node = img_wrap.node_image
own_map = img_wrap.node_mapping
if tex == image.name:
links.new(link.from_node.outputs['Alpha'], img_wrap.socket_dst)
nodes.remove(own_map)
nodes.remove(own_node)
for imgs in bpy.data.images:
if imgs.name[-3:].isdigit():
if not img.users:
bpy.data.images.remove(imgs)
else:
links.new(img_wrap.node_image.outputs['Alpha'], img_wrap.socket_dst) links.new(img_wrap.node_image.outputs['Alpha'], img_wrap.socket_dst)
shader.location = (300, 300) shader.location = (300, 300)