Polyboy
Ich habe mir gerade von ChatGPT ein nützliches Python Script erstellen lassen. Es entfernt alle Texturen, aus allen Materialien einer Szene. Das kann ganz nützlich sein, wenn man z.B. Modelle bei Sketchfab hochladen will, ohne Dateigrößen Limitierungen zu reißen. Vielleicht hat ja der eine oder andere, Verwendung dafür:
Here's a Python script you can run inside Blender's scripting editor to remove all textures from all materials in a scene. This script removes image texture nodes and disconnects any texture-related inputs in shader nodes.
Blender Python Script: Remove All Textures from All Materials
import bpy
def remove_all_textures():
for material in bpy.data.materials:
if material.use_nodes:
nodes = material.node_tree.nodes
links = material.node_tree.links
# Find and remove image texture nodes
texture_nodes = [node for node in nodes if node.type == 'TEX_IMAGE']
for tex_node in texture_nodes:
# Remove all links connected to the texture node
for link in tex_node.outputs[0].links:
links.remove(link)
nodes.remove(tex_node)
# Optional: clean up unused nodes or other texture types
for node in nodes:
# Disconnect any inputs that are linked to texture-type nodes
for input_socket in node.inputs:
if input_socket.is_linked:
from_node = input_socket.links[0].from_node
if from_node.type == 'TEX_IMAGE':
links.remove(input_socket.links[0])
print("All texture nodes have been removed from all materials.")
# Run the function
remove_all_textures()