replace C-style boolean operators with their keyword counterparts (#72)

closes #71

Reviewed-on: https://codeberg.org/StreamGraph/StreamGraph/pulls/72
Co-authored-by: Lera Elvoé <yagich@poto.cafe>
Co-committed-by: Lera Elvoé <yagich@poto.cafe>
This commit is contained in:
Lera Elvoé 2024-02-21 06:11:29 +00:00 committed by yagich
parent 51652ef277
commit c3a91d0848
29 changed files with 90 additions and 90 deletions

View file

@ -19,7 +19,7 @@ static func _twitch_chat_received(msg_dict : Dictionary):
## Temporary Function for loading generic Connection credentials from user:// as a [CredSaver] Resource ## Temporary Function for loading generic Connection credentials from user:// as a [CredSaver] Resource
static func load_credentials(service : String): static func load_credentials(service : String):
if !FileAccess.file_exists("user://" + service + "_creds.res"): if not FileAccess.file_exists("user://" + service + "_creds.res"):
DeckHolder.logger.log_system("No Credentials exist for " + service + " Service", Logger.LogType.WARN) DeckHolder.logger.log_system("No Credentials exist for " + service + " Service", Logger.LogType.WARN)
return null return null
@ -27,7 +27,7 @@ static func load_credentials(service : String):
var creds = ResourceLoader.load("user://" + service + "_creds.res") var creds = ResourceLoader.load("user://" + service + "_creds.res")
if !creds is CredSaver: if not creds is CredSaver:
DeckHolder.logger.log_system("Error loading Credentials for " + service + " Service", Logger.LogType.ERROR) DeckHolder.logger.log_system("Error loading Credentials for " + service + " Service", Logger.LogType.ERROR)
return null return null

View file

@ -85,24 +85,24 @@ func add_node_inst(node: DeckNode, assign_id: String = "", assign_to_self: bool
if emit_node_added_signal: if emit_node_added_signal:
node_added.emit(node) node_added.emit(node)
if is_group && emit_group_signals: if is_group and emit_group_signals:
node_added_to_group.emit(node, node._id, assign_to_self, self) node_added_to_group.emit(node, node._id, assign_to_self, self)
node.port_value_updated.connect( node.port_value_updated.connect(
func(port_idx: int, new_value: Variant): func(port_idx: int, new_value: Variant):
if is_group && emit_group_signals: if is_group and emit_group_signals:
node_port_value_updated.emit(node._id, port_idx, new_value, self) node_port_value_updated.emit(node._id, port_idx, new_value, self)
) )
node.renamed.connect( node.renamed.connect(
func(new_name: String): func(new_name: String):
if is_group && emit_group_signals: if is_group and emit_group_signals:
node_renamed.emit(node._id, new_name, self) node_renamed.emit(node._id, new_name, self)
) )
node.position_updated.connect( node.position_updated.connect(
func(new_position: Dictionary): func(new_position: Dictionary):
if is_group && emit_group_signals: if is_group and emit_group_signals:
node_moved.emit(node._id, new_position, self) node_moved.emit(node._id, new_position, self)
) )
@ -126,14 +126,14 @@ func is_valid_connection(from_node_id: String, to_node_id: String, from_output_p
var usage_from: Port.UsageType = from_node.get_output_ports()[from_output_port].usage_type var usage_from: Port.UsageType = from_node.get_output_ports()[from_output_port].usage_type
var usage_to: Port.UsageType = to_node.get_input_ports()[to_input_port].usage_type var usage_to: Port.UsageType = to_node.get_input_ports()[to_input_port].usage_type
# incompatible usages # incompatible usages
if (usage_from != Port.UsageType.BOTH) && (usage_to != Port.UsageType.BOTH): if (usage_from != Port.UsageType.BOTH) and (usage_to != Port.UsageType.BOTH):
if usage_from != usage_to: if usage_from != usage_to:
return false return false
var type_from: DeckType.Types = from_node.get_output_ports()[from_output_port].type var type_from: DeckType.Types = from_node.get_output_ports()[from_output_port].type
var type_to: DeckType.Types = to_node.get_input_ports()[to_input_port].type var type_to: DeckType.Types = to_node.get_input_ports()[to_input_port].type
# incompatible types # incompatible types
if !DeckType.can_convert(type_from, type_to): if not DeckType.can_convert(type_from, type_to):
return false return false
# duplicate connection # duplicate connection
@ -145,7 +145,7 @@ func is_valid_connection(from_node_id: String, to_node_id: String, from_output_p
## Attempt to connect two nodes. Returns [code]true[/code] if the connection succeeded. ## Attempt to connect two nodes. Returns [code]true[/code] if the connection succeeded.
func connect_nodes(from_node_id: String, to_node_id: String, from_output_port: int, to_input_port: int) -> bool: func connect_nodes(from_node_id: String, to_node_id: String, from_output_port: int, to_input_port: int) -> bool:
if !is_valid_connection(from_node_id, to_node_id, from_output_port, to_input_port): if not is_valid_connection(from_node_id, to_node_id, from_output_port, to_input_port):
return false return false
var from_node := get_node(from_node_id) var from_node := get_node(from_node_id)
@ -157,7 +157,7 @@ func connect_nodes(from_node_id: String, to_node_id: String, from_output_port: i
var node_out_port: int = connection.values()[0] var node_out_port: int = connection.values()[0]
disconnect_nodes(node_id, to_node_id, node_out_port, to_input_port) disconnect_nodes(node_id, to_node_id, node_out_port, to_input_port)
if is_group && emit_group_signals: if is_group and emit_group_signals:
nodes_connected_in_group.emit(from_node_id, to_node_id, from_output_port, to_input_port, self) nodes_connected_in_group.emit(from_node_id, to_node_id, from_output_port, to_input_port, self)
from_node.add_outgoing_connection(from_output_port, to_node._id, to_input_port) from_node.add_outgoing_connection(from_output_port, to_node._id, to_input_port)
@ -170,7 +170,7 @@ func disconnect_nodes(from_node_id: String, to_node_id: String, from_output_port
var to_node := get_node(to_node_id) var to_node := get_node(to_node_id)
from_node.remove_outgoing_connection(from_output_port, to_node_id, to_input_port) from_node.remove_outgoing_connection(from_output_port, to_node_id, to_input_port)
to_node.remove_incoming_connection(to_input_port) to_node.remove_incoming_connection(to_input_port)
if is_group && emit_group_signals: if is_group and emit_group_signals:
nodes_disconnected_in_group.emit(from_node_id, to_node_id, from_output_port, to_input_port, self) nodes_disconnected_in_group.emit(from_node_id, to_node_id, from_output_port, to_input_port, self)
nodes_disconnected.emit(from_node_id, to_node_id, from_output_port, to_input_port) nodes_disconnected.emit(from_node_id, to_node_id, from_output_port, to_input_port)
@ -178,7 +178,7 @@ func disconnect_nodes(from_node_id: String, to_node_id: String, from_output_port
## Returns true if this deck has no nodes and no variables. ## Returns true if this deck has no nodes and no variables.
func is_empty() -> bool: func is_empty() -> bool:
return nodes.is_empty() && variable_stack.is_empty() return nodes.is_empty() and variable_stack.is_empty()
## Remove a node from this deck. ## Remove a node from this deck.
@ -187,10 +187,10 @@ func remove_node(uuid: String, remove_connections: bool = false, force: bool = f
if node == null: if node == null:
return return
if !node.user_can_delete && !force: if not node.user_can_delete and not force:
return return
if node.node_type == "group_node" && !keep_group_instances: if node.node_type == "group_node" and not keep_group_instances:
DeckHolder.close_group_instance(node.group_id, node.group_instance_id) DeckHolder.close_group_instance(node.group_id, node.group_instance_id)
if remove_connections: if remove_connections:
@ -211,7 +211,7 @@ func remove_node(uuid: String, remove_connections: bool = false, force: bool = f
node_removed.emit(node) node_removed.emit(node)
if is_group && emit_group_signals: if is_group and emit_group_signals:
node_removed_from_group.emit(uuid, remove_connections, self) node_removed_from_group.emit(uuid, remove_connections, self)
@ -272,14 +272,14 @@ func group_nodes(nodes_to_group: Array) -> Deck:
for from_port: int in outgoing_connections: for from_port: int in outgoing_connections:
for to_node: String in outgoing_connections[from_port]: for to_node: String in outgoing_connections[from_port]:
for to_port: int in outgoing_connections[from_port][to_node]: for to_port: int in outgoing_connections[from_port][to_node]:
if !(to_node in node_ids_to_keep): if to_node not in node_ids_to_keep:
disconnect_nodes(node._id, to_node, from_port, to_port) disconnect_nodes(node._id, to_node, from_port, to_port)
var incoming_connections := node.incoming_connections.duplicate(true) var incoming_connections := node.incoming_connections.duplicate(true)
for to_port: int in incoming_connections: for to_port: int in incoming_connections:
for from_node: String in incoming_connections[to_port]: for from_node: String in incoming_connections[to_port]:
if !(from_node in node_ids_to_keep): if from_node not in node_ids_to_keep:
disconnect_nodes(from_node, node._id, incoming_connections[to_port][from_node], to_port) disconnect_nodes(from_node, node._id, incoming_connections[to_port][from_node], to_port)
midpoint += node.position_as_vector2() midpoint += node.position_as_vector2()
@ -338,12 +338,12 @@ func copy_nodes(nodes_to_copy: Array[String]) -> Dictionary:
for from_port: int in outgoing_connections: for from_port: int in outgoing_connections:
for to_node: String in outgoing_connections[from_port]: for to_node: String in outgoing_connections[from_port]:
if !(to_node in nodes_to_copy): if to_node not in nodes_to_copy:
(d.nodes[node].outgoing_connections[from_port] as Dictionary).erase(to_node) (d.nodes[node].outgoing_connections[from_port] as Dictionary).erase(to_node)
var outgoing_is_empty: bool = true var outgoing_is_empty: bool = true
for from_port: int in d.nodes[node].outgoing_connections: for from_port: int in d.nodes[node].outgoing_connections:
if !(d.nodes[node].outgoing_connections[from_port] as Dictionary).is_empty(): if not (d.nodes[node].outgoing_connections[from_port] as Dictionary).is_empty():
outgoing_is_empty = false outgoing_is_empty = false
break break
@ -354,12 +354,12 @@ func copy_nodes(nodes_to_copy: Array[String]) -> Dictionary:
for to_port: int in incoming_connections: for to_port: int in incoming_connections:
for from_node: String in incoming_connections[to_port]: for from_node: String in incoming_connections[to_port]:
if !(from_node in nodes_to_copy): if from_node not in nodes_to_copy:
(d.nodes[node].incoming_connections[to_port] as Dictionary).erase(from_node) (d.nodes[node].incoming_connections[to_port] as Dictionary).erase(from_node)
var incoming_is_empty: bool = true var incoming_is_empty: bool = true
for to_port: int in d.nodes[node].incoming_connections: for to_port: int in d.nodes[node].incoming_connections:
if !(d.nodes[node].incoming_connections[to_port] as Dictionary).is_empty(): if not (d.nodes[node].incoming_connections[to_port] as Dictionary).is_empty():
incoming_is_empty = false incoming_is_empty = false
break break
@ -388,7 +388,7 @@ func allocate_ids(count: int) -> Array[String]:
func paste_nodes_from_dict(nodes: Dictionary, position: Vector2 = Vector2()) -> void: func paste_nodes_from_dict(nodes: Dictionary, position: Vector2 = Vector2()) -> void:
if !nodes.get("nodes"): if not nodes.get("nodes"):
return return
var new_ids := allocate_ids(nodes.nodes.size()) var new_ids := allocate_ids(nodes.nodes.size())
@ -475,7 +475,7 @@ func to_dict(with_meta: bool = true, group_ids: Array = []) -> Dictionary:
for node_id: String in nodes.keys(): for node_id: String in nodes.keys():
inner["nodes"][node_id] = nodes[node_id].to_dict(with_meta) inner["nodes"][node_id] = nodes[node_id].to_dict(with_meta)
if (nodes[node_id] as DeckNode).node_type == "group_node": if (nodes[node_id] as DeckNode).node_type == "group_node":
if !(nodes[node_id].group_id in group_ids): if nodes[node_id].group_id not in group_ids:
inner["groups"][nodes[node_id].group_id] = DeckHolder.get_deck(nodes[node_id].group_id).to_dict(with_meta, group_ids) inner["groups"][nodes[node_id].group_id] = DeckHolder.get_deck(nodes[node_id].group_id).to_dict(with_meta, group_ids)
group_ids.append(nodes[node_id].group_id) group_ids.append(nodes[node_id].group_id)

View file

@ -77,17 +77,17 @@ static func connect_group_signals(group: Deck) -> void:
static func get_deck(id: String) -> Deck: static func get_deck(id: String) -> Deck:
if !decks.has(id): if not decks.has(id):
return null return null
if !(decks[id] is Dictionary): if not decks[id] is Dictionary:
return decks[id] return decks[id]
else: else:
return (decks[id] as Dictionary).values()[0] return (decks[id] as Dictionary).values()[0]
static func get_group_instance(group_id: String, instance_id: String) -> Deck: static func get_group_instance(group_id: String, instance_id: String) -> Deck:
if !decks.has(group_id): if not decks.has(group_id):
return null return null
if decks[group_id] is Dictionary: if decks[group_id] is Dictionary:

View file

@ -166,7 +166,7 @@ func add_incoming_connection(to_port: int, from_node: String, from_port: int) ->
## Returns [code]null[/code] if no incoming connection exists on that port. ## Returns [code]null[/code] if no incoming connection exists on that port.
## The connected node may also return [code]null[/code]. ## The connected node may also return [code]null[/code].
func request_value_async(on_port: int) -> Variant: func request_value_async(on_port: int) -> Variant:
if !incoming_connections.has(on_port): if not incoming_connections.has(on_port):
return null return null
var connection: Dictionary = incoming_connections[on_port] var connection: Dictionary = incoming_connections[on_port]
@ -208,15 +208,15 @@ func remove_incoming_connection(to_port: int) -> void:
## Returns [code]true[/code] if the exact connection from this node exists. ## Returns [code]true[/code] if the exact connection from this node exists.
func has_outgoing_connection_exact(from_port: int, to_node: String, to_port: int) -> bool: func has_outgoing_connection_exact(from_port: int, to_node: String, to_port: int) -> bool:
if !outgoing_connections.has(from_port): if not outgoing_connections.has(from_port):
return false return false
var connection: Dictionary = outgoing_connections[from_port] var connection: Dictionary = outgoing_connections[from_port]
if !connection.has(to_node): if not connection.has(to_node):
return false return false
var connections_to_node: Array = connection[to_node] var connections_to_node: Array = connection[to_node]
if !(to_port in connections_to_node): if to_port not in connections_to_node:
return false return false
return true return true
@ -320,7 +320,7 @@ func resolve_input_port_value_async(input_port: int, empty_value: Variant = null
var request = await request_value_async(input_port) var request = await request_value_async(input_port)
if request != null: if request != null:
return request return request
elif get_input_ports()[input_port].value_callback.get_object() && get_input_ports()[input_port].value_callback.call() != empty_value: elif get_input_ports()[input_port].value_callback.get_object() and get_input_ports()[input_port].value_callback.call() != empty_value:
return get_input_ports()[input_port].value_callback.call() return get_input_ports()[input_port].value_callback.call()
elif get_input_ports()[input_port].value != empty_value: elif get_input_ports()[input_port].value != empty_value:
return get_input_ports()[input_port].value return get_input_ports()[input_port].value

View file

@ -68,7 +68,7 @@ func create_descriptors(path: String) -> void:
## Helper Function that instances a [DeckNode] based off of it's [member DeckNode.node_type] ## Helper Function that instances a [DeckNode] based off of it's [member DeckNode.node_type]
func instance_node(type: String) -> DeckNode: func instance_node(type: String) -> DeckNode:
if !nodes.has(type): if not nodes.has(type):
return null return null
return load(nodes[type]["script_path"]).new() return load(nodes[type]["script_path"]).new()
@ -108,7 +108,7 @@ func load_node_index() -> bool:
## Sets a specific [member DeckNode.node_type] to be a "favorite" for use in ## Sets a specific [member DeckNode.node_type] to be a "favorite" for use in
## [AddNodeMenu]. Then stores the updated list of favorites at [member FAVORITE_NODES_PATH] ## [AddNodeMenu]. Then stores the updated list of favorites at [member FAVORITE_NODES_PATH]
func set_node_favorite(node_type: String, favorite: bool) -> void: func set_node_favorite(node_type: String, favorite: bool) -> void:
if (favorite && node_type in favorite_nodes) || (!favorite && !(node_type in favorite_nodes)): if (favorite and node_type in favorite_nodes) or (not favorite and node_type not in favorite_nodes):
return return
if favorite: if favorite:
@ -122,7 +122,7 @@ func set_node_favorite(node_type: String, favorite: bool) -> void:
## Loads the list of Favorite [memeber DeckNode.node_type]s from [member FAVORITE_NODES_PATH] ## Loads the list of Favorite [memeber DeckNode.node_type]s from [member FAVORITE_NODES_PATH]
func load_favorites() -> void: func load_favorites() -> void:
var f := FileAccess.open(FAVORITE_NODES_PATH, FileAccess.READ) var f := FileAccess.open(FAVORITE_NODES_PATH, FileAccess.READ)
if !f: if not f:
return return
var data: Array = JSON.parse_string(f.get_as_text()) var data: Array = JSON.parse_string(f.get_as_text())
favorite_nodes.clear() favorite_nodes.clear()

View file

@ -48,6 +48,6 @@ func _receive(to_input_port: int, data: Variant, extra_data: Array = []) -> void
#print(data_to_print) #print(data_to_print)
#print("extra data: ", extra_data) #print("extra data: ", extra_data)
DeckHolder.logger.log_node(data_to_print) DeckHolder.logger.log_node(data_to_print)
if !extra_data.is_empty(): if not extra_data.is_empty():
DeckHolder.logger.log_node(str("Extra data: ", extra_data)) DeckHolder.logger.log_node(str("Extra data: ", extra_data))
send(0, true) send(0, true)

View file

@ -34,7 +34,7 @@ func _event_received(event_name: StringName, event_data: Dictionary = {}) -> voi
var run = await resolve_input_port_value_async(0) == true var run = await resolve_input_port_value_async(0) == true
if !run: if not run:
return return
delta = event_data.delta delta = event_data.delta

View file

@ -29,7 +29,7 @@ func _init() -> void:
func _value_request(on_port: int) -> Variant: func _value_request(on_port: int) -> Variant:
var delimiter = await resolve_input_port_value_async(1) var delimiter = await resolve_input_port_value_async(1)
if !delimiter: if not delimiter:
DeckHolder.logger.log_node("Split: could not resolve delimiter. Returning: []", Logger.LogType.ERROR) DeckHolder.logger.log_node("Split: could not resolve delimiter. Returning: []", Logger.LogType.ERROR)
return [] return []

View file

@ -41,7 +41,7 @@ func _on_outgoing_connection_removed(port_idx: int) -> void:
#if !(outgoing_connections[port] as Array).is_empty(): #if !(outgoing_connections[port] as Array).is_empty():
#last_connected_port = port #last_connected_port = port
for port: int in outgoing_connections.keys().slice(1): for port: int in outgoing_connections.keys().slice(1):
if !(outgoing_connections.get(port, {}) as Dictionary).is_empty(): if not (outgoing_connections.get(port, {}) as Dictionary).is_empty():
last_connected_port = port last_connected_port = port
#prints("l:", last_connected_port, "p:", port_idx) #prints("l:", last_connected_port, "p:", port_idx)

View file

@ -33,12 +33,12 @@ func _pre_connection() -> void:
func init_io() -> void: func init_io() -> void:
#var group: Deck = _belonging_to.groups.get(group_id) as Deck #var group: Deck = _belonging_to.groups.get(group_id) as Deck
var group := DeckHolder.get_group_instance(group_id, group_instance_id) var group := DeckHolder.get_group_instance(group_id, group_instance_id)
if !group: if not group:
return return
if input_node && input_node.ports_updated.is_connected(recalculate_ports): if input_node and input_node.ports_updated.is_connected(recalculate_ports):
input_node.ports_updated.disconnect(recalculate_ports) input_node.ports_updated.disconnect(recalculate_ports)
if output_node && output_node.ports_updated.is_connected(recalculate_ports): if output_node and output_node.ports_updated.is_connected(recalculate_ports):
output_node.ports_updated.disconnect(recalculate_ports) output_node.ports_updated.disconnect(recalculate_ports)
input_node = group.get_node(group.group_input_node) input_node = group.get_node(group.group_input_node)

View file

@ -39,7 +39,7 @@ func _on_incoming_connection_added(port_idx: int) -> void:
func _on_incoming_connection_removed(port_idx: int) -> void: func _on_incoming_connection_removed(port_idx: int) -> void:
var last_connected_port := 0 var last_connected_port := 0
for port: int in incoming_connections.keys().slice(1): for port: int in incoming_connections.keys().slice(1):
if !(incoming_connections[port] as Dictionary).is_empty(): if not (incoming_connections[port] as Dictionary).is_empty():
last_connected_port = port last_connected_port = port
#prints("l:", last_connected_port, "p:", port_idx) #prints("l:", last_connected_port, "p:", port_idx)

View file

@ -27,15 +27,15 @@ func _value_request(_on_port: int) -> Variant:
var va = await request_value_async(0) var va = await request_value_async(0)
var vb = await request_value_async(1) var vb = await request_value_async(1)
if !va || !vb: if not va or not vb:
DeckHolder.logger.log_node("Vector Add: one of the vectors is invalid.", Logger.LogType.ERROR) DeckHolder.logger.log_node("Vector Add: one of the vectors is invalid.", Logger.LogType.ERROR)
return null return null
if !(va as Dictionary).has("x") || !(va as Dictionary).has("y"): if not (va as Dictionary).has("x") or not (va as Dictionary).has("y"):
DeckHolder.logger.log_node("Vector Add: one of the vectors is invalid.", Logger.LogType.ERROR) DeckHolder.logger.log_node("Vector Add: one of the vectors is invalid.", Logger.LogType.ERROR)
return null return null
if !(vb as Dictionary).has("x") || !(vb as Dictionary).has("y"): if not (vb as Dictionary).has("x") or not (vb as Dictionary).has("y"):
DeckHolder.logger.log_node("Vector Add: one of the vectors is invalid.", Logger.LogType.ERROR) DeckHolder.logger.log_node("Vector Add: one of the vectors is invalid.", Logger.LogType.ERROR)
return null return null

View file

@ -26,11 +26,11 @@ func _init() -> void:
func _value_request(on_port: int) -> Variant: func _value_request(on_port: int) -> Variant:
var v = await request_value_async(0) var v = await request_value_async(0)
if !v: if not v:
DeckHolder.logger.log_node("Vector Decompose: the vector is invalid.", Logger.LogType.ERROR) DeckHolder.logger.log_node("Vector Decompose: the vector is invalid.", Logger.LogType.ERROR)
return null return null
if !(v as Dictionary).has("x") || !(v as Dictionary).has("y"): if not (v as Dictionary).has("x") or not (v as Dictionary).has("y"):
DeckHolder.logger.log_node("Vector Decompose: the vector is invalid.", Logger.LogType.ERROR) DeckHolder.logger.log_node("Vector Decompose: the vector is invalid.", Logger.LogType.ERROR)
return null return null

View file

@ -28,15 +28,15 @@ func _value_request(_on_port: int) -> Variant:
var va = await request_value_async(0) var va = await request_value_async(0)
var vb = await request_value_async(1) var vb = await request_value_async(1)
if !va || !vb: if not va or not vb:
DeckHolder.logger.log_node("Vector Dot: one of the vectors is invalid.", Logger.LogType.ERROR) DeckHolder.logger.log_node("Vector Dot: one of the vectors is invalid.", Logger.LogType.ERROR)
return null return null
if !(va as Dictionary).has("x") || !(va as Dictionary).has("y"): if not (va as Dictionary).has("x") or not (va as Dictionary).has("y"):
DeckHolder.logger.log_node("Vector Dot: one of the vectors is invalid.", Logger.LogType.ERROR) DeckHolder.logger.log_node("Vector Dot: one of the vectors is invalid.", Logger.LogType.ERROR)
return null return null
if !(vb as Dictionary).has("x") || !(vb as Dictionary).has("y"): if not (vb as Dictionary).has("x") or not (vb as Dictionary).has("y"):
DeckHolder.logger.log_node("Vector Dot: one of the vectors is invalid.", Logger.LogType.ERROR) DeckHolder.logger.log_node("Vector Dot: one of the vectors is invalid.", Logger.LogType.ERROR)
return null return null

View file

@ -28,11 +28,11 @@ func _init() -> void:
func _value_request(_on_port: int) -> Variant: func _value_request(_on_port: int) -> Variant:
var v = await request_value_async(0) var v = await request_value_async(0)
if !v: if not v:
DeckHolder.logger.log_node("Vector Mult: the vector is invalid.", Logger.LogType.ERROR) DeckHolder.logger.log_node("Vector Mult: the vector is invalid.", Logger.LogType.ERROR)
return null return null
if !(v as Dictionary).has("x") || !(v as Dictionary).has("y"): if not (v as Dictionary).has("x") or not (v as Dictionary).has("y"):
DeckHolder.logger.log_node("Vector Mult: the vector is invalid.", Logger.LogType.ERROR) DeckHolder.logger.log_node("Vector Mult: the vector is invalid.", Logger.LogType.ERROR)
return null return null

View file

@ -22,11 +22,11 @@ func _init() -> void:
func _value_request(_on_port: int) -> Variant: func _value_request(_on_port: int) -> Variant:
var v = await request_value_async(0) var v = await request_value_async(0)
if !v: if not v:
DeckHolder.logger.log_node("Vector Normalize: the vector is invalid.", Logger.LogType.ERROR) DeckHolder.logger.log_node("Vector Normalize: the vector is invalid.", Logger.LogType.ERROR)
return null return null
if !(v as Dictionary).has("x") || !(v as Dictionary).has("y"): if not (v as Dictionary).has("x") or not (v as Dictionary).has("y"):
DeckHolder.logger.log_node("Vector Normalize: the vector is invalid.", Logger.LogType.ERROR) DeckHolder.logger.log_node("Vector Normalize: the vector is invalid.", Logger.LogType.ERROR)
return null return null

View file

@ -27,15 +27,15 @@ func _value_request(_on_port: int) -> Variant:
var va = await request_value_async(0) var va = await request_value_async(0)
var vb = await request_value_async(1) var vb = await request_value_async(1)
if !va || !vb: if not va or not vb:
DeckHolder.logger.log_node("Vector Sub: one of the vectors is invalid.", Logger.LogType.ERROR) DeckHolder.logger.log_node("Vector Sub: one of the vectors is invalid.", Logger.LogType.ERROR)
return null return null
if !(va as Dictionary).has("x") || !(va as Dictionary).has("y"): if not (va as Dictionary).has("x") or not (va as Dictionary).has("y"):
DeckHolder.logger.log_node("Vector Sub: one of the vectors is invalid.", Logger.LogType.ERROR) DeckHolder.logger.log_node("Vector Sub: one of the vectors is invalid.", Logger.LogType.ERROR)
return null return null
if !(vb as Dictionary).has("x") || !(vb as Dictionary).has("y"): if not (vb as Dictionary).has("x") or not (vb as Dictionary).has("y"):
DeckHolder.logger.log_node("Vector Sub: one of the vectors is invalid.", Logger.LogType.ERROR) DeckHolder.logger.log_node("Vector Sub: one of the vectors is invalid.", Logger.LogType.ERROR)
return null return null

View file

@ -48,7 +48,7 @@ func _value_request(_on_output_port: int) -> Variant:
var scene_name: String = scene_name_req var scene_name: String = scene_name_req
var source_name: String = source_name_req var source_name: String = source_name_req
if cached_scene_name == scene_name && cached_source_name == scene_name: if cached_scene_name == scene_name and cached_source_name == scene_name:
return cached_id return cached_id
cached_scene_name = scene_name cached_scene_name = scene_name

View file

@ -21,10 +21,10 @@ func _init() -> void:
func _value_request(_on_port: int) -> Variant: func _value_request(_on_port: int) -> Variant:
var v = await request_value_async(0) var v = await request_value_async(0)
if !v: if not v:
return null return null
if !(v as Dictionary).has("x") || !(v as Dictionary).has("y"): if not (v as Dictionary).has("x") or not (v as Dictionary).has("y"):
return null return null
return {"position_x": v.x, "position_y": v.y} return {"position_x": v.x, "position_y": v.y}

View file

@ -33,7 +33,7 @@ func _receive(to_input_port, data: Variant, extra_data: Array = []):
var input_data = await resolve_input_port_value_async(1) var input_data = await resolve_input_port_value_async(1)
if input_data == null or !"condition" in input_data.keys(): if input_data == null or "condition" not in input_data.keys():
DeckHolder.logger.log_node(name + ": Incorrect Subscription Data Connected, please supply a Dictionary with condition and if needed, version. Last supplied Data was: " + str(input_data), Logger.LogType.ERROR) DeckHolder.logger.log_node(name + ": Incorrect Subscription Data Connected, please supply a Dictionary with condition and if needed, version. Last supplied Data was: " + str(input_data), Logger.LogType.ERROR)
return return

View file

@ -19,7 +19,7 @@ func _init():
func _receive(to_input_port, data: Variant, extra_data: Array = []): func _receive(to_input_port, data: Variant, extra_data: Array = []):
if !to_input_port == 1: if to_input_port != 1:
return return

View file

@ -79,7 +79,7 @@ static func erase(name_space: String, channel: String, key: String) -> Variant:
## Commits the [param channel] to the filesystem. If [param channel] is empty, ## Commits the [param channel] to the filesystem. If [param channel] is empty,
## commits all channels in the [param name_space]. ## commits all channels in the [param name_space].
static func commit(name_space: String, channel: String = "") -> void: static func commit(name_space: String, channel: String = "") -> void:
if !channel.is_empty(): if not channel.is_empty():
_commit_channel(name_space, channel) _commit_channel(name_space, channel)
else: else:
for c: String in _data[name_space]: for c: String in _data[name_space]:
@ -104,7 +104,7 @@ static func _create_namespace_folder(name_space: String) -> Error:
static func _lazy_load_channel(name_space: String, channel: String) -> void: static func _lazy_load_channel(name_space: String, channel: String) -> void:
var validated_name := name_space.validate_filename() var validated_name := name_space.validate_filename()
var validated_channel := channel.validate_filename() var validated_channel := channel.validate_filename()
if !_data.has(validated_name): if not _data.has(validated_name):
DeckHolder.logger.log_system("Namespace %s is not initialized" % name_space, Logger.LogType.ERROR) DeckHolder.logger.log_system("Namespace %s is not initialized" % name_space, Logger.LogType.ERROR)
return return

View file

@ -65,7 +65,7 @@ static func search(term: String) -> Array[NodeDB.NodeDescriptor]:
for node_type: String in NodeDB.nodes: for node_type: String in NodeDB.nodes:
var nd: NodeDB.NodeDescriptor = NodeDB.nodes[node_type] var nd: NodeDB.NodeDescriptor = NodeDB.nodes[node_type]
if !nd.appears_in_search: if not nd.appears_in_search:
continue continue
var full_search_string := nd.name + nd.aliases var full_search_string := nd.name + nd.aliases

View file

@ -47,7 +47,7 @@ func add_category_item(category: String, item: String, tooltip: String = "", fav
## Wrapper around [method add_category_item] and [method add_category]. Adds an item to a [param category], creating the category if it doesn't exist yet. ## Wrapper around [method add_category_item] and [method add_category]. Adds an item to a [param category], creating the category if it doesn't exist yet.
func add_item(category: String, item: String, tooltip: String = "", favorite: bool = false) -> void: func add_item(category: String, item: String, tooltip: String = "", favorite: bool = false) -> void:
if !categories.has(category): if not categories.has(category):
add_category(category) add_category(category)
add_category_item(category, item, tooltip, favorite) add_category_item(category, item, tooltip, favorite)
@ -142,7 +142,7 @@ func get_next_visible_category(at: int) -> Category:
while s < scroll_content_container.get_child_count(): while s < scroll_content_container.get_child_count():
i = (i + 1) % scroll_content_container.get_child_count() i = (i + 1) % scroll_content_container.get_child_count()
if !(scroll_content_container.get_child(i) as Category).is_collapsed(): if not (scroll_content_container.get_child(i) as Category).is_collapsed():
return scroll_content_container.get_child(i) return scroll_content_container.get_child(i)
s += 1 s += 1
@ -157,7 +157,7 @@ func get_previous_visible_category(at: int) -> Category:
while s < scroll_content_container.get_child_count(): while s < scroll_content_container.get_child_count():
i = (i - 1) % scroll_content_container.get_child_count() i = (i - 1) % scroll_content_container.get_child_count()
if !(scroll_content_container.get_child(i) as Category).is_collapsed(): if not (scroll_content_container.get_child(i) as Category).is_collapsed():
return scroll_content_container.get_child(i) return scroll_content_container.get_child(i)
s += 1 s += 1
@ -227,7 +227,7 @@ class Category extends VBoxContainer:
collapse_button.icon = COLLAPSE_ICON_COLLAPSED if collapsed else COLLAPSE_ICON collapse_button.icon = COLLAPSE_ICON_COLLAPSED if collapsed else COLLAPSE_ICON
collapse_button.set_pressed_no_signal(collapsed) collapse_button.set_pressed_no_signal(collapsed)
for c: CategoryItem in get_children(): for c: CategoryItem in get_children():
c.visible = !collapsed c.visible = not collapsed
## Add an item to the category. ## Add an item to the category.

View file

@ -82,7 +82,7 @@ func _ready() -> void:
) )
get_tree().get_root().gui_embed_subwindows = embed_subwindows get_tree().get_root().gui_embed_subwindows = embed_subwindows
file_dialog.use_native_dialog = !embed_subwindows file_dialog.use_native_dialog = not embed_subwindows
recent_files = RendererPersistence.get_or_create( recent_files = RendererPersistence.get_or_create(
PERSISTENCE_NAMESPACE, "config", PERSISTENCE_NAMESPACE, "config",
@ -96,7 +96,7 @@ func _ready() -> void:
tab_container.tab_close_requested.connect( tab_container.tab_close_requested.connect(
func(tab: int): func(tab: int):
if tab_container.get_tab_metadata(tab, "dirty") && !tab_container.get_tab_metadata(tab, "group"): if tab_container.get_tab_metadata(tab, "dirty") and not tab_container.get_tab_metadata(tab, "group"):
unsaved_changes_dialog_single_deck.set_meta("tab", tab) unsaved_changes_dialog_single_deck.set_meta("tab", tab)
unsaved_changes_dialog_single_deck.show() unsaved_changes_dialog_single_deck.show()
return return
@ -181,7 +181,7 @@ func close_current_tab() -> void:
func close_tab(tab: int) -> void: func close_tab(tab: int) -> void:
if !tab_container.get_tab_metadata(tab, "group"): if not tab_container.get_tab_metadata(tab, "group"):
var groups := DeckHolder.close_deck(tab_container.get_tab_metadata(tab, "id")) var groups := DeckHolder.close_deck(tab_container.get_tab_metadata(tab, "id"))
# close tabs associated with this deck's groups # close tabs associated with this deck's groups
for group in groups: for group in groups:
@ -217,7 +217,7 @@ func open_open_dialog(path: String) -> void:
## 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
if !deck: if not deck:
return return
deck.save_path = path deck.save_path = path
@ -369,9 +369,9 @@ func _on_debug_id_pressed(id: int) -> void:
d.popup_centered() d.popup_centered()
DebugMenuId.EMBED_SUBWINDOWS: DebugMenuId.EMBED_SUBWINDOWS:
var c := debug_popup_menu.is_item_checked(id) var c := debug_popup_menu.is_item_checked(id)
debug_popup_menu.set_item_checked(id, !c) debug_popup_menu.set_item_checked(id, not c)
get_tree().get_root().gui_embed_subwindows = !c get_tree().get_root().gui_embed_subwindows = not c
RendererPersistence.set_value(PERSISTENCE_NAMESPACE, "config", "embed_subwindows", !c) RendererPersistence.set_value(PERSISTENCE_NAMESPACE, "config", "embed_subwindows", not c)
file_dialog.use_native_dialog = c file_dialog.use_native_dialog = c

View file

@ -204,7 +204,7 @@ func get_selected_nodes() -> Array:
## Executes functionality based off hotkey inputs. Specifically handles creating groups ## Executes functionality based off hotkey inputs. Specifically handles creating groups
## based off the action "group_nodes". ## based off the action "group_nodes".
func _gui_input(event: InputEvent) -> void: func _gui_input(event: InputEvent) -> void:
if event.is_action_pressed("group_nodes") && get_selected_nodes().size() > 0: if event.is_action_pressed("group_nodes") and get_selected_nodes().size() > 0:
clear_connections() clear_connections()
var nodes = get_selected_nodes().map( var nodes = get_selected_nodes().map(
func(x: DeckNodeRendererGraphNode): func(x: DeckNodeRendererGraphNode):
@ -214,7 +214,7 @@ func _gui_input(event: InputEvent) -> void:
refresh_connections() refresh_connections()
get_viewport().set_input_as_handled() get_viewport().set_input_as_handled()
if event.is_action_pressed("rename_node") && get_selected_nodes().size() == 1: if event.is_action_pressed("rename_node") and get_selected_nodes().size() == 1:
var node: DeckNodeRendererGraphNode = get_selected_nodes()[0] var node: DeckNodeRendererGraphNode = get_selected_nodes()[0]
var pos := get_viewport_rect().position + get_global_mouse_position() var pos := get_viewport_rect().position + get_global_mouse_position()
rename_popup.popup_on_parent(Rect2i(pos, rename_popup_size)) rename_popup.popup_on_parent(Rect2i(pos, rename_popup_size))
@ -225,11 +225,11 @@ func _gui_input(event: InputEvent) -> void:
## 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 not has_focus():
return return
if event.is_action_pressed("enter_group") && get_selected_nodes().size() == 1: if event.is_action_pressed("enter_group") and get_selected_nodes().size() == 1:
if !((get_selected_nodes()[0] as DeckNodeRendererGraphNode).node.node_type == "group_node"): if (get_selected_nodes()[0] as DeckNodeRendererGraphNode).node.node_type != "group_node":
return return
group_enter_requested.emit((get_selected_nodes()[0] as DeckNodeRendererGraphNode).node.group_id) group_enter_requested.emit((get_selected_nodes()[0] as DeckNodeRendererGraphNode).node.group_id)
get_viewport().set_input_as_handled() get_viewport().set_input_as_handled()

View file

@ -101,7 +101,7 @@ func is_empty() -> bool:
## Closes a tab at the index [param tab]. ## Closes a tab at the index [param tab].
func close_tab(tab: int) -> void: func close_tab(tab: int) -> void:
if !tab_bar.select_previous_available(): if not tab_bar.select_previous_available():
tab_bar.select_next_available() tab_bar.select_next_available()
content_container.get_child(tab).queue_free() content_container.get_child(tab).queue_free()
_tab_metadata.remove_at(tab) _tab_metadata.remove_at(tab)

View file

@ -43,7 +43,7 @@ func copy_auth_link():
func connect_to_chat(): func connect_to_chat():
if !Connections.twitch.get("chat_socket") or Connections.twitch.chat_socket.get_ready_state() != WebSocketPeer.STATE_OPEN: if not Connections.twitch.get("chat_socket") or Connections.twitch.chat_socket.get_ready_state() != WebSocketPeer.STATE_OPEN:
Connections.twitch.setup_chat_connection(%Default_Chat.text) Connections.twitch.setup_chat_connection(%Default_Chat.text)
return return

View file

@ -69,7 +69,7 @@ func commit_item_change(item: TreeItem = variable_tree.get_edited()) -> void:
_: _:
new_value = item.get_meta(&"value") new_value = item.get_meta(&"value")
if !item.has_meta(&"container"): if not item.has_meta(&"container"):
top_field_edited.emit(_old_name, new_name, new_value) top_field_edited.emit(_old_name, new_name, new_value)
else: else:
var container = item.get_meta(&"container") var container = item.get_meta(&"container")
@ -93,13 +93,13 @@ func edit_item() -> void:
# do nothing if this is an array and user is trying to edit index # do nothing if this is an array and user is trying to edit index
# (TODO: proper reordering) # (TODO: proper reordering)
if column == 0 && item.get_meta(&"indexed"): if column == 0 and item.get_meta(&"indexed"):
return return
if column < 2: if column < 2:
var value = item.get_meta(&"value") var value = item.get_meta(&"value")
if column == 1 && (value is Array || value is Dictionary): if column == 1 and (value is Array or value is Dictionary):
item.collapsed = !item.collapsed item.collapsed = not item.collapsed
return return
_old_name = item.get_text(0) _old_name = item.get_text(0)
@ -207,7 +207,7 @@ func _on_variable_tree_button_clicked(item: TreeItem, column: int, id: int, mous
# we only have a delete button for now, so assume it is what's clicked # we only have a delete button for now, so assume it is what's clicked
if !item.has_meta(&"container"): if not item.has_meta(&"container"):
var key := item.get_text(0) var key := item.get_text(0)
top_field_removed.emit(key) top_field_removed.emit(key)
item.free() item.free()
@ -259,7 +259,7 @@ func _on_types_popup_id_pressed(id: int) -> void:
current_item.set_text(2, DeckType.type_str(id)) current_item.set_text(2, DeckType.type_str(id))
if !current_item.has_meta(&"container"): if not current_item.has_meta(&"container"):
var field_name := current_item.get_text(0) var field_name := current_item.get_text(0)
top_field_edited.emit(field_name, field_name, new_value) top_field_edited.emit(field_name, field_name, new_value)
@ -268,7 +268,7 @@ func _on_new_variable_button_pressed() -> void:
var selected := variable_tree.get_selected() var selected := variable_tree.get_selected()
# TODO: UX impr. - if selected is part of a container, add to that container instead # TODO: UX impr. - if selected is part of a container, add to that container instead
# (but if selected is a container, prioritize adding to that) # (but if selected is a container, prioritize adding to that)
if selected == null || !(selected.get_meta(&"value") is Array || selected.get_meta(&"value") is Dictionary): if selected == null or not (selected.get_meta(&"value") is Array or selected.get_meta(&"value") is Dictionary):
# top field # top field
var var_name := "new_variable%s" % variable_tree.get_root().get_child_count() var var_name := "new_variable%s" % variable_tree.get_root().get_child_count()
var new_item := add_item(var_name, "") var new_item := add_item(var_name, "")