feat(characters): add modular woodland traveler kit
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
extends SceneTree
|
||||
## Native-renderer proof of the same modular meshes and profiles used in gameplay.
|
||||
|
||||
const OUTPUT := "res://docs/baselines/"
|
||||
|
||||
|
||||
func _initialize() -> void:
|
||||
call_deferred("_run")
|
||||
|
||||
|
||||
func _run() -> void:
|
||||
root.size = Vector2i(1600, 1000)
|
||||
if OS.get_cmdline_user_args().has("--world"):
|
||||
await _capture_world()
|
||||
quit()
|
||||
return
|
||||
var workshop := load("res://tools/CharacterWorkshop.tscn").instantiate() as Node3D
|
||||
root.add_child(workshop)
|
||||
for frame in 30:
|
||||
await process_frame
|
||||
await _save("character_workshop")
|
||||
workshop.ui.hide()
|
||||
workshop.set_process(false)
|
||||
var actor: Node3D = workshop.actor
|
||||
actor.position.x = 0
|
||||
actor.rotation.y = 0
|
||||
var camera: Camera3D = workshop.camera
|
||||
camera.position = Vector3(3.1, 2.4, 6.0)
|
||||
camera.look_at(Vector3(0, 1.3, 0))
|
||||
camera.size = 3.15
|
||||
await _save("character_traveler")
|
||||
camera.position = Vector3(-3.5, 2.8, -6.0)
|
||||
camera.look_at(Vector3(0, 1.3, 0))
|
||||
await _save("character_traveler_back")
|
||||
actor.hide()
|
||||
for index in workshop.PRESETS.size():
|
||||
var person := load("res://player/PlayerVisual.tscn").instantiate() as Node3D
|
||||
workshop.add_child(person)
|
||||
person.set_process(false)
|
||||
person.get_node("Sword").hide()
|
||||
var profile: CharacterAppearanceProfile = load(
|
||||
workshop.PROFILE_DIR + workshop.PRESETS[index] + ".tres"
|
||||
)
|
||||
AnimalAppearance.apply_to(person, 0, false, profile)
|
||||
person.position.x = (float(index) - 2.5) * 1.7
|
||||
person.rotation.y = -0.2
|
||||
camera.position = Vector3(0, 2.8, 13.0)
|
||||
camera.look_at(Vector3(0, 1.35, 0))
|
||||
camera.size = 7.2
|
||||
await _save("character_variations")
|
||||
workshop.queue_free()
|
||||
await process_frame
|
||||
quit()
|
||||
|
||||
|
||||
func _capture_world() -> void:
|
||||
var main := load("res://main.tscn").instantiate() as Node3D
|
||||
main.get_node("SimulationManager").set("debug_logs", false)
|
||||
root.add_child(main)
|
||||
await process_frame
|
||||
main.get_node("SimulationManager").set_process(false)
|
||||
var cycle := main.get_node("JajceWorld/DayNightCycle")
|
||||
cycle.set_process(false)
|
||||
cycle.call("_apply_light_rotation", 0.40)
|
||||
cycle.call("_apply_environment", 0.40)
|
||||
var demo := main.get_node("DemoController")
|
||||
if demo.get("debug_overlay_visible"):
|
||||
demo.call("toggle_debug_overlay")
|
||||
for child in main.get_children():
|
||||
if child is CanvasLayer:
|
||||
child.hide()
|
||||
var rig := main.get_node("CameraRig") as Node3D
|
||||
rig.set_physics_process(false)
|
||||
rig.set_process_unhandled_input(false)
|
||||
var player := main.get_node("Player") as CharacterBody3D
|
||||
for frame in 30:
|
||||
await process_frame
|
||||
player.set_physics_process(false)
|
||||
var camera := root.get_camera_3d()
|
||||
camera.reparent(main)
|
||||
camera.global_position = player.global_position + Vector3(7.5, 5.5, 10.5)
|
||||
camera.look_at(player.global_position + Vector3(0, 1.25, 0))
|
||||
camera.fov = 48.0
|
||||
await _save("character_gameplay")
|
||||
main.queue_free()
|
||||
await process_frame
|
||||
|
||||
|
||||
func _save(name_stem: String) -> void:
|
||||
for frame in 10:
|
||||
await process_frame
|
||||
await RenderingServer.frame_post_draw
|
||||
var suffix := (
|
||||
"_compatibility"
|
||||
if RenderingServer.get_current_rendering_method() == "gl_compatibility"
|
||||
else ""
|
||||
)
|
||||
var path := OUTPUT + name_stem + suffix + ".png"
|
||||
assert(root.get_texture().get_image().save_png(path) == OK)
|
||||
print("[TOOL] Saved " + path)
|
||||
Reference in New Issue
Block a user