OverviewFilesCommitsIssuesDocsReleasesPeers

Attila772-hypergodot commits / c613814

Ui and screenshot functionality
c613814203966f4d053a5e563aa49c7e3bb484d8
by Attila772 <71554727+Attila772@users.noreply.github.com> · 2025-01-07T13:53:42.000Z

Changed files (29) +367 -12

.gdignore +1 -0
……@@ -0,0 +1 @@
1screenshot_*.png
.github/FUNDING.yml +3 -0
……@@ -0,0 +1,3 @@
1
2github: [jeremi360]
3custom: [https://rakugoteam.github.io/fund/]
.github/ISSUE_TEMPLATE/bug_report.md +31 -0
……@@ -0,0 +1,31 @@
1---
2name: Bug report
3about: Create a report to help us improve
4title: ''
5labels: bug
6assignees: jebedaia360
7
8---
9
10**Describe the bug**
11A clear and concise description of what the bug is.
12
13**To Reproduce**
14Steps to reproduce the behavior:
151. Go to '...'
162. Click on '....'
173. Scroll down to '....'
184. See error
19
20**Expected behavior**
21A clear and concise description of what you expected to happen.
22
23**Screenshots**
24If applicable, add screenshots to help explain your problem.
25
26**Runtime (please complete the following information):**
27 - Godot version [ e.g 3.2]
28 - Rakugo Version [e.g. 2.0.8]
29
30**Additional context**
31Add any other context about the problem here.
.github/ISSUE_TEMPLATE/feature_request.md +20 -0
……@@ -0,0 +1,20 @@
1---
2name: Feature request
3about: Suggest an idea for this project
4title: ''
5labels: enhancement
6assignees: jebedaia360
7
8---
9
10**Is your feature request related to a problem? Please describe.**
11A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
13**Describe the solution you'd like**
14A clear and concise description of what you want to happen.
15
16**Describe alternatives you've considered**
17A clear and concise description of any alternative solutions or features you've considered.
18
19**Additional context**
20Add any other context or screenshots about the feature request here.
.import/MaterialButton.svg-5f94e142277195ea0bc7e98f55cd231d.md5 +3 -0
……@@ -0,0 +1,3 @@
1source_md5="8e9736671bfb1bad8070d12613919ea1"
2dest_md5="eff6ea05379ffad621474ce7e4ba4c5f"
3
.import/MaterialButton.svg-5f94e142277195ea0bc7e98f55cd231d.stex +0 -0
(no content changes — binary or rename)
.import/MaterialIcon.svg-ecfd91f2228e77b5fe8b93ab817a7618.md5 +3 -0
……@@ -0,0 +1,3 @@
1source_md5="06f24cce4b34af064b521f3ed45dd78a"
2dest_md5="bcd1778e4d6348f4b4c12655e9a7a0ce"
3
.import/MaterialIcon.svg-ecfd91f2228e77b5fe8b93ab817a7618.stex +0 -0
(no content changes — binary or rename)
.import/icon.png-487276ed1e3a0c39cad0279d744ee560.md5 +3 -0
……@@ -0,0 +1,3 @@
1source_md5="7f2ca3a97e2aa648b1ad0a3e8a77a3f0"
2dest_md5="9d553917664bc8c8ec35c7dc6aad793f"
3
.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex +0 -0
(no content changes — binary or rename)
Camera2D.gd +24 -0
……@@ -7,6 +7,8 @@ var dragging: bool = false
77var drag_last_position: Vector2
88
99func _ready():
10 var dir = DirAccess.open("user://")
11 dir.make_dir("screenshots")
1012 # Initial setup if needed
1113 pass
1214
……@@ -41,3 +43,25 @@ func _input(event):
4143 # Move the camera based on the drag
4244 position += drag_delta
4345 drag_last_position = drag_current_position
46
47
48func _on_button_button_up() -> void:
49 get_parent().get_node("CanvasLayer2").get_node("Button").visible = false
50 # Enable high-quality mode
51 Global.high_quality = true
52 queue_redraw()
53 await RenderingServer.frame_post_draw # Wait for the high-quality redraw
54 # Capture the screenshot
55 var image = get_viewport().get_texture().get_image()
56
57 var dir = DirAccess.open("user://screenshots")
58 var c= 0
59 for n in dir.get_files():
60 c+=1
61 image.save_png("user://screenshots/ss" +str(c)+ ".png")
62
63
64 # Revert back to normal mode
65 Global.high_quality = false
66 get_parent().get_node("CanvasLayer2").get_node("Button").visible = true
67 pass # Replace with function body.
Global.gd +1 -0
……@@ -2,6 +2,7 @@ extends Node
22
33var group_dictionary = {}
44var group_count = 0
5var high_quality = false
56
67# Function to initialize the groups from a list of group names
78func initialize_groups(group_names: Array):
HyperEdge.gd +17 -3
……@@ -5,6 +5,7 @@ var color: Color
55var width = 5
66var dragging = false
77var group = ""
8var point_count = 50
89
910func _ready():
1011 pass
……@@ -20,6 +21,10 @@ func _input(event):
2021 else:
2122 dragging = false # Stop dragging
2223 queue_redraw() # Optionally, queue a redraw when you stop dragging
24
25
26
27
2328func _draw():
2429 var points = []
2530 for node_id in nodes:
……@@ -28,10 +33,19 @@ func _draw():
2833 if node:
2934 var center = node.position
3035 var radius = nodes[node_id]
31 points += generate_circle_points(center, radius,50) # Generate circle points
36
37
38 var config = ConfigFile.new()
39 var err = config.load("res://conf.cfg")
40 if err == OK:
41 # Get the edge_width value from the config file
42 point_count = config.get_value("graph_settings", "point_count", 2.0)
43 if Global.high_quality:
44 point_count = 300
45 points += generate_circle_points(center, radius,point_count) # Generate circle points
3246 # Draw each point as a small circle for visibility
33 for point in points:
34 draw_circle(point, 2, Color(1, 0, 0)) # Red color, radius 2
47 #for point in points:
48 # draw_circle(point, 2, Color(1, 0, 0)) # Red color, radius 2
3549
3650 # Compute the convex hull of the points
3751 var hull = andrew_monotone_chain(points)
LICENSE +21 -0
……@@ -0,0 +1,21 @@
1MIT License
2
3Copyright (c) 2021 Jeremi Biernacki <jeremi360@gmail.com>
4
5Permission is hereby granted, free of charge, to any person obtaining a copy
6of this software and associated documentation files (the "Software"), to deal
7in the Software without restriction, including without limitation the rights
8to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9copies of the Software, and to permit persons to whom the Software is
10furnished to do so, subject to the following conditions:
11
12The above copyright notice and this permission notice shall be included in
13all copies or substantial portions of the Software.
14
15THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21THE SOFTWARE.
README.md +33 -0
……@@ -0,0 +1,33 @@
1![github-top-lang][lang] ![lic] ![lic-font]
2
3# MaterialIcons for Godot
4
5[*Templarian's Material-Design-Icons*](https://github.com/templarian/MaterialDesign) is a collection of icons for the [Material Design](https://material.io/) specification.
6
7This addon provides the following nodes to use the icons in Godot:
8- **MaterialIcon**: A node that displays an icon from the Material Design Icons collection.
9- **MaterialButton**: A node that displays an icon from the Material Design Icons collection as a button (without label).
10
11It's also adds **IconsFinder** to the Godot's **Tools** menu.
12So you can find the icons easily.
13
14![IconsFinder Screen Shot](screenshot_if.png)
15
16## Exporting
17For emojis to work in exported projects, you need add `*.json` files to include files settings:
18![include files settings](screenshot_export.png)
19
20## Install using gd-plug
21To install it with [gd-plug](https://github.com/imjp94/gd-plug) add in your `plug.gd` script:
22```gdscript
23extends "res://addons/gd-plug/plug.gd"
24
25func _plugging():
26 # your other plugins/addons install instructions
27 # ...
28 plug("rakugoteam/Godot-Material-Icons", {"include": ["addons", ".import/"]})
29```
30
31[lic]: https://img.shields.io/github/license/rakugoteam/Godot-Material-Icons?style=flat-square&label=📃%20License&
32[lang]: https://img.shields.io/github/languages/top/rakugoteam/Godot-Material-Icons?style=flat-square
33[lic-font]:https://img.shields.io/static/v1.svg?label=📜%20Font%20License&message=Pictogrammers%20Free%20License&color=informational&style=flat-square
camera.png +0 -0
(no content changes — binary or rename)
camera.png.import +34 -0
……@@ -0,0 +1,34 @@
1[remap]
2
3importer="texture"
4type="CompressedTexture2D"
5uid="uid://m1iltai5tk4w"
6path="res://.godot/imported/camera.png-b0b88c537f13bbf3b97a5735e4e3dab8.ctex"
7metadata={
8"vram_texture": false
9}
10
11[deps]
12
13source_file="res://camera.png"
14dest_files=["res://.godot/imported/camera.png-b0b88c537f13bbf3b97a5735e4e3dab8.ctex"]
15
16[params]
17
18compress/mode=0
19compress/high_quality=false
20compress/lossy_quality=0.7
21compress/hdr_compression=1
22compress/normal_map=0
23compress/channel_pack=0
24mipmaps/generate=false
25mipmaps/limit=-1
26roughness/mode=0
27roughness/src_normal=""
28process/fix_alpha_border=true
29process/premult_alpha=false
30process/normal_map_invert_y=false
31process/hdr_as_srgb=false
32process/hdr_clamp_exposure=false
33process/size_limit=0
34detect_3d/compress_to=1
conf.cfg +15 -0
……@@ -0,0 +1,15 @@
1[graph_settings]
2point_count = 10
3edge_width_expression = "pow(support, 0.35)"
4
5
6# point_count sets the number of points that will be generated around the nodes in order to calculate the curve,
7# More points mean a nicer curve, for the cost of more processing power.
8# edge_width_expression is a customizable expression that will apply to the width of the hyper edes. For ex.:
9# edge_width_expression = "20.0" will set the widths to be 20
10# Usable variables:
11# support : Support or weight of the edge
12# node_count: The count of how many nodes are in the given edge
13# total_nodes: How many nodes are in the full hypergraph
14# on the expressions themselves look up the godot documentation's expression page:
15# https://docs.godotengine.org/en/latest/tutorials/scripting/evaluating_expressions.html
default_env.tres +7 -0
……@@ -0,0 +1,7 @@
1[gd_resource type="Environment" load_steps=2 format=2]
2
3[sub_resource type="ProceduralSky" id=1]
4
5[resource]
6background_mode = 2
7background_sky = SubResource( 1 )
icon.png +0 -0
(no content changes — binary or rename)
icon.png.import +34 -0
……@@ -0,0 +1,34 @@
1[remap]
2
3importer="texture"
4type="CompressedTexture2D"
5uid="uid://croy0w3pwc1hw"
6path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"
7metadata={
8"vram_texture": false
9}
10
11[deps]
12
13source_file="res://icon.png"
14dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"]
15
16[params]
17
18compress/mode=0
19compress/high_quality=false
20compress/lossy_quality=0.7
21compress/hdr_compression=1
22compress/normal_map=0
23compress/channel_pack=0
24mipmaps/generate=false
25mipmaps/limit=-1
26roughness/mode=0
27roughness/src_normal=""
28process/fix_alpha_border=true
29process/premult_alpha=false
30process/normal_map_invert_y=false
31process/hdr_as_srgb=false
32process/hdr_clamp_exposure=false
33process/size_limit=0
34detect_3d/compress_to=1
main.gd +20 -1
……@@ -124,9 +124,28 @@ func populate_edge_data(file_data):
124124
125125 hyperedge_instance.add_to_group("edges")
126126 hyperedge_instance.name = str(edge_id)
127 var config = ConfigFile.new()
128 var expression = Expression.new()
129 var err = config.load("res://conf.cfg")
130 var expression_text = config.get_value("graph_settings", "edge_width_expression")
131 print(expression_text)
132
133 var error = expression.parse(expression_text, ["support", "node_count", "total_nodes"])
127134
135 if error != OK:
136 $AcceptDialog.window_title = "Error"
137 $AcceptDialog.dialog_text = "The expression cannot be parsed: " + error
138 $AcceptDialog.get_ok().text = "Close"
139 $AcceptDialog.popup_centered()
128140 # Set the width of the hyperedge based on the support value
129 hyperedge_instance.width = pow(edges[edge_id]["support"], 0.35)
141 var result = expression.execute([edges[edge_id]["support"], edge_data["nodes"].size(), nodes.size()] )
142 if result == null:
143 $AcceptDialog.title = "Error"
144 $AcceptDialog.dialog_text = "The expression cannot be parsed: Error" + str(error)
145 $AcceptDialog.ok_button_text = "Close"
146 $AcceptDialog.popup_centered()
147 return 1.0
148 hyperedge_instance.width = result
130149
131150 # Add the hyperedge instance to the scene tree
132151 add_child(hyperedge_instance)
main.tscn +20 -5
……@@ -1,16 +1,17 @@
1[gd_scene load_steps=3 format=3 uid="uid://2f8fvrck2f38"]
1[gd_scene load_steps=4 format=3 uid="uid://2f8fvrck2f38"]
22
33[ext_resource type="Script" path="res://main.gd" id="1_1hwno"]
44[ext_resource type="Script" path="res://Camera2D.gd" id="2_iiqxp"]
5[ext_resource type="Texture2D" uid="uid://m1iltai5tk4w" path="res://camera.png" id="3_rymd3"]
56
67[node name="Node2D" type="Node2D"]
78script = ExtResource("1_1hwno")
89
910[node name="ColorRect" type="ColorRect" parent="."]
10offset_left = -8559.0
11offset_top = -6223.0
12offset_right = 9085.0
13offset_bottom = 6156.0
11offset_left = -9305.0
12offset_top = -6418.0
13offset_right = 8339.0
14offset_bottom = 5961.0
1415
1516[node name="CanvasLayer" type="CanvasLayer" parent="."]
1617
……@@ -22,3 +23,17 @@ color = Color(0.0980392, 0.0980392, 0.0980392, 1)
2223
2324[node name="Camera2D" type="Camera2D" parent="."]
2425script = ExtResource("2_iiqxp")
26
27[node name="AcceptDialog" type="AcceptDialog" parent="."]
28
29[node name="CanvasLayer2" type="CanvasLayer" parent="."]
30layer = 3
31
32[node name="Button" type="Button" parent="CanvasLayer2"]
33offset_left = 4.0
34offset_top = 4.0
35offset_right = 108.0
36offset_bottom = 108.0
37icon = ExtResource("3_rymd3")
38
39[connection signal="button_up" from="CanvasLayer2/Button" to="Camera2D" method="_on_button_button_up"]
patterns.txt +1 -2
……@@ -1,6 +1,5 @@
11Environment_and_Natural_Resources Pollution_Management #SUP: 2662 #GROUP 2022
2Energy_and_Extractives Energy_Efficiency #SUP: 3163 #GROUP 2022
2Energy_and_Extractives Energy_Efficiency #SUP: 313 #GROUP 2022
33Energy_and_Extractives Health_Emergency_Preparedness_and_Disaster_Response #SUP: 7720 #GROUP 2022
44Environment_and_Natural_Resources Pollution_Management Air_Pollution #SUP: 3312 #GROUP 2023
55Environment_and_Natural_Resources Energy_and_Extractives Climate_Change Renewable_Energy #SUP: 3301 #GROUP 2023
6Energy_and_Extractives Health_Emergency_Preparedness_and_Disaster_Response #SUP: 5647 #GROUP 2023
project.godot +8 -1
……@@ -12,12 +12,19 @@ config_version=5
1212
1313config/name="Hypergodot"
1414run/main_scene="res://main.tscn"
15config/use_custom_user_dir=true
16config/custom_user_dir_name="screenshots"
1517config/features=PackedStringArray("4.3", "Forward Plus")
1618config/icon="res://icon.svg"
1719
1820[autoload]
1921
2022Global="*res://Global.gd"
23MaterialIconsDB="*res://addons/material-design-icons/icons/icons.gd"
24
25[debug]
26
27settings/stdout/print_fps=true
2128
2229[display]
2330
……@@ -29,7 +36,7 @@ project/assembly_name="Hypergodot"
2936
3037[editor_plugins]
3138
32enabled=PackedStringArray()
39enabled=PackedStringArray("res://addons/material-design-icons/plugin.cfg")
3340
3441[input]
3542
screenshot_export.png +0 -0
(no content changes — binary or rename)
screenshot_export.png.import +34 -0
……@@ -0,0 +1,34 @@
1[remap]
2
3importer="texture"
4type="CompressedTexture2D"
5uid="uid://b0jesjk1ltppl"
6path="res://.godot/imported/screenshot_export.png-e77d637744960750654bc8e433584754.ctex"
7metadata={
8"vram_texture": false
9}
10
11[deps]
12
13source_file="res://screenshot_export.png"
14dest_files=["res://.godot/imported/screenshot_export.png-e77d637744960750654bc8e433584754.ctex"]
15
16[params]
17
18compress/mode=0
19compress/high_quality=false
20compress/lossy_quality=0.7
21compress/hdr_compression=1
22compress/normal_map=0
23compress/channel_pack=0
24mipmaps/generate=false
25mipmaps/limit=-1
26roughness/mode=0
27roughness/src_normal=""
28process/fix_alpha_border=true
29process/premult_alpha=false
30process/normal_map_invert_y=false
31process/hdr_as_srgb=false
32process/hdr_clamp_exposure=false
33process/size_limit=0
34detect_3d/compress_to=1
screenshot_if.png +0 -0
(no content changes — binary or rename)
screenshot_if.png.import +34 -0
……@@ -0,0 +1,34 @@
1[remap]
2
3importer="texture"
4type="CompressedTexture2D"
5uid="uid://cfj7olysy1cv0"
6path="res://.godot/imported/screenshot_if.png-05119fa07b503c3e0c4929e8360dc9d2.ctex"
7metadata={
8"vram_texture": false
9}
10
11[deps]
12
13source_file="res://screenshot_if.png"
14dest_files=["res://.godot/imported/screenshot_if.png-05119fa07b503c3e0c4929e8360dc9d2.ctex"]
15
16[params]
17
18compress/mode=0
19compress/high_quality=false
20compress/lossy_quality=0.7
21compress/hdr_compression=1
22compress/normal_map=0
23compress/channel_pack=0
24mipmaps/generate=false
25mipmaps/limit=-1
26roughness/mode=0
27roughness/src_normal=""
28process/fix_alpha_border=true
29process/premult_alpha=false
30process/normal_map_invert_y=false
31process/hdr_as_srgb=false
32process/hdr_clamp_exposure=false
33process/size_limit=0
34detect_3d/compress_to=1