This commit is contained in:
Nicholas Butzke
2026-08-02 02:20:02 -04:00
parent 61669627db
commit 922983429e
226 changed files with 34032 additions and 18521 deletions
+19 -2
View File
@@ -17,6 +17,14 @@ func _initialize() -> void:
_out_dir = args[0]
if args.size() > 1:
_scene = args[1]
if not _out_dir.is_absolute_path():
_out_dir = ProjectSettings.globalize_path(_out_dir)
var mkdir_error := DirAccess.make_dir_recursive_absolute(_out_dir)
if mkdir_error != OK:
printerr("visual_capture: could not create '%s' (error %d)" % [
_out_dir, mkdir_error])
quit(mkdir_error)
return
change_scene_to_file("res://ui/main_menu/main_menu.tscn")
@@ -61,6 +69,11 @@ func _process(_delta: float) -> bool:
cam.look_at(Vector3(-8, 4, -18), Vector3.UP)
elif _frames == 360:
_shot("street")
# Let the loaded scene and RenderingServer resources drain before the
# process exits. Large CSG maps can still have deferred frees queued on
# the exact frame of the last screenshot.
unload_current_scene()
elif _frames == 480:
return true
return false
@@ -68,5 +81,9 @@ func _process(_delta: float) -> bool:
func _shot(tag: String) -> void:
var img := root.get_viewport().get_texture().get_image()
var path := _out_dir + "/shot_" + tag + ".png"
img.save_png(path)
print("visual_capture: saved ", path)
var save_error := img.save_png(path)
if save_error == OK:
print("visual_capture: saved ", path)
else:
printerr("visual_capture: could not save '%s' (error %d)" % [
path, save_error])