This repository has been archived by the owner on Jun 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Alexander Rösel <[email protected]>
- Loading branch information
1 parent
910ffa8
commit abe1852
Showing
13 changed files
with
452 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
extends Button | ||
|
||
const MoveFragment: Resource = preload( | ||
"res://src/script_editor/fragments/move_fragment/turn_fragment.tscn" | ||
) | ||
|
||
|
||
func _on_pressed(): | ||
#print_tree_pretty() | ||
API.insert(200) | ||
( | ||
get_tree() | ||
. get_current_scene() | ||
. get_node("VBoxContainer/VScrollContainer/AutoRefresh/Code") | ||
. add_child(MoveFragment.instantiate()) | ||
) | ||
#get_tree().get_current_scene().print_tree_pretty() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,15 @@ | ||
extends Button | ||
|
||
const TurnFragment: Resource = preload( | ||
"res://src/script_editor/fragments/move_fragment/move_fragment.tscn" | ||
) | ||
|
||
|
||
func _on_pressed(): | ||
API.insert(200) | ||
( | ||
get_tree() | ||
. get_current_scene() | ||
. get_node("VBoxContainer/VScrollContainer/AutoRefresh/Code") | ||
. add_child(TurnFragment.instantiate()) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
extends Button | ||
|
||
const MoveFragment: Resource = preload( | ||
"res://src/script_editor/fragments/move_fragment/for_fragment.tscn" | ||
) | ||
|
||
|
||
func _on_pressed(): | ||
API.insert(200) | ||
( | ||
get_tree() | ||
. get_current_scene() | ||
. get_node("VBoxContainer/VScrollContainer/AutoRefresh/Code") | ||
. add_child(MoveFragment.instantiate()) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
extends Button | ||
|
||
const MoveFragment: Resource = preload( | ||
"res://src/script_editor/fragments/move_fragment/while_fragment.tscn" | ||
) | ||
|
||
|
||
func _on_pressed(): | ||
API.insert(200) | ||
( | ||
get_tree() | ||
. get_current_scene() | ||
. get_node("VBoxContainer/VScrollContainer/AutoRefresh/Code") | ||
. add_child(MoveFragment.instantiate()) | ||
) |
76 changes: 76 additions & 0 deletions
76
godot/src/script_editor/fragments/move_fragment/for_fragment.tscn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
[gd_scene load_steps=4 format=3 uid="uid://oiepjld6lwrp"] | ||
|
||
[ext_resource type="Script" path="res://src/widgets/draggable tree/draggable_node.gd" id="1_o43h1"] | ||
[ext_resource type="Script" path="res://src/widgets/draggable tree/non_dragable_label.gd" id="2_37oc4"] | ||
[ext_resource type="Script" path="res://src/widgets/draggable tree/draggable_node_start.gd" id="3_wsklg"] | ||
|
||
[node name="ForFragment" type="Control"] | ||
custom_minimum_size = Vector2(0, 200) | ||
layout_mode = 3 | ||
anchors_preset = 15 | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
grow_horizontal = 2 | ||
grow_vertical = 2 | ||
size_flags_horizontal = 3 | ||
script = ExtResource("1_o43h1") | ||
|
||
[node name="VBoxContainer2" type="VBoxContainer" parent="."] | ||
layout_mode = 1 | ||
anchors_preset = 15 | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
grow_horizontal = 2 | ||
grow_vertical = 2 | ||
|
||
[node name="NonDragLabel" type="Control" parent="VBoxContainer2"] | ||
custom_minimum_size = Vector2(0, 20) | ||
layout_mode = 2 | ||
script = ExtResource("2_37oc4") | ||
|
||
[node name="Label" type="Label" parent="VBoxContainer2/NonDragLabel"] | ||
custom_minimum_size = Vector2(0, 20) | ||
layout_mode = 0 | ||
offset_right = 40.0 | ||
offset_bottom = 23.0 | ||
text = "For sdfsdfsdf" | ||
|
||
[node name="DragNodeStart" type="Control" parent="VBoxContainer2"] | ||
visible = false | ||
custom_minimum_size = Vector2(0, 20) | ||
layout_mode = 2 | ||
script = ExtResource("3_wsklg") | ||
|
||
[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer2"] | ||
custom_minimum_size = Vector2(200, 200) | ||
layout_mode = 2 | ||
size_flags_horizontal = 3 | ||
size_flags_vertical = 2 | ||
|
||
[node name="Label3" type="Label" parent="VBoxContainer2/VBoxContainer"] | ||
custom_minimum_size = Vector2(200, 20) | ||
layout_mode = 2 | ||
size_flags_vertical = 3 | ||
text = "wrwerwer" | ||
autowrap_mode = 3 | ||
|
||
[node name="Label2" type="Label" parent="VBoxContainer2/VBoxContainer"] | ||
custom_minimum_size = Vector2(200, 20) | ||
layout_mode = 2 | ||
size_flags_vertical = 3 | ||
text = "wrwer" | ||
autowrap_mode = 3 | ||
|
||
[node name="Label" type="Label" parent="VBoxContainer2/VBoxContainer"] | ||
custom_minimum_size = Vector2(200, 20) | ||
layout_mode = 2 | ||
size_flags_vertical = 3 | ||
text = "werwer" | ||
autowrap_mode = 3 | ||
|
||
[node name="Label4" type="Label" parent="VBoxContainer2/VBoxContainer"] | ||
custom_minimum_size = Vector2(200, 20) | ||
layout_mode = 2 | ||
size_flags_vertical = 3 | ||
text = "werwer" | ||
autowrap_mode = 3 |
27 changes: 27 additions & 0 deletions
27
godot/src/script_editor/fragments/move_fragment/move_fragment.tscn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[gd_scene load_steps=2 format=3 uid="uid://bsutrnlas8do1"] | ||
|
||
[ext_resource type="Script" path="res://src/widgets/draggable tree/draggable_leaf.gd" id="1_8mp6h"] | ||
|
||
[node name="Move Fragment" type="Control"] | ||
custom_minimum_size = Vector2(0, 20) | ||
layout_mode = 3 | ||
anchors_preset = 0 | ||
offset_right = 40.0 | ||
offset_bottom = 40.0 | ||
script = ExtResource("1_8mp6h") | ||
|
||
[node name="VBoxContainer" type="VBoxContainer" parent="."] | ||
custom_minimum_size = Vector2(0, 20) | ||
layout_mode = 2 | ||
offset_right = 74.0 | ||
offset_bottom = 23.0 | ||
size_flags_horizontal = 3 | ||
size_flags_vertical = 3 | ||
|
||
[node name="Label" type="Label" parent="VBoxContainer"] | ||
custom_minimum_size = Vector2(0, 20) | ||
layout_mode = 2 | ||
size_flags_horizontal = 3 | ||
size_flags_vertical = 3 | ||
text = "MOVE X Y" | ||
vertical_alignment = 1 |
28 changes: 28 additions & 0 deletions
28
godot/src/script_editor/fragments/move_fragment/turn_fragment.tscn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[gd_scene load_steps=2 format=3 uid="uid://ccy3ijvvrbguo"] | ||
|
||
[ext_resource type="Script" path="res://src/widgets/draggable tree/draggable_leaf.gd" id="1_8rgbb"] | ||
|
||
[node name="MoveFragment" type="Container"] | ||
custom_minimum_size = Vector2(0, 20) | ||
anchors_preset = 15 | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
grow_horizontal = 2 | ||
grow_vertical = 2 | ||
size_flags_horizontal = 3 | ||
size_flags_vertical = 3 | ||
script = ExtResource("1_8rgbb") | ||
|
||
[node name="VBoxContainer" type="VBoxContainer" parent="."] | ||
custom_minimum_size = Vector2(0, 20) | ||
layout_mode = 2 | ||
size_flags_horizontal = 3 | ||
size_flags_vertical = 3 | ||
|
||
[node name="Label" type="Label" parent="VBoxContainer"] | ||
custom_minimum_size = Vector2(0, 20) | ||
layout_mode = 2 | ||
size_flags_horizontal = 3 | ||
size_flags_vertical = 3 | ||
text = "TURN X" | ||
vertical_alignment = 1 |
76 changes: 76 additions & 0 deletions
76
godot/src/script_editor/fragments/move_fragment/while_fragment.tscn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
[gd_scene load_steps=4 format=3 uid="uid://d215f38mcypns"] | ||
|
||
[ext_resource type="Script" path="res://src/widgets/draggable tree/draggable_node.gd" id="1_oy1be"] | ||
[ext_resource type="Script" path="res://src/widgets/draggable tree/non_dragable_label.gd" id="2_wuun8"] | ||
[ext_resource type="Script" path="res://src/widgets/draggable tree/draggable_node_start.gd" id="3_jnb65"] | ||
|
||
[node name="ForFragment" type="Control"] | ||
custom_minimum_size = Vector2(0, 200) | ||
layout_mode = 3 | ||
anchors_preset = 15 | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
grow_horizontal = 2 | ||
grow_vertical = 2 | ||
size_flags_horizontal = 3 | ||
script = ExtResource("1_oy1be") | ||
|
||
[node name="VBoxContainer2" type="VBoxContainer" parent="."] | ||
layout_mode = 1 | ||
anchors_preset = 15 | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
grow_horizontal = 2 | ||
grow_vertical = 2 | ||
|
||
[node name="NonDragLabel" type="Control" parent="VBoxContainer2"] | ||
custom_minimum_size = Vector2(0, 20) | ||
layout_mode = 2 | ||
script = ExtResource("2_wuun8") | ||
|
||
[node name="Label" type="Label" parent="VBoxContainer2/NonDragLabel"] | ||
custom_minimum_size = Vector2(0, 20) | ||
layout_mode = 0 | ||
offset_right = 40.0 | ||
offset_bottom = 23.0 | ||
text = "while sdfsdfsdf" | ||
|
||
[node name="DragNodeStart" type="Control" parent="VBoxContainer2"] | ||
visible = false | ||
custom_minimum_size = Vector2(0, 20) | ||
layout_mode = 2 | ||
script = ExtResource("3_jnb65") | ||
|
||
[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer2"] | ||
custom_minimum_size = Vector2(200, 200) | ||
layout_mode = 2 | ||
size_flags_horizontal = 3 | ||
size_flags_vertical = 2 | ||
|
||
[node name="Label3" type="Label" parent="VBoxContainer2/VBoxContainer"] | ||
custom_minimum_size = Vector2(200, 20) | ||
layout_mode = 2 | ||
size_flags_vertical = 3 | ||
text = "wrwerwer" | ||
autowrap_mode = 3 | ||
|
||
[node name="Label2" type="Label" parent="VBoxContainer2/VBoxContainer"] | ||
custom_minimum_size = Vector2(200, 20) | ||
layout_mode = 2 | ||
size_flags_vertical = 3 | ||
text = "wrwer" | ||
autowrap_mode = 3 | ||
|
||
[node name="Label" type="Label" parent="VBoxContainer2/VBoxContainer"] | ||
custom_minimum_size = Vector2(200, 20) | ||
layout_mode = 2 | ||
size_flags_vertical = 3 | ||
text = "werwer" | ||
autowrap_mode = 3 | ||
|
||
[node name="Label4" type="Label" parent="VBoxContainer2/VBoxContainer"] | ||
custom_minimum_size = Vector2(200, 20) | ||
layout_mode = 2 | ||
size_flags_vertical = 3 | ||
text = "werwer" | ||
autowrap_mode = 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
@tool | ||
class_name DragLeaf | ||
extends Control | ||
|
||
@onready var target = 0 | ||
|
||
|
||
func _ready(): | ||
add_to_group("draggable_leaf") | ||
|
||
|
||
func _get_drag_data(_at_position: Vector2): | ||
set_drag_preview(get_preview_controll()) | ||
return self | ||
|
||
|
||
func get_preview_controll(): | ||
return duplicate() | ||
|
||
|
||
func _drop_data(_at_position, _data): | ||
pass | ||
|
||
|
||
func _can_drop_data(_at_position, data): | ||
var node | ||
if data.is_in_group("draggable_leaf"): | ||
target = get_node(self.get_path()).get_index(true) | ||
node = get_node(data.get_path()) | ||
get_parent().move_child(node, target) | ||
|
||
elif data.is_in_group("draggable_node"): | ||
target = get_node(self.get_path()).get_index(true) | ||
node = get_node(data.get_path()) | ||
get_parent().move_child(node, target) | ||
else: | ||
print(data) | ||
assert(false, "Invalid node") | ||
return true |
Oops, something went wrong.