在Blender中添加材质和纹理,并将模型导出为“.fbx”文件
import bpy
mat = bpy.data.materials.new(name="New Material")
mat.diffuse_color = (1.0, 1.0, 1.0, 1.0)
obj = bpy.context.active_object obj.data.materials.append(mat)
tex = bpy.data.textures.new(name="New Texture", type='IMAGE') img = bpy.data.images.load(filepath="//path/to/image.png") slot = mat.texture_slots.add() slot.texture = tex slot.texture_coords = 'UV' slot.mapping = 'FLAT' slot.use_map_color_diffuse = True slot.image = img
import bpy
bpy.ops.export_scene.fbx(filepath="//path/to/export.fbx", use_selection=True)