Added mapping tool, reworked scene structure, and added test data.

This commit is contained in:
2026-09-06 16:50:32 -07:00
parent ab632f455d
commit a7ba813c81
20 changed files with 350 additions and 12 deletions
+54
View File
@@ -0,0 +1,54 @@
extends GraphNode
class_name GraphFileNode
var scene : DialogueScene = null
# static var base_loc :String = "res://dialogue/resources/"
var file_loc : String
func _init(loc : String):
file_loc = loc
title = loc
name = loc.replace("/", ";").replace(".","*")
scene = DialogueScene.load_scene(loc)
func _ready():
add_child(Control.new())
set_slot(0, true, 0, Color.BLACK, false, 0, Color.BLACK)
if scene == null:
return
var dias : Array[Dialogue] = scene.get_scene()
var i = 1
for dia in dias:
if dia.choices.is_empty():
continue
else:
for chc : Choice in dia.choices:
var l = Label.new()
if chc.response.is_empty() :
l.text = "(invisible choice)"
else:
l.text = chc.response
add_child(l)
set_slot(i, false, 0, Color.BLACK, true, 0, Color.from_hsv(float(i-1)*0.1, 1, 1))
i+=1
func map(ge : GraphEdit):
if scene != null:
var to_map_arr : Array[GraphFileNode] = []
var dias : Array[Dialogue] = scene.get_scene()
var i = 0
for dia in dias:
if dia.choices.is_empty():
continue
else:
for chc : Choice in dia.choices:
for t : ChoiceTarget in chc.targets:
var name1 = t.target_scene_loc.replace("/", ";").replace(".","*")
var outNode : GraphFileNode
if !ge.has_node(name1):
outNode = GraphFileNode.new(t.target_scene_loc)
ge.add_child(outNode)
to_map_arr.append(outNode)
ge.connect_node(self.name, i, name1, 0)
i+=1
for to_map : GraphFileNode in to_map_arr:
to_map.map(ge)