欢迎光临散文网 会员登陆 & 注册

Blender查找包含丢失图像的材质名

2023-08-11 20:32 作者:Msv777  | 我要投稿

import bpy

import os

for image in bpy.data.images:

    try:

        old_path = bpy.path.abspath(image.filepath)

        if not os.path.isfile(old_path):

            print("Image block:", image.name, "is missing.")

            for material in bpy.data.materials:

                if material.use_nodes:

                    for node in material.node_tree.nodes:

                        if node.type == 'TEX_IMAGE' and node.image == image:

                            print("Image block is used in material of object:", material.name)

    except Exception as e:

        print('Error when processing image:', image.name)

        print('Error details:', str(e))


Blender查找包含丢失图像的材质名的评论 (共 条)

分享到微博请遵守国家法律