mirror of
https://codeberg.org/StreamGraph/StreamGraph.git
synced 2024-11-13 19:49:55 +01:00
capitalize categories properly in add node menu (#49)
closes #34 Reviewed-on: https://codeberg.org/StreamGraph/StreamGraph/pulls/49 Co-authored-by: Lera Elvoé <yagich@poto.cafe> Co-committed-by: Lera Elvoé <yagich@poto.cafe>
This commit is contained in:
parent
7ef913c13b
commit
bb7b7d0adb
2 changed files with 12 additions and 1 deletions
|
@ -13,6 +13,11 @@ const NODE_INDEX_CACHE_PATH := "user://nodes_index.json"
|
|||
## Filepath where the the list of Favorite Nodes is stored.
|
||||
const FAVORITE_NODES_PATH := "user://favorite_nodes.json"
|
||||
|
||||
## A map of [code]snake_case[/code] category names for proper capitalization.
|
||||
const CATEGORY_CAPITALIZATION := {
|
||||
"obs": "OBS"
|
||||
}
|
||||
|
||||
## [Array] used for storing all the "Favorite" Nodes that were set in the [AddNodeMenu]
|
||||
var favorite_nodes: Array[String]
|
||||
|
||||
|
@ -128,6 +133,12 @@ func load_favorites() -> void:
|
|||
func is_node_favorite(node_type: String) -> bool:
|
||||
return node_type in favorite_nodes
|
||||
|
||||
|
||||
## Returns a capitalized category string.
|
||||
func get_category_capitalization(category: String) -> String:
|
||||
return CATEGORY_CAPITALIZATION.get(category, category.capitalize())
|
||||
|
||||
|
||||
## Used for storing the shorthand data of a [DeckNode].
|
||||
##
|
||||
## Allows for more simply storing [DeckNode]s properties without needing to
|
||||
|
|
|
@ -25,7 +25,7 @@ func _ready() -> void:
|
|||
|
||||
## Add a new category to the menu.
|
||||
func add_category(category_name: String) -> void:
|
||||
var c := Category.new(category_name.capitalize())
|
||||
var c := Category.new(NodeDB.get_category_capitalization(category_name))
|
||||
categories[category_name] = c
|
||||
scroll_content_container.add_child(c)
|
||||
c.collapse_toggled.connect(_on_category_collapse_toggled.bind(category_name))
|
||||
|
|
Loading…
Reference in a new issue