Make output dir configurable and auto create if it doesn't exitst
This commit is contained in:
6
Main.gd
6
Main.gd
@@ -4,6 +4,7 @@ var config = ConfigFile.new()
|
|||||||
|
|
||||||
var websocket_url
|
var websocket_url
|
||||||
var public_path
|
var public_path
|
||||||
|
var output_dir
|
||||||
var rendering = false
|
var rendering = false
|
||||||
signal finished_rendering
|
signal finished_rendering
|
||||||
|
|
||||||
@@ -12,8 +13,11 @@ func _ready():
|
|||||||
config.load("res://config.cfg")
|
config.load("res://config.cfg")
|
||||||
websocket_url = config.get_value("core", "websocket_url")
|
websocket_url = config.get_value("core", "websocket_url")
|
||||||
public_path = config.get_value("core", "public_path")
|
public_path = config.get_value("core", "public_path")
|
||||||
|
output_dir = config.get_value("core", "output_dir")
|
||||||
print("Starting render node")
|
print("Starting render node")
|
||||||
|
|
||||||
|
var directory = DirAccess.open(".")
|
||||||
|
directory.make_dir(output_dir)
|
||||||
$JobServer.InitWebsocket()
|
$JobServer.InitWebsocket()
|
||||||
|
|
||||||
func FinishedRendering():
|
func FinishedRendering():
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ func RenderJob(job):
|
|||||||
# Get rendered image
|
# Get rendered image
|
||||||
var img = get_viewport().get_texture().get_image()
|
var img = get_viewport().get_texture().get_image()
|
||||||
var outFile = "%s_%s.png" % [job["type"],job["jobId"]]
|
var outFile = "%s_%s.png" % [job["type"],job["jobId"]]
|
||||||
img.save_png("output/" + outFile)
|
img.save_png("%s/%s" % [$"/root/Main".output_dir, outFile])
|
||||||
|
|
||||||
return outFile
|
return outFile
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
[core]
|
[core]
|
||||||
websocket_url="ws://localhost:6980"
|
websocket_url="ws://localhost:6980"
|
||||||
public_path="http://localhost:8899/"
|
public_path="http://localhost:8899/"
|
||||||
|
output_dir="./output"
|
||||||
|
|||||||
Reference in New Issue
Block a user