mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-22 16:20:19 +01:00
Add sandbox scene, a zoomed in, simple version for making GIFs :D
This commit is contained in:
parent
04f4898417
commit
d69c832aba
7 changed files with 86 additions and 30 deletions
20
arrow.gd
20
arrow.gd
|
@ -1,24 +1,33 @@
|
||||||
extends Node2D
|
extends Node2D
|
||||||
|
|
||||||
var label = "label" setget label_set
|
var label = "label" setget label_set
|
||||||
var target: String setget target_set
|
|
||||||
|
var source: String
|
||||||
|
var target: String
|
||||||
|
|
||||||
var repository: Control
|
var repository: Control
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
func _process(_delta):
|
func _process(_delta):
|
||||||
var end = global_position + Vector2(0, 50)
|
#position = -repository.objects[source].position
|
||||||
|
position = Vector2(0,0)
|
||||||
|
|
||||||
|
var start = repository.objects[source].position
|
||||||
|
var end = start + Vector2(0, 30)
|
||||||
|
|
||||||
if repository and repository.objects.has(target) and repository.objects[target].visible:
|
if repository and repository.objects.has(target) and repository.objects[target].visible:
|
||||||
var t = repository.objects[target]
|
var t = repository.objects[target]
|
||||||
end = t.global_position
|
end = t.position
|
||||||
$Target.hide()
|
$Target.hide()
|
||||||
else:
|
else:
|
||||||
$Target.text = target
|
$Target.text = target
|
||||||
if $Target.text.substr(0, 5) != "refs/":
|
if $Target.text.substr(0, 5) != "refs/":
|
||||||
$Target.text = ""#$Target.text.substr(0,8)
|
$Target.text = ""#$Target.text.substr(0,8)
|
||||||
$Target.show()
|
$Target.show()
|
||||||
$Line.points[1] = (end - global_position)/repository.find_node("Nodes").rect_scale.x
|
|
||||||
|
$Line.points[1] = end - repository.objects[source].position
|
||||||
$Label.position = ($Line.points[0] + $Line.points[1])/1.3
|
$Label.position = ($Line.points[0] + $Line.points[1])/1.3
|
||||||
$Tip.position = ($Line.points[0] + $Line.points[1])/1.3
|
$Tip.position = ($Line.points[0] + $Line.points[1])/1.3
|
||||||
$Tip.rotation = PI+$Line.points[0].angle_to($Line.points[1])
|
$Tip.rotation = PI+$Line.points[0].angle_to($Line.points[1])
|
||||||
|
@ -26,6 +35,3 @@ func _process(_delta):
|
||||||
func label_set(new_label):
|
func label_set(new_label):
|
||||||
label = new_label
|
label = new_label
|
||||||
$Label/ID.text = label
|
$Label/ID.text = label
|
||||||
|
|
||||||
func target_set(new_target):
|
|
||||||
target = new_target
|
|
||||||
|
|
1
node.gd
1
node.gd
|
@ -85,6 +85,7 @@ func children_set(new_children):
|
||||||
if not children.has(c):
|
if not children.has(c):
|
||||||
var a = arrow.instance()
|
var a = arrow.instance()
|
||||||
a.label = new_children[c]
|
a.label = new_children[c]
|
||||||
|
a.source = id
|
||||||
a.target = c
|
a.target = c
|
||||||
a.repository = repository
|
a.repository = repository
|
||||||
$Arrows.add_child(a)
|
$Arrows.add_child(a)
|
||||||
|
|
|
@ -1,16 +1,9 @@
|
||||||
extends Control
|
extends Control
|
||||||
|
|
||||||
export(NodePath) var index_path
|
onready var index = $VSplitContainer/RepoVis/Index
|
||||||
onready var index = get_node(index_path)
|
onready var nodes = $VSplitContainer/RepoVis/Nodes
|
||||||
|
onready var file_browser = $VSplitContainer/FileBrowser
|
||||||
export(NodePath) var nodes_path
|
onready var label_node = $VSplitContainer/RepoVis/Label
|
||||||
onready var nodes = get_node(nodes_path)
|
|
||||||
|
|
||||||
export(NodePath) var file_browser_path
|
|
||||||
onready var file_browser = get_node(file_browser_path)
|
|
||||||
|
|
||||||
export(NodePath) var label_node_path
|
|
||||||
onready var label_node = get_node(label_node_path)
|
|
||||||
|
|
||||||
export var label: String setget set_label
|
export var label: String setget set_label
|
||||||
export var path: String setget set_path, get_path
|
export var path: String setget set_path, get_path
|
||||||
|
|
|
@ -14,10 +14,6 @@ script = ExtResource( 1 )
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
index_path = NodePath("VSplitContainer/RepoVis/Index")
|
|
||||||
nodes_path = NodePath("VSplitContainer/RepoVis/Nodes")
|
|
||||||
file_browser_path = NodePath("VSplitContainer/FileBrowser")
|
|
||||||
label_node_path = NodePath("VSplitContainer/RepoVis/Label")
|
|
||||||
|
|
||||||
[node name="VSplitContainer" type="VSplitContainer" parent="."]
|
[node name="VSplitContainer" type="VSplitContainer" parent="."]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
|
|
4
sandbox.gd
Normal file
4
sandbox.gd
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
extends Control
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
$HSplitContainer/Repository.path = "/tmp/active"
|
55
sandbox.tscn
Normal file
55
sandbox.tscn
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
[gd_scene load_steps=5 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://terminal.tscn" type="PackedScene" id=1]
|
||||||
|
[ext_resource path="res://repository.tscn" type="PackedScene" id=2]
|
||||||
|
[ext_resource path="res://styles/theme.tres" type="Theme" id=3]
|
||||||
|
[ext_resource path="res://sandbox.gd" type="Script" id=4]
|
||||||
|
|
||||||
|
[node name="Sandbox" type="Control"]
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
margin_right = -960.0
|
||||||
|
margin_bottom = -540.0
|
||||||
|
rect_scale = Vector2( 2, 2 )
|
||||||
|
theme = ExtResource( 3 )
|
||||||
|
script = ExtResource( 4 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Background" type="ColorRect" parent="."]
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
mouse_filter = 2
|
||||||
|
color = Color( 0.0705882, 0.0705882, 0.0705882, 1 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="HSplitContainer" type="HSplitContainer" parent="."]
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
margin_left = 5.0
|
||||||
|
margin_top = 5.0
|
||||||
|
margin_right = -5.0
|
||||||
|
margin_bottom = -5.0
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Repository" parent="HSplitContainer" instance=ExtResource( 2 )]
|
||||||
|
anchor_right = 0.0
|
||||||
|
anchor_bottom = 0.0
|
||||||
|
margin_right = 469.0
|
||||||
|
margin_bottom = 530.0
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
file_browser_active = false
|
||||||
|
|
||||||
|
[node name="Terminal" parent="HSplitContainer" instance=ExtResource( 1 )]
|
||||||
|
anchor_right = 0.0
|
||||||
|
anchor_bottom = 0.0
|
||||||
|
margin_left = 481.0
|
||||||
|
margin_right = 950.0
|
||||||
|
margin_bottom = 530.0
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
repository_path = NodePath("../Repository")
|
|
@ -17,14 +17,11 @@ corner_radius_top_right = 10
|
||||||
corner_radius_bottom_right = 10
|
corner_radius_bottom_right = 10
|
||||||
corner_radius_bottom_left = 10
|
corner_radius_bottom_left = 10
|
||||||
|
|
||||||
[node name="Terminal" type="Container"]
|
[node name="Terminal" type="Control"]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
mouse_filter = 1
|
mouse_filter = 1
|
||||||
script = ExtResource( 2 )
|
script = ExtResource( 2 )
|
||||||
__meta__ = {
|
|
||||||
"_edit_use_anchors_": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="Control" type="VBoxContainer" parent="."]
|
[node name="Control" type="VBoxContainer" parent="."]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
|
@ -65,15 +62,19 @@ flat = false
|
||||||
align = 0
|
align = 0
|
||||||
|
|
||||||
[node name="ClearButton" type="Button" parent="."]
|
[node name="ClearButton" type="Button" parent="."]
|
||||||
anchor_left = 0.9
|
anchor_left = 1.0
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
margin_left = -10.0
|
margin_left = -88.0
|
||||||
margin_top = 10.0
|
margin_top = 5.0
|
||||||
margin_right = -10.0
|
margin_right = -5.0
|
||||||
|
margin_bottom = 36.0
|
||||||
focus_mode = 0
|
focus_mode = 0
|
||||||
custom_fonts/font = ExtResource( 1 )
|
custom_fonts/font = ExtResource( 1 )
|
||||||
enabled_focus_mode = 0
|
enabled_focus_mode = 0
|
||||||
text = "Clear"
|
text = "Clear"
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
[node name="TextEditor" parent="." instance=ExtResource( 5 )]
|
[node name="TextEditor" parent="." instance=ExtResource( 5 )]
|
||||||
visible = false
|
visible = false
|
||||||
|
|
Loading…
Reference in a new issue