Campbell Barton 98986c6562 Python: replace '%' with str.format for examples & templates
Use modern/preferred string formatting for user facing scripts.
2024-04-12 15:33:40 +10:00

25 lines
554 B
Python

import bpy
# print all objects
for obj in bpy.data.objects:
print(obj.name)
# print all scene names in a list
print(bpy.data.scenes.keys())
# remove mesh Cube
if "Cube" in bpy.data.meshes:
mesh = bpy.data.meshes["Cube"]
print("removing mesh", mesh)
bpy.data.meshes.remove(mesh)
# write images into a file next to the blend
import os
with open(os.path.splitext(bpy.data.filepath)[0] + ".txt", 'w') as fs:
for image in bpy.data.images:
fs.write("{:s} {:d} x {:d}\n".format(image.filepath, image.size[0], image.size[1]))