extends SceneTree # Same tutorial lighting/camera before and after the authored material repair. const OUTPUT = "res://playtest/artifacts/styled/iron_ball_surface/" const Maps = preload("res://playtest/tutorial/scripts/maps.gd") func _initialize() -> void: call_deferred("run") func picture() -> Image: for i in range(4):await process_frame RenderingServer.force_draw(false) RenderingServer.force_sync() return root.get_texture().get_image() func run() -> void: var phase := "after" if "--before" in OS.get_cmdline_user_args():phase = "before" var app = load("res://playtest/tutorial/scenes/tutorial.tscn").instantiate() root.add_child(app) for r in Maps.solution(app.lesson): app.records.append({"id":r.id,"kind":r.kind,"position":app.lib.vector(r.position),"quarter":int(r.quarter)}) app.rebuild();app.reset_simulation();app.refresh_slots();app.refresh_ui() var full: Image = await picture() full.save_png(ProjectSettings.globalize_path(OUTPUT + phase + "_tutorial.png")) for child in app.get_children(): if child is CanvasLayer:child.hide() for tag in app.tags:tag.hide() app.selection.hide();app.ball_marker.hide();app.preview_view.hide();app.slots_view.hide() app.camera.h_offset=0;app.camera.v_offset=0 app.camera_size=1.65;app.target=app.balls[0].position;app.update_camera() var views := Image.create(1024,1024,false,Image.FORMAT_RGB8) for i in range(4): app.balls[0].rotation=Vector3(i*PI/2,i*PI/4,0) var frame: Image = await picture() frame.convert(Image.FORMAT_RGB8) var crop := Rect2i((frame.get_width()-512)/2,(frame.get_height()-512)/2,512,512) views.blit_rect(frame,crop,Vector2i((i%2)*512,(i/2)*512)) views.save_png(ProjectSettings.globalize_path(OUTPUT + phase + "_rotations.png")) app.balls[0].rotation=Vector3.ZERO print("IRON_BALL_SURFACE_CAPTURE ",phase) quit()