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
6 changes: 6 additions & 0 deletions material_maker/doc/user_interface_shortcuts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ Graph Editor
+-------------------------------------------------------+----------------------------------------------------+
| :kbd:`Ctrl/Cmd-Shift-Z` | Redo |
+-------------------------------------------------------+----------------------------------------------------+
| :kbd:`Alt-RMB` | Lazy link |
+-------------------------------------------------------+----------------------------------------------------+
| :kbd:`Shift-Alt-RMB` | Lazy link (with link picking) |
+-------------------------------------------------------+----------------------------------------------------+
| :kbd:`Ctrl/Cmd-Alt-RMB` | Lazy mix |
+-------------------------------------------------------+----------------------------------------------------+

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 @@ -363,6 +363,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
28 changes: 16 additions & 12 deletions material_maker/panels/graph_edit/graph_edit.tscn
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
[gd_scene load_steps=8 format=3 uid="uid://dy1u50we7gtru"]
[gd_scene format=3 uid="uid://dy1u50we7gtru"]

[ext_resource type="Script" uid="uid://dkp4w3at1o6cm" path="res://material_maker/panels/graph_edit/graph_edit.gd" id="1"]
[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 All @@ -17,7 +18,7 @@ region = Rect2(15.4016, 47.1451, 16.7512, 17.8319)
atlas = ExtResource("2")
region = Rect2(0, 48, 16, 16)

[node name="GraphEdit" type="GraphEdit" groups=["mm_graphedit"]]
[node name="GraphEdit" type="GraphEdit" unique_id=40283213 groups=["mm_graphedit"]]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
Expand All @@ -34,11 +35,11 @@ show_menu = false
show_zoom_label = true
script = ExtResource("1")

[node name="Timer" type="Timer" parent="."]
[node name="Timer" type="Timer" parent="." unique_id=2032959171]
wait_time = 0.2
one_shot = true

[node name="GraphUI" type="HBoxContainer" parent="."]
[node name="GraphUI" type="HBoxContainer" parent="." unique_id=553812488]
top_level = true
custom_minimum_size = Vector2(0, 25)
layout_mode = 1
Expand All @@ -51,43 +52,46 @@ offset_bottom = 31.0
grow_horizontal = 0
alignment = 2

[node name="SubGraphUI" type="HBoxContainer" parent="GraphUI"]
[node name="SubGraphUI" type="HBoxContainer" parent="GraphUI" unique_id=1647006840]
layout_mode = 2
size_flags_horizontal = 9

[node name="Label" type="LineEdit" parent="GraphUI/SubGraphUI"]
[node name="Label" type="LineEdit" parent="GraphUI/SubGraphUI" unique_id=1832306241]
custom_minimum_size = Vector2(150, 0)
layout_mode = 2
size_flags_horizontal = 9

[node name="Description" parent="GraphUI/SubGraphUI" instance=ExtResource("4")]
[node name="Description" parent="GraphUI/SubGraphUI" unique_id=493781275 instance=ExtResource("4")]
layout_mode = 2

[node name="ButtonTransmitsSeed" type="Button" parent="GraphUI/SubGraphUI"]
[node name="ButtonTransmitsSeed" type="Button" parent="GraphUI/SubGraphUI" unique_id=2053263820]
layout_mode = 2
size_flags_horizontal = 9
tooltip_text = "Affect children seeds"
toggle_mode = true
icon = SubResource("3")

[node name="ButtonUp" type="Button" parent="GraphUI/SubGraphUI"]
[node name="ButtonUp" type="Button" parent="GraphUI/SubGraphUI" unique_id=1330694184]
layout_mode = 2
size_flags_horizontal = 9
tooltip_text = "Back to parent"
icon = SubResource("4")

[node name="ButtonShowTree" type="Button" parent="GraphUI"]
[node name="ButtonShowTree" type="Button" parent="GraphUI" unique_id=13835757]
layout_mode = 2
tooltip_text = "Show hierarchy"
icon = SubResource("5")

[node name="Control" type="Control" parent="GraphUI"]
[node name="Control" type="Control" parent="GraphUI" unique_id=484165793]
custom_minimum_size = Vector2(14, 0)
layout_mode = 2

[node name="UndoRedo" type="Node" parent="."]
[node name="UndoRedo" type="Node" parent="." unique_id=45519432]
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