import pathlib import sys import bpy root = pathlib.Path(__file__).resolve().parents[3] hierarchy = "--hierarchy" in sys.argv target = root / "tests/files/web" / ( "object_editor_visibility_scene.blend" if hierarchy else "object_editor_scene.blend") if target.exists(): raise RuntimeError("Fixture already exists; retain the existing hash-bound input") bpy.ops.wm.open_mainfile(filepath=str(root / "tests/files/web/basic_scene.blend")) cube = bpy.data.objects["BasicCube"] cube.location = (3.0, -2.0, 5.0) cube.rotation_mode = "XYZ" cube.rotation_euler = (0.2, 0.4, 0.6) cube.scale = (1.5, 2.0, 0.5) if hierarchy: collection = bpy.data.collections["Collection"] nested = bpy.data.collections.new("ObjectEditor Nested") collection.children.link(nested) camera = bpy.data.objects["BasicCamera"] collection.objects.unlink(camera) nested.objects.link(camera) alternative = bpy.data.collections.new("ObjectEditor Alternative") bpy.context.scene.collection.children.link(alternative) alternative.objects.link(bpy.data.objects["BasicArea"]) hidden = bpy.data.objects.new("ObjectEditor Hidden", None) hidden.hide_viewport = True alternative.objects.link(hidden) bpy.context.view_layer.update() for obj in bpy.context.view_layer.objects: obj.select_set(obj == cube) bpy.context.view_layer.objects.active = cube bpy.ops.wm.save_as_mainfile(filepath=str(target))