When I import models from online, they come with an Alpha map which makes the whole object translucent looking and when I remove the image textures attached to Alpha map of all materials, it fixes the issue. So, I am looking for a code which will help me a ton to remove the image textures attached to Alpha of Principled BSDF of all materials.
1 Answer
$\begingroup$
$\endgroup$
```python
import bpy
def remove_alpha_image(object):
'''
Remove alpha image texture node.
object (bpy.types.Object) - The object to take material from.
'''
if object.material_slots:
for slot in object.material_slots:
if slot.material:
node_tree = slot.material.node_tree
for node in node_tree.nodes:
if node.type == 'BSDF_PRINCIPLED' and node.inputs['Alpha'].is_linked:
image_node = node.inputs['Alpha'].links[0].from_node
node_tree.nodes.remove(image_node)
remove_alpha_image(bpy.context.object)