Add conformance test files for bpy.ops, bpy.types.Object, bpy.types.Context, bpy.msgbus, and bpy.data from official Blender documentation for both 5.0 and 5.1. Generate a ContextDict TypedDict from Context properties so that Context.copy() returns precisely typed values instead of dict[str, object], fixing type errors when unpacking into temp_override(). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
27 lines
580 B
Python
27 lines
580 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])
|
|
)
|