Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions material_maker/doc/user_interface_shortcuts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,16 @@ Graph Editor
+-------------------------------------------------------+----------------------------------------------------+
| :kbd:`Ctrl/Cmd-Shift-Z` | Redo |
+-------------------------------------------------------+----------------------------------------------------+
<<<<<<< HEAD
| :kbd:`Alt-RMB` | Lazy link |
+-------------------------------------------------------+----------------------------------------------------+
| :kbd:`Shift-Alt-RMB` | Lazy link (with link picking) |
+-------------------------------------------------------+----------------------------------------------------+
| :kbd:`Ctrl/Cmd-Alt-RMB` | Lazy mix |
=======
| :kbd:`1` :kbd:`2` :kbd:`3` :kbd:`4` :kbd:`5` | Add node from respective quick bar slot in add |
| :kbd:`6` :kbd:`7` :kbd:`8` :kbd:`9` :kbd:`0` | node popup/menu |
>>>>>>> master
+-------------------------------------------------------+----------------------------------------------------+

Nodes
Expand Down
14 changes: 14 additions & 0 deletions material_maker/panels/graph_edit/graph_edit.gd
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,20 @@ func _draw() -> void:
MMGraphPortal.draw_links(self)

# Misc. useful functions

func get_closest_node_at_point(point: Vector2) -> GraphNode:
var closest_dist : float = INF
var closest_node : GraphNode
for node in get_children():
if node is GraphNode:
var node_rect : Rect2 = node.get_rect()
var dist : float = point.clamp(node_rect.position,
node_rect.size + node_rect.position).distance_squared_to(point)
if dist < closest_dist:
closest_dist = dist
closest_node = node
return closest_node

func get_source(node, port) -> Dictionary:
for c in get_connection_list():
if c.to_node == node and c.to_port == port:
Expand Down
4 changes: 4 additions & 0 deletions material_maker/panels/graph_edit/graph_edit.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[ext_resource type="Texture2D" uid="uid://c0j4px4n72di5" path="res://material_maker/icons/icons.tres" id="2"]
[ext_resource type="Script" uid="uid://bne3k0g56crmy" path="res://material_maker/tools/undo_redo/undo_redo.gd" id="3"]
[ext_resource type="PackedScene" uid="uid://buj231c2gxm4o" path="res://material_maker/widgets/desc_button/desc_button.tscn" id="4"]
[ext_resource type="PackedScene" uid="uid://bd3ummbwaq3i" path="res://material_maker/panels/graph_edit/lazy_link/lazy_link.tscn" id="5_u5byk"]

[sub_resource type="AtlasTexture" id="3"]
atlas = ExtResource("2")
Expand Down Expand Up @@ -88,6 +89,9 @@ layout_mode = 2
[node name="UndoRedo" type="Node" parent="." unique_id=118784873]
script = ExtResource("3")

[node name="LazyLink" parent="." unique_id=1711863233 instance=ExtResource("5_u5byk")]
layout_mode = 1

[connection signal="connection_drag_ended" from="." to="." method="_on_connection_drag_ended"]
[connection signal="connection_drag_started" from="." to="." method="_on_connection_drag_started"]
[connection signal="connection_from_empty" from="." to="." method="request_popup" binds= [true]]
Expand Down
Loading