feat(m53): add guild visual matrix probe
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
extends SceneTree
|
||||
|
||||
const GuildView = preload("res://entry/views/guild_page_view.gd")
|
||||
const FIXTURES := [Vector2i(760, 360), Vector2i(844, 390), Vector2i(1280, 720)]
|
||||
const LOCALES := ["zh_CN", "en"]
|
||||
|
||||
func _initialize() -> void:
|
||||
call_deferred("_run")
|
||||
@@ -12,21 +14,45 @@ func _run() -> void:
|
||||
quit(1)
|
||||
return
|
||||
DirAccess.make_dir_recursive_absolute(out)
|
||||
root.size = Vector2(844, 390)
|
||||
for fixture in FIXTURES:
|
||||
for locale in LOCALES:
|
||||
await _capture_fixture(fixture, locale, out)
|
||||
print("ABG_M53_GUILD_VISUAL_PROBE_OK fixtures=3 locales=2 views=static,dynamic,final")
|
||||
quit(0)
|
||||
|
||||
func _capture_fixture(fixture: Vector2i, locale: String, out: String) -> void:
|
||||
root.size = Vector2(fixture)
|
||||
var view := GuildView.new()
|
||||
view.name = "GuildVisualProbeView"
|
||||
view.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
||||
view.configure_presentation({"safe_area": 24, "text_scale": 1.0, "locale": "zh_CN"})
|
||||
view.configure_presentation({"safe_area": 24, "text_scale": 1.0, "locale": locale})
|
||||
root.add_child(view)
|
||||
view.render({"ok": true, "locale": "zh_CN", "company": {"owned_count": 2, "coin": 38, "display_recruits": []}, "destinations": {}, "recruits": [], "notice": ""})
|
||||
# Guild has animated world layers; use a bounded frame settle instead of waiting
|
||||
# on frame_post_draw, which can remain unresolved in headless compatibility mode.
|
||||
view.render({"ok": true, "locale": locale, "company": {"owned_count": 2, "coin": 38, "display_recruits": []}, "destinations": {}, "recruits": [], "notice": ""})
|
||||
await _settle()
|
||||
_save(view, out, locale, fixture, "final")
|
||||
var overlay := view.find_child("GuildAnchorRoot", true, false) as Control
|
||||
if overlay != null:
|
||||
overlay.visible = false
|
||||
await _settle()
|
||||
_save(view, out, locale, fixture, "static")
|
||||
if overlay != null:
|
||||
overlay.visible = true
|
||||
var world := view.find_child("GuildMasterWorldExtension", true, false) as Control
|
||||
if world != null:
|
||||
world.visible = false
|
||||
await _settle()
|
||||
_save(view, out, locale, fixture, "dynamic")
|
||||
view.queue_free()
|
||||
await process_frame
|
||||
|
||||
func _settle() -> void:
|
||||
for _i in range(3):
|
||||
await process_frame
|
||||
var viewport_texture := root.get_viewport().get_texture()
|
||||
if viewport_texture != null:
|
||||
var image := viewport_texture.get_image()
|
||||
if image != null:
|
||||
image.save_png(out.path_join("guild-844x390-zh_CN-final.png"))
|
||||
print("ABG_M53_GUILD_VISUAL_PROBE_OK")
|
||||
quit(0)
|
||||
|
||||
func _save(view: Control, out: String, locale: String, fixture: Vector2i, kind: String) -> void:
|
||||
var viewport_texture := view.get_viewport().get_texture()
|
||||
if viewport_texture == null:
|
||||
return
|
||||
var image := viewport_texture.get_image()
|
||||
if image != null:
|
||||
image.save_png(out.path_join("guild-%dx%d-%s-%s.png" % [fixture.x, fixture.y, locale, kind]))
|
||||
|
||||
Reference in New Issue
Block a user