mirror of
https://codeberg.org/StreamGraph/StreamGraph.git
synced 2024-11-13 19:49:55 +01:00
format
This commit is contained in:
parent
1fb71617bb
commit
a427535ff5
4 changed files with 32 additions and 32 deletions
|
@ -37,7 +37,7 @@ func _ready() -> void:
|
||||||
|
|
||||||
file_dialog.canceled.connect(disconnect_file_dialog_signals)
|
file_dialog.canceled.connect(disconnect_file_dialog_signals)
|
||||||
|
|
||||||
## Called when the File button in the [MenuBar] is pressed with the [param id]
|
## Called when the File button in the [MenuBar] is pressed with the [param id]
|
||||||
## of the button within it that was pressed.
|
## of the button within it that was pressed.
|
||||||
func _on_file_id_pressed(id: int) -> void:
|
func _on_file_id_pressed(id: int) -> void:
|
||||||
match id:
|
match id:
|
||||||
|
@ -65,7 +65,7 @@ func add_empty_deck() -> void:
|
||||||
func close_current_tab() -> void:
|
func close_current_tab() -> void:
|
||||||
tab_container.close_tab(tab_container.get_current_tab())
|
tab_container.close_tab(tab_container.get_current_tab())
|
||||||
|
|
||||||
## Opens [member file_dialog] with the mode [member FileDialog.FILE_MODE_SAVE_FILE]
|
## Opens [member file_dialog] with the mode [member FileDialog.FILE_MODE_SAVE_FILE]
|
||||||
## as well as getting a weakref to the active [Deck]
|
## as well as getting a weakref to the active [Deck]
|
||||||
func open_save_dialog(path: String) -> void:
|
func open_save_dialog(path: String) -> void:
|
||||||
file_dialog.file_mode = FileDialog.FILE_MODE_SAVE_FILE
|
file_dialog.file_mode = FileDialog.FILE_MODE_SAVE_FILE
|
||||||
|
@ -75,7 +75,7 @@ func open_save_dialog(path: String) -> void:
|
||||||
file_dialog.popup_centered()
|
file_dialog.popup_centered()
|
||||||
file_dialog.file_selected.connect(_on_file_dialog_save_file, CONNECT_ONE_SHOT)
|
file_dialog.file_selected.connect(_on_file_dialog_save_file, CONNECT_ONE_SHOT)
|
||||||
|
|
||||||
## Opens [member file_dialog] with the mode [FileDialog.FILE_MODE_OPEN_FILES]
|
## Opens [member file_dialog] with the mode [FileDialog.FILE_MODE_OPEN_FILES]
|
||||||
## with the supplied [param path]
|
## with the supplied [param path]
|
||||||
func open_open_dialog(path: String) -> void:
|
func open_open_dialog(path: String) -> void:
|
||||||
file_dialog.file_mode = FileDialog.FILE_MODE_OPEN_FILES
|
file_dialog.file_mode = FileDialog.FILE_MODE_OPEN_FILES
|
||||||
|
@ -84,7 +84,7 @@ func open_open_dialog(path: String) -> void:
|
||||||
file_dialog.popup_centered()
|
file_dialog.popup_centered()
|
||||||
file_dialog.files_selected.connect(_on_file_dialog_open_files, CONNECT_ONE_SHOT)
|
file_dialog.files_selected.connect(_on_file_dialog_open_files, CONNECT_ONE_SHOT)
|
||||||
|
|
||||||
## Connected to [signal FileDialog.save_file] on [member file_dialog].
|
## Connected to [signal FileDialog.save_file] on [member file_dialog].
|
||||||
## Saves the selected [Deck] if it still exists.
|
## Saves the selected [Deck] if it still exists.
|
||||||
func _on_file_dialog_save_file(path: String) -> void:
|
func _on_file_dialog_save_file(path: String) -> void:
|
||||||
var deck: Deck = _deck_to_save.get_ref() as Deck
|
var deck: Deck = _deck_to_save.get_ref() as Deck
|
||||||
|
@ -96,7 +96,7 @@ func _on_file_dialog_save_file(path: String) -> void:
|
||||||
var f := FileAccess.open(path, FileAccess.WRITE)
|
var f := FileAccess.open(path, FileAccess.WRITE)
|
||||||
f.store_string(json)
|
f.store_string(json)
|
||||||
|
|
||||||
## Connected to [signal FileDialog.open_files] on [member file_dialog]. Opens
|
## Connected to [signal FileDialog.open_files] on [member file_dialog]. Opens
|
||||||
## the selected paths, instantiating [DeckRenderGraphEdit]s and [Deck]s for each.
|
## the selected paths, instantiating [DeckRenderGraphEdit]s and [Deck]s for each.
|
||||||
func _on_file_dialog_open_files(paths: PackedStringArray) -> void:
|
func _on_file_dialog_open_files(paths: PackedStringArray) -> void:
|
||||||
for path in paths:
|
for path in paths:
|
||||||
|
@ -131,8 +131,8 @@ func disconnect_file_dialog_signals() -> void:
|
||||||
if file_dialog.files_selected.is_connected(_on_file_dialog_open_files):
|
if file_dialog.files_selected.is_connected(_on_file_dialog_open_files):
|
||||||
file_dialog.files_selected.disconnect(_on_file_dialog_open_files)
|
file_dialog.files_selected.disconnect(_on_file_dialog_open_files)
|
||||||
|
|
||||||
## Connected to [signal DeckRenderGraphEdit.group_entered_request] to allow entering
|
## Connected to [signal DeckRenderGraphEdit.group_entered_request] to allow entering
|
||||||
## groups based off the given [param group_id] and [param deck]. As well as adding
|
## groups based off the given [param group_id] and [param deck]. As well as adding
|
||||||
## a corresponding tab to [member tab_container]
|
## a corresponding tab to [member tab_container]
|
||||||
func _on_deck_renderer_group_enter_requested(group_id: String, deck: Deck) -> void:
|
func _on_deck_renderer_group_enter_requested(group_id: String, deck: Deck) -> void:
|
||||||
var group_deck := deck.get_group(group_id)
|
var group_deck := deck.get_group(group_id)
|
||||||
|
|
|
@ -3,11 +3,11 @@ class_name DeckNodeRendererGraphNode
|
||||||
|
|
||||||
## [GraphNode] based renderer of [DeckNode]
|
## [GraphNode] based renderer of [DeckNode]
|
||||||
|
|
||||||
## Stores the data container [DeckNode] that the visuals of this [DeckNodeRendererGraphNode]
|
## Stores the data container [DeckNode] that the visuals of this [DeckNodeRendererGraphNode]
|
||||||
## are based off.
|
## are based off.
|
||||||
var node: DeckNode
|
var node: DeckNode
|
||||||
|
|
||||||
## Setups up all the properties based off [member node]. Including looping through
|
## Setups up all the properties based off [member node]. Including looping through
|
||||||
## [method DeckNode.get_all_ports()] and setting up all the descriptors.
|
## [method DeckNode.get_all_ports()] and setting up all the descriptors.
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
title = node.name
|
title = node.name
|
||||||
|
@ -55,20 +55,20 @@ func _ready() -> void:
|
||||||
Color.WHITE,
|
Color.WHITE,
|
||||||
)
|
)
|
||||||
|
|
||||||
## Connected to [signal GraphElement.position_offset_updated] and updates the
|
## Connected to [signal GraphElement.position_offset_updated] and updates the
|
||||||
## [member node]s properties
|
## [member node]s properties
|
||||||
func _on_position_offset_changed() -> void:
|
func _on_position_offset_changed() -> void:
|
||||||
node.position.x = position_offset.x
|
node.position.x = position_offset.x
|
||||||
node.position.y = position_offset.y
|
node.position.y = position_offset.y
|
||||||
|
|
||||||
## Connected to [member node]s [signal position_updated] to keep parity with the
|
## Connected to [member node]s [signal position_updated] to keep parity with the
|
||||||
## data position.
|
## data position.
|
||||||
func _on_node_position_updated(new_position: Dictionary) -> void:
|
func _on_node_position_updated(new_position: Dictionary) -> void:
|
||||||
position_offset.x = new_position.x
|
position_offset.x = new_position.x
|
||||||
position_offset.y = new_position.y
|
position_offset.y = new_position.y
|
||||||
|
|
||||||
## Connected to [member node]s [signal port_added] handles setting up the specified
|
## Connected to [member node]s [signal port_added] handles setting up the specified
|
||||||
## [member Port.descriptor] with it's required nodes/signals etc. + adding the port
|
## [member Port.descriptor] with it's required nodes/signals etc. + adding the port
|
||||||
## using [method GraphNode.set_slot]
|
## using [method GraphNode.set_slot]
|
||||||
func _on_node_port_added(port_idx: int) -> void:
|
func _on_node_port_added(port_idx: int) -> void:
|
||||||
var port := node.get_all_ports()[port_idx]
|
var port := node.get_all_ports()[port_idx]
|
||||||
|
@ -112,7 +112,7 @@ func _on_node_port_added(port_idx: int) -> void:
|
||||||
Color.WHITE,
|
Color.WHITE,
|
||||||
)
|
)
|
||||||
|
|
||||||
## Connected to [member node]s [signal port_removed], queue_frees the [Node]
|
## Connected to [member node]s [signal port_removed], queue_frees the [Node]
|
||||||
## used for the descriptor, as well as using [method GraphNode.set_slot] to remove the slot.
|
## used for the descriptor, as well as using [method GraphNode.set_slot] to remove the slot.
|
||||||
func _on_node_port_removed(port_idx: int) -> void:
|
func _on_node_port_removed(port_idx: int) -> void:
|
||||||
set_slot(
|
set_slot(
|
||||||
|
@ -127,7 +127,7 @@ func _on_node_port_removed(port_idx: int) -> void:
|
||||||
|
|
||||||
get_child(port_idx).queue_free()
|
get_child(port_idx).queue_free()
|
||||||
|
|
||||||
## Connected to [member node]s [signal ports_updated]. Remakes all of the ports
|
## Connected to [member node]s [signal ports_updated]. Remakes all of the ports
|
||||||
## + their descriptors whenever this is received to allow keeping the Renderers ports up to date.
|
## + their descriptors whenever this is received to allow keeping the Renderers ports up to date.
|
||||||
func _on_node_ports_updated() -> void:
|
func _on_node_ports_updated() -> void:
|
||||||
clear_all_slots()
|
clear_all_slots()
|
||||||
|
|
|
@ -13,7 +13,7 @@ var add_node_menu: AddNodeMenu
|
||||||
|
|
||||||
## Used to specify the size of [member search_popup_panel].
|
## Used to specify the size of [member search_popup_panel].
|
||||||
@export var search_popup_size: Vector2i = Vector2i(500, 300)
|
@export var search_popup_size: Vector2i = Vector2i(500, 300)
|
||||||
## Stores the position of the [member search_popup_panel] for use when adding
|
## Stores the position of the [member search_popup_panel] for use when adding
|
||||||
## nodes in [method _on_add_node_menu_node_selected]
|
## nodes in [method _on_add_node_menu_node_selected]
|
||||||
var popup_position: Vector2
|
var popup_position: Vector2
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ var deck: Deck:
|
||||||
signal group_enter_requested(group_id: String)
|
signal group_enter_requested(group_id: String)
|
||||||
|
|
||||||
## Sets up the [member search_popup_panel] with an instance of [member ADD_NODE_SCENE]
|
## Sets up the [member search_popup_panel] with an instance of [member ADD_NODE_SCENE]
|
||||||
## stored in [member add_node_menu]. And sets its size of [member search_popup_panel] to
|
## stored in [member add_node_menu]. And sets its size of [member search_popup_panel] to
|
||||||
## [member add_node_popup_size]
|
## [member add_node_popup_size]
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
add_node_menu = ADD_NODE_MENU_SCENE.instantiate()
|
add_node_menu = ADD_NODE_MENU_SCENE.instantiate()
|
||||||
|
@ -42,7 +42,7 @@ func _ready() -> void:
|
||||||
connection_request.connect(attempt_connection)
|
connection_request.connect(attempt_connection)
|
||||||
disconnection_request.connect(attempt_disconnect)
|
disconnection_request.connect(attempt_disconnect)
|
||||||
|
|
||||||
## Receives [signal GraphEdit.connection_request] and attempts to create a
|
## Receives [signal GraphEdit.connection_request] and attempts to create a
|
||||||
## connection between the two [DeckNode]s involved, utilizes [NodeDB] for accessing them.
|
## connection between the two [DeckNode]s involved, utilizes [NodeDB] for accessing them.
|
||||||
func attempt_connection(from_node_name: StringName, from_port: int, to_node_name: StringName, to_port: int) -> void:
|
func attempt_connection(from_node_name: StringName, from_port: int, to_node_name: StringName, to_port: int) -> void:
|
||||||
var from_node_renderer: DeckNodeRendererGraphNode = get_node(NodePath(from_node_name))
|
var from_node_renderer: DeckNodeRendererGraphNode = get_node(NodePath(from_node_name))
|
||||||
|
@ -59,7 +59,7 @@ func attempt_connection(from_node_name: StringName, from_port: int, to_node_name
|
||||||
to_port
|
to_port
|
||||||
)
|
)
|
||||||
|
|
||||||
## Receives [signal GraphEdit.disconnection_request] and attempts to disconnect the two [DeckNode]s
|
## Receives [signal GraphEdit.disconnection_request] and attempts to disconnect the two [DeckNode]s
|
||||||
## involved, utilizes [NodeDB] for accessing them.
|
## involved, utilizes [NodeDB] for accessing them.
|
||||||
func attempt_disconnect(from_node_name: StringName, from_port: int, to_node_name: StringName, to_port: int) -> void:
|
func attempt_disconnect(from_node_name: StringName, from_port: int, to_node_name: StringName, to_port: int) -> void:
|
||||||
var from_node_renderer: DeckNodeRendererGraphNode = get_node(NodePath(from_node_name))
|
var from_node_renderer: DeckNodeRendererGraphNode = get_node(NodePath(from_node_name))
|
||||||
|
@ -77,7 +77,7 @@ func attempt_disconnect(from_node_name: StringName, from_port: int, to_node_name
|
||||||
to_port
|
to_port
|
||||||
)
|
)
|
||||||
|
|
||||||
## Returns the associated [DeckNodeRendererGraphNode] for the supplied [DeckNode].
|
## Returns the associated [DeckNodeRendererGraphNode] for the supplied [DeckNode].
|
||||||
## Or [code]null[/code] if none is found.
|
## Or [code]null[/code] if none is found.
|
||||||
func get_node_renderer(node: DeckNode) -> DeckNodeRendererGraphNode:
|
func get_node_renderer(node: DeckNode) -> DeckNodeRendererGraphNode:
|
||||||
for i: DeckNodeRendererGraphNode in get_children().slice(1):
|
for i: DeckNodeRendererGraphNode in get_children().slice(1):
|
||||||
|
@ -114,7 +114,7 @@ func initialize_from_deck() -> void:
|
||||||
|
|
||||||
refresh_connections()
|
refresh_connections()
|
||||||
|
|
||||||
## Loops through all [DeckNode]s in [member Deck.nodes] and calls
|
## Loops through all [DeckNode]s in [member Deck.nodes] and calls
|
||||||
## [method GraphEdit.connect_node] for all the connections that exist in each
|
## [method GraphEdit.connect_node] for all the connections that exist in each
|
||||||
func refresh_connections() -> void:
|
func refresh_connections() -> void:
|
||||||
for node_id in deck.nodes:
|
for node_id in deck.nodes:
|
||||||
|
@ -146,7 +146,7 @@ func refresh_connections() -> void:
|
||||||
to_node_port
|
to_node_port
|
||||||
)
|
)
|
||||||
|
|
||||||
## Connected to [signal Deck.node_added], used to instance the required
|
## Connected to [signal Deck.node_added], used to instance the required
|
||||||
## [DeckNodeRendererGraphNode] and set it's [member DeckNodeRenderGraphNode.position_offset]
|
## [DeckNodeRendererGraphNode] and set it's [member DeckNodeRenderGraphNode.position_offset]
|
||||||
func _on_deck_node_added(node: DeckNode) -> void:
|
func _on_deck_node_added(node: DeckNode) -> void:
|
||||||
var inst: DeckNodeRendererGraphNode = NODE_SCENE.instantiate()
|
var inst: DeckNodeRendererGraphNode = NODE_SCENE.instantiate()
|
||||||
|
@ -154,7 +154,7 @@ func _on_deck_node_added(node: DeckNode) -> void:
|
||||||
add_child(inst)
|
add_child(inst)
|
||||||
inst.position_offset = inst.node.position_as_vector2()
|
inst.position_offset = inst.node.position_as_vector2()
|
||||||
|
|
||||||
## Connected to [signal Deck.node_added], used to remove the specified
|
## Connected to [signal Deck.node_added], used to remove the specified
|
||||||
## [DeckNodeRendererGraphNode] and queue_free it.
|
## [DeckNodeRendererGraphNode] and queue_free it.
|
||||||
func _on_deck_node_removed(node: DeckNode) -> void:
|
func _on_deck_node_removed(node: DeckNode) -> void:
|
||||||
for renderer: DeckNodeRendererGraphNode in get_children().slice(1):
|
for renderer: DeckNodeRendererGraphNode in get_children().slice(1):
|
||||||
|
@ -186,7 +186,7 @@ func _gui_input(event: InputEvent) -> void:
|
||||||
refresh_connections()
|
refresh_connections()
|
||||||
get_viewport().set_input_as_handled()
|
get_viewport().set_input_as_handled()
|
||||||
|
|
||||||
## Handles entering groups with action "enter_group". Done here to bypass neighbor
|
## Handles entering groups with action "enter_group". Done here to bypass neighbor
|
||||||
## functionality.
|
## functionality.
|
||||||
func _input(event: InputEvent) -> void:
|
func _input(event: InputEvent) -> void:
|
||||||
if !has_focus():
|
if !has_focus():
|
||||||
|
@ -208,8 +208,8 @@ func _on_popup_request(p_popup_position: Vector2) -> void:
|
||||||
add_node_menu.focus_search_bar()
|
add_node_menu.focus_search_bar()
|
||||||
popup_position = p_popup_position
|
popup_position = p_popup_position
|
||||||
|
|
||||||
## Connected to [signal AddNodeMenu.node_selected] and creates a [DeckNode] using
|
## Connected to [signal AddNodeMenu.node_selected] and creates a [DeckNode] using
|
||||||
## [method NodeDB.instance_node]. Then placing it at the [member scroll_offset] +
|
## [method NodeDB.instance_node]. Then placing it at the [member scroll_offset] +
|
||||||
## [member popup_position] / [member zoom]
|
## [member popup_position] / [member zoom]
|
||||||
func _on_add_node_menu_node_selected(type: String) -> void:
|
func _on_add_node_menu_node_selected(type: String) -> void:
|
||||||
var node := NodeDB.instance_node(type) as DeckNode
|
var node := NodeDB.instance_node(type) as DeckNode
|
||||||
|
|
|
@ -2,12 +2,12 @@ extends VBoxContainer
|
||||||
class_name TabContainerCustom
|
class_name TabContainerCustom
|
||||||
|
|
||||||
## Custom Recreation of [TabContainer] for Flexibility
|
## Custom Recreation of [TabContainer] for Flexibility
|
||||||
##
|
##
|
||||||
## Allows for more customizability within the [TabBar] thats used mainly. Extra buttons etc.
|
## Allows for more customizability within the [TabBar] thats used mainly. Extra buttons etc.
|
||||||
|
|
||||||
## Reference to the [TabBar] at the top of the Container.
|
## Reference to the [TabBar] at the top of the Container.
|
||||||
@onready var tab_bar: TabBar = %TabBar
|
@onready var tab_bar: TabBar = %TabBar
|
||||||
## Reference to the [Button] at the end of the [TabBar] that's
|
## Reference to the [Button] at the end of the [TabBar] that's
|
||||||
## used for adding new Tabs
|
## used for adding new Tabs
|
||||||
@onready var add_tab_button: Button = %Button
|
@onready var add_tab_button: Button = %Button
|
||||||
## Reference to the [MarginContainer] around the Tabs Contents.
|
## Reference to the [MarginContainer] around the Tabs Contents.
|
||||||
|
@ -17,10 +17,10 @@ class_name TabContainerCustom
|
||||||
signal add_button_pressed
|
signal add_button_pressed
|
||||||
## Emitted when the current tab in [member tab_bar] is changed.
|
## Emitted when the current tab in [member tab_bar] is changed.
|
||||||
signal tab_changed(tab: int)
|
signal tab_changed(tab: int)
|
||||||
## Emitted when a tab in [member tab_bar] has been closed.
|
## Emitted when a tab in [member tab_bar] has been closed.
|
||||||
## See [signal TabBar.tab_close_requested]
|
## See [signal TabBar.tab_close_requested]
|
||||||
signal tab_closed(tab: int)
|
signal tab_closed(tab: int)
|
||||||
## Emitted when a request to close a tab in the [member tab_bar] has been
|
## Emitted when a request to close a tab in the [member tab_bar] has been
|
||||||
## requested using [signal TabBar.tab_close_pressed]
|
## requested using [signal TabBar.tab_close_pressed]
|
||||||
signal tab_close_requested(tab: int)
|
signal tab_close_requested(tab: int)
|
||||||
## Emitted when the order of the tabs in [member tab_bar] has been changed.
|
## Emitted when the order of the tabs in [member tab_bar] has been changed.
|
||||||
|
@ -90,12 +90,12 @@ func get_current_tab() -> int:
|
||||||
func get_content(idx: int) -> Control:
|
func get_content(idx: int) -> Control:
|
||||||
return content_container.get_child(idx)
|
return content_container.get_child(idx)
|
||||||
|
|
||||||
## Sets the metadata value for the tab at index [param tab_idx], which can be
|
## Sets the metadata value for the tab at index [param tab_idx], which can be
|
||||||
## retrieved later using [method TabBar.get_tab_metadata()]
|
## retrieved later using [method TabBar.get_tab_metadata()]
|
||||||
func set_tab_metadata(tab: int, metadata: Variant) -> void:
|
func set_tab_metadata(tab: int, metadata: Variant) -> void:
|
||||||
tab_bar.set_tab_metadata(tab, metadata)
|
tab_bar.set_tab_metadata(tab, metadata)
|
||||||
|
|
||||||
## Returns the metadata value set to the tab at index [param tab_idx] using set_tab_metadata().
|
## Returns the metadata value set to the tab at index [param tab_idx] using set_tab_metadata().
|
||||||
## If no metadata was previously set, returns null by default.
|
## If no metadata was previously set, returns null by default.
|
||||||
func get_tab_metadata(tab: int) -> Variant:
|
func get_tab_metadata(tab: int) -> Variant:
|
||||||
return tab_bar.get_tab_metadata(tab)
|
return tab_bar.get_tab_metadata(tab)
|
||||||
|
|
Loading…
Reference in a new issue