mirror of
https://codeberg.org/StreamGraph/StreamGraph.git
synced 2024-11-13 19:49:55 +01:00
followup to db590ac
: improve group node renderer UX
This commit is contained in:
parent
cb1e30d6af
commit
32bda994f6
2 changed files with 29 additions and 1 deletions
|
@ -51,6 +51,8 @@ func _ready() -> void:
|
||||||
node.renamed.connect(_on_node_renamed)
|
node.renamed.connect(_on_node_renamed)
|
||||||
if node.node_type == "group_node":
|
if node.node_type == "group_node":
|
||||||
get_titlebar_hbox().tooltip_text = "Group %s" % node.group_id.left(8)
|
get_titlebar_hbox().tooltip_text = "Group %s" % node.group_id.left(8)
|
||||||
|
if get_child_count() == 0:
|
||||||
|
create_group_help_text()
|
||||||
|
|
||||||
size = node.get_meta("size", Vector2())
|
size = node.get_meta("size", Vector2())
|
||||||
|
|
||||||
|
@ -112,8 +114,11 @@ func _on_node_ports_updated() -> void:
|
||||||
|
|
||||||
for port in node.get_all_ports():
|
for port in node.get_all_ports():
|
||||||
update_port(port)
|
update_port(port)
|
||||||
|
|
||||||
|
if get_child_count() == 0:
|
||||||
|
create_group_help_text()
|
||||||
await get_tree().process_frame
|
await get_tree().process_frame
|
||||||
|
|
||||||
size = Vector2()
|
size = Vector2()
|
||||||
|
|
||||||
|
|
||||||
|
@ -121,6 +126,12 @@ func _on_node_renamed(new_name: String) -> void:
|
||||||
title = new_name
|
title = new_name
|
||||||
|
|
||||||
|
|
||||||
|
func create_group_help_text() -> void:
|
||||||
|
var l := Label.new()
|
||||||
|
l.text = RendererShortcuts.interpolate_string("This group node has no used ports.\nPress {enter_group} to enter and edit it to see changes reflected.")
|
||||||
|
add_child(l)
|
||||||
|
|
||||||
|
|
||||||
func update_port(port: Port) -> void:
|
func update_port(port: Port) -> void:
|
||||||
var descriptor_split := port.descriptor.split(":")
|
var descriptor_split := port.descriptor.split(":")
|
||||||
var d: DescriptorContainer
|
var d: DescriptorContainer
|
||||||
|
|
|
@ -100,6 +100,17 @@ static func get_full_map() -> Dictionary:
|
||||||
return defaults_copy
|
return defaults_copy
|
||||||
|
|
||||||
|
|
||||||
|
static func get_full_map_string() -> Dictionary:
|
||||||
|
var full_map := get_full_map()
|
||||||
|
var res := {}
|
||||||
|
for key: String in full_map:
|
||||||
|
if key.begins_with("_"):
|
||||||
|
continue
|
||||||
|
res[key] = (full_map[key] as Shortcut).get_as_text()
|
||||||
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Returns the default [Shortcut] for the given [param action].
|
## Returns the default [Shortcut] for the given [param action].
|
||||||
static func get_default(action: String) -> Shortcut:
|
static func get_default(action: String) -> Shortcut:
|
||||||
return defaults.get(action)
|
return defaults.get(action)
|
||||||
|
@ -173,3 +184,9 @@ static func map_from_dict(d: Dictionary) -> void:
|
||||||
static func commit_overrides() -> void:
|
static func commit_overrides() -> void:
|
||||||
RendererPersistence.set_value(PERSISTENCE_NAMESPACE, PERSISTENCE_CHANNEL, PERSISTENCE_KEY, map_to_dict())
|
RendererPersistence.set_value(PERSISTENCE_NAMESPACE, PERSISTENCE_CHANNEL, PERSISTENCE_KEY, map_to_dict())
|
||||||
RendererPersistence.commit(PERSISTENCE_NAMESPACE, PERSISTENCE_CHANNEL)
|
RendererPersistence.commit(PERSISTENCE_NAMESPACE, PERSISTENCE_CHANNEL)
|
||||||
|
|
||||||
|
|
||||||
|
## Replaces shortcut names with their keybinds in [param s].[br]
|
||||||
|
## Example usage: [code]interpolate_string("Press {new_deck} to open a new deck.")[/code]
|
||||||
|
static func interpolate_string(s: String) -> String:
|
||||||
|
return s.format(get_full_map_string())
|
||||||
|
|
Loading…
Reference in a new issue