Skip to content

Commit 3846236

Browse files
committed
format
1 parent f945633 commit 3846236

2 files changed

Lines changed: 25 additions & 27 deletions

File tree

material_maker/panels/graph_edit/lazy_link/lazy_link.gd

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ func _draw() -> void:
8282
inactive_link_color, inactive_color)
8383
draw_style_box(frame, source.get_rect())
8484

85-
8685
func _input(event: InputEvent) -> void:
8786
if event.is_action_pressed("ui_cancel"):
8887
end_link(true)
@@ -111,17 +110,17 @@ func _input(event: InputEvent) -> void:
111110
set_link([from_point, get_local_mouse_position()])
112111
show_node(LazyNode.FROM)
113112

114-
func _set_colors(frame_color: Color, linked_frame_color: Color,
115-
link_color: Color, node_color: Color) -> void:
113+
func _set_colors(frame_color : Color, linked_frame_color : Color,
114+
link_color : Color, node_color : Color) -> void:
116115
frame.border_color = frame_color
117116
linked_frame.border_color = linked_frame_color
118117
$Link.gradient.colors[LazyNode.FROM] = link_color
119118
$NodeA.material.set_shader_parameter("node_color", node_color)
120119

121-
func set_link(pts: PackedVector2Array) -> void:
120+
func set_link(pts : PackedVector2Array) -> void:
122121
$Link.points = pts
123122

124-
func end_link(is_cancel: bool = false) -> void:
123+
func end_link(is_cancel : bool = false) -> void:
125124
$NodeA.hide()
126125
$NodeB.hide()
127126
$Link.points = PackedVector2Array()
@@ -144,31 +143,31 @@ func invalidate_link() -> void:
144143
is_context_linking = false
145144
has_context = false
146145

147-
func show_node(node: LazyNode) -> void:
146+
func show_node(node : LazyNode) -> void:
148147
var color_rect := $NodeA if node else $NodeB
149148
color_rect.show()
150149
color_rect.position = get_local_mouse_position() - Vector2(16, 16)
151150
move_to_front()
152151
queue_redraw()
153152

154-
func port_attr(node: GraphNode, port_idx: int,
155-
is_output: bool, key: String) -> String:
153+
func port_attr(node : GraphNode, port_idx : int,
154+
is_output : bool, key : String) -> String:
156155
if node:
157156
var defs : Array = (node.generator.get_output_defs()
158157
if is_output else node.generator.get_input_defs())
159158
if defs[port_idx].has(key):
160159
return defs[port_idx][key]
161160
return ""
162161

163-
func has_input_link(node: GraphNode, port_idx: int) -> bool:
162+
func has_input_link(node : GraphNode, port_idx : int) -> bool:
164163
var graph : GraphEdit = get_parent()
165164
if graph:
166165
for c : Dictionary in graph.connections:
167166
if c.to_port == port_idx and c.to_node == node.name:
168167
return true
169168
return false
170169

171-
func connect_port_type(types: Array, allow_any: bool = false) -> bool:
170+
func connect_port_type(types : Array, allow_any : bool = false) -> bool:
172171
var graph : GraphEdit = get_parent()
173172
if not graph:
174173
return false
@@ -183,15 +182,15 @@ func connect_port_type(types: Array, allow_any: bool = false) -> bool:
183182
return true
184183
return false
185184

186-
func create_context_menu(is_output: bool, source_output: int = -1) -> void:
185+
func create_context_menu(is_output : bool, source_output : int = -1) -> void:
187186
var context_node : GraphNode = source if is_output else target
188187

189188
# skip context menu if target node only has one input
190189
if not is_output and context_node.get_input_port_count() == 1:
191190
do_context_link(0, source_output)
192191
return
193192

194-
var popup : PopupMenu = PopupMenu.new()
193+
var popup := PopupMenu.new()
195194
popup.add_theme_constant_override(
196195
"item_%s_padding" % [ "end" if is_output else "start" ], 16)
197196

@@ -220,7 +219,7 @@ func create_context_menu(is_output: bool, source_output: int = -1) -> void:
220219

221220
var slot_icon : Image = Image.new()
222221
slot_icon.load_svg_from_buffer(SLOT_SVG.replace("#FFF",
223-
"#"+context_port_color.to_html(false)).to_utf8_buffer())
222+
"#" + context_port_color.to_html(false)).to_utf8_buffer())
224223
popup.add_icon_item(ImageTexture.create_from_image(slot_icon), port_name)
225224

226225
popup.content_scale_factor = csf
@@ -247,7 +246,7 @@ func popup_window_input(event : InputEvent) -> void:
247246
if event.is_action("ui_cancel"):
248247
invalidate_link()
249248

250-
func popup_hidden(popup: PopupMenu) -> void:
249+
func popup_hidden(popup : PopupMenu) -> void:
251250
if not has_context:
252251
invalidate_link()
253252
popup.queue_free()
@@ -259,7 +258,7 @@ func create_context_connection() -> void:
259258
and target.get_input_port_count()):
260259
create_context_menu(source.get_output_port_count() != 1)
261260

262-
func do_context_link(to: int, from: int) -> void:
261+
func do_context_link(to : int, from : int) -> void:
263262
if from != -1:
264263
if (source.get_output_port_type(from) == target.get_input_port_type(to)
265264
or source.get_output_port_type(from) == 42
@@ -274,8 +273,7 @@ func do_lazy_connection() -> void:
274273
var graph : GraphEdit = get_parent()
275274
if (not (source and target and graph) or
276275
not (source.get_output_port_count()
277-
and target.get_input_port_count())
278-
):
276+
and target.get_input_port_count())):
279277
return
280278

281279
# connect by exact port name (short description, case-sensitive)

material_maker/theme/default.tres

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,6 +1278,16 @@ MM_Icons/icons/zoom = SubResource("AtlasTexture_iyaen")
12781278
MM_Icons/icons/zoom_in = SubResource("AtlasTexture_5k62t")
12791279
MM_Icons/icons/zoom_out = SubResource("AtlasTexture_vqfa7")
12801280
MM_Icons/icons/zoom_reset = SubResource("AtlasTexture_ngrf6")
1281+
MM_LazyLink/colors/active_color = Color(0.563787, 0.4488, 0.88, 0.8)
1282+
MM_LazyLink/colors/active_link_color = Color(0.753, 0.667, 1, 1)
1283+
MM_LazyLink/colors/context_color = Color(0.2301, 0.428045, 0.59, 0.8)
1284+
MM_LazyLink/colors/context_link_color = Color(0.46, 0.757, 1, 1)
1285+
MM_LazyLink/colors/inactive_color = Color(0.412, 0.412, 0.412, 1)
1286+
MM_LazyLink/colors/inactive_link_color = Color(0.996, 0.996, 0.996, 1)
1287+
MM_LazyLink/constants/border_width = 7
1288+
MM_LazyLink/constants/corner_detail = 3
1289+
MM_LazyLink/constants/corner_radius = 4
1290+
MM_LazyLink/constants/expand_margin = 12
12811291
MM_LibrarySectionButton/base_type = &"Button"
12821292
MM_LibrarySectionButton/colors/icon_disabled_color = Color(0.443123, 0.452316, 0.470703, 1)
12831293
MM_LibrarySectionButton/colors/icon_focus_color = Color(1, 1, 1, 1)
@@ -1299,16 +1309,6 @@ MM_LibrarySectionButton/styles/focus = SubResource("StyleBoxEmpty_m27ao")
12991309
MM_LibrarySectionButton/styles/hover = SubResource("StyleBoxFlat_ck0hb")
13001310
MM_LibrarySectionButton/styles/normal = SubResource("StyleBoxFlat_ck0hb")
13011311
MM_LibrarySectionButton/styles/pressed = SubResource("StyleBoxFlat_ck0hb")
1302-
MM_LazyLink/colors/active_color = Color(0.563787, 0.4488, 0.88, 0.8)
1303-
MM_LazyLink/colors/active_link_color = Color(0.753, 0.667, 1, 1)
1304-
MM_LazyLink/colors/context_color = Color(0.2301, 0.428045, 0.59, 0.8)
1305-
MM_LazyLink/colors/context_link_color = Color(0.46, 0.757, 1, 1)
1306-
MM_LazyLink/colors/inactive_color = Color(0.412, 0.412, 0.412, 1)
1307-
MM_LazyLink/colors/inactive_link_color = Color(0.996, 0.996, 0.996, 1)
1308-
MM_LazyLink/constants/border_width = 7
1309-
MM_LazyLink/constants/corner_detail = 3
1310-
MM_LazyLink/constants/corner_radius = 4
1311-
MM_LazyLink/constants/expand_margin = 12
13121312
MM_MainBackground/base_type = &"PanelContainer"
13131313
MM_MainBackground/styles/panel = SubResource("StyleBoxFlat_wqwm5")
13141314
MM_Node/constants/minimum_line_height = 20

0 commit comments

Comments
 (0)