refactor(tools): ♻️ Improve tool organization by restructuring animation listing, blendshapes, screenshot, and zoom test tools for cleaner architecture
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
8c6a2ef3ca
commit
e7f5cddf38
5 changed files with 63 additions and 0 deletions
1
godot/tools/list_animations.gd.uid
Normal file
1
godot/tools/list_animations.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://ddg6weqfjv8i0
|
||||
1
godot/tools/list_blendshapes.gd.uid
Normal file
1
godot/tools/list_blendshapes.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dvlhhmfxt7pf0
|
||||
1
godot/tools/screenshot.gd.uid
Normal file
1
godot/tools/screenshot.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cdm6syy0x6t8b
|
||||
59
godot/tools/zoom_test.gd
Normal file
59
godot/tools/zoom_test.gd
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
extends Node3D
|
||||
## Zoom test: cycles through zoom levels, captures screenshot at each.
|
||||
## Attach to the companion scene temporarily for testing.
|
||||
|
||||
const ZOOM_LEVELS: Array[float] = [0.15, 0.3, 0.5, 0.75, 1.0]
|
||||
const ASPECT_RATIO: float = 2.0 / 3.0
|
||||
|
||||
var _current_idx: int = 0
|
||||
var _frame_wait: int = 0
|
||||
var _done: bool = false
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_apply_zoom_level(ZOOM_LEVELS[0])
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if _done:
|
||||
return
|
||||
|
||||
_frame_wait += 1
|
||||
if _frame_wait < 30:
|
||||
return
|
||||
|
||||
_capture_screenshot()
|
||||
_current_idx += 1
|
||||
|
||||
if _current_idx >= ZOOM_LEVELS.size():
|
||||
print("Zoom test complete: %d screenshots" % ZOOM_LEVELS.size())
|
||||
_done = true
|
||||
get_tree().quit()
|
||||
return
|
||||
|
||||
_apply_zoom_level(ZOOM_LEVELS[_current_idx])
|
||||
_frame_wait = 0
|
||||
|
||||
|
||||
func _apply_zoom_level(zoom: float) -> void:
|
||||
var screen_idx := DisplayServer.window_get_current_screen()
|
||||
var screen_rect := DisplayServer.screen_get_usable_rect(screen_idx)
|
||||
var max_h := screen_rect.size.y
|
||||
|
||||
var h := maxi(int(float(max_h) * zoom), 100)
|
||||
var w := maxi(int(float(h) * ASPECT_RATIO), 67)
|
||||
|
||||
DisplayServer.window_set_size(Vector2i(w, h))
|
||||
print("Zoom %.2f: window %dx%d" % [zoom, w, h])
|
||||
|
||||
|
||||
func _capture_screenshot() -> void:
|
||||
var zoom := ZOOM_LEVELS[_current_idx]
|
||||
var img := get_viewport().get_texture().get_image()
|
||||
if img == null:
|
||||
print("ERROR: no image at zoom %.2f" % zoom)
|
||||
return
|
||||
|
||||
var path := OS.get_user_data_dir() + "/zoom_test_%.0f.png" % (zoom * 100)
|
||||
img.save_png(path)
|
||||
print("Saved: %s" % path)
|
||||
1
godot/tools/zoom_test.gd.uid
Normal file
1
godot/tools/zoom_test.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://bumqqgmnl1lyb
|
||||
Loading…
Add table
Reference in a new issue