Simple graphics for the different nodes

This commit is contained in:
Sebastian Morr 2020-09-21 19:59:36 +02:00
parent f28ec7a3a7
commit 176a069a6a
12 changed files with 446 additions and 26 deletions

View file

@ -19,8 +19,8 @@ func _process(_delta):
$Target.text = ""#$Target.text.substr(0,8) $Target.text = ""#$Target.text.substr(0,8)
$Target.show() $Target.show()
$Line.points[1] = end - global_position $Line.points[1] = end - global_position
$Label.position = ($Line.points[0] + $Line.points[1])/2 $Label.position = ($Line.points[0] + $Line.points[1])/1.3
$Tip.position = ($Line.points[0] + $Line.points[1])/2 $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])
func label_set(new_label): func label_set(new_label):

View file

@ -20,7 +20,14 @@ z_index = 1
position = Vector2( -9.66138, -2.89842 ) position = Vector2( -9.66138, -2.89842 )
z_index = -1 z_index = -1
color = Color( 0.2, 0.2, 0.2, 1 ) color = Color( 0.2, 0.2, 0.2, 1 )
polygon = PoolVector2Array( -19.8744, 17.0372, 47.7551, 11.8845, -10.5351, -21.2861 ) polygon = PoolVector2Array( -8.50021, 20.4619, 36.1874, 8.44903, 0.869781, -21.8232 )
[node name="Polygon2" type="Polygon2D" parent="Tip"]
visible = false
position = Vector2( -9.66138, -2.89842 )
z_index = -1
color = Color( 0.2, 0.2, 0.2, 1 )
polygon = PoolVector2Array( -8.50021, 20.4619, 22.2526, 5.80623, 2.31131, -19.9012, -12.104, -23.7453, 4.95413, 1.72188, -21.9546, 16.1372 )
[node name="Label" type="Node2D" parent="."] [node name="Label" type="Node2D" parent="."]
visible = false visible = false
@ -40,6 +47,7 @@ __meta__ = {
} }
[node name="Target" type="Label" parent="."] [node name="Target" type="Label" parent="."]
visible = false
margin_left = -229.024 margin_left = -229.024
margin_top = 63.3118 margin_top = 63.3118
margin_right = 232.976 margin_right = 232.976

18
node.gd
View file

@ -55,18 +55,24 @@ func type_set(new_type):
#$ID.text = $ID.text.replace("refs/", "") #$ID.text = $ID.text.replace("refs/", "")
match new_type: match new_type:
"blob": "blob":
$Rect.color = Color("#333333") $Sprite.texture = preload("res://nodes/blob.svg")
#$Rect.color = Color("#333333")
"tree": "tree":
$Rect.color = Color.darkgreen $Sprite.texture = preload("res://nodes/tree.svg")
#$Rect.color = Color.darkgreen
"commit": "commit":
$Rect.color = Color.orange $Sprite.texture = preload("res://nodes/commit.svg")
#$Rect.color = Color.orange
"tag": "tag":
$Rect.color = Color.blue $Sprite.texture = preload("res://nodes/blob.svg")
#$Rect.color = Color.blue
"ref": "ref":
$Rect.color = Color("#6680ff") $Sprite.texture = preload("res://nodes/ref.svg")
#$Rect.color = Color("#6680ff")
id_always_visible = true id_always_visible = true
"head": "head":
$Rect.color = Color.red $Sprite.texture = preload("res://nodes/ref.svg")
#$Rect.color = Color.red
id_always_visible = true id_always_visible = true
if id_always_visible: if id_always_visible:
$ID.show() $ID.show()

View file

@ -2,6 +2,7 @@
[ext_resource path="res://node.gd" type="Script" id=1] [ext_resource path="res://node.gd" type="Script" id=1]
[ext_resource path="res://fonts/default.tres" type="DynamicFont" id=2] [ext_resource path="res://fonts/default.tres" type="DynamicFont" id=2]
[ext_resource path="res://nodes/blob.svg" type="Texture" id=3]
[sub_resource type="StyleBoxFlat" id=1] [sub_resource type="StyleBoxFlat" id=1]
content_margin_left = 5.0 content_margin_left = 5.0
@ -14,9 +15,6 @@ corner_radius_top_right = 5
corner_radius_bottom_right = 5 corner_radius_bottom_right = 5
corner_radius_bottom_left = 5 corner_radius_bottom_left = 5
[sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 30.4838, 29.9015 )
[node name="Node" type="Node2D"] [node name="Node" type="Node2D"]
z_index = 1 z_index = 1
script = ExtResource( 1 ) script = ExtResource( 1 )
@ -25,13 +23,17 @@ script = ExtResource( 1 )
margin_left = -29.0 margin_left = -29.0
margin_top = -28.0 margin_top = -28.0
margin_right = 29.0 margin_right = 29.0
margin_bottom = 30.0 margin_bottom = 29.0
mouse_filter = 1 mouse_filter = 1
color = Color( 0.984314, 0, 0, 1 ) color = Color( 1, 1, 1, 0 )
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="Sprite" type="Sprite" parent="."]
scale = Vector2( 0.5, 0.5 )
texture = ExtResource( 3 )
[node name="ID" type="Label" parent="."] [node name="ID" type="Label" parent="."]
visible = false visible = false
margin_left = -19.9265 margin_left = -19.9265
@ -47,10 +49,10 @@ __meta__ = {
[node name="Content" type="Label" parent="."] [node name="Content" type="Label" parent="."]
visible = false visible = false
margin_left = -30.0 margin_left = -22.2898
margin_top = 37.0 margin_top = 30.1969
margin_right = -20.0 margin_right = -12.2898
margin_bottom = 72.0 margin_bottom = 65.1969
custom_styles/normal = SubResource( 1 ) custom_styles/normal = SubResource( 1 )
custom_fonts/font = ExtResource( 2 ) custom_fonts/font = ExtResource( 2 )
custom_colors/font_color = Color( 1, 1, 1, 1 ) custom_colors/font_color = Color( 1, 1, 1, 1 )
@ -58,14 +60,6 @@ __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="Area" type="Area2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area"]
shape = SubResource( 2 )
[node name="Arrows" type="Node2D" parent="."] [node name="Arrows" type="Node2D" parent="."]
[connection signal="mouse_entered" from="Rect" to="." method="_on_hover"] [connection signal="mouse_entered" from="Rect" to="." method="_on_hover"]
[connection signal="mouse_exited" from="Rect" to="." method="_on_unhover"] [connection signal="mouse_exited" from="Rect" to="." method="_on_unhover"]
[connection signal="input_event" from="Area" to="." method="_input_event"]
[connection signal="mouse_entered" from="Area" to="." method="_on_hover"]
[connection signal="mouse_exited" from="Area" to="." method="_on_unhover"]

62
nodes/blob.svg Normal file
View file

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="18.716124mm"
height="18.716124mm"
viewBox="0 0 18.716123 18.716123"
version="1.1"
id="svg8"
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"
sodipodi:docname="blob.svg">
<defs
id="defs2" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="2.8"
inkscape:cx="29.133458"
inkscape:cy="35.585442"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
inkscape:document-rotation="0"
showgrid="false"
inkscape:window-width="1280"
inkscape:window-height="959"
inkscape:window-x="6400"
inkscape:window-y="1166"
inkscape:window-maximized="1" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-50.047513,-136.47649)">
<circle
style="fill:#666666;fill-rule:evenodd;stroke-width:0.999997;stroke-linecap:round;stroke-linejoin:round"
id="path835"
cx="59.405575"
cy="145.83455"
r="9.3580618" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

34
nodes/blob.svg.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/blob.svg-32176d6d674206dbc69554456f0ea720.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://nodes/blob.svg"
dest_files=[ "res://.import/blob.svg-32176d6d674206dbc69554456f0ea720.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

64
nodes/commit.svg Normal file
View file

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="24.586214mm"
height="24.586214mm"
viewBox="0 0 24.586213 24.586213"
version="1.1"
id="svg8"
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"
sodipodi:docname="commit.svg">
<defs
id="defs2" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="2.8"
inkscape:cx="13.86055"
inkscape:cy="14.59879"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
inkscape:document-rotation="0"
showgrid="false"
inkscape:window-width="1280"
inkscape:window-height="959"
inkscape:window-x="6400"
inkscape:window-y="1166"
inkscape:window-maximized="1" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-54.08847,-142.02921)">
<rect
style="fill:#c2bf26;fill-opacity:1;fill-rule:evenodd;stroke-width:0.0999996;stroke-linecap:round;stroke-linejoin:round"
id="rect831"
width="24.586214"
height="24.586214"
x="54.08847"
y="142.02921"
ry="3.3460476" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

34
nodes/commit.svg.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/commit.svg-e84b6d5f0dcf8ee449788a8c35e799e5.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://nodes/commit.svg"
dest_files=[ "res://.import/commit.svg-e84b6d5f0dcf8ee449788a8c35e799e5.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

78
nodes/ref.svg Normal file
View file

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="38.384991mm"
height="27.78401mm"
viewBox="0 0 38.384989 27.784009"
version="1.1"
id="svg8"
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"
sodipodi:docname="ref.svg">
<defs
id="defs2" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="3.959798"
inkscape:cx="59.966053"
inkscape:cy="33.076383"
inkscape:document-units="mm"
inkscape:current-layer="g836"
inkscape:document-rotation="0"
showgrid="false"
inkscape:window-width="1280"
inkscape:window-height="959"
inkscape:window-x="6400"
inkscape:window-y="1166"
inkscape:window-maximized="1" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-42.497567,-140.42952)">
<g
id="g836"
transform="matrix(1.1299927,0,0,1.1299927,-8.019261,-20.06068)"
style="stroke-width:0.884961">
<rect
style="fill:#1e1e71;fill-opacity:1;fill-rule:evenodd;stroke-width:0.0884958;stroke-linecap:round;stroke-linejoin:round"
id="rect831"
width="24.586214"
height="24.586214"
x="54.08847"
y="142.02921"
ry="3.3460476" />
<rect
style="fill:#1e1e71;fill-opacity:1;fill-rule:evenodd;stroke-width:0.0884954;stroke-linecap:round;stroke-linejoin:round"
id="rect832"
width="18.886017"
height="18.886017"
x="-78.260193"
y="139.98091"
ry="2.5702822"
transform="rotate(-45)" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

34
nodes/ref.svg.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/ref.svg-ba1531cc32a42d39c1bb1fbb28f745fb.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://nodes/ref.svg"
dest_files=[ "res://.import/ref.svg-ba1531cc32a42d39c1bb1fbb28f745fb.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

72
nodes/tree.svg Normal file
View file

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="27.858206mm"
height="24.125914mm"
viewBox="0 0 27.858205 24.125914"
version="1.1"
id="svg8"
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"
sodipodi:docname="tree.svg">
<defs
id="defs2" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="2.8"
inkscape:cx="37.415506"
inkscape:cy="40.571638"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
inkscape:document-rotation="0"
showgrid="false"
inkscape:window-width="1280"
inkscape:window-height="959"
inkscape:window-x="6400"
inkscape:window-y="1166"
inkscape:window-maximized="1" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-47.856221,-135.15722)">
<path
sodipodi:type="star"
style="fill:#164816;fill-opacity:1;fill-rule:evenodd;stroke-width:0.1;stroke-linecap:round;stroke-linejoin:round"
id="path833"
sodipodi:sides="3"
sodipodi:cx="61.785324"
sodipodi:cy="151.24117"
sodipodi:r1="16.083942"
sodipodi:r2="8.0419712"
sodipodi:arg1="-1.5707963"
sodipodi:arg2="-0.52359878"
inkscape:flatsided="true"
inkscape:rounded="0"
inkscape:randomized="0"
d="m 61.785324,135.15722 13.929102,24.12592 -27.858205,0 z"
inkscape:transform-center-y="-4.0209816" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

34
nodes/tree.svg.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/tree.svg-3883bff21a1825dc9656cd06abe52ea6.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://nodes/tree.svg"
dest_files=[ "res://.import/tree.svg-3883bff21a1825dc9656cd06abe52ea6.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0