Files
IntoHole/assets/balls/shared/source/capture_material_style.gd
T
Yanchen d1141b04c7 feat: 更新 IntoHole 的球体、滑槽和环境资产
- 为铁球、陶瓷球和木球制作风格化材质,归档 CC0 原始参考
- 更新方形球洞和实心滑槽,统一 90° 弯槽并兼容旧存档
- 用顺流泡沫表示水流方向,为冰块制作三种交错的裂纹
- 同步 Blender 源资产、Godot 加载、工坊和试玩预览
2026-11-19 16:18:41 +08:00

49 lines
1.7 KiB
GDScript

extends SceneTree
const OUTPUT = "res://assets/balls/shared/previews/material-style-v1/"
const BALLS = ["iron_ball", "ceramic_ball", "wood_ball"]
func _initialize() -> void:
call_deferred("capture")
func capture() -> void:
var args := OS.get_cmdline_user_args()
if args.size() != 1 or args[0] not in ["before", "after"]:
push_error("Pass either before or after as the capture name.")
quit(1)
return
var app = load("res://playtest/tutorial/scenes/tutorial.tscn").instantiate()
root.add_child(app)
var pieces: Array = []
var balls: Array = []
for i in range(BALLS.size()):
var at := Vector3(1.5, 0, -1.0) * (i - 1)
pieces.append({"id": "lane_%d" % i, "kind": "straight", "position": [at.x, at.y, at.z], "quarter": 0})
var center: Vector3 = at + app.lib.ball_on_surface("straight", 0.5)
balls.append({"id": BALLS[i], "ballTypeId": BALLS[i], "position": [center.x, center.y, center.z]})
app.apply_data({"schemaVersion": 2, "pieces": pieces, "entities": [], "balls": balls})
for child in app.get_children():
if child is CanvasLayer:
child.hide()
for tag in app.tags:
tag.hide()
app.slots_view.hide()
app.preview_view.hide()
app.selection.hide()
app.ball_marker.hide()
app.camera.h_offset = 0
app.camera.v_offset = 0
app.camera_size = 6.2
app.target = Vector3(0, 0.56, 0)
app.update_camera()
for i in range(8):
await process_frame
RenderingServer.force_draw(false)
RenderingServer.force_sync()
var screenshot := root.get_texture().get_image()
var path := ProjectSettings.globalize_path(OUTPUT + args[0] + ".png")
var result := screenshot.save_png(path)
if result != OK:
push_error("Could not save material comparison to " + path)
quit(0 if result == OK else 1)