Skip to content

Commit 26fbead

Browse files
committed
update color highlight logic
1 parent e2eac30 commit 26fbead

File tree

2 files changed

+12
-16
lines changed

2 files changed

+12
-16
lines changed

material_maker/icons/down.tres

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
[gd_resource type="AtlasTexture" load_steps=2 format=3]
1+
[gd_resource type="AtlasTexture" load_steps=2 format=3 uid="uid://bp2jrkwyb64m5"]
22

3-
[ext_resource type="Texture2D" path="res://material_maker/icons/icons.tres" id="1"]
3+
[ext_resource type="Texture2D" uid="uid://c0j4px4n72di5" path="res://material_maker/icons/icons.tres" id="1"]
44

55
[resource]
6-
flags = 4
7-
atlas = ExtResource( 1 )
8-
region = Rect2( 32, 48, 16, 16 )
6+
atlas = ExtResource("1")
7+
region = Rect2(32, 48, 16, 16)

material_maker/panels/graph_edit/graph_edit.gd

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -215,14 +215,14 @@ func _gui_input(event) -> void:
215215
KEY_ALT:
216216
if (Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT)
217217
and has_graph_node_selection()):
218-
hint_node_drop_blocked(false, true)
218+
hint_node_drop_allowed(false)
219219
highlight_connection(target_drop_connection)
220220
elif not event.pressed:
221221
var scancode_with_modifiers = event.get_keycode_with_modifiers()
222222
match scancode_with_modifiers:
223223
KEY_ALT:
224224
if has_graph_node_selection():
225-
hint_node_drop_blocked(true, true)
225+
hint_node_drop_allowed(true)
226226
match event.get_keycode():
227227
KEY_SHIFT, KEY_CTRL, KEY_ALT:
228228
var found_tip : bool = false
@@ -260,7 +260,7 @@ func _gui_input(event) -> void:
260260
if (get_selected_nodes().size() == 1
261261
and event.button_mask & MOUSE_BUTTON_MASK_LEFT != 0
262262
and event.relative.length() > 0.0):
263-
hint_node_drop_blocked(not event.alt_pressed, true)
263+
hint_node_drop_allowed(not event.alt_pressed)
264264
var node : GraphElement = get_selected_nodes()[0]
265265
if node is not GraphNode:
266266
return
@@ -277,19 +277,16 @@ func _gui_input(event) -> void:
277277
if conns.size() > 1:
278278
conns.sort_custom(compare_connection_by_port_position_y)
279279
active_conn = conns.front()
280+
highlight_connection(active_conn)
280281
if not event.alt_pressed:
281282
target_drop_connection = active_conn
282283
target_drop_node = node
283-
set_connection_activity(active_conn.from_node, active_conn.from_port,
284-
active_conn.to_node, active_conn.to_port,
285-
0.5 if has_theme_color_override("activity") else 1.0)
286284
else:
287285
target_drop_connection.clear()
288286
target_drop_node = null
289287
for c in get_connection_list():
290288
if c != active_conn:
291-
set_connection_activity(c.from_node, c.from_port,
292-
c.to_node, c.to_port, 0.0)
289+
highlight_connection(c, 0.0)
293290
else:
294291
remove_theme_color_override("activity")
295292
remove_theme_color_override("connection_hover_tint_color")
@@ -325,12 +322,12 @@ func drop_node_on_connection(node : GraphNode, connection : Dictionary) -> void:
325322
break
326323
undoredo.end_group()
327324

328-
func hint_node_drop_blocked(should_block: bool, force_connection_redraw: bool = false) -> void:
329-
if should_block:
325+
func hint_node_drop_allowed(should_allow: bool, force_connection_redraw: bool = true) -> void:
326+
add_theme_color_override("connection_hover_tint_color", Color.TRANSPARENT)
327+
if should_allow:
330328
remove_theme_color_override("activity")
331329
else:
332330
add_theme_color_override("activity", Color.BLACK)
333-
add_theme_color_override("connection_hover_tint_color", Color.TRANSPARENT)
334331
if force_connection_redraw:
335332
get_node("_connection_layer").queue_redraw()
336333

0 commit comments

Comments
 (0)