-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathToolOptionsDisplay.gd
More file actions
41 lines (30 loc) · 1.02 KB
/
ToolOptionsDisplay.gd
File metadata and controls
41 lines (30 loc) · 1.02 KB
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
class_name ToolOptionsDisplay extends VBoxContainer
static var _singleton: ToolOptionsDisplay
static func get_singleton() -> ToolOptionsDisplay:
return _singleton
func _init() -> void:
_singleton = self
@onready var tool_window = $ToolOptionsDisplayWindow
var active_tool: ToolWindowBase = null
var tool_windows: Dictionary
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func add_tool(name: String, window: Control):
print("Adding tool ", name)
tool_windows[name] = window
func select_tool(name: String):
print("Selecting tool", name)
if active_tool != null:
active_tool.on_tool_hide()
tool_window.remove_child(active_tool)
active_tool = tool_windows[name]
tool_window.add_child(active_tool)
active_tool.reset_tool()
func reset_current_tool():
if (active_tool):
active_tool.reset_tool()
print("Resetting current tool")