Skip to content

Commit 0f78f47

Browse files
Update to Godot 4.5 and sync with upstream and (#73)
1 parent 14abc27 commit 0f78f47

274 files changed

Lines changed: 2929 additions & 2285 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/disabled_classes.build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
"AnimationNodeStateMachinePlayback",
1313
"AnimationNodeStateMachineTransition",
1414
"AspectRatioContainer",
15-
"AtlasTexture",
1615
"AudioBusLayout",
1716
"AudioEffect",
1817
"AudioStream",

.github/file_format.sh

Lines changed: 61 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,69 @@
11
#!/usr/bin/env bash
2-
32
# This script ensures proper POSIX text file formatting and a few other things.
4-
53
set -uo pipefail
64
IFS=$'\n\t'
75

6+
# Function to check if file is UTF-8.
7+
is_utf8() {
8+
local file="$1"
9+
# Use file command if available, otherwise assume UTF-8.
10+
if command -v file >/dev/null 2>&1; then
11+
file -b --mime-encoding "$file" | grep -q "utf-8\|ascii"
12+
else
13+
return 0 # Assume UTF-8 if can't check.
14+
fi
15+
}
16+
17+
# Function to convert CRLF to LF.
18+
convert_line_endings() {
19+
local file="$1"
20+
# Check if file has CRLF endings.
21+
if grep -q $'\r$' "$file" 2>/dev/null; then
22+
# Convert CRLF to LF using sed.
23+
sed -i 's/\r$//' "$file"
24+
echo "Converted CRLF to LF: $file"
25+
fi
26+
}
27+
28+
# Function to remove trailing spaces and ensure final newline.
29+
clean_whitespace() {
30+
local file="$1"
31+
# Remove trailing spaces and ensure final newline.
32+
sed -i -e '/[^ \t]/ s/[ \t]*$//' -e '/^[ \t]*$/ s/ *$//' -e '$a\' "$file"
33+
}
34+
835
# Loops through all text files tracked by Git.
936
git grep -zIl '' |
1037
while IFS= read -rd '' f; do
11-
# Exclude some types of files.
12-
if [[ "$f" == *"svg" ]]; then
13-
continue
14-
elif [[ "$f" == *"build" ]]; then
15-
continue
16-
elif [[ "$f" == *".patch" ]]; then
17-
continue
18-
fi
19-
# Ensure that files are UTF-8 formatted.
20-
recode UTF-8 "$f" 2> /dev/null
21-
# Ensure that files have LF line endings and do not contain a BOM.
22-
dos2unix "$f" 2> /dev/null
23-
# Remove trailing space characters and ensure that files end
24-
# with newline characters. -l option handles newlines conveniently.
25-
perl -i -ple 's/ *$//g' "$f"
26-
# Remove the character sequence "== true" if it has a leading space.
27-
perl -i -pe 's/\x20== true//g' "$f"
28-
# We don't want to change lines around braces in godot/tscn files.
29-
if [[ "$f" == *"godot" ]]; then
30-
continue
31-
elif [[ "$f" == *"tscn" ]]; then
38+
# Exclude some types of files.
39+
if [[ "$f" == *"svg" ]]; then
40+
continue
41+
elif [[ "$f" == *"build" ]]; then
42+
continue
43+
elif [[ "$f" == *".patch" ]]; then
3244
continue
33-
fi
34-
# Disallow empty lines after the opening brace.
35-
sed -z -i 's/\x7B\x0A\x0A/\x7B\x0A/g' "$f"
36-
# Disallow some empty lines before the closing brace.
37-
sed -z -i 's/\x0A\x0A\x7D/\x0A\x7D/g' "$f"
45+
fi
46+
47+
if ! is_utf8 "$f"; then
48+
echo "Warning: $f may not be UTF-8 encoded"
49+
fi
50+
51+
convert_line_endings "$f"
52+
clean_whitespace "$f"
53+
54+
# Remove the character sequence "== true" if it has a leading space.
55+
sed -i 's/ [=][=] true//g' "$f"
56+
57+
# We don't want to change lines around braces in godot/tscn files.
58+
if [[ "$f" == *"godot" ]] || [[ "$f" == *"tscn" ]]; then
59+
continue
60+
fi
61+
62+
# Disallow empty lines after the opening brace.
63+
sed -i ':a;N;$!ba;s/{\n\n/{\n/g' "$f"
64+
65+
# Disallow some empty lines before the closing brace.
66+
sed -i ':a;N;$!ba;s/\n\n}/\n}/g' "$f"
3867
done
3968

4069
git diff > patch.patch
@@ -43,15 +72,15 @@ MAXSIZE=5
4372

4473
# If no patch has been generated all is OK, clean up, and exit.
4574
if (( FILESIZE < MAXSIZE )); then
46-
printf "Files in this commit comply with the formatting rules.\n"
47-
rm -f patch.patch
48-
exit 0
75+
printf "Files in this commit comply with the formatting rules.\n"
76+
rm -f patch.patch
77+
exit 0
4978
fi
5079

5180
# A patch has been created, notify the user, clean up, and exit.
5281
printf "\n*** The following differences were found between the code "
5382
printf "and the formatting rules:\n\n"
5483
cat patch.patch
55-
printf "\n*** Aborting, please fix the formatting issue(s).'\n"
84+
printf "\n*** Aborting, please fix the formatting issue(s).\n"
5685
rm -f patch.patch
5786
exit 1

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ env:
1111
# Which godot version to use for exporting.
1212
GODOT_VERSION: 4.5
1313
# Which godot release to use for exporting. (stable/rc/beta/alpha)
14-
GODOT_RELEASE: beta5
14+
GODOT_RELEASE: stable
1515
# Used in the editor config file name. Do not change this for patch releases.
1616
GODOT_FEATURE_VERSION: 4.5
1717
# Commit hash
18-
GODOT_COMMIT_HASH: c81fd6c
18+
GODOT_COMMIT_HASH: 2dd26a027
1919
PROJECT_NAME: VectorTouch
2020
BUILD_OPTIONS: target=template_release lto=full production=yes deprecated=no minizip=no brotli=no vulkan=no openxr=no use_volk=no disable_3d=yes disable_physics_2d=yes disable_navigation_2d=yes modules_enabled_by_default=no module_freetype_enabled=yes module_gdscript_enabled=yes module_svg_enabled=yes module_jpg_enabled=yes module_text_server_adv_enabled=yes graphite=no module_webp_enabled=yes module_mbedtls_enabled=yes swappy=no build_profile=../vectortouch/.github/disabled_classes.build
2121
GODOT_REPO: https://github.com/godotengine/godot.git

CONTRIBUTING.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,28 @@ After submitting your pull request, I (MewPurPur) will review your changes and m
3131

3232
Editing translations is explained [here](translations/README.md)
3333

34-
## Code guidelines
34+
## Code guidelines and style
3535

36-
To document some quirks of our code that we've decided on:
36+
As usual, look around and try to copy the things you find in surrounding code.
3737

38-
- StringNames are avoided when possible. We do this because it makes the codebase simpler, although if something is actually shown to be performance-critical, it can be reconsidered.
39-
- Nodes may only be exported if their runtime structure isn't known.
38+
Guidelines:
39+
40+
- StringNames are avoided when possible.
41+
- Rationale: This makes the codebase simpler, and StringNames aren't a universal optimization. I've heard of a lot of cases where they counterintuitively make performance worse, and I don't currently understand them well-enough to not fall into traps. If performance benefits for using StringName somewhere are arduously benchmarked, it can be considered.
42+
- We avoid exporting nodes, unless their runtime structure isn't known.
4043
- Strings are always translated with `Translator.translate()`, not `tr()`.
4144

42-
## Code style
45+
Follow the [GDScript style guide](https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_styleguide.html). Almost all this guide's rules are enforced here.
4346

44-
For scripts, only GDScript code is allowed. Follow the [GDScript style guide](https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_styleguide.html). Most of its rules are enforced here. Additionally:
47+
We have some additional style rules:
4548

46-
- Static typing is used as much as possible.
49+
- Always use static typing. And if possible, use inferred typing, i.e., `var f := 4.0` instead of `var f: float = 4.0`
4750
- Comments are typically written like sentences with punctuation.
48-
- Two spaces are used to separate inline comments and code.
51+
- Inline comments are separated from the code by two spaces.
52+
- Documentation comments are written like normal comments, without modifiers like `[param]` or `[code]`.
53+
- Rationale: The amount by which they improve the readability of the documentation isn't enough to outweigh how much worse they are when you look at them in code. I believe they aren't suitable in a project where only developers will be reading them.
4954
- For empty lines in the middle of indented blocks, the scope's indentation is kept.
55+
- Rationale: I don't really know why this isn't conventional, I find that it just gets in the way when you want to add code where there were previously empty spaces.
5056
- Class names use `class_name X extends Y` syntax.
5157

5258
Don't make pull requests for code style changes without discussing them first (unless it's for corrections to abide by the ones described here). The same generally applies to making style changes unrelated to a PR's main goal. Pull requests may also get production tweaks to tweak their style before being merged.

assets/icons/ApplyMatrix.svg.import

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
[remap]
22

33
importer="svg"
4-
type="SVGTexture"
4+
type="DPITexture"
55
uid="uid://cqg7ga6y3m0v1"
6-
path="res://.godot/imported/ApplyMatrix.svg-4b4fb4d9ae9b2b8df69ee71dac2db3d2.svgtex"
6+
path="res://.godot/imported/ApplyMatrix.svg-4b4fb4d9ae9b2b8df69ee71dac2db3d2.dpitex"
77

88
[deps]
99

1010
source_file="res://assets/icons/ApplyMatrix.svg"
11-
dest_files=["res://.godot/imported/ApplyMatrix.svg-4b4fb4d9ae9b2b8df69ee71dac2db3d2.svgtex"]
11+
dest_files=["res://.godot/imported/ApplyMatrix.svg-4b4fb4d9ae9b2b8df69ee71dac2db3d2.dpitex"]
1212

1313
[params]
1414

assets/icons/Arrow.svg.import

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
[remap]
22

33
importer="svg"
4-
type="SVGTexture"
4+
type="DPITexture"
55
uid="uid://coda6chhcatal"
6-
path="res://.godot/imported/Arrow.svg-454f1a120b660e1c200a4fee4bc9d4e9.svgtex"
6+
path="res://.godot/imported/Arrow.svg-454f1a120b660e1c200a4fee4bc9d4e9.dpitex"
77

88
[deps]
99

1010
source_file="res://assets/icons/Arrow.svg"
11-
dest_files=["res://.godot/imported/Arrow.svg-454f1a120b660e1c200a4fee4bc9d4e9.svgtex"]
11+
dest_files=["res://.godot/imported/Arrow.svg-454f1a120b660e1c200a4fee4bc9d4e9.dpitex"]
1212

1313
[params]
1414

assets/icons/BWHandle.svg.import

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
[remap]
22

33
importer="svg"
4-
type="SVGTexture"
4+
type="DPITexture"
55
uid="uid://ksx758sjihau"
6-
path="res://.godot/imported/BWHandle.svg-9588bc79a1c5a24e3ab185d58c8cacd6.svgtex"
6+
path="res://.godot/imported/BWHandle.svg-9588bc79a1c5a24e3ab185d58c8cacd6.dpitex"
77

88
[deps]
99

1010
source_file="res://assets/icons/BWHandle.svg"
11-
dest_files=["res://.godot/imported/BWHandle.svg-9588bc79a1c5a24e3ab185d58c8cacd6.svgtex"]
11+
dest_files=["res://.godot/imported/BWHandle.svg-9588bc79a1c5a24e3ab185d58c8cacd6.dpitex"]
1212

1313
[params]
1414

assets/icons/Checkerboard.svg

Lines changed: 1 addition & 1 deletion
Loading

assets/icons/Checkerboard.svg.import

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
[remap]
22

33
importer="svg"
4-
type="SVGTexture"
4+
type="DPITexture"
55
uid="uid://c68og6bsqt0lb"
6-
path="res://.godot/imported/Checkerboard.svg-6a6a77a30bc3d01a7e939a20ab5e8a17.svgtex"
6+
path="res://.godot/imported/Checkerboard.svg-6a6a77a30bc3d01a7e939a20ab5e8a17.dpitex"
77

88
[deps]
99

1010
source_file="res://assets/icons/Checkerboard.svg"
11-
dest_files=["res://.godot/imported/Checkerboard.svg-6a6a77a30bc3d01a7e939a20ab5e8a17.svgtex"]
11+
dest_files=["res://.godot/imported/Checkerboard.svg-6a6a77a30bc3d01a7e939a20ab5e8a17.dpitex"]
1212

1313
[params]
1414

assets/icons/CheckerboardColorButton.svg.import

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
[remap]
22

33
importer="svg"
4-
type="SVGTexture"
4+
type="DPITexture"
55
uid="uid://y0l74x73w0co"
6-
path="res://.godot/imported/CheckerboardColorButton.svg-a3714a8fc4a1322639155850c5bd0c5e.svgtex"
6+
path="res://.godot/imported/CheckerboardColorButton.svg-a3714a8fc4a1322639155850c5bd0c5e.dpitex"
77

88
[deps]
99

1010
source_file="res://assets/icons/CheckerboardColorButton.svg"
11-
dest_files=["res://.godot/imported/CheckerboardColorButton.svg-a3714a8fc4a1322639155850c5bd0c5e.svgtex"]
11+
dest_files=["res://.godot/imported/CheckerboardColorButton.svg-a3714a8fc4a1322639155850c5bd0c5e.dpitex"]
1212

1313
[params]
1414

0 commit comments

Comments
 (0)