Skip to content

Commit

Permalink
Move to Godot 4.4.beta1 (#1081)
Browse files Browse the repository at this point in the history
  • Loading branch information
MewPurPur authored Jan 17, 2025
1 parent 2de3a69 commit 76f16fc
Show file tree
Hide file tree
Showing 216 changed files with 428 additions and 221 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/export-optimized.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ on:

env:
# Which godot version to use for exporting.
GODOT_VERSION: 4.3
GODOT_VERSION: 4.4
# Which godot release to use for exporting. (stable/rc/beta/alpha)
GODOT_RELEASE: stable
GODOT_RELEASE: beta1
# Used in the editor config file name. Do not change this for patch releases.
GODOT_FEATURE_VERSION: 4.3
GODOT_FEATURE_VERSION: 4.4
# Commit hash
GODOT_COMMIT_HASH: 77dcf97
GODOT_COMMIT_HASH: d33da79d3
PROJECT_NAME: GodSVG
GODOT_REPO: https://github.com/godotengine/godot.git
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 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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Note that if you're on MacOS, you need to [disable Gatekeeper](https://disable-g

Link to the web build: https://godsvg.com/editor

To run the latest unreleased version, you can download Godot from https://godotengine.org (development is currently happening in v4.3). After getting the repository files on your machine, you must open Godot, click on the "Import" button, and import the `project.godot` folder. If there are a lot of errors as some people have reported, it's Godot's fault. Try closing and opening the project a few times, changing small things on the code that errors out, etc. until the errors hopefully clear.
To run the latest unreleased version, you can download Godot from https://godotengine.org (development is currently happening in v4.4.dev7). After getting the repository files on your machine, you must open Godot, click on the "Import" button, and import the `project.godot` folder. If there are a lot of errors as some people have reported, it's Godot's fault. Try closing and opening the project a few times, changing small things on the code that errors out, etc. until the errors hopefully clear.

## How to use it

Expand Down
1 change: 1 addition & 0 deletions assets/icons/PlatformAndroid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions assets/icons/PlatformAndroid.svg.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://bo5c20hy73tpr"
path="res://.godot/imported/PlatformAndroid.svg-507e6984f29f635a4ac46090e9514435.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/icons/PlatformAndroid.svg"
dest_files=["res://.godot/imported/PlatformAndroid.svg-507e6984f29f635a4ac46090e9514435.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false
2 changes: 1 addition & 1 deletion godot_only/scripts/tests.gd
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ func _run() -> void:


func pathdata_tests(print_success := false) -> bool:
var tests := {
var tests: Dictionary[String, Array] = {
"Jerky": [],
"M 3s 6 h 6 v 3 z": [],
"M 3 s6 h 6 v 3 z": [],
Expand Down
1 change: 1 addition & 0 deletions godot_only/scripts/tests.gd.uid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uid://dat252hg8ds38
1 change: 1 addition & 0 deletions godot_only/scripts/update_theme.gd.uid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uid://dwlvevusq633j
9 changes: 4 additions & 5 deletions godot_only/scripts/update_translations.gd
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ msgstr \"\"
\"X-Generator: Poedit 3.4.2\\n\"\n"""

# Don't have a better solution than handling all these different whitespace variations...
var delimiters := {}
var delimiters: Dictionary[String, String] = {}
func populate_delimiters() -> void:
for method in ["translate"]:
for quote in ["'", '"', '"""']:
Expand Down Expand Up @@ -57,16 +57,15 @@ func search_directory(dir: String) -> void:

for file_name in DirAccess.get_files_at(dir):
var file_text := FileAccess.get_file_as_string(dir.path_join(file_name))
for start_delim: String in delimiters:
var end_delim: String = delimiters[start_delim]
for start_delim in delimiters:
var end_delim := delimiters[start_delim]
var cursor := 0
while true:
cursor = file_text.find(start_delim, cursor)
if cursor == -1:
break

var string_start := cursor + start_delim.length()
var old_cursor := cursor
cursor = file_text.find(end_delim, cursor)

var msgid := file_text.substr(string_start, cursor - string_start)
Expand Down Expand Up @@ -99,7 +98,7 @@ func update_translations() -> void:

var args := PackedStringArray(["--update", "--quiet", "--verbose", "--backup=off",
ProjectSettings.globalize_path("translations").path_join(file), location])
var output := []
var output: Array = []
var result := OS.execute("msgmerge", args, output, true)
if not result == -1:
if file == "GodSVG.pot":
Expand Down
1 change: 1 addition & 0 deletions godot_only/scripts/update_translations.gd.uid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uid://borkcfuyb12bq
9 changes: 7 additions & 2 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ config_version=5
config/name="GodSVG"
config/version="1.0-alpha7"
config/tags=PackedStringArray("project")
run/main_scene="res://src/ui_parts/main_scene.tscn"
run/main_scene="res://src/ui_parts/editor_scene.tscn"
config/use_custom_user_dir=true
config/features=PackedStringArray("4.3")
config/features=PackedStringArray("4.4")
run/low_processor_mode=true
boot_splash/bg_color=Color(0.1065, 0.1181, 0.15, 1)
boot_splash/image="res://assets/logos/splash.png"
Expand Down Expand Up @@ -327,6 +327,11 @@ pointing/android/enable_pan_and_scale_gestures=true

locale/translations=PackedStringArray("res://assets/translations/bg.po", "res://assets/translations/de.po", "res://assets/translations/en.po", "res://assets/translations/fr.po", "res://assets/translations/nl.po", "res://assets/translations/ru.po", "res://assets/translations/uk.po", "res://assets/translations/zh.po")

[physics]

2d/physics_engine="Dummy"
3d/physics_engine="Dummy"

[rendering]

renderer/rendering_method="gl_compatibility"
Expand Down
4 changes: 2 additions & 2 deletions src/autoload/Configs.gd
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func save() -> void:
ResourceSaver.save(savedata, savedata_path)


var default_shortcuts := {}
var default_shortcuts: Dictionary[String, Array] = {}

func _enter_tree() -> void:
# Fill up the default shortcuts dictionary before the shortcuts are loaded.
Expand Down Expand Up @@ -79,7 +79,7 @@ func reset_settings() -> void:
savedata.reset_to_default()
savedata.language = "en"
savedata.set_shortcut_panel_slots({ 0: "undo", 1: "redo" })
savedata.set_palettes([ColorPalette.new("Pure", ColorPalette.Preset.PURE)])
savedata.set_palettes([Palette.new("Pure", Palette.Preset.PURE)])
save()


Expand Down
1 change: 1 addition & 0 deletions src/autoload/Configs.gd.uid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uid://skypmx350i3b
16 changes: 8 additions & 8 deletions src/autoload/HandlerGUI.gd
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
extends Node

# Not a good idea to preload scenes inside a singleton.
var AlertDialog = load("res://src/ui_parts/alert_dialog.tscn")
var ConfirmDialog = load("res://src/ui_parts/confirm_dialog.tscn")
var SettingsMenu = load("res://src/ui_parts/settings_menu.tscn")
var AboutMenu = load("res://src/ui_parts/about_menu.tscn")
var DonateMenu = load("res://src/ui_parts/donate_menu.tscn")
var UpdateMenu = load("res://src/ui_parts/update_menu.tscn")
var ExportMenu = load("res://src/ui_parts/export_menu.tscn")
var ShortcutPanelScene = load("res://src/ui_parts/shortcut_panel.tscn")
const AlertDialog = preload("res://src/ui_parts/alert_dialog.tscn")
const ConfirmDialog = preload("res://src/ui_parts/confirm_dialog.tscn")
const SettingsMenu = preload("res://src/ui_parts/settings_menu.tscn")
const AboutMenu = preload("res://src/ui_parts/about_menu.tscn")
const DonateMenu = preload("res://src/ui_parts/donate_menu.tscn")
const UpdateMenu = preload("res://src/ui_parts/update_menu.tscn")
const ExportMenu = preload("res://src/ui_parts/export_menu.tscn")
const ShortcutPanelScene = preload("res://src/ui_parts/shortcut_panel.tscn")

# Menus should be added with add_menu() and removed by being freed.
# To add them as modals that don't hide the previous one, use add_dialog().
Expand Down
1 change: 1 addition & 0 deletions src/autoload/HandlerGUI.gd.uid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uid://cdt4mqkgfis8b
10 changes: 5 additions & 5 deletions src/autoload/Indications.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
extends Node

# Not a good idea to preload scenes inside a singleton.
var PathCommandPopup = load("res://src/ui_widgets/path_popup.tscn")
const PathCommandPopup = preload("res://src/ui_widgets/path_popup.tscn")

const path_actions_dict := {
const path_actions_dict: Dictionary[String, String] = {
"move_absolute": "M", "move_relative": "m",
"line_absolute": "L", "line_relative": "l",
"horizontal_line_absolute": "H", "horizontal_line_relative": "h",
Expand Down Expand Up @@ -403,7 +403,7 @@ func respond_to_key_input(event: InputEventKey) -> void:
for action_name in path_actions_dict.keys():
if ShortcutUtils.is_action_pressed(event, action_name):
var path_cmd_count := path_attrib.get_command_count()
var path_cmd_char: String = path_actions_dict[action_name]
var path_cmd_char := path_actions_dict[action_name]
# Z after a Z is syntactically invalid.
if (path_cmd_count == 0 and not path_cmd_char in "Mm") or\
(path_cmd_char in "Zz" and path_cmd_count > 0 and\
Expand All @@ -422,7 +422,7 @@ func respond_to_key_input(event: InputEventKey) -> void:
if element_ref.name == "path":
if ShortcutUtils.is_action_pressed(event, action_name):
var path_attrib: AttributePathdata = element_ref.get_attribute("d")
var path_cmd_char: String = path_actions_dict[action_name]
var path_cmd_char := path_actions_dict[action_name]
var last_selection: int = inner_selections.max()
# Z after a Z is syntactically invalid.
if path_attrib.get_command(last_selection) is PathCommand.CloseCommand and\
Expand Down Expand Up @@ -507,7 +507,7 @@ func get_selection_context(popup_method: Callable, context: Context) -> ContextP
var can_move_down := true
var can_move_up := true
for base_xid in filtered_xids:
if not XIDUtils.are_siblings(base_xid, filtered_xids[0]):
if not XIDUtils.are_siblings_or_same(base_xid, filtered_xids[0]):
can_move_down = false
can_move_up = false
break
Expand Down
1 change: 1 addition & 0 deletions src/autoload/Indications.gd.uid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uid://588gvlmtp1r7
1 change: 1 addition & 0 deletions src/autoload/SVG.gd.uid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uid://d1g3tf6hqcyv1
1 change: 1 addition & 0 deletions src/config_classes/ConfigResource.gd.uid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uid://bwqn1fkixjgrd
2 changes: 1 addition & 1 deletion src/config_classes/Formatter.gd
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ enum NamedColorUse {ALWAYS, WHEN_SHORTER_OR_EQUAL, WHEN_SHORTER, NEVER}
enum PrimaryColorSyntax {THREE_OR_SIX_DIGIT_HEX, SIX_DIGIT_HEX, RGB}

# Elements that don't make sense without child elements.
const container_elements = ["svg", "g", "linearGradient", "radialGradient"]
const container_elements: Array[String] = ["svg", "g", "linearGradient", "radialGradient"]


static func get_preset_enum_text(enum_value: Preset) -> String:
Expand Down
1 change: 1 addition & 0 deletions src/config_classes/Formatter.gd.uid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uid://7ryl3eingrpi
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# A resource for the color palettes that are listed in the color picker.
class_name ColorPalette extends ConfigResource
class_name Palette extends ConfigResource

enum Preset {EMPTY, PURE, GRAYSCALE}

var presets = {
var _presets: Dictionary[Preset, Array] = {
Preset.EMPTY: [PackedStringArray(), PackedStringArray()],
Preset.PURE: [PackedStringArray(["#fff", "#000", "#f00", "#0f0", "#00f", "#ff0",
"#f0f", "#0ff"]), PackedStringArray(["White", "Black", "Red", "Green", "Blue",
Expand Down Expand Up @@ -109,16 +109,16 @@ func modify_color_name(idx: int, new_color_name: String) -> void:

func apply_preset(new_preset: Preset) -> void:
if not is_same_as_preset(new_preset):
_colors = presets[new_preset][0].duplicate()
_color_names = presets[new_preset][1].duplicate()
_colors = _presets[new_preset][0].duplicate()
_color_names = _presets[new_preset][1].duplicate()
emit_changed()
layout_changed.emit()

func is_same_as_preset(preset: Preset) -> bool:
return _colors == presets[preset][0] and _color_names == presets[preset][1]
return _colors == _presets[preset][0] and _color_names == _presets[preset][1]

func has_unique_definitions() -> bool:
var dict := {}
var dict: Dictionary[Color, Array] = {}
for i in _color_names.size():
var color := ColorParser.text_to_color(_colors[i])
if dict.has(color) and dict[color].has(_color_names[i]):
Expand Down Expand Up @@ -146,13 +146,13 @@ func _validate() -> void:
_color_names.resize(_colors.size())


static func text_to_palettes(text: String) -> Array[ColorPalette]:
static func text_to_palettes(text: String) -> Array[Palette]:
var parser := XMLParser.new()
parser.open_buffer(text.to_utf8_buffer())
var parsed_title: String
var parsed_colors := PackedStringArray()
var parsed_color_names := PackedStringArray()
var palettes: Array[ColorPalette] = []
var palettes: Array[Palette] = []
while parser.read() == OK:
match parser.get_node_type():
XMLParser.NODE_ELEMENT:
Expand All @@ -167,7 +167,7 @@ static func text_to_palettes(text: String) -> Array[ColorPalette]:
parsed_colors.append(col_str)
XMLParser.NODE_ELEMENT_END:
if parser.get_node_name() == "palette":
var new_palette := ColorPalette.new(parsed_title)
var new_palette := Palette.new(parsed_title)
new_palette.setup(parsed_colors, parsed_color_names)
parsed_colors.clear()
parsed_color_names.clear()
Expand Down
1 change: 1 addition & 0 deletions src/config_classes/Palette.gd.uid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uid://d3psyvkuyj7tg
2 changes: 1 addition & 1 deletion src/config_classes/SVGHighlighter.gd
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func _get_line_syntax_highlighting(line: int) -> Dictionary:
if svg_text.is_empty():
return {}

var color_map := {} # Dictionary{int: Dictionary{String: Color}}
var color_map: Dictionary[int, Dictionary] = {}
var parser := XMLParser.new()
parser.open_buffer(svg_text.to_utf8_buffer())
while parser.read() == OK:
Expand Down
1 change: 1 addition & 0 deletions src/config_classes/SVGHighlighter.gd.uid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uid://dqqj8wr6p708t
Loading

0 comments on commit 76f16fc

Please sign in to comment.