blob: f86956694451d951ea9672759bdfb633d9d2e2f3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# Hurry Curry! - a game about cooking
# Copyright (C) 2025 Hurry Curry! contributors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, version 3 of the License only.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
extends Menu
@onready var renderer = $Renderer
func _ready():
super()
var input_file: String
if Cli.opts.has("render-items"):
renderer.mode = renderer.Mode.ITEMS
input_file = Cli.opts["render-items"]
elif Cli.opts.has("render-tiles"):
renderer.mode = renderer.Mode.TILES
input_file = Cli.opts["render-tiles"]
else:
push_error("cannot open render_tool menu without corresponding cli options")
return
var file = FileAccess.open(input_file, FileAccess.READ)
var object_name_list = file.get_as_text().strip_edges().split("\n")
var resolution = Vector2i.ONE * int(Cli.opts.get("render-resolution", "256"))
$Renderer/SubViewport.size = resolution
for object_name in object_name_list:
renderer.setup_object(object_name)
await RenderingServer.frame_post_draw
var path = Cli.opts.get("render-output", ".").path_join(object_name + ".png")
$Renderer/SubViewport.get_texture().get_image().save_png(path)
exit()
|