diff --git a/.github/workflows/export-optimized.yml b/.github/workflows/export-optimized.yml index 2313a138..9b28739d 100644 --- a/.github/workflows/export-optimized.yml +++ b/.github/workflows/export-optimized.yml @@ -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 diff --git a/README.md b/README.md index f152e5e6..8181a683 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/assets/icons/PlatformAndroid.svg b/assets/icons/PlatformAndroid.svg new file mode 100644 index 00000000..5c89cf00 --- /dev/null +++ b/assets/icons/PlatformAndroid.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/icons/PlatformAndroid.svg.import b/assets/icons/PlatformAndroid.svg.import new file mode 100644 index 00000000..47811381 --- /dev/null +++ b/assets/icons/PlatformAndroid.svg.import @@ -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 diff --git a/godot_only/scripts/tests.gd b/godot_only/scripts/tests.gd index fb38b773..0b695807 100644 --- a/godot_only/scripts/tests.gd +++ b/godot_only/scripts/tests.gd @@ -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": [], diff --git a/godot_only/scripts/tests.gd.uid b/godot_only/scripts/tests.gd.uid new file mode 100644 index 00000000..895c14b3 --- /dev/null +++ b/godot_only/scripts/tests.gd.uid @@ -0,0 +1 @@ +uid://dat252hg8ds38 diff --git a/godot_only/scripts/update_theme.gd.uid b/godot_only/scripts/update_theme.gd.uid new file mode 100644 index 00000000..76383e25 --- /dev/null +++ b/godot_only/scripts/update_theme.gd.uid @@ -0,0 +1 @@ +uid://dwlvevusq633j diff --git a/godot_only/scripts/update_translations.gd b/godot_only/scripts/update_translations.gd index c3aeab32..5bacd223 100644 --- a/godot_only/scripts/update_translations.gd +++ b/godot_only/scripts/update_translations.gd @@ -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 ["'", '"', '"""']: @@ -57,8 +57,8 @@ 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) @@ -66,7 +66,6 @@ func search_directory(dir: String) -> void: 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) @@ -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": diff --git a/godot_only/scripts/update_translations.gd.uid b/godot_only/scripts/update_translations.gd.uid new file mode 100644 index 00000000..eec2456d --- /dev/null +++ b/godot_only/scripts/update_translations.gd.uid @@ -0,0 +1 @@ +uid://borkcfuyb12bq diff --git a/project.godot b/project.godot index c6fea1c1..68ce864d 100644 --- a/project.godot +++ b/project.godot @@ -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" @@ -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" diff --git a/src/autoload/Configs.gd b/src/autoload/Configs.gd index c5f22c3a..f6b3b931 100644 --- a/src/autoload/Configs.gd +++ b/src/autoload/Configs.gd @@ -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. @@ -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() diff --git a/src/autoload/Configs.gd.uid b/src/autoload/Configs.gd.uid new file mode 100644 index 00000000..a9c4c1de --- /dev/null +++ b/src/autoload/Configs.gd.uid @@ -0,0 +1 @@ +uid://skypmx350i3b diff --git a/src/autoload/HandlerGUI.gd b/src/autoload/HandlerGUI.gd index 9d4e85e6..2b1401ed 100644 --- a/src/autoload/HandlerGUI.gd +++ b/src/autoload/HandlerGUI.gd @@ -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(). diff --git a/src/autoload/HandlerGUI.gd.uid b/src/autoload/HandlerGUI.gd.uid new file mode 100644 index 00000000..05f3b8ec --- /dev/null +++ b/src/autoload/HandlerGUI.gd.uid @@ -0,0 +1 @@ +uid://cdt4mqkgfis8b diff --git a/src/autoload/Indications.gd b/src/autoload/Indications.gd index 6a3315ef..452ad336 100644 --- a/src/autoload/Indications.gd +++ b/src/autoload/Indications.gd @@ -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", @@ -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\ @@ -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\ @@ -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 diff --git a/src/autoload/Indications.gd.uid b/src/autoload/Indications.gd.uid new file mode 100644 index 00000000..4c73b5a8 --- /dev/null +++ b/src/autoload/Indications.gd.uid @@ -0,0 +1 @@ +uid://588gvlmtp1r7 diff --git a/src/autoload/SVG.gd.uid b/src/autoload/SVG.gd.uid new file mode 100644 index 00000000..3cda3136 --- /dev/null +++ b/src/autoload/SVG.gd.uid @@ -0,0 +1 @@ +uid://d1g3tf6hqcyv1 diff --git a/src/config_classes/ConfigResource.gd.uid b/src/config_classes/ConfigResource.gd.uid new file mode 100644 index 00000000..dfcc9675 --- /dev/null +++ b/src/config_classes/ConfigResource.gd.uid @@ -0,0 +1 @@ +uid://bwqn1fkixjgrd diff --git a/src/config_classes/Formatter.gd b/src/config_classes/Formatter.gd index b3610fb7..64bbb0a2 100644 --- a/src/config_classes/Formatter.gd +++ b/src/config_classes/Formatter.gd @@ -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: diff --git a/src/config_classes/Formatter.gd.uid b/src/config_classes/Formatter.gd.uid new file mode 100644 index 00000000..5ad1fb8b --- /dev/null +++ b/src/config_classes/Formatter.gd.uid @@ -0,0 +1 @@ +uid://7ryl3eingrpi diff --git a/src/config_classes/ColorPalette.gd b/src/config_classes/Palette.gd similarity index 91% rename from src/config_classes/ColorPalette.gd rename to src/config_classes/Palette.gd index a7ab358b..38b8390e 100644 --- a/src/config_classes/ColorPalette.gd +++ b/src/config_classes/Palette.gd @@ -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", @@ -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]): @@ -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: @@ -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() diff --git a/src/config_classes/Palette.gd.uid b/src/config_classes/Palette.gd.uid new file mode 100644 index 00000000..51d39b89 --- /dev/null +++ b/src/config_classes/Palette.gd.uid @@ -0,0 +1 @@ +uid://d3psyvkuyj7tg diff --git a/src/config_classes/SVGHighlighter.gd b/src/config_classes/SVGHighlighter.gd index 04222c74..e53a8c7c 100644 --- a/src/config_classes/SVGHighlighter.gd +++ b/src/config_classes/SVGHighlighter.gd @@ -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: diff --git a/src/config_classes/SVGHighlighter.gd.uid b/src/config_classes/SVGHighlighter.gd.uid new file mode 100644 index 00000000..fce430f3 --- /dev/null +++ b/src/config_classes/SVGHighlighter.gd.uid @@ -0,0 +1 @@ +uid://dqqj8wr6p708t diff --git a/src/config_classes/SaveData.gd b/src/config_classes/SaveData.gd index 592075f0..c5809424 100644 --- a/src/config_classes/SaveData.gd +++ b/src/config_classes/SaveData.gd @@ -3,8 +3,8 @@ class_name SaveData extends ConfigResource const GoodColorPicker = preload("res://src/ui_widgets/good_color_picker.gd") const ShortcutPanel = preload("res://src/ui_parts/shortcut_panel.gd") -var _palette_validities := {} -var _shortcut_validities := {} +var _palette_validities: Dictionary[String, bool] = {} +var _shortcut_validities: Dictionary[Key, bool] = {} # Most settings don't need a default. func get_setting_default(setting: String) -> Variant: @@ -363,7 +363,7 @@ func add_recent_dir(dir: String) -> void: _recent_dirs = PackedStringArray([dir]) + _recent_dirs -@export var _shortcuts := {}: +@export var _shortcuts: Dictionary[String, Array] = {}: set(new_value): if _shortcuts != new_value: _shortcuts = new_value @@ -427,7 +427,7 @@ func get_actions_with_shortcut(shortcut: InputEvent) -> PackedStringArray: return actions_with_shortcut -@export var _palettes: Array[ColorPalette] = []: +@export var _palettes: Array[Palette] = []: set(new_value): if _palettes != new_value: _palettes = new_value @@ -443,7 +443,7 @@ func _update_palette_validities() -> void: if not palette.title.is_empty(): _palette_validities[palette.title] = not palette.title in _palette_validities -func is_palette_valid(checked_palette: ColorPalette) -> bool: +func is_palette_valid(checked_palette: Palette) -> bool: if checked_palette.title.is_empty(): return false if not checked_palette.title in _palette_validities: @@ -456,7 +456,7 @@ func is_palette_title_unused(checked_title: String) -> bool: return false return true -func add_palette(new_palette: ColorPalette) -> void: +func add_palette(new_palette: Palette) -> void: _palettes.append(new_palette) new_palette.changed.connect(emit_changed) _update_palette_validities() @@ -476,7 +476,7 @@ func rename_palette(idx: int, new_name: String) -> void: _update_palette_validities() emit_changed() -func replace_palette(idx: int, new_palette: ColorPalette) -> void: +func replace_palette(idx: int, new_palette: Palette) -> void: if _palettes.size() <= idx: return _palettes[idx] = new_palette @@ -484,25 +484,25 @@ func replace_palette(idx: int, new_palette: ColorPalette) -> void: emit_changed() func move_palette_up(idx: int) -> void: - var palette: ColorPalette = _palettes.pop_at(idx) + var palette: Palette = _palettes.pop_at(idx) _palettes.insert(idx - 1, palette) emit_changed() func move_palette_down(idx: int) -> void: - var palette: ColorPalette = _palettes.pop_at(idx) + var palette: Palette = _palettes.pop_at(idx) _palettes.insert(idx + 1, palette) emit_changed() -func get_palettes() -> Array[ColorPalette]: +func get_palettes() -> Array[Palette]: return _palettes func get_palette_count() -> int: return _palettes.size() -func get_palette(idx: int) -> ColorPalette: +func get_palette(idx: int) -> Palette: return _palettes[idx] -func set_palettes(new_palettes: Array[ColorPalette]) -> void: +func set_palettes(new_palettes: Array[Palette]) -> void: _palettes = new_palettes emit_changed() @@ -524,7 +524,7 @@ func set_palettes(new_palettes: Array[ColorPalette]) -> void: const SHORTCUT_PANEL_MAX_SLOTS = 6 -@export var _shortcut_panel_slots := {}: # Dictionary{int: String} +@export var _shortcut_panel_slots: Dictionary[int, String] = {}: set(new_value): # Validation for key in new_value: @@ -549,7 +549,7 @@ func set_shortcut_panel_slot(slot: int, shortcut: String) -> void: emit_changed() Configs.shortcut_panel_changed.emit() -func set_shortcut_panel_slots(slots: Dictionary) -> void: +func set_shortcut_panel_slots(slots: Dictionary[int, String]) -> void: _shortcut_panel_slots = slots emit_changed() Configs.shortcut_panel_changed.emit() diff --git a/src/config_classes/SaveData.gd.uid b/src/config_classes/SaveData.gd.uid new file mode 100644 index 00000000..38f10b49 --- /dev/null +++ b/src/config_classes/SaveData.gd.uid @@ -0,0 +1 @@ +uid://dhq5loh004hma diff --git a/src/data_classes/Attribute.gd.uid b/src/data_classes/Attribute.gd.uid new file mode 100644 index 00000000..50586fd4 --- /dev/null +++ b/src/data_classes/Attribute.gd.uid @@ -0,0 +1 @@ +uid://ee0dg80rpuqm diff --git a/src/data_classes/AttributeColor.gd b/src/data_classes/AttributeColor.gd index 3b34a697..598b1e57 100644 --- a/src/data_classes/AttributeColor.gd +++ b/src/data_classes/AttributeColor.gd @@ -64,7 +64,7 @@ static func get_named_colors(include_alpha := false) -> Dictionary: else: return _named_colors -const _named_colors = { # Dictionary{String: String} +const _named_colors: Dictionary[String, String] = { "aliceblue": "#f0f8ff", "antiquewhite": "#faebd7", "aqua": "#00ffff", diff --git a/src/data_classes/AttributeColor.gd.uid b/src/data_classes/AttributeColor.gd.uid new file mode 100644 index 00000000..bc2219b9 --- /dev/null +++ b/src/data_classes/AttributeColor.gd.uid @@ -0,0 +1 @@ +uid://xfsgrwpf6ni7 diff --git a/src/data_classes/AttributeEnum.gd.uid b/src/data_classes/AttributeEnum.gd.uid new file mode 100644 index 00000000..8eb29960 --- /dev/null +++ b/src/data_classes/AttributeEnum.gd.uid @@ -0,0 +1 @@ +uid://cbn5d76skivrn diff --git a/src/data_classes/AttributeID.gd.uid b/src/data_classes/AttributeID.gd.uid new file mode 100644 index 00000000..151bbb77 --- /dev/null +++ b/src/data_classes/AttributeID.gd.uid @@ -0,0 +1 @@ +uid://d2ydjsxd6hphx diff --git a/src/data_classes/AttributeList.gd b/src/data_classes/AttributeList.gd index df32fd7f..e0b9cf38 100644 --- a/src/data_classes/AttributeList.gd +++ b/src/data_classes/AttributeList.gd @@ -49,7 +49,7 @@ func insert_element(idx: int, value: float) -> void: static func text_to_list(string: String) -> PackedFloat64Array: var nums_parsed := PackedFloat64Array() - var current_num_string: String = "" + var current_num_string := "" var comma_exhausted := false var pos := 0 while pos < string.length(): diff --git a/src/data_classes/AttributeList.gd.uid b/src/data_classes/AttributeList.gd.uid new file mode 100644 index 00000000..ac85d27a --- /dev/null +++ b/src/data_classes/AttributeList.gd.uid @@ -0,0 +1 @@ +uid://d2dsctfq0ei4 diff --git a/src/data_classes/AttributeNumeric.gd.uid b/src/data_classes/AttributeNumeric.gd.uid new file mode 100644 index 00000000..6f2a041f --- /dev/null +++ b/src/data_classes/AttributeNumeric.gd.uid @@ -0,0 +1 @@ +uid://bnj3jlqussr2i diff --git a/src/data_classes/AttributePathdata.gd.uid b/src/data_classes/AttributePathdata.gd.uid new file mode 100644 index 00000000..99daacd8 --- /dev/null +++ b/src/data_classes/AttributePathdata.gd.uid @@ -0,0 +1 @@ +uid://cmkigd8rugde3 diff --git a/src/data_classes/AttributeTransformList.gd.uid b/src/data_classes/AttributeTransformList.gd.uid new file mode 100644 index 00000000..6e73b0cc --- /dev/null +++ b/src/data_classes/AttributeTransformList.gd.uid @@ -0,0 +1 @@ +uid://d3rf477gmixq0 diff --git a/src/data_classes/BasicXNode.gd.uid b/src/data_classes/BasicXNode.gd.uid new file mode 100644 index 00000000..2c386805 --- /dev/null +++ b/src/data_classes/BasicXNode.gd.uid @@ -0,0 +1 @@ +uid://b3qbd47s5wfse diff --git a/src/data_classes/ColorParser.gd.uid b/src/data_classes/ColorParser.gd.uid new file mode 100644 index 00000000..ee633926 --- /dev/null +++ b/src/data_classes/ColorParser.gd.uid @@ -0,0 +1 @@ +uid://bb0tfogvh7l1h diff --git a/src/data_classes/DB.gd b/src/data_classes/DB.gd index f17a36ac..440f52ef 100644 --- a/src/data_classes/DB.gd +++ b/src/data_classes/DB.gd @@ -5,10 +5,10 @@ enum PercentageHandling {FRACTION, HORIZONTAL, VERTICAL, NORMALIZED} enum NumberRange {ARBITRARY, POSITIVE, UNIT} -const recognized_elements = ["svg", "g", "circle", "ellipse", "rect", "path", "line", - "polyline", "polygon", "stop", "linearGradient", "radialGradient"] +const recognized_elements: Array[String] = ["svg", "g", "circle", "ellipse", "rect", + "path", "line", "polyline", "polygon", "stop", "linearGradient", "radialGradient"] -const element_icons = { +const _element_icons: Dictionary[String, Texture2D] = { "circle": preload("res://assets/icons/element/circle.svg"), "ellipse": preload("res://assets/icons/element/ellipse.svg"), "rect": preload("res://assets/icons/element/rect.svg"), @@ -22,15 +22,15 @@ const element_icons = { "radialGradient": preload("res://assets/icons/element/radialGradient.svg"), "stop": preload("res://assets/icons/element/stop.svg"), } -const unrecognized_xnode_icon = preload("res://assets/icons/element/unrecognized.svg") +const _unrecognized_xnode_icon = preload("res://assets/icons/element/unrecognized.svg") -const xnode_icons = { +const _xnode_icons: Dictionary[BasicXNode.NodeType, Texture2D] = { BasicXNode.NodeType.COMMENT: preload("res://assets/icons/element/xmlnodeComment.svg"), BasicXNode.NodeType.TEXT: preload("res://assets/icons/element/xmlnodeText.svg"), BasicXNode.NodeType.CDATA: preload("res://assets/icons/element/xmlnodeCDATA.svg"), } -const recognized_attributes = { # Dictionary{String: Array[String]} +const recognized_attributes: Dictionary[String, Array] = { # TODO this is just propagated_attributes, but it ruins the const because of Godot bug. # TODO Add "color" to "g" when we're ready. "svg": ["xmlns", "x", "y", "width", "height", "viewBox", "fill", "fill-opacity", @@ -59,7 +59,7 @@ const recognized_attributes = { # Dictionary{String: Array[String]} "stop": ["offset", "stop-color", "stop-opacity"], } -const valid_children = { # Dictionary{String: Array[String]} +const _valid_children: Dictionary[String, Array] = { "svg": ["svg", "path", "circle", "ellipse", "rect", "line", "polygon", "polyline", "g", "linearGradient", "radialGradient"], "g": ["svg", "path", "circle", "ellipse", "rect", "line", "polygon", "polyline", @@ -76,10 +76,10 @@ const valid_children = { # Dictionary{String: Array[String]} "stop": [], } -const propagated_attributes = ["fill", "fill-opacity", "stroke", "stroke-opacity", - "stroke-width", "stroke-linecap", "stroke-linejoin", "color"] +const propagated_attributes: Array[String] = ["fill", "fill-opacity", "stroke", + "stroke-opacity", "stroke-width", "stroke-linecap", "stroke-linejoin", "color"] -const attribute_types = { +const _attribute_types: Dictionary[String, AttributeType] = { "viewBox": AttributeType.LIST, "width": AttributeType.NUMERIC, "height": AttributeType.NUMERIC, @@ -115,14 +115,14 @@ const attribute_types = { "spreadMethod": AttributeType.ENUM, } -const attribute_enum_values = { +const attribute_enum_values: Dictionary[String, Array] = { "stroke-linecap": ["butt", "round", "square"], "stroke-linejoin": ["miter", "round", "bevel"], "gradientUnits": ["userSpaceOnUse", "objectBoundingBox"], "spreadMethod": ["pad", "reflect", "repeat"], } -const attribute_number_range = { +const attribute_number_range: Dictionary[String, NumberRange] = { "width": NumberRange.POSITIVE, "height": NumberRange.POSITIVE, "x": NumberRange.ARBITRARY, @@ -144,9 +144,10 @@ const attribute_number_range = { "stop-opacity": NumberRange.UNIT, } -const attribute_color_url_allowed = ["fill", "stroke"] -const attribute_color_none_allowed = ["fill", "stroke"] -const attribute_color_current_color_allowed = ["fill", "stroke", "stop-color"] +const attribute_color_url_allowed: Array[String] = ["fill", "stroke"] +const attribute_color_none_allowed: Array[String] = ["fill", "stroke"] +const attribute_color_current_color_allowed: Array[String] = ["fill", "stroke", + "stop-color"] static func get_recognized_attributes(element_name: String) -> Array: @@ -159,24 +160,24 @@ static func is_attribute_recognized(element_name: String, attribute_name: String static func is_child_element_valid(parent_name: String, child_name: String) -> bool: if not parent_name in recognized_elements or not child_name in recognized_elements: return true - return child_name in valid_children[parent_name] + return child_name in _valid_children[parent_name] static func get_valid_parents(child_name: String) -> PackedStringArray: var valid_parents := PackedStringArray() - for parent_name in valid_children.keys(): - if child_name in valid_children[parent_name]: + for parent_name in _valid_children.keys(): + if child_name in _valid_children[parent_name]: valid_parents.append(parent_name) return valid_parents static func get_element_icon(element_name: String) -> Texture2D: - return element_icons.get(element_name, unrecognized_xnode_icon) + return _element_icons.get(element_name, _unrecognized_xnode_icon) static func get_xnode_icon(xnode_type: BasicXNode.NodeType) -> Texture2D: - return xnode_icons.get(xnode_type, unrecognized_xnode_icon) + return _xnode_icons.get(xnode_type, _unrecognized_xnode_icon) static func get_attribute_type(attribute_name: String) -> AttributeType: - return attribute_types.get(attribute_name, AttributeType.UNKNOWN) + return _attribute_types.get(attribute_name, AttributeType.UNKNOWN) static func get_attribute_default_percentage_handling( attribute_name: String) -> PercentageHandling: diff --git a/src/data_classes/DB.gd.uid b/src/data_classes/DB.gd.uid new file mode 100644 index 00000000..3106ff4e --- /dev/null +++ b/src/data_classes/DB.gd.uid @@ -0,0 +1 @@ +uid://t0ak8hlsio0y diff --git a/src/data_classes/Element.gd b/src/data_classes/Element.gd index 9bb9e00c..bfa40a47 100644 --- a/src/data_classes/Element.gd +++ b/src/data_classes/Element.gd @@ -6,7 +6,7 @@ signal ancestor_attribute_changed(name: String) signal descendant_attribute_changed(name: String) var _child_elements: Array[XNode] -var _attributes: Dictionary # Dictionary{String: Attribute} +var _attributes: Dictionary[String, Attribute] func _init() -> void: attribute_changed.connect(_on_attribute_changed) diff --git a/src/data_classes/Element.gd.uid b/src/data_classes/Element.gd.uid new file mode 100644 index 00000000..dea27a5f --- /dev/null +++ b/src/data_classes/Element.gd.uid @@ -0,0 +1 @@ +uid://cl8yj7okvxvu3 diff --git a/src/data_classes/ElementCircle.gd b/src/data_classes/ElementCircle.gd index cb6e91ce..a068f2bc 100644 --- a/src/data_classes/ElementCircle.gd +++ b/src/data_classes/ElementCircle.gd @@ -2,7 +2,7 @@ class_name ElementCircle extends Element const name = "circle" -const possible_conversions = ["ellipse", "rect", "path"] +const possible_conversions: Array[String] = ["ellipse", "rect", "path"] func user_setup(precise_pos := PackedFloat64Array([0.0, 0.0])) -> void: set_attribute("r", 1.0) diff --git a/src/data_classes/ElementCircle.gd.uid b/src/data_classes/ElementCircle.gd.uid new file mode 100644 index 00000000..08389aa7 --- /dev/null +++ b/src/data_classes/ElementCircle.gd.uid @@ -0,0 +1 @@ +uid://c647rlrrs4yxd diff --git a/src/data_classes/ElementEllipse.gd b/src/data_classes/ElementEllipse.gd index 42096921..28931aeb 100644 --- a/src/data_classes/ElementEllipse.gd +++ b/src/data_classes/ElementEllipse.gd @@ -2,7 +2,7 @@ class_name ElementEllipse extends Element const name = "ellipse" -const possible_conversions = ["circle", "rect", "path"] +const possible_conversions: Array[String] = ["circle", "rect", "path"] func user_setup(precise_pos := PackedFloat64Array([0.0, 0.0])) -> void: set_attribute("rx", 1.0) diff --git a/src/data_classes/ElementEllipse.gd.uid b/src/data_classes/ElementEllipse.gd.uid new file mode 100644 index 00000000..0f60cbaf --- /dev/null +++ b/src/data_classes/ElementEllipse.gd.uid @@ -0,0 +1 @@ +uid://n36kaqbxntjs diff --git a/src/data_classes/ElementG.gd b/src/data_classes/ElementG.gd index 3bcdaa85..06e6ef8d 100644 --- a/src/data_classes/ElementG.gd +++ b/src/data_classes/ElementG.gd @@ -2,7 +2,7 @@ class_name ElementG extends Element const name = "g" -const possible_conversions = [] +const possible_conversions: Array[String] = [] func _get_own_default(attribute_name: String) -> String: match attribute_name: diff --git a/src/data_classes/ElementG.gd.uid b/src/data_classes/ElementG.gd.uid new file mode 100644 index 00000000..4d3f6ec9 --- /dev/null +++ b/src/data_classes/ElementG.gd.uid @@ -0,0 +1 @@ +uid://bb6f2csicr8n5 diff --git a/src/data_classes/ElementLine.gd b/src/data_classes/ElementLine.gd index 61f432d2..a574f83a 100644 --- a/src/data_classes/ElementLine.gd +++ b/src/data_classes/ElementLine.gd @@ -2,7 +2,7 @@ class_name ElementLine extends Element const name = "line" -const possible_conversions = ["path", "polyline"] +const possible_conversions: Array[String] = ["path", "polyline"] func user_setup(precise_pos := PackedFloat64Array([0.0, 0.0])) -> void: if precise_pos != PackedFloat64Array([0.0, 0.0]): diff --git a/src/data_classes/ElementLine.gd.uid b/src/data_classes/ElementLine.gd.uid new file mode 100644 index 00000000..55488c28 --- /dev/null +++ b/src/data_classes/ElementLine.gd.uid @@ -0,0 +1 @@ +uid://vu6b4wyncxbg diff --git a/src/data_classes/ElementLinearGradient.gd b/src/data_classes/ElementLinearGradient.gd index 6b1bce88..1b20051c 100644 --- a/src/data_classes/ElementLinearGradient.gd +++ b/src/data_classes/ElementLinearGradient.gd @@ -2,7 +2,7 @@ class_name ElementLinearGradient extends Element const name = "linearGradient" -const possible_conversions = [] +const possible_conversions: Array[String] = [] func _get_own_default(attribute_name: String) -> String: match attribute_name: @@ -31,7 +31,7 @@ func get_config_warnings() -> PackedStringArray: if not child is ElementStop: continue - var stop_opacity: float = maxf(child.get_attribute_num("stop-opacity"), 0.0) + var stop_opacity := maxf(child.get_attribute_num("stop-opacity"), 0.0) var stop_color: String = child.get_attribute_value("stop-color") if stop_color.strip_edges() == "currentColor": stop_color = child.get_attribute_value("color") diff --git a/src/data_classes/ElementLinearGradient.gd.uid b/src/data_classes/ElementLinearGradient.gd.uid new file mode 100644 index 00000000..64169a8c --- /dev/null +++ b/src/data_classes/ElementLinearGradient.gd.uid @@ -0,0 +1 @@ +uid://bs54ei7rkc2kg diff --git a/src/data_classes/ElementPath.gd b/src/data_classes/ElementPath.gd index 26f125b7..fe9a5ea1 100644 --- a/src/data_classes/ElementPath.gd +++ b/src/data_classes/ElementPath.gd @@ -2,7 +2,7 @@ class_name ElementPath extends Element const name = "path" -const possible_conversions = [] +const possible_conversions: Array[String] = [] func user_setup(precise_pos := PackedFloat64Array([0.0, 0.0])) -> void: if precise_pos != PackedFloat64Array([0.0, 0.0]): diff --git a/src/data_classes/ElementPath.gd.uid b/src/data_classes/ElementPath.gd.uid new file mode 100644 index 00000000..1473b192 --- /dev/null +++ b/src/data_classes/ElementPath.gd.uid @@ -0,0 +1 @@ +uid://chsdxipqliits diff --git a/src/data_classes/ElementPolygon.gd b/src/data_classes/ElementPolygon.gd index 66ed606d..ce019e59 100644 --- a/src/data_classes/ElementPolygon.gd +++ b/src/data_classes/ElementPolygon.gd @@ -2,7 +2,7 @@ class_name ElementPolygon extends Element const name = "polygon" -const possible_conversions = ["path", "rect"] +const possible_conversions: Array[String] = ["path", "rect"] func user_setup(precise_pos := PackedFloat64Array([0.0, 0.0])) -> void: if precise_pos != PackedFloat64Array([0.0, 0.0]): diff --git a/src/data_classes/ElementPolygon.gd.uid b/src/data_classes/ElementPolygon.gd.uid new file mode 100644 index 00000000..c5100c8f --- /dev/null +++ b/src/data_classes/ElementPolygon.gd.uid @@ -0,0 +1 @@ +uid://c6wlnyqalgcvk diff --git a/src/data_classes/ElementPolyline.gd b/src/data_classes/ElementPolyline.gd index d97b3c1d..7e6945c0 100644 --- a/src/data_classes/ElementPolyline.gd +++ b/src/data_classes/ElementPolyline.gd @@ -2,7 +2,7 @@ class_name ElementPolyline extends Element const name = "polyline" -const possible_conversions = ["path", "line"] +const possible_conversions: Array[String] = ["path", "line"] func user_setup(precise_pos := PackedFloat64Array([0.0, 0.0])) -> void: if precise_pos != PackedFloat64Array([0.0, 0.0]): diff --git a/src/data_classes/ElementPolyline.gd.uid b/src/data_classes/ElementPolyline.gd.uid new file mode 100644 index 00000000..3ee126b4 --- /dev/null +++ b/src/data_classes/ElementPolyline.gd.uid @@ -0,0 +1 @@ +uid://bx1lj6721qkae diff --git a/src/data_classes/ElementRadialGradient.gd b/src/data_classes/ElementRadialGradient.gd index 99f33b97..d3a22201 100644 --- a/src/data_classes/ElementRadialGradient.gd +++ b/src/data_classes/ElementRadialGradient.gd @@ -2,7 +2,7 @@ class_name ElementRadialGradient extends Element const name = "radialGradient" -const possible_conversions = [] +const possible_conversions: Array[String] = [] func _get_own_default(attribute_name: String) -> String: match attribute_name: @@ -30,7 +30,7 @@ func get_config_warnings() -> PackedStringArray: if not child is ElementStop: continue - var stop_opacity: float = maxf(child.get_attribute_num("stop-opacity"), 0.0) + var stop_opacity := maxf(child.get_attribute_num("stop-opacity"), 0.0) var stop_color: String = child.get_attribute_value("stop-color") if stop_color.strip_edges() == "currentColor": stop_color = child.get_attribute_value("color") diff --git a/src/data_classes/ElementRadialGradient.gd.uid b/src/data_classes/ElementRadialGradient.gd.uid new file mode 100644 index 00000000..e11f0d06 --- /dev/null +++ b/src/data_classes/ElementRadialGradient.gd.uid @@ -0,0 +1 @@ +uid://dgdl8exdqxe57 diff --git a/src/data_classes/ElementRect.gd b/src/data_classes/ElementRect.gd index ab4cb3ae..2014191a 100644 --- a/src/data_classes/ElementRect.gd +++ b/src/data_classes/ElementRect.gd @@ -2,7 +2,7 @@ class_name ElementRect extends Element const name = "rect" -const possible_conversions = ["circle", "ellipse", "polygon", "path"] +const possible_conversions: Array[String] = ["circle", "ellipse", "polygon", "path"] func user_setup(precise_pos := PackedFloat64Array([0.0, 0.0])) -> void: set_attribute("width", 1.0) diff --git a/src/data_classes/ElementRect.gd.uid b/src/data_classes/ElementRect.gd.uid new file mode 100644 index 00000000..6ab2d1b0 --- /dev/null +++ b/src/data_classes/ElementRect.gd.uid @@ -0,0 +1 @@ +uid://b56c6ceo4suh7 diff --git a/src/data_classes/ElementRoot.gd b/src/data_classes/ElementRoot.gd index 90fd51dc..54727f75 100644 --- a/src/data_classes/ElementRoot.gd +++ b/src/data_classes/ElementRoot.gd @@ -148,7 +148,7 @@ func move_xnodes_to(xids: Array[PackedInt32Array], location: PackedInt32Array) - get_xnode(XIDUtils.get_parent_xid(location)).insert_child(location[-1], xnode) # Check if this actually chagned the layout. for id in xids_stored: - if not XIDUtils.are_siblings(id, location) or id[-1] < location[-1] or\ + if not XIDUtils.are_siblings_or_same(id, location) or id[-1] < location[-1] or\ id[-1] >= location[-1] + xids_stored.size(): # If this condition is passed, then there was a layout change. xnodes_moved_to.emit(xids, location) diff --git a/src/data_classes/ElementRoot.gd.uid b/src/data_classes/ElementRoot.gd.uid new file mode 100644 index 00000000..db2339aa --- /dev/null +++ b/src/data_classes/ElementRoot.gd.uid @@ -0,0 +1 @@ +uid://bhardox24qct1 diff --git a/src/data_classes/ElementSVG.gd b/src/data_classes/ElementSVG.gd index ac56dfe3..463aef42 100644 --- a/src/data_classes/ElementSVG.gd +++ b/src/data_classes/ElementSVG.gd @@ -16,7 +16,7 @@ var canvas_precise_transform: PackedFloat64Array: canvas_transform = Utils64Bit.get_transform(canvas_precise_transform) const name = "svg" -const possible_conversions = [] +const possible_conversions: Array[String] = [] func _init() -> void: attribute_changed.connect(_conditional_update_cache) diff --git a/src/data_classes/ElementSVG.gd.uid b/src/data_classes/ElementSVG.gd.uid new file mode 100644 index 00000000..693f4570 --- /dev/null +++ b/src/data_classes/ElementSVG.gd.uid @@ -0,0 +1 @@ +uid://p4dd6a6q1vvm diff --git a/src/data_classes/ElementStop.gd b/src/data_classes/ElementStop.gd index 83669f1c..18c7eb23 100644 --- a/src/data_classes/ElementStop.gd +++ b/src/data_classes/ElementStop.gd @@ -2,7 +2,7 @@ class_name ElementStop extends Element const name = "stop" -const possible_conversions = [] +const possible_conversions: Array[String] = [] func _get_own_default(attribute_name: String) -> String: match attribute_name: diff --git a/src/data_classes/ElementStop.gd.uid b/src/data_classes/ElementStop.gd.uid new file mode 100644 index 00000000..f5dea249 --- /dev/null +++ b/src/data_classes/ElementStop.gd.uid @@ -0,0 +1 @@ +uid://bsx1vj7s4tnnt diff --git a/src/data_classes/ElementUnrecognized.gd b/src/data_classes/ElementUnrecognized.gd index 7714aab0..5c3ad23a 100644 --- a/src/data_classes/ElementUnrecognized.gd +++ b/src/data_classes/ElementUnrecognized.gd @@ -2,7 +2,7 @@ class_name ElementUnrecognized extends Element var name: String -const possible_conversions = [] +const possible_conversions: Array[String] = [] func _init(new_name: String) -> void: name = new_name diff --git a/src/data_classes/ElementUnrecognized.gd.uid b/src/data_classes/ElementUnrecognized.gd.uid new file mode 100644 index 00000000..0ea4467b --- /dev/null +++ b/src/data_classes/ElementUnrecognized.gd.uid @@ -0,0 +1 @@ +uid://bbg40asca0wvi diff --git a/src/data_classes/ListParser.gd.uid b/src/data_classes/ListParser.gd.uid new file mode 100644 index 00000000..b7ccb2fb --- /dev/null +++ b/src/data_classes/ListParser.gd.uid @@ -0,0 +1 @@ +uid://cpy03ktthuxbu diff --git a/src/data_classes/NumberParser.gd b/src/data_classes/NumberParser.gd index 96c3f2c1..43cdbf33 100644 --- a/src/data_classes/NumberParser.gd +++ b/src/data_classes/NumberParser.gd @@ -8,7 +8,7 @@ static func num_to_text(number: float, formatter: Formatter) -> String: if number == -0.0: number = absf(number) - var numstr := String.num(number, Utils.MAX_NUMERIC_PRECISION) + var numstr := Utils.num_simple(number, Utils.MAX_NUMERIC_PRECISION) if formatter.number_use_exponent_if_shorter: if numstr.ends_with("000"): diff --git a/src/data_classes/NumberParser.gd.uid b/src/data_classes/NumberParser.gd.uid new file mode 100644 index 00000000..5b4e3601 --- /dev/null +++ b/src/data_classes/NumberParser.gd.uid @@ -0,0 +1 @@ +uid://ddfh8osmujydg diff --git a/src/data_classes/NumstringParser.gd b/src/data_classes/NumstringParser.gd index c3adf688..7d25bea9 100644 --- a/src/data_classes/NumstringParser.gd +++ b/src/data_classes/NumstringParser.gd @@ -5,14 +5,14 @@ var compress_numbers: bool var minimize_spacing: bool static func basic_num_to_text(num: float, is_angle := false) -> String: - var text := String.num(num, Utils.MAX_ANGLE_PRECISION if is_angle\ + var text := Utils.num_simple(num, Utils.MAX_ANGLE_PRECISION if is_angle\ else Utils.MAX_NUMERIC_PRECISION) if text == "-0": text = "0" return text func num_to_text(num: float, is_angle := false) -> String: - var text := String.num(num, Utils.MAX_ANGLE_PRECISION if is_angle\ + var text := Utils.num_simple(num, Utils.MAX_ANGLE_PRECISION if is_angle\ else Utils.MAX_NUMERIC_PRECISION) if compress_numbers: if text.begins_with("0."): diff --git a/src/data_classes/NumstringParser.gd.uid b/src/data_classes/NumstringParser.gd.uid new file mode 100644 index 00000000..cec9c601 --- /dev/null +++ b/src/data_classes/NumstringParser.gd.uid @@ -0,0 +1 @@ +uid://cv5bupqo3fenc diff --git a/src/data_classes/PathCommand.gd b/src/data_classes/PathCommand.gd index c1c39427..cadc7fd6 100644 --- a/src/data_classes/PathCommand.gd +++ b/src/data_classes/PathCommand.gd @@ -1,14 +1,14 @@ # A native class that represents a path command and its parameters. class_name PathCommand extends RefCounted -const translation_dict := { +const translation_dict: Dictionary[String, GDScript] = { "M": MoveCommand, "L": LineCommand, "H": HorizontalLineCommand, "V": VerticalLineCommand, "Z": CloseCommand, "A": EllipticalArcCommand, "Q": QuadraticBezierCommand, "T": ShorthandQuadraticBezierCommand, "C": CubicBezierCommand, "S": ShorthandCubicBezierCommand } -const arg_count_dict := { # Dictionary{String: int} +const arg_count_dict: Dictionary[String, int] = { "M": 2, "L": 2, "H": 1, "V": 1, "Z": 0, "A": 7, "Q": 4, "T": 2, "C": 6, "S": 4 } diff --git a/src/data_classes/PathCommand.gd.uid b/src/data_classes/PathCommand.gd.uid new file mode 100644 index 00000000..b27d7bbc --- /dev/null +++ b/src/data_classes/PathCommand.gd.uid @@ -0,0 +1 @@ +uid://c7hhv52fw4ddw diff --git a/src/data_classes/SVGParser.gd.uid b/src/data_classes/SVGParser.gd.uid new file mode 100644 index 00000000..ad5fc90d --- /dev/null +++ b/src/data_classes/SVGParser.gd.uid @@ -0,0 +1 @@ +uid://ce2f3pndgficj diff --git a/src/data_classes/Transform.gd b/src/data_classes/Transform.gd index 5b057938..9b49e4a9 100644 --- a/src/data_classes/Transform.gd +++ b/src/data_classes/Transform.gd @@ -22,6 +22,9 @@ class TransformMatrix extends Transform: func compute_precise_transform() -> PackedFloat64Array: return PackedFloat64Array([x1, x2, y1, y2, o1, o2]) + + func is_redundant() -> bool: + return x1 == 1.0 and x2 == 0.0 and y1 == 0.0 and y2 == 1.0 and o1 == 0.0 and o2 == 0.0 class TransformTranslate extends Transform: var x: float @@ -36,6 +39,9 @@ class TransformTranslate extends Transform: func compute_precise_transform() -> PackedFloat64Array: return PackedFloat64Array([1.0, 0.0, 0.0, 1.0, x, y]) + + func is_redundant() -> bool: + return x == 0.0 and y == 0.0 class TransformRotate extends Transform: var deg: float @@ -58,6 +64,9 @@ class TransformRotate extends Transform: var ox := x - x * cos_val + y * sin_val var oy := y - x * sin_val - y * cos_val return PackedFloat64Array([cos_val, sin_val, -sin_val, cos_val, ox, oy]) + + func is_redundant() -> bool: + return fmod(deg, 360.0) == 0.0 class TransformScale extends Transform: var x: float @@ -72,6 +81,9 @@ class TransformScale extends Transform: func compute_precise_transform() -> PackedFloat64Array: return PackedFloat64Array([x, 0, 0, y, 0, 0]) + + func is_redundant() -> bool: + return x == 1.0 and y == 1.0 class TransformSkewX extends Transform: var x: float @@ -84,6 +96,9 @@ class TransformSkewX extends Transform: func compute_precise_transform() -> PackedFloat64Array: return PackedFloat64Array([1.0, 0.0, tan(deg_to_rad(x)), 1.0, 0.0, 0.0]) + + func is_redundant() -> bool: + return x == 0.0 class TransformSkewY extends Transform: @@ -97,3 +112,6 @@ class TransformSkewY extends Transform: func compute_precise_transform() -> PackedFloat64Array: return PackedFloat64Array([1.0, tan(deg_to_rad(y)), 0.0, 1.0, 0.0, 0.0]) + + func is_redundant() -> bool: + return y == 0.0 diff --git a/src/data_classes/Transform.gd.uid b/src/data_classes/Transform.gd.uid new file mode 100644 index 00000000..1ced60c3 --- /dev/null +++ b/src/data_classes/Transform.gd.uid @@ -0,0 +1 @@ +uid://dmkv5ewygittm diff --git a/src/data_classes/XNode.gd.uid b/src/data_classes/XNode.gd.uid new file mode 100644 index 00000000..30e71745 --- /dev/null +++ b/src/data_classes/XNode.gd.uid @@ -0,0 +1 @@ +uid://bb8vu2qsdmuys diff --git a/src/shaders/animated_stroke.gdshader.uid b/src/shaders/animated_stroke.gdshader.uid new file mode 100644 index 00000000..aed119fe --- /dev/null +++ b/src/shaders/animated_stroke.gdshader.uid @@ -0,0 +1 @@ +uid://bnnw58jl4tfv5 diff --git a/src/shaders/color_wheel.gdshader.uid b/src/shaders/color_wheel.gdshader.uid new file mode 100644 index 00000000..20f85abf --- /dev/null +++ b/src/shaders/color_wheel.gdshader.uid @@ -0,0 +1 @@ +uid://dwop5cmg7i04p diff --git a/src/shaders/slider_visuals.gdshader.uid b/src/shaders/slider_visuals.gdshader.uid new file mode 100644 index 00000000..27ffa129 --- /dev/null +++ b/src/shaders/slider_visuals.gdshader.uid @@ -0,0 +1 @@ +uid://b5e666h18rkbo diff --git a/src/shaders/zoom_shader.gdshader.uid b/src/shaders/zoom_shader.gdshader.uid new file mode 100644 index 00000000..98c59261 --- /dev/null +++ b/src/shaders/zoom_shader.gdshader.uid @@ -0,0 +1 @@ +uid://i2y5pyhcgra2 diff --git a/src/ui_parts/DeltaHandle.gd.uid b/src/ui_parts/DeltaHandle.gd.uid new file mode 100644 index 00000000..cb9032ba --- /dev/null +++ b/src/ui_parts/DeltaHandle.gd.uid @@ -0,0 +1 @@ +uid://nqnhlku0r2p8 diff --git a/src/ui_parts/Handle.gd.uid b/src/ui_parts/Handle.gd.uid new file mode 100644 index 00000000..aa13c9ab --- /dev/null +++ b/src/ui_parts/Handle.gd.uid @@ -0,0 +1 @@ +uid://m55i4l56l4vv diff --git a/src/ui_parts/PathHandle.gd.uid b/src/ui_parts/PathHandle.gd.uid new file mode 100644 index 00000000..df2221a9 --- /dev/null +++ b/src/ui_parts/PathHandle.gd.uid @@ -0,0 +1 @@ +uid://crynaooub1efk diff --git a/src/ui_parts/PolyHandle.gd.uid b/src/ui_parts/PolyHandle.gd.uid new file mode 100644 index 00000000..319f00d5 --- /dev/null +++ b/src/ui_parts/PolyHandle.gd.uid @@ -0,0 +1 @@ +uid://en64nbkc10cg diff --git a/src/ui_parts/XYHandle.gd.uid b/src/ui_parts/XYHandle.gd.uid new file mode 100644 index 00000000..79adeaa9 --- /dev/null +++ b/src/ui_parts/XYHandle.gd.uid @@ -0,0 +1 @@ +uid://dc0dsufu1mdiv diff --git a/src/ui_parts/about_menu.gd.uid b/src/ui_parts/about_menu.gd.uid new file mode 100644 index 00000000..d7c999c8 --- /dev/null +++ b/src/ui_parts/about_menu.gd.uid @@ -0,0 +1 @@ +uid://ys8g367cpqc2 diff --git a/src/ui_parts/alert_dialog.gd.uid b/src/ui_parts/alert_dialog.gd.uid new file mode 100644 index 00000000..20890029 --- /dev/null +++ b/src/ui_parts/alert_dialog.gd.uid @@ -0,0 +1 @@ +uid://dlsd0uctldklk diff --git a/src/ui_parts/camera.gd.uid b/src/ui_parts/camera.gd.uid new file mode 100644 index 00000000..74639c69 --- /dev/null +++ b/src/ui_parts/camera.gd.uid @@ -0,0 +1 @@ +uid://cm5033meho5vr diff --git a/src/ui_parts/choose_name_dialog.gd.uid b/src/ui_parts/choose_name_dialog.gd.uid new file mode 100644 index 00000000..34e7b25e --- /dev/null +++ b/src/ui_parts/choose_name_dialog.gd.uid @@ -0,0 +1 @@ +uid://qiuaih0hajks diff --git a/src/ui_parts/code_editor.gd.uid b/src/ui_parts/code_editor.gd.uid new file mode 100644 index 00000000..b42a5e38 --- /dev/null +++ b/src/ui_parts/code_editor.gd.uid @@ -0,0 +1 @@ +uid://c3q5dvxm6ro1m diff --git a/src/ui_parts/confirm_dialog.gd.uid b/src/ui_parts/confirm_dialog.gd.uid new file mode 100644 index 00000000..56027f33 --- /dev/null +++ b/src/ui_parts/confirm_dialog.gd.uid @@ -0,0 +1 @@ +uid://3gwwpcy3jctv diff --git a/src/ui_parts/display.gd.uid b/src/ui_parts/display.gd.uid new file mode 100644 index 00000000..6b82cc76 --- /dev/null +++ b/src/ui_parts/display.gd.uid @@ -0,0 +1 @@ +uid://bxmb134e3sqpr diff --git a/src/ui_parts/display_texture.gd b/src/ui_parts/display_texture.gd index f1b8deb1..0fba42f2 100644 --- a/src/ui_parts/display_texture.gd +++ b/src/ui_parts/display_texture.gd @@ -50,6 +50,5 @@ func _update() -> void: var err := img.load_svg_from_string(svg_text, image_zoom) if err == OK: position = display_rect.position - # TODO check if deferred is still needed. set_deferred("size", display_rect.size) texture = ImageTexture.create_from_image(img) diff --git a/src/ui_parts/display_texture.gd.uid b/src/ui_parts/display_texture.gd.uid new file mode 100644 index 00000000..f7203e09 --- /dev/null +++ b/src/ui_parts/display_texture.gd.uid @@ -0,0 +1 @@ +uid://dtplje5mhdmrj diff --git a/src/ui_parts/donate_menu.gd.uid b/src/ui_parts/donate_menu.gd.uid new file mode 100644 index 00000000..19f8e228 --- /dev/null +++ b/src/ui_parts/donate_menu.gd.uid @@ -0,0 +1 @@ +uid://pj5ax4gste0l diff --git a/src/ui_parts/main_scene.gd b/src/ui_parts/editor_scene.gd similarity index 100% rename from src/ui_parts/main_scene.gd rename to src/ui_parts/editor_scene.gd diff --git a/src/ui_parts/editor_scene.gd.uid b/src/ui_parts/editor_scene.gd.uid new file mode 100644 index 00000000..9c0894fe --- /dev/null +++ b/src/ui_parts/editor_scene.gd.uid @@ -0,0 +1 @@ +uid://b14gd6s3wl4us diff --git a/src/ui_parts/main_scene.tscn b/src/ui_parts/editor_scene.tscn similarity index 73% rename from src/ui_parts/main_scene.tscn rename to src/ui_parts/editor_scene.tscn index 50f46134..1cc3f544 100644 --- a/src/ui_parts/main_scene.tscn +++ b/src/ui_parts/editor_scene.tscn @@ -1,10 +1,10 @@ [gd_scene load_steps=6 format=3 uid="uid://ce6j54x27pom"] -[ext_resource type="PackedScene" uid="uid://cr1fdlmbknnko" path="res://src/ui_parts/code_editor.tscn" id="1_0jgh3"] -[ext_resource type="Texture2D" uid="uid://co75w07yqmcro" path="res://assets/icons/theme/SplitGrabber2.svg" id="1_7y812"] -[ext_resource type="PackedScene" uid="uid://ccynisiuyn5qn" path="res://src/ui_parts/inspector.tscn" id="1_afxvd"] -[ext_resource type="Script" path="res://src/ui_parts/main_scene.gd" id="1_c0fkj"] -[ext_resource type="PackedScene" uid="uid://bvrncl7e6yn5b" path="res://src/ui_parts/display.tscn" id="3_qbqbs"] +[ext_resource type="Script" uid="uid://b14gd6s3wl4us" path="res://src/ui_parts/editor_scene.gd" id="1_78d5d"] +[ext_resource type="Texture2D" uid="uid://co75w07yqmcro" path="res://assets/icons/theme/SplitGrabber2.svg" id="2_852uu"] +[ext_resource type="PackedScene" uid="uid://cr1fdlmbknnko" path="res://src/ui_parts/code_editor.tscn" id="3_5ris2"] +[ext_resource type="PackedScene" uid="uid://ccynisiuyn5qn" path="res://src/ui_parts/inspector.tscn" id="4_podmt"] +[ext_resource type="PackedScene" uid="uid://bvrncl7e6yn5b" path="res://src/ui_parts/display.tscn" id="5_4vrq4"] [node name="MainScene" type="HBoxContainer"] anchors_preset = 15 @@ -12,7 +12,7 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 -script = ExtResource("1_c0fkj") +script = ExtResource("1_78d5d") [node name="PanelContainer" type="PanelContainer" parent="."] custom_minimum_size = Vector2(360, 0) @@ -23,7 +23,7 @@ size_flags_horizontal = 3 layout_mode = 2 size_flags_horizontal = 3 theme_override_constants/separation = 6 -theme_override_icons/grabber = ExtResource("1_7y812") +theme_override_icons/grabber = ExtResource("2_852uu") split_offset = -122 [node name="MarginContainer" type="MarginContainer" parent="PanelContainer/HSplitContainer"] @@ -38,13 +38,13 @@ layout_mode = 2 theme_override_constants/separation = 10 split_offset = -400 -[node name="CodeEditor" parent="PanelContainer/HSplitContainer/MarginContainer/MainContainer" instance=ExtResource("1_0jgh3")] +[node name="CodeEditor" parent="PanelContainer/HSplitContainer/MarginContainer/MainContainer" instance=ExtResource("3_5ris2")] layout_mode = 2 -[node name="Inspector" parent="PanelContainer/HSplitContainer/MarginContainer/MainContainer" instance=ExtResource("1_afxvd")] +[node name="Inspector" parent="PanelContainer/HSplitContainer/MarginContainer/MainContainer" instance=ExtResource("4_podmt")] layout_mode = 2 -[node name="Display" parent="PanelContainer/HSplitContainer" instance=ExtResource("3_qbqbs")] +[node name="Display" parent="PanelContainer/HSplitContainer" instance=ExtResource("5_4vrq4")] unique_name_in_owner = true layout_mode = 2 size_flags_horizontal = 3 diff --git a/src/ui_parts/element_container.gd.uid b/src/ui_parts/element_container.gd.uid new file mode 100644 index 00000000..d13d7726 --- /dev/null +++ b/src/ui_parts/element_container.gd.uid @@ -0,0 +1 @@ +uid://b7nxmncbtpjvt diff --git a/src/ui_parts/export_menu.gd b/src/ui_parts/export_menu.gd index d08c5b8e..945f2511 100644 --- a/src/ui_parts/export_menu.gd +++ b/src/ui_parts/export_menu.gd @@ -171,7 +171,8 @@ func update() -> void: func get_dimensions_text(sides: Vector2, integer := false) -> String: var precision := 0 if integer else 2 - return String.num(sides.x, precision) + "×" + String.num(sides.y, precision) + return "%s×%s" % [Utils.num_simple(sides.x, precision), + Utils.num_simple(sides.y, precision)] func _input(event: InputEvent) -> void: diff --git a/src/ui_parts/export_menu.gd.uid b/src/ui_parts/export_menu.gd.uid new file mode 100644 index 00000000..662a59b4 --- /dev/null +++ b/src/ui_parts/export_menu.gd.uid @@ -0,0 +1 @@ +uid://bouo2y3v0gy4a diff --git a/src/ui_parts/eyedropper_popup.gd.uid b/src/ui_parts/eyedropper_popup.gd.uid new file mode 100644 index 00000000..1ac24f99 --- /dev/null +++ b/src/ui_parts/eyedropper_popup.gd.uid @@ -0,0 +1 @@ +uid://3owchx7ygm21 diff --git a/src/ui_parts/global_menu.gd b/src/ui_parts/global_menu.gd index 2e1fe6d4..c9762bba 100644 --- a/src/ui_parts/global_menu.gd +++ b/src/ui_parts/global_menu.gd @@ -181,9 +181,9 @@ func _get_keycode_for_events(input_events: Array[InputEvent]) -> Key: func _on_svg_changed() -> void: NativeMenu.set_item_disabled(file_rid, file_clear_svg_idx, SVG.text == SVG.DEFAULT) - var empty_path := Configs.savedata.current_file_path.is_empty() - NativeMenu.set_item_disabled(file_rid, file_clear_association_idx, empty_path) - NativeMenu.set_item_disabled(file_rid, file_reset_svg_idx, empty_path) + var is_path_empty := Configs.savedata.current_file_path.is_empty() + NativeMenu.set_item_disabled(file_rid, file_clear_association_idx, is_path_empty) + NativeMenu.set_item_disabled(file_rid, file_reset_svg_idx, is_path_empty) func _on_display_view_settings_updated(show_grid: bool, show_handles: bool, rasterized_svg: bool) -> void: diff --git a/src/ui_parts/global_menu.gd.uid b/src/ui_parts/global_menu.gd.uid new file mode 100644 index 00000000..08b5fe5a --- /dev/null +++ b/src/ui_parts/global_menu.gd.uid @@ -0,0 +1 @@ +uid://cjkc40a5x7j4k diff --git a/src/ui_parts/good_file_dialog.gd b/src/ui_parts/good_file_dialog.gd index eb6e5fa3..94d07430 100644 --- a/src/ui_parts/good_file_dialog.gd +++ b/src/ui_parts/good_file_dialog.gd @@ -11,9 +11,9 @@ const folder_icon = preload("res://assets/icons/Folder.svg") const broken_file_icon = preload("res://assets/icons/FileBroken.svg") const text_file_icon = preload("res://assets/icons/TextFile.svg") -const system_dirs_to_show = [OS.SYSTEM_DIR_DESKTOP, OS.SYSTEM_DIR_DOCUMENTS, - OS.SYSTEM_DIR_DOWNLOADS, OS.SYSTEM_DIR_MOVIES, OS.SYSTEM_DIR_MUSIC, - OS.SYSTEM_DIR_PICTURES] +const system_dirs_to_show: Array[OS.SystemDir] = [OS.SYSTEM_DIR_DESKTOP, + OS.SYSTEM_DIR_DOCUMENTS, OS.SYSTEM_DIR_DOWNLOADS, OS.SYSTEM_DIR_MOVIES, + OS.SYSTEM_DIR_MUSIC, OS.SYSTEM_DIR_PICTURES] enum FileMode {SELECT, SAVE} var mode: FileMode @@ -423,7 +423,7 @@ func _init() -> void: OS.SYSTEM_DIR_PICTURES, OS.SYSTEM_DIR_RINGTONES]: system_dir_paths[enum_value] = OS.get_system_dir(enum_value) -var system_dir_paths := {} +var system_dir_paths: Dictionary[OS.SystemDir, String] = {} func get_drive_icon(path: String) -> Texture2D: if path == system_dir_paths[OS.SYSTEM_DIR_DESKTOP]: diff --git a/src/ui_parts/good_file_dialog.gd.uid b/src/ui_parts/good_file_dialog.gd.uid new file mode 100644 index 00000000..c0462203 --- /dev/null +++ b/src/ui_parts/good_file_dialog.gd.uid @@ -0,0 +1 @@ +uid://cdlrqylqsmc22 diff --git a/src/ui_parts/handles_manager.gd b/src/ui_parts/handles_manager.gd index 848c6b70..b48ff7c3 100644 --- a/src/ui_parts/handles_manager.gd +++ b/src/ui_parts/handles_manager.gd @@ -1,22 +1,13 @@ # This script manages contour drawing and handles. extends Control -var normal_handle_textures: Dictionary -var hovered_handle_textures: Dictionary -var selected_handle_textures: Dictionary -var hovered_selected_handle_textures: Dictionary +var normal_handle_textures: Dictionary[Handle.Display, Texture2D] +var hovered_handle_textures: Dictionary[Handle.Display, Texture2D] +var selected_handle_textures: Dictionary[Handle.Display, Texture2D] +var hovered_selected_handle_textures: Dictionary[Handle.Display, Texture2D] const stroke_shader = preload("res://src/shaders/animated_stroke.gdshader") -const handles_svg_dict = { - Handle.Display.BIG: """""", - Handle.Display.SMALL: """""", -} - const DEFAULT_GRAB_DISTANCE_SQUARED := 81.0 const CONTOUR_WIDTH = 1.0 const TANGENT_WIDTH = 0.65 @@ -51,7 +42,7 @@ func render_handle_textures() -> void: var s := Configs.savedata.handle_size # Shorthand var img := Image.new() - var handles_dict := { + var handles_dict: Dictionary[Handle.Display, String] = { Handle.Display.BIG: """""" % [s * 10, s * 10, @@ -63,7 +54,7 @@ func render_handle_textures() -> void: } for handle_type in [Handle.Display.BIG, Handle.Display.SMALL]: - var handle_type_svg: String = handles_dict[handle_type] + var handle_type_svg := handles_dict[handle_type] img.load_svg_from_string(handle_type_svg % [inside_str, normal_str]) img.fix_alpha_edges() normal_handle_textures[handle_type] = ImageTexture.create_from_image(img) @@ -641,7 +632,7 @@ func _draw() -> void: func draw_objects_of_type(color: Color, polylines: Array[PackedVector2Array], multiline: PackedVector2Array, handles_array: Array[Handle], -handle_texture_array: Dictionary) -> void: +handle_texture_dictionary: Dictionary[Handle.Display, Texture2D]) -> void: for polyline in polylines: var color_array := PackedColorArray() color_array.resize(polyline.size()) @@ -659,7 +650,7 @@ handle_texture_array: Dictionary) -> void: RenderingServer.canvas_item_add_multiline(surface, multiline, color_array, TANGENT_WIDTH, true) for handle in handles_array: - var texture: Texture2D = handle_texture_array[handle.display_mode] + var texture := handle_texture_dictionary[handle.display_mode] texture.draw(surface, SVG.root_element.canvas_to_world( handle.transform * handle.pos) * Indications.zoom - texture.get_size() / 2) diff --git a/src/ui_parts/handles_manager.gd.uid b/src/ui_parts/handles_manager.gd.uid new file mode 100644 index 00000000..bb4589a0 --- /dev/null +++ b/src/ui_parts/handles_manager.gd.uid @@ -0,0 +1 @@ +uid://csqewpxr21ywy diff --git a/src/ui_parts/import_warning_menu.gd.uid b/src/ui_parts/import_warning_menu.gd.uid new file mode 100644 index 00000000..f79022c5 --- /dev/null +++ b/src/ui_parts/import_warning_menu.gd.uid @@ -0,0 +1 @@ +uid://d1mdyvr7majfe diff --git a/src/ui_parts/inspector.gd b/src/ui_parts/inspector.gd index d5233868..f3bb98a4 100644 --- a/src/ui_parts/inspector.gd +++ b/src/ui_parts/inspector.gd @@ -15,7 +15,6 @@ func _ready() -> void: SVG.xnode_layout_changed.connect(full_rebuild) SVG.changed_unknown.connect(full_rebuild) add_button.pressed.connect(_on_add_button_pressed) - full_rebuild() func update_theme() -> void: diff --git a/src/ui_parts/inspector.gd.uid b/src/ui_parts/inspector.gd.uid new file mode 100644 index 00000000..1ed975c1 --- /dev/null +++ b/src/ui_parts/inspector.gd.uid @@ -0,0 +1 @@ +uid://csl2me44lu3yd diff --git a/src/ui_parts/inspector.tscn b/src/ui_parts/inspector.tscn index 9663f46a..d3bb33f6 100644 --- a/src/ui_parts/inspector.tscn +++ b/src/ui_parts/inspector.tscn @@ -1,10 +1,10 @@ [gd_scene load_steps=6 format=3 uid="uid://ccynisiuyn5qn"] -[ext_resource type="Script" path="res://src/ui_parts/inspector.gd" id="1_16ggy"] +[ext_resource type="Script" uid="uid://csl2me44lu3yd" path="res://src/ui_parts/inspector.gd" id="1_16ggy"] [ext_resource type="PackedScene" uid="uid://bktmk76u7dsu0" path="res://src/ui_parts/root_element_editor.tscn" id="2_jnl50"] -[ext_resource type="Script" path="res://src/ui_parts/element_container.gd" id="3_qeptj"] +[ext_resource type="Script" uid="uid://b7nxmncbtpjvt" path="res://src/ui_parts/element_container.gd" id="3_qeptj"] [ext_resource type="Texture2D" uid="uid://eif2ioi0mw17" path="res://assets/icons/Plus.svg" id="3_vo6hf"] -[ext_resource type="Script" path="res://src/ui_parts/move_to_overlay.gd" id="5_otlmf"] +[ext_resource type="Script" uid="uid://b04padjc3w1s8" path="res://src/ui_parts/move_to_overlay.gd" id="5_otlmf"] [node name="Inspector" type="Container"] custom_minimum_size = Vector2(408, 0) diff --git a/src/ui_parts/move_to_overlay.gd.uid b/src/ui_parts/move_to_overlay.gd.uid new file mode 100644 index 00000000..c97705fe --- /dev/null +++ b/src/ui_parts/move_to_overlay.gd.uid @@ -0,0 +1 @@ +uid://b04padjc3w1s8 diff --git a/src/ui_parts/root_element_editor.gd.uid b/src/ui_parts/root_element_editor.gd.uid new file mode 100644 index 00000000..c93a6a5a --- /dev/null +++ b/src/ui_parts/root_element_editor.gd.uid @@ -0,0 +1 @@ +uid://beukt3a23d5ug diff --git a/src/ui_parts/settings_menu.gd b/src/ui_parts/settings_menu.gd index c5d911f6..e0bc2cb6 100644 --- a/src/ui_parts/settings_menu.gd +++ b/src/ui_parts/settings_menu.gd @@ -21,7 +21,7 @@ var focused_tab := "" var current_setup_setting := "" var current_setup_resource: Resource var setting_container: VBoxContainer -var advice := {} # String: String +var advice: Dictionary[String, String] = {} func _ready() -> void: close_button.pressed.connect(queue_free) @@ -328,9 +328,10 @@ func _on_language_pressed() -> void: for msg in translation_obj.get_message_list(): if not msg.is_empty(): translated_count += 1 - var percentage := String.num(translated_count * 100.0 / strings_count, 1) + "%" + var percentage :=\ + Utils.num_simple(translated_count * 100.0 / strings_count, 1) + "%" - var is_current_locale := lang == TranslationServer.get_locale() + var is_current_locale := (lang == TranslationServer.get_locale()) var new_btn := ContextPopup.create_button( TranslationServer.get_locale_name(lang) + " (" + lang.to_upper() + ")", Callable(), is_current_locale) @@ -401,7 +402,7 @@ func _popup_xml_palette_options(palette_xml_button: Button) -> void: btn_arr.append(ContextPopup.create_button(Translator.translate("Import XML"), add_imported_palette, false, load("res://assets/icons/Import.svg"))) btn_arr.append(ContextPopup.create_button(Translator.translate("Paste XML"), - add_pasted_palette, !ColorPalette.is_valid_palette(Utils.get_clipboard_web_safe()), + add_pasted_palette, !Palette.is_valid_palette(Utils.get_clipboard_web_safe()), load("res://assets/icons/Paste.svg"))) var context_popup := ContextPopup.new() @@ -411,22 +412,22 @@ func _popup_xml_palette_options(palette_xml_button: Button) -> void: func add_empty_palette() -> void: - _shared_add_palette_logic(ColorPalette.new()) + _shared_add_palette_logic(Palette.new()) func add_pasted_palette() -> void: - _shared_add_palettes_logic(ColorPalette.text_to_palettes(Utils.get_clipboard_web_safe())) + _shared_add_palettes_logic(Palette.text_to_palettes(Utils.get_clipboard_web_safe())) func add_imported_palette() -> void: FileUtils.open_xml_import_dialog(_on_import_palette_finished) func _on_import_palette_finished(file_text: String) -> void: - _shared_add_palettes_logic(ColorPalette.text_to_palettes(file_text)) + _shared_add_palettes_logic(Palette.text_to_palettes(file_text)) -func _shared_add_palettes_logic(palettes: Array[ColorPalette]) -> void: +func _shared_add_palettes_logic(palettes: Array[Palette]) -> void: if not palettes.is_empty(): _shared_add_palette_logic(palettes[0]) -func _shared_add_palette_logic(palette: ColorPalette) -> void: +func _shared_add_palette_logic(palette: Palette) -> void: Configs.savedata.add_palette(palette) rebuild_palettes() @@ -467,8 +468,8 @@ func rebuild_palettes() -> void: xml_palette_button.pressed.connect(_popup_xml_palette_options.bind(xml_palette_button)) -var shortcut_tab_names := ["file", "edit", "view", "tool", "help"] -var formatter_tab_names := ["editor", "export"] +var shortcut_tab_names := PackedStringArray(["file", "edit", "view", "tool", "help"]) +var formatter_tab_names := PackedStringArray(["editor", "export"]) func get_translated_formatter_tab(tab_idx: String) -> String: match tab_idx: diff --git a/src/ui_parts/settings_menu.gd.uid b/src/ui_parts/settings_menu.gd.uid new file mode 100644 index 00000000..aff39f58 --- /dev/null +++ b/src/ui_parts/settings_menu.gd.uid @@ -0,0 +1 @@ +uid://1rjr3yrqwueu diff --git a/src/ui_parts/shortcut_panel.gd.uid b/src/ui_parts/shortcut_panel.gd.uid new file mode 100644 index 00000000..630a25a2 --- /dev/null +++ b/src/ui_parts/shortcut_panel.gd.uid @@ -0,0 +1 @@ +uid://cqqaic7b2s5xu diff --git a/src/ui_parts/shortcut_panel_config.gd b/src/ui_parts/shortcut_panel_config.gd index 0f271099..025defd5 100644 --- a/src/ui_parts/shortcut_panel_config.gd +++ b/src/ui_parts/shortcut_panel_config.gd @@ -23,7 +23,7 @@ func _ready() -> void: update_shortcut_slots() func update_shortcut_slots() -> void: - var shortcut_texts := {} # Dictionary{String: String} + var shortcut_texts: Dictionary[String, String] = {} # action: action_description for shortcut in ShortcutUtils.get_all_shortcuts(): shortcut_texts[shortcut] = TranslationUtils.get_shortcut_description(shortcut) diff --git a/src/ui_parts/shortcut_panel_config.gd.uid b/src/ui_parts/shortcut_panel_config.gd.uid new file mode 100644 index 00000000..b985da52 --- /dev/null +++ b/src/ui_parts/shortcut_panel_config.gd.uid @@ -0,0 +1 @@ +uid://cnmsf3h1qq3q6 diff --git a/src/ui_parts/update_menu.gd b/src/ui_parts/update_menu.gd index 79868610..06b6c57a 100644 --- a/src/ui_parts/update_menu.gd +++ b/src/ui_parts/update_menu.gd @@ -8,7 +8,7 @@ extends PanelContainer @onready var close_button: Button = $VBoxContainer/CloseButton var current_version: String = ProjectSettings.get_setting("application/config/version") -var results := {} # Dictionary{String: String} version: [url, is_prerelease] +var results: Dictionary[String, Array] = {} # version: [url, is_prerelease] func _ready() -> void: http.request_completed.connect(_on_request_completed) @@ -99,7 +99,7 @@ func display_results() -> void: else: status_label.text = Translator.translate("New versions") + ":" for version in results: - var result: Array = results[version] + var result := results[version] if prereleases_checkbox.button_pressed or result[1] == false: if OS.has_feature("web"): status_label.text += "\n%s" % version diff --git a/src/ui_parts/update_menu.gd.uid b/src/ui_parts/update_menu.gd.uid new file mode 100644 index 00000000..c67c4c5d --- /dev/null +++ b/src/ui_parts/update_menu.gd.uid @@ -0,0 +1 @@ +uid://c6ca4ckjyrxg3 diff --git a/src/ui_parts/viewport.gd b/src/ui_parts/viewport.gd index 12be6bab..219b2348 100644 --- a/src/ui_parts/viewport.gd +++ b/src/ui_parts/viewport.gd @@ -64,7 +64,6 @@ func _unhandled_input(event: InputEvent) -> void: if event is InputEventMouseMotion and\ event.button_mask & (MOUSE_BUTTON_MASK_LEFT | MOUSE_BUTTON_MASK_MIDDLE): - # Zooming with Ctrl + MMB. if event.ctrl_pressed and event.button_mask == MOUSE_BUTTON_MASK_MIDDLE: if _zoom_to == Vector2.ZERO: # Set zoom position if starting action. @@ -73,7 +72,8 @@ func _unhandled_input(event: InputEvent) -> void: (1 if Configs.savedata.invert_zoom else -1) *\ (wrap_mouse(event.relative).y if Configs.savedata.wrap_mouse else\ event.relative.y) / 128.0), _zoom_to) - # Panning with LMB or MMB. + # Panning with LMB or MMB. This gives a reliable way to adjust the view + # without dragging the things on it. else: set_view(view.position - (wrap_mouse(event.relative) if\ Configs.savedata.wrap_mouse else event.relative) / Indications.zoom) @@ -92,7 +92,7 @@ func _unhandled_input(event: InputEvent) -> void: elif event is InputEventMouseButton and event.is_pressed(): var move_vec := Vector2.ZERO var zoom_dir := 0 - var mouse_offset := get_mouse_position() / (size * 1.0) + # Zooming with scrolling. if (not event.ctrl_pressed and not event.shift_pressed and\ not Configs.savedata.use_ctrl_for_zoom) or\ @@ -102,6 +102,7 @@ func _unhandled_input(event: InputEvent) -> void: MOUSE_BUTTON_WHEEL_DOWN when Configs.savedata.invert_zoom: zoom_dir = 1 MOUSE_BUTTON_WHEEL_UP: zoom_dir = 1 MOUSE_BUTTON_WHEEL_DOWN: zoom_dir = -1 + _: return # Inverted panning with Shift + scrolling. elif event.shift_pressed: match event.button_index: @@ -109,6 +110,7 @@ func _unhandled_input(event: InputEvent) -> void: MOUSE_BUTTON_WHEEL_DOWN: move_vec = Vector2.RIGHT MOUSE_BUTTON_WHEEL_LEFT: move_vec = Vector2.UP MOUSE_BUTTON_WHEEL_RIGHT: move_vec = Vector2.DOWN + _: return # Panning with scrolling. else: match event.button_index: @@ -116,7 +118,9 @@ func _unhandled_input(event: InputEvent) -> void: MOUSE_BUTTON_WHEEL_DOWN: move_vec = Vector2.DOWN MOUSE_BUTTON_WHEEL_LEFT: move_vec = Vector2.LEFT MOUSE_BUTTON_WHEEL_RIGHT: move_vec = Vector2.RIGHT + _: return + var mouse_offset := get_mouse_position() / Vector2(size) # Apply scroll data from above. var factor: float = event.factor if factor == roundf(factor): # Detects if precise factor is unsuported. diff --git a/src/ui_parts/viewport.gd.uid b/src/ui_parts/viewport.gd.uid new file mode 100644 index 00000000..c4f17839 --- /dev/null +++ b/src/ui_parts/viewport.gd.uid @@ -0,0 +1 @@ +uid://b6pmlbnl76wmm diff --git a/src/ui_parts/zoom_menu.gd b/src/ui_parts/zoom_menu.gd index 02bf0fac..3943b689 100644 --- a/src/ui_parts/zoom_menu.gd +++ b/src/ui_parts/zoom_menu.gd @@ -48,13 +48,13 @@ func zoom_reset() -> void: func update_buttons_appearance() -> void: if _zoom_level < 0.1: - zoom_reset_button.text = String.num(_zoom_level * 100, 2) + "%" + zoom_reset_button.text = Utils.num_simple(_zoom_level * 100, 2) + "%" elif _zoom_level < 10.0: - zoom_reset_button.text = String.num(_zoom_level * 100, 1) + "%" + zoom_reset_button.text = Utils.num_simple(_zoom_level * 100, 1) + "%" elif _zoom_level < 100.0: zoom_reset_button.text = String.num_uint64(roundi(_zoom_level * 100)) + "%" else: - zoom_reset_button.text = String.num(_zoom_level, 1) + "x" + zoom_reset_button.text = Utils.num_simple(_zoom_level, 1) + "x" var is_max_zoom := _zoom_level > MAX_ZOOM or is_equal_approx(_zoom_level, MAX_ZOOM) var is_min_zoom := _zoom_level < MIN_ZOOM or is_equal_approx(_zoom_level, MIN_ZOOM) diff --git a/src/ui_parts/zoom_menu.gd.uid b/src/ui_parts/zoom_menu.gd.uid new file mode 100644 index 00000000..38fad997 --- /dev/null +++ b/src/ui_parts/zoom_menu.gd.uid @@ -0,0 +1 @@ +uid://dj2q7wnto3uqp diff --git a/src/ui_widgets/BetterLineEdit.gd b/src/ui_widgets/BetterLineEdit.gd index c46811e2..9777ae55 100644 --- a/src/ui_widgets/BetterLineEdit.gd +++ b/src/ui_widgets/BetterLineEdit.gd @@ -26,6 +26,7 @@ func _init() -> void: mouse_exited.connect(_on_base_class_mouse_exited) text_submitted.connect(release_focus.unbind(1)) Configs.theme_changed.connect(update_theme) + update_theme() func update_theme() -> void: if editable: @@ -63,7 +64,7 @@ func _on_base_class_mouse_exited() -> void: func _draw() -> void: - if editable and _hovered and has_theme_stylebox("hover"): + if _hovered and editable and has_theme_stylebox("hover"): draw_style_box(get_theme_stylebox("hover"), Rect2(Vector2.ZERO, size)) func _make_custom_tooltip(for_text: String) -> Object: diff --git a/src/ui_widgets/BetterLineEdit.gd.uid b/src/ui_widgets/BetterLineEdit.gd.uid new file mode 100644 index 00000000..569c4574 --- /dev/null +++ b/src/ui_widgets/BetterLineEdit.gd.uid @@ -0,0 +1 @@ +uid://1hox6gd5pxku diff --git a/src/ui_widgets/BetterTextEdit.gd.uid b/src/ui_widgets/BetterTextEdit.gd.uid new file mode 100644 index 00000000..c66d2426 --- /dev/null +++ b/src/ui_widgets/BetterTextEdit.gd.uid @@ -0,0 +1 @@ +uid://dh5mir6i27u4u diff --git a/src/ui_widgets/BetterToggleButton.gd.uid b/src/ui_widgets/BetterToggleButton.gd.uid new file mode 100644 index 00000000..6f4ca0bf --- /dev/null +++ b/src/ui_widgets/BetterToggleButton.gd.uid @@ -0,0 +1 @@ +uid://ynx3s1jc6bwq diff --git a/src/ui_widgets/ContextPopup.gd.uid b/src/ui_widgets/ContextPopup.gd.uid new file mode 100644 index 00000000..63261679 --- /dev/null +++ b/src/ui_widgets/ContextPopup.gd.uid @@ -0,0 +1 @@ +uid://hbh2rb8xlkln diff --git a/src/ui_widgets/GridDrawingControl.gd.uid b/src/ui_widgets/GridDrawingControl.gd.uid new file mode 100644 index 00000000..aad2a904 --- /dev/null +++ b/src/ui_widgets/GridDrawingControl.gd.uid @@ -0,0 +1 @@ +uid://ci44864moadn diff --git a/src/ui_widgets/HTitledPanel.gd.uid b/src/ui_widgets/HTitledPanel.gd.uid new file mode 100644 index 00000000..251e0a3a --- /dev/null +++ b/src/ui_widgets/HTitledPanel.gd.uid @@ -0,0 +1 @@ +uid://chk5g6lh7jc14 diff --git a/src/ui_widgets/LineEditButton.gd b/src/ui_widgets/LineEditButton.gd index 6ab21e25..6c94fc9b 100644 --- a/src/ui_widgets/LineEditButton.gd +++ b/src/ui_widgets/LineEditButton.gd @@ -164,7 +164,6 @@ func _draw() -> void: Vector2(size.x - BUTTON_WIDTH, size.y), sb.border_color, 2) # The default overrun behavior couldn't be changed for the simplest draw methods. var text_obj := TextLine.new() - text_obj.ellipsis_char = "a" # TODO: #98841 will address the need for this. text_obj.text_overrun_behavior = TextServer.OVERRUN_TRIM_CHAR text_obj.width = size.x - BUTTON_WIDTH - horizontal_margin_width text_obj.add_string(placeholder_text if text.is_empty() else text, _get_font(), diff --git a/src/ui_widgets/LineEditButton.gd.uid b/src/ui_widgets/LineEditButton.gd.uid new file mode 100644 index 00000000..65fc2802 --- /dev/null +++ b/src/ui_widgets/LineEditButton.gd.uid @@ -0,0 +1 @@ +uid://bg0n823ssr1kk diff --git a/src/ui_widgets/TitledPanel.gd.uid b/src/ui_widgets/TitledPanel.gd.uid new file mode 100644 index 00000000..52a0bfc6 --- /dev/null +++ b/src/ui_widgets/TitledPanel.gd.uid @@ -0,0 +1 @@ +uid://5demww4vkjj8 diff --git a/src/ui_widgets/VTitledPanel.gd.uid b/src/ui_widgets/VTitledPanel.gd.uid new file mode 100644 index 00000000..d293dd3d --- /dev/null +++ b/src/ui_widgets/VTitledPanel.gd.uid @@ -0,0 +1 @@ +uid://ojo0537b6hcy diff --git a/src/ui_widgets/basic_xnode_frame.gd.uid b/src/ui_widgets/basic_xnode_frame.gd.uid new file mode 100644 index 00000000..d54c3482 --- /dev/null +++ b/src/ui_widgets/basic_xnode_frame.gd.uid @@ -0,0 +1 @@ +uid://cftadbnbgghps diff --git a/src/ui_widgets/color_edit.gd.uid b/src/ui_widgets/color_edit.gd.uid new file mode 100644 index 00000000..d4422ab7 --- /dev/null +++ b/src/ui_widgets/color_edit.gd.uid @@ -0,0 +1 @@ +uid://bu3mp6qwgvgh0 diff --git a/src/ui_widgets/color_field.gd.uid b/src/ui_widgets/color_field.gd.uid new file mode 100644 index 00000000..86084b74 --- /dev/null +++ b/src/ui_widgets/color_field.gd.uid @@ -0,0 +1 @@ +uid://ditw2rswb3tjd diff --git a/src/ui_widgets/color_picker_popup.gd.uid b/src/ui_widgets/color_picker_popup.gd.uid new file mode 100644 index 00000000..42827cfa --- /dev/null +++ b/src/ui_widgets/color_picker_popup.gd.uid @@ -0,0 +1 @@ +uid://6epc6l4yo18d diff --git a/src/ui_widgets/color_popup.gd b/src/ui_widgets/color_popup.gd index 6873ebab..b13f5666 100644 --- a/src/ui_widgets/color_popup.gd +++ b/src/ui_widgets/color_popup.gd @@ -1,7 +1,7 @@ # A popup for picking a color. extends PanelContainer -# Useful here, because it avoids the ColorPalette validation. +# Useful here, because it avoids the Palette validation. class MockPalette extends RefCounted: var title: String var colors: PackedStringArray diff --git a/src/ui_widgets/color_popup.gd.uid b/src/ui_widgets/color_popup.gd.uid new file mode 100644 index 00000000..d8059e85 --- /dev/null +++ b/src/ui_widgets/color_popup.gd.uid @@ -0,0 +1 @@ +uid://caecf6gysjqel diff --git a/src/ui_widgets/color_popup.tscn b/src/ui_widgets/color_popup.tscn index aca2272c..48b086f2 100644 --- a/src/ui_widgets/color_popup.tscn +++ b/src/ui_widgets/color_popup.tscn @@ -1,9 +1,9 @@ [gd_scene load_steps=5 format=3 uid="uid://f5cljfdpe85v"] -[ext_resource type="Script" path="res://src/ui_widgets/color_popup.gd" id="1_t1mgf"] +[ext_resource type="Script" uid="uid://caecf6gysjqel" path="res://src/ui_widgets/color_popup.gd" id="1_t1mgf"] [ext_resource type="FontFile" uid="uid://clpf84p1lfwlp" path="res://assets/fonts/Font.ttf" id="2_5tod5"] [ext_resource type="PackedScene" uid="uid://b1eig44cov474" path="res://src/ui_widgets/good_color_picker.tscn" id="2_jv3ea"] -[ext_resource type="Script" path="res://src/ui_widgets/BetterLineEdit.gd" id="2_lkukd"] +[ext_resource type="Script" uid="uid://1hox6gd5pxku" path="res://src/ui_widgets/BetterLineEdit.gd" id="2_lkukd"] [node name="ColorPopup" type="PanelContainer"] custom_minimum_size = Vector2(160, 0) diff --git a/src/ui_widgets/color_swatch.gd b/src/ui_widgets/color_swatch.gd index d2a4eafe..1480d239 100644 --- a/src/ui_widgets/color_swatch.gd +++ b/src/ui_widgets/color_swatch.gd @@ -13,7 +13,7 @@ var gradient_texture: GradientTexture2D var current_color := Color.BLACK func _ready() -> void: - tooltip_text = "lmofa" # TODO: _make_custom_tooltip() requires some text to work. + tooltip_text = "lmofa" # TODO: Remove this when #101550 is fixed. # TODO remove this when #25296 is fixed. if ColorParser.is_valid_url(color): var id := color.substr(5, color.length() - 6) diff --git a/src/ui_widgets/color_swatch.gd.uid b/src/ui_widgets/color_swatch.gd.uid new file mode 100644 index 00000000..8d017519 --- /dev/null +++ b/src/ui_widgets/color_swatch.gd.uid @@ -0,0 +1 @@ +uid://b8kcgqnji5wvq diff --git a/src/ui_widgets/color_swatch.tscn b/src/ui_widgets/color_swatch.tscn index c10d6dfd..2a5d33f5 100644 --- a/src/ui_widgets/color_swatch.tscn +++ b/src/ui_widgets/color_swatch.tscn @@ -1,13 +1,12 @@ [gd_scene load_steps=2 format=3 uid="uid://bujllg1bqlub6"] -[ext_resource type="Script" path="res://src/ui_widgets/color_swatch.gd" id="1_2b2yq"] +[ext_resource type="Script" uid="uid://b8kcgqnji5wvq" path="res://src/ui_widgets/color_swatch.gd" id="1_2b2yq"] [node name="ColorSwatch" type="Button"] custom_minimum_size = Vector2(22, 22) offset_right = 20.0 offset_bottom = 20.0 focus_mode = 0 -mouse_filter = 1 mouse_default_cursor_shape = 2 theme_type_variation = &"Swatch" script = ExtResource("1_2b2yq") diff --git a/src/ui_widgets/color_swatch_config.gd b/src/ui_widgets/color_swatch_config.gd index a13b4b5e..0d8832a3 100644 --- a/src/ui_widgets/color_swatch_config.gd +++ b/src/ui_widgets/color_swatch_config.gd @@ -5,17 +5,16 @@ const gear_icon = preload("res://assets/icons/GearOutlined.svg") const ColorSwatch = preload("res://src/ui_widgets/color_swatch.tscn") -var palette: ColorPalette +var palette: Palette var idx := -1 # Index inside the palette. -var proposed_drop_data: Array = [] # Used to sync with drag-and-dropping information. +var proposed_drop_data: DropData # Used to sync with drag-and-dropping information. var surface := RenderingServer.canvas_item_create() func _ready() -> void: + tooltip_text = "lmofa" # TODO: Remove this when #101550 is fixed. RenderingServer.canvas_item_set_parent(surface, get_canvas_item()) RenderingServer.canvas_item_set_z_index(surface, 1) - # TODO This is no logner needed in 4.4 - tooltip_text = "lmofa" # _make_custom_tooltip() requires some text to work. func _exit_tree() -> void: RenderingServer.free_rid(surface) @@ -34,13 +33,13 @@ func _draw() -> void: draw_rect(inside_rect, parsed_color) RenderingServer.canvas_item_clear(surface) - if proposed_drop_data.size() != 2 or proposed_drop_data[0] != palette: + if not is_instance_valid(proposed_drop_data) or proposed_drop_data.palette != palette: # Gear indicator. if is_hovered(): gear_icon.draw(get_canvas_item(), (size - gear_icon.get_size()) / 2) return - var drop_idx: int = proposed_drop_data[1] + var drop_idx := proposed_drop_data.index # Draw the drag-and-drop indicator. var drop_sb := StyleBoxFlat.new() drop_sb.draw_center = false @@ -72,10 +71,10 @@ func _make_custom_tooltip(_for_text: String) -> Object: var is_dragging := false class DropData extends RefCounted: - var palette: ColorPalette + var palette: Palette var index: int - func _init(new_palette: ColorPalette, new_index: int) -> void: + func _init(new_palette: Palette, new_index: int) -> void: palette = new_palette index = new_index @@ -93,7 +92,7 @@ func _get_drag_data(_at_position: Vector2) -> Variant: func _notification(what: int) -> void: if what == NOTIFICATION_DRAG_END: - proposed_drop_data.clear() + proposed_drop_data = null modulate = Color(1, 1, 1) queue_redraw() diff --git a/src/ui_widgets/color_swatch_config.gd.uid b/src/ui_widgets/color_swatch_config.gd.uid new file mode 100644 index 00000000..9b003b46 --- /dev/null +++ b/src/ui_widgets/color_swatch_config.gd.uid @@ -0,0 +1 @@ +uid://b5cscj6y8oi2h diff --git a/src/ui_widgets/color_swatch_config.tscn b/src/ui_widgets/color_swatch_config.tscn index 50cd573a..de5425d3 100644 --- a/src/ui_widgets/color_swatch_config.tscn +++ b/src/ui_widgets/color_swatch_config.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=2 format=3 uid="uid://e73b7lssdp6m"] -[ext_resource type="Script" path="res://src/ui_widgets/color_swatch_config.gd" id="1_u3awj"] +[ext_resource type="Script" uid="uid://b5cscj6y8oi2h" path="res://src/ui_widgets/color_swatch_config.gd" id="1_u3awj"] [node name="ColorSwatchConfig" type="Button"] custom_minimum_size = Vector2(22, 22) diff --git a/src/ui_widgets/configure_color_popup.gd b/src/ui_widgets/configure_color_popup.gd index 852c6894..5f005822 100644 --- a/src/ui_widgets/configure_color_popup.gd +++ b/src/ui_widgets/configure_color_popup.gd @@ -8,7 +8,7 @@ signal color_deletion_requested @onready var delete_button: Button = %ConfigureContainer/BottomContainer/DeleteButton @onready var label_container: HBoxContainer = %LabelContainer -var palette: ColorPalette +var palette: Palette var idx: int func _ready() -> void: diff --git a/src/ui_widgets/configure_color_popup.gd.uid b/src/ui_widgets/configure_color_popup.gd.uid new file mode 100644 index 00000000..3c183f64 --- /dev/null +++ b/src/ui_widgets/configure_color_popup.gd.uid @@ -0,0 +1 @@ +uid://btl68wj2dmivk diff --git a/src/ui_widgets/dropdown.gd b/src/ui_widgets/dropdown.gd index f03ee1a5..9ea040d5 100644 --- a/src/ui_widgets/dropdown.gd +++ b/src/ui_widgets/dropdown.gd @@ -1,14 +1,13 @@ # A dropdown with multiple options, not tied to any attribute. extends HBoxContainer -@onready var line_edit: BetterLineEdit = $LineEdit - @export var values: PackedStringArray @export var disabled_values: PackedStringArray @export var restricted := true @export var align_left := false # The alignment of the popup options' text. +@export var value_text_map: Dictionary[String, String] = {} -@export var value_text_map := {} # Dictionary{String: String} +@onready var line_edit: BetterLineEdit = $LineEdit signal value_changed(new_value: String) var _value := "" diff --git a/src/ui_widgets/dropdown.gd.uid b/src/ui_widgets/dropdown.gd.uid new file mode 100644 index 00000000..96a7bf9c --- /dev/null +++ b/src/ui_widgets/dropdown.gd.uid @@ -0,0 +1 @@ +uid://bp4ji11u8dr0m diff --git a/src/ui_widgets/element_content_basic_shape.gd.uid b/src/ui_widgets/element_content_basic_shape.gd.uid new file mode 100644 index 00000000..816d9d58 --- /dev/null +++ b/src/ui_widgets/element_content_basic_shape.gd.uid @@ -0,0 +1 @@ +uid://cv6p3un40sgne diff --git a/src/ui_widgets/element_content_g.gd.uid b/src/ui_widgets/element_content_g.gd.uid new file mode 100644 index 00000000..02f3058a --- /dev/null +++ b/src/ui_widgets/element_content_g.gd.uid @@ -0,0 +1 @@ +uid://dcvadp80yr47v diff --git a/src/ui_widgets/element_content_linear_gradient.gd.uid b/src/ui_widgets/element_content_linear_gradient.gd.uid new file mode 100644 index 00000000..7cb2668a --- /dev/null +++ b/src/ui_widgets/element_content_linear_gradient.gd.uid @@ -0,0 +1 @@ +uid://4xraagkofgdj diff --git a/src/ui_widgets/element_content_path.gd.uid b/src/ui_widgets/element_content_path.gd.uid new file mode 100644 index 00000000..d41b3a86 --- /dev/null +++ b/src/ui_widgets/element_content_path.gd.uid @@ -0,0 +1 @@ +uid://db6oyweh2t54d diff --git a/src/ui_widgets/element_content_polyshape.gd.uid b/src/ui_widgets/element_content_polyshape.gd.uid new file mode 100644 index 00000000..e4f08c89 --- /dev/null +++ b/src/ui_widgets/element_content_polyshape.gd.uid @@ -0,0 +1 @@ +uid://d3tlbx5skjsjj diff --git a/src/ui_widgets/element_content_radial_gradient.gd.uid b/src/ui_widgets/element_content_radial_gradient.gd.uid new file mode 100644 index 00000000..5ab6f2b2 --- /dev/null +++ b/src/ui_widgets/element_content_radial_gradient.gd.uid @@ -0,0 +1 @@ +uid://1mmtphi577im diff --git a/src/ui_widgets/element_content_stop.gd.uid b/src/ui_widgets/element_content_stop.gd.uid new file mode 100644 index 00000000..1e3a3170 --- /dev/null +++ b/src/ui_widgets/element_content_stop.gd.uid @@ -0,0 +1 @@ +uid://b21t3dseqwcdt diff --git a/src/ui_widgets/element_content_unrecognized.gd.uid b/src/ui_widgets/element_content_unrecognized.gd.uid new file mode 100644 index 00000000..8c29c0cb --- /dev/null +++ b/src/ui_widgets/element_content_unrecognized.gd.uid @@ -0,0 +1 @@ +uid://cpgpynf4om34b diff --git a/src/ui_widgets/element_frame.gd b/src/ui_widgets/element_frame.gd index 9e66385e..619934f8 100644 --- a/src/ui_widgets/element_frame.gd +++ b/src/ui_widgets/element_frame.gd @@ -2,7 +2,7 @@ extends VTitledPanel const warning_icon = preload("res://assets/icons/Warning.svg") -const element_content_types = { +const element_content_types: Dictionary[String, PackedScene] = { "path": preload("res://src/ui_widgets/element_content_path.tscn"), "polygon": preload("res://src/ui_widgets/element_content_polyshape.tscn"), "polyline": preload("res://src/ui_widgets/element_content_polyshape.tscn"), diff --git a/src/ui_widgets/element_frame.gd.uid b/src/ui_widgets/element_frame.gd.uid new file mode 100644 index 00000000..8fa8168d --- /dev/null +++ b/src/ui_widgets/element_frame.gd.uid @@ -0,0 +1 @@ +uid://cgtbtlg2nfwvt diff --git a/src/ui_widgets/enum_dropdown.gd.uid b/src/ui_widgets/enum_dropdown.gd.uid new file mode 100644 index 00000000..5ab8c478 --- /dev/null +++ b/src/ui_widgets/enum_dropdown.gd.uid @@ -0,0 +1 @@ +uid://cmywc1vb0rw8y diff --git a/src/ui_widgets/enum_field.gd.uid b/src/ui_widgets/enum_field.gd.uid new file mode 100644 index 00000000..d877c643 --- /dev/null +++ b/src/ui_widgets/enum_field.gd.uid @@ -0,0 +1 @@ +uid://bplpuld6fqv7q diff --git a/src/ui_widgets/flag_field.gd.uid b/src/ui_widgets/flag_field.gd.uid new file mode 100644 index 00000000..91f02836 --- /dev/null +++ b/src/ui_widgets/flag_field.gd.uid @@ -0,0 +1 @@ +uid://ndfvlxytvcm8 diff --git a/src/ui_widgets/good_color_picker.gd.uid b/src/ui_widgets/good_color_picker.gd.uid new file mode 100644 index 00000000..17438af7 --- /dev/null +++ b/src/ui_widgets/good_color_picker.gd.uid @@ -0,0 +1 @@ +uid://bof1kkpsf7cmx diff --git a/src/ui_widgets/id_field.gd.uid b/src/ui_widgets/id_field.gd.uid new file mode 100644 index 00000000..412872f2 --- /dev/null +++ b/src/ui_widgets/id_field.gd.uid @@ -0,0 +1 @@ +uid://dla17p5hsn7e1 diff --git a/src/ui_widgets/mini_number_field.gd.uid b/src/ui_widgets/mini_number_field.gd.uid new file mode 100644 index 00000000..a5a38272 --- /dev/null +++ b/src/ui_widgets/mini_number_field.gd.uid @@ -0,0 +1 @@ +uid://dcnkg4irpqdl diff --git a/src/ui_widgets/number_dropdown.gd b/src/ui_widgets/number_dropdown.gd index 7b34199f..b35ae7de 100644 --- a/src/ui_widgets/number_dropdown.gd +++ b/src/ui_widgets/number_dropdown.gd @@ -38,10 +38,8 @@ func _on_button_pressed() -> void: func to_str(num: float) -> String: - var ret := String.num(num) - if not (is_integer or "." in ret): - ret += ".0" - return ret + # Right now, all the places this is used benefit from showing "1" as "1.0". + return String.num(num, 0 if is_integer else Utils.MAX_NUMERIC_PRECISION) func _on_text_submitted(new_text: String) -> void: if (restricted and new_text.to_float() in values) or not restricted: diff --git a/src/ui_widgets/number_dropdown.gd.uid b/src/ui_widgets/number_dropdown.gd.uid new file mode 100644 index 00000000..da7316a4 --- /dev/null +++ b/src/ui_widgets/number_dropdown.gd.uid @@ -0,0 +1 @@ +uid://trxmy0mb706i diff --git a/src/ui_widgets/number_edit.gd b/src/ui_widgets/number_edit.gd index bf094aa9..169f544d 100644 --- a/src/ui_widgets/number_edit.gd +++ b/src/ui_widgets/number_edit.gd @@ -41,4 +41,4 @@ func _on_text_submitted(submitted_text: String) -> void: set_value(NumstringParser.evaluate(submitted_text)) func sync_text() -> void: - text = String.num(_value, Utils.MAX_NUMERIC_PRECISION) + text = Utils.num_simple(_value, Utils.MAX_NUMERIC_PRECISION) diff --git a/src/ui_widgets/number_edit.gd.uid b/src/ui_widgets/number_edit.gd.uid new file mode 100644 index 00000000..9621b2d9 --- /dev/null +++ b/src/ui_widgets/number_edit.gd.uid @@ -0,0 +1 @@ +uid://csvfi4sy8ky68 diff --git a/src/ui_widgets/number_field.gd.uid b/src/ui_widgets/number_field.gd.uid new file mode 100644 index 00000000..3a9a51ab --- /dev/null +++ b/src/ui_widgets/number_field.gd.uid @@ -0,0 +1 @@ +uid://313bndd6viir diff --git a/src/ui_widgets/number_field_with_slider.gd.uid b/src/ui_widgets/number_field_with_slider.gd.uid new file mode 100644 index 00000000..b09d1612 --- /dev/null +++ b/src/ui_widgets/number_field_with_slider.gd.uid @@ -0,0 +1 @@ +uid://cmj05v3n1gfpl diff --git a/src/ui_widgets/palette_config.gd b/src/ui_widgets/palette_config.gd index 17a5a673..39cf7946 100644 --- a/src/ui_widgets/palette_config.gd +++ b/src/ui_widgets/palette_config.gd @@ -8,7 +8,7 @@ const plus_icon = preload("res://assets/icons/Plus.svg") signal layout_changed -var palette: ColorPalette +var palette: Palette var currently_edited_idx := -1 @onready var palette_button: Button = $MainContainer/HBoxContainer/PaletteButton @@ -31,7 +31,7 @@ func setup_theme() -> void: # Used to setup a palette for this element. -func assign_palette(new_palette: ColorPalette) -> void: +func assign_palette(new_palette: Palette) -> void: palette = new_palette palette.layout_changed.connect(rebuild_colors) palette.layout_changed.connect(display_warnings) @@ -177,7 +177,7 @@ func move_down() -> void: layout_changed.emit() func paste_palette() -> void: - var pasted_palettes := ColorPalette.text_to_palettes(Utils.get_clipboard_web_safe()) + var pasted_palettes := Palette.text_to_palettes(Utils.get_clipboard_web_safe()) if pasted_palettes.is_empty(): return Configs.savedata.replace_palette(find_palette_index(), pasted_palettes[0]) @@ -186,16 +186,16 @@ func paste_palette() -> void: func open_palette_options() -> void: var btn_arr: Array[Button] = [] btn_arr.append(ContextPopup.create_button("Pure", - apply_preset.bind(ColorPalette.Preset.PURE), - palette.is_same_as_preset(ColorPalette.Preset.PURE), + apply_preset.bind(Palette.Preset.PURE), + palette.is_same_as_preset(Palette.Preset.PURE), load("res://assets/icons/PresetPure.svg"))) btn_arr.append(ContextPopup.create_button("Grayscale", - apply_preset.bind(ColorPalette.Preset.GRAYSCALE), - palette.is_same_as_preset(ColorPalette.Preset.GRAYSCALE), + apply_preset.bind(Palette.Preset.GRAYSCALE), + palette.is_same_as_preset(Palette.Preset.GRAYSCALE), load("res://assets/icons/PresetGrayscale.svg"))) btn_arr.append(ContextPopup.create_button("Empty", - apply_preset.bind(ColorPalette.Preset.EMPTY), - palette.is_same_as_preset(ColorPalette.Preset.EMPTY), + apply_preset.bind(Palette.Preset.EMPTY), + palette.is_same_as_preset(Palette.Preset.EMPTY), load("res://assets/icons/Clear.svg"))) var context_popup := ContextPopup.new() @@ -203,7 +203,7 @@ func open_palette_options() -> void: HandlerGUI.popup_under_rect_center(context_popup, palette_button.get_global_rect(), get_viewport()) -func apply_preset(preset: ColorPalette.Preset) -> void: +func apply_preset(preset: Palette.Preset) -> void: Configs.savedata.get_palette(find_palette_index()).apply_preset(preset) @@ -228,7 +228,7 @@ func _on_palette_button_pressed() -> void: DisplayServer.clipboard_set.bind(Configs.savedata.get_palette(palette_idx).\ to_text()), false, load("res://assets/icons/Copy.svg"))) btn_arr.append(ContextPopup.create_button(Translator.translate("Paste XML"), - paste_palette, !ColorPalette.is_valid_palette(Utils.get_clipboard_web_safe()), + paste_palette, !Palette.is_valid_palette(Utils.get_clipboard_web_safe()), load("res://assets/icons/Paste.svg"))) btn_arr.append(ContextPopup.create_button(Translator.translate("Apply Preset"), open_palette_options, false, load("res://assets/icons/Import.svg"))) @@ -275,7 +275,7 @@ func _can_drop_data(_at_position: Vector2, data: Variant) -> bool: proposed_drop_idx = new_idx for swatch in get_swatches(): - swatch.proposed_drop_data = [palette, new_idx] + swatch.proposed_drop_data = ColorSwatchType.DropData.new(palette, new_idx) swatch.queue_redraw() return data.palette != palette or (data.palette == palette and\ data.index != new_idx and data.index != new_idx - 1) @@ -297,5 +297,5 @@ func _drop_data(_at_position: Vector2, data: Variant) -> void: func clear_proposed_drop() -> void: proposed_drop_idx = -1 for swatch in get_swatches(): - swatch.proposed_drop_data.clear() + swatch.proposed_drop_data = null swatch.queue_redraw() diff --git a/src/ui_widgets/palette_config.gd.uid b/src/ui_widgets/palette_config.gd.uid new file mode 100644 index 00000000..b35ec4df --- /dev/null +++ b/src/ui_widgets/palette_config.gd.uid @@ -0,0 +1 @@ +uid://e73am1tdeku diff --git a/src/ui_widgets/path_command_button.gd.uid b/src/ui_widgets/path_command_button.gd.uid new file mode 100644 index 00000000..f0121341 --- /dev/null +++ b/src/ui_widgets/path_command_button.gd.uid @@ -0,0 +1 @@ +uid://fln0r81yv0rn diff --git a/src/ui_widgets/path_popup.gd.uid b/src/ui_widgets/path_popup.gd.uid new file mode 100644 index 00000000..c7146f65 --- /dev/null +++ b/src/ui_widgets/path_popup.gd.uid @@ -0,0 +1 @@ +uid://l4ongcnemxuq diff --git a/src/ui_widgets/pathdata_field.gd b/src/ui_widgets/pathdata_field.gd index d2105aa3..cb19112e 100644 --- a/src/ui_widgets/pathdata_field.gd +++ b/src/ui_widgets/pathdata_field.gd @@ -143,14 +143,13 @@ func _on_add_move_button_pressed() -> void: func _on_selections_or_hover_changed() -> void: var new_selections: Array[int] = [] if Indications.semi_selected_xid == element.xid: - new_selections = Indications.inner_selections + new_selections = Indications.inner_selections.duplicate() var new_hovered := -1 if Indications.semi_hovered_xid == element.xid: new_hovered = Indications.inner_hovered # Only redraw if selections or hovered changed. if new_selections != current_selections: - # TODO Figure out why the fuck must I duplicate it. - current_selections = new_selections.duplicate() + current_selections = new_selections commands_container.queue_redraw() if new_hovered != current_hovered: current_hovered = new_hovered diff --git a/src/ui_widgets/pathdata_field.gd.uid b/src/ui_widgets/pathdata_field.gd.uid new file mode 100644 index 00000000..3fe5d7d4 --- /dev/null +++ b/src/ui_widgets/pathdata_field.gd.uid @@ -0,0 +1 @@ +uid://p4nyhlbpwxe2 diff --git a/src/ui_widgets/points_field.gd b/src/ui_widgets/points_field.gd index a86eb4d3..4c2f8cea 100644 --- a/src/ui_widgets/points_field.gd +++ b/src/ui_widgets/points_field.gd @@ -138,14 +138,13 @@ func _on_add_move_button_pressed() -> void: func _on_selections_or_hover_changed() -> void: var new_selections: Array[int] = [] if Indications.semi_selected_xid == element.xid: - new_selections = Indications.inner_selections + new_selections = Indications.inner_selections.duplicate() var new_hovered := -1 if Indications.semi_hovered_xid == element.xid: new_hovered = Indications.inner_hovered # Only redraw if selections or hovered changed. if new_selections != current_selections: - # TODO Figure out why the fuck must I duplicate it. - current_selections = new_selections.duplicate() + current_selections = new_selections points_container.queue_redraw() if new_hovered != current_hovered: current_hovered = new_hovered diff --git a/src/ui_widgets/points_field.gd.uid b/src/ui_widgets/points_field.gd.uid new file mode 100644 index 00000000..bd15e74d --- /dev/null +++ b/src/ui_widgets/points_field.gd.uid @@ -0,0 +1 @@ +uid://bey3843fto5dc diff --git a/src/ui_widgets/presented_shortcut.gd.uid b/src/ui_widgets/presented_shortcut.gd.uid new file mode 100644 index 00000000..1076b61c --- /dev/null +++ b/src/ui_widgets/presented_shortcut.gd.uid @@ -0,0 +1 @@ +uid://beewlny6guury diff --git a/src/ui_widgets/preview_rect.gd.uid b/src/ui_widgets/preview_rect.gd.uid new file mode 100644 index 00000000..4372ae9f --- /dev/null +++ b/src/ui_widgets/preview_rect.gd.uid @@ -0,0 +1 @@ +uid://cx43kir18is86 diff --git a/src/ui_widgets/profile_frame.gd.uid b/src/ui_widgets/profile_frame.gd.uid new file mode 100644 index 00000000..3b29c20e --- /dev/null +++ b/src/ui_widgets/profile_frame.gd.uid @@ -0,0 +1 @@ +uid://dfp0yap8evr57 diff --git a/src/ui_widgets/setting_frame.gd b/src/ui_widgets/setting_frame.gd index b7a09f87..477edc67 100644 --- a/src/ui_widgets/setting_frame.gd +++ b/src/ui_widgets/setting_frame.gd @@ -137,7 +137,7 @@ func update_widgets() -> void: Type.COLOR: var setting_value: Color = getter.call() var show_alpha: bool = widget.enable_alpha and setting_value.a != 1.0 - var setting_str: String = setting_value.to_html(show_alpha) + var setting_str := setting_value.to_html(show_alpha) widget.value = setting_str reset_button.visible = (not disabled and\ getter.call().to_html() != default.to_html()) diff --git a/src/ui_widgets/setting_frame.gd.uid b/src/ui_widgets/setting_frame.gd.uid new file mode 100644 index 00000000..a7e8b6e5 --- /dev/null +++ b/src/ui_widgets/setting_frame.gd.uid @@ -0,0 +1 @@ +uid://3tqaiuqu1h01 diff --git a/src/ui_widgets/setting_shortcut.gd.uid b/src/ui_widgets/setting_shortcut.gd.uid new file mode 100644 index 00000000..913db7e3 --- /dev/null +++ b/src/ui_widgets/setting_shortcut.gd.uid @@ -0,0 +1 @@ +uid://civujbqn2um1u diff --git a/src/ui_widgets/transform_editor.gd.uid b/src/ui_widgets/transform_editor.gd.uid new file mode 100644 index 00000000..e5799aa0 --- /dev/null +++ b/src/ui_widgets/transform_editor.gd.uid @@ -0,0 +1 @@ +uid://cdipr84aqj703 diff --git a/src/ui_widgets/transform_field.gd.uid b/src/ui_widgets/transform_field.gd.uid new file mode 100644 index 00000000..e7f04c90 --- /dev/null +++ b/src/ui_widgets/transform_field.gd.uid @@ -0,0 +1 @@ +uid://bws54nmwus6y6 diff --git a/src/ui_widgets/transform_popup.gd b/src/ui_widgets/transform_popup.gd index c9e8a20e..9defe1b2 100644 --- a/src/ui_widgets/transform_popup.gd +++ b/src/ui_widgets/transform_popup.gd @@ -6,7 +6,7 @@ const NumberEditType = preload("res://src/ui_widgets/number_edit.gd") const MiniNumberField = preload("res://src/ui_widgets/mini_number_field.tscn") const TransformEditor = preload("res://src/ui_widgets/transform_editor.tscn") -const icons_dict := { +const _icons_dict: Dictionary[String, Texture2D] = { "matrix": preload("res://assets/icons/Matrix.svg"), "translate": preload("res://assets/icons/Translate.svg"), "rotate": preload("res://assets/icons/Rotate.svg"), @@ -86,7 +86,7 @@ func rebuild() -> void: elif t is Transform.TransformSkewY: fields = [create_mini_number_field(i, "y")] t_editor.setup(t, fields) - t_editor.transform_button.icon = icons_dict[t_editor.type] + t_editor.transform_button.icon = _icons_dict[t_editor.type] t_editor.transform_button.pressed.connect( popup_transform_actions.bind(i, t_editor.transform_button)) i += 1 @@ -170,7 +170,7 @@ func popup_new_transform_context(idx: int, control: Control) -> void: var btn_array: Array[Button] = [] for transform in ["matrix", "translate", "rotate", "scale", "skewX", "skewY"]: var btn := ContextPopup.create_button(transform, - insert_transform.bind(idx, transform), false, icons_dict[transform]) + insert_transform.bind(idx, transform), false, _icons_dict[transform]) btn.add_theme_font_override("font", ThemeUtils.mono_font) btn_array.append(btn) diff --git a/src/ui_widgets/transform_popup.gd.uid b/src/ui_widgets/transform_popup.gd.uid new file mode 100644 index 00000000..6f7a514e --- /dev/null +++ b/src/ui_widgets/transform_popup.gd.uid @@ -0,0 +1 @@ +uid://dnolxvseucte diff --git a/src/ui_widgets/unrecognized_field.gd.uid b/src/ui_widgets/unrecognized_field.gd.uid new file mode 100644 index 00000000..eaff49c9 --- /dev/null +++ b/src/ui_widgets/unrecognized_field.gd.uid @@ -0,0 +1 @@ +uid://dk0q2mcxvxiwt diff --git a/src/utils/AttributeFieldBuilder.gd.uid b/src/utils/AttributeFieldBuilder.gd.uid new file mode 100644 index 00000000..a80b15a6 --- /dev/null +++ b/src/utils/AttributeFieldBuilder.gd.uid @@ -0,0 +1 @@ +uid://ebtjyurq2e0n diff --git a/src/utils/FileUtils.gd b/src/utils/FileUtils.gd index 45454a5f..4ffd2701 100644 --- a/src/utils/FileUtils.gd +++ b/src/utils/FileUtils.gd @@ -30,7 +30,7 @@ static func save_svg() -> void: static func open_export_dialog(export_data: ImageExportData) -> void: OS.request_permissions() if OS.has_feature("web"): - var web_format_name: String = ImageExportData.web_formats[export_data.format] + var web_format_name := ImageExportData.web_formats[export_data.format] if export_data.format == "svg": _web_save(export_data.svg_to_buffer(), web_format_name) else: diff --git a/src/utils/FileUtils.gd.uid b/src/utils/FileUtils.gd.uid new file mode 100644 index 00000000..3813356c --- /dev/null +++ b/src/utils/FileUtils.gd.uid @@ -0,0 +1 @@ +uid://dptyxkljfm0jf diff --git a/src/utils/ImageExportData.gd b/src/utils/ImageExportData.gd index d17c9753..d2d5499a 100644 --- a/src/utils/ImageExportData.gd +++ b/src/utils/ImageExportData.gd @@ -1,6 +1,6 @@ class_name ImageExportData extends RefCounted -const web_formats = { # Dictionary{String: String} +const web_formats: Dictionary[String, String] = { "svg": "image/svg+xml", "png": "image/png", "jpg": "image/jpeg", diff --git a/src/utils/ImageExportData.gd.uid b/src/utils/ImageExportData.gd.uid new file mode 100644 index 00000000..33930a9a --- /dev/null +++ b/src/utils/ImageExportData.gd.uid @@ -0,0 +1 @@ +uid://cqswl7k8w3j5p diff --git a/src/utils/ShortcutUtils.gd b/src/utils/ShortcutUtils.gd index 1dc07dba..525e16ac 100644 --- a/src/utils/ShortcutUtils.gd +++ b/src/utils/ShortcutUtils.gd @@ -1,7 +1,7 @@ class_name ShortcutUtils extends RefCounted # The bool after each action is for whether the shortcut can be modified. -const _shortcut_categories_dict = { +const _shortcut_categories_dict: Dictionary[String, Dictionary] = { "file": { "import": true, "export": true, diff --git a/src/utils/ShortcutUtils.gd.uid b/src/utils/ShortcutUtils.gd.uid new file mode 100644 index 00000000..154c40e0 --- /dev/null +++ b/src/utils/ShortcutUtils.gd.uid @@ -0,0 +1 @@ +uid://cacbwgxbmiqyy diff --git a/src/utils/ThemeUtils.gd b/src/utils/ThemeUtils.gd index 84d62475..2eac1acb 100644 --- a/src/utils/ThemeUtils.gd +++ b/src/utils/ThemeUtils.gd @@ -42,6 +42,7 @@ const translucent_button_color_pressed = Color("ddeeff44") const translucent_button_color_disabled = Color("05060755") const flat_button_color_hover = Color("ddeeff11") const flat_button_color_pressed = Color("ddeeff33") +const flat_button_color_hovered_pressed = Color("ddeeff41") # hover.blend(pressed) const flat_button_color_disabled = Color("05060744") const dark_panel_color = Color("11111a") @@ -564,7 +565,6 @@ static func _setup_itemlist(theme: Theme) -> void: theme.set_color("font_hovered", "ItemList", Color.WHITE) theme.set_color("font_selected", "ItemList", Color.WHITE) theme.set_color("guide_color", "ItemList", Color.TRANSPARENT) - #theme.set_constant("v_separation", "ItemList", 0) theme.set_constant("icon_margin", "ItemList", 4) var empty_stylebox := StyleBoxEmpty.new() @@ -586,6 +586,11 @@ static func _setup_itemlist(theme: Theme) -> void: selected_item_stylebox.bg_color = flat_button_color_pressed theme.set_stylebox("selected", "ItemList", selected_item_stylebox) theme.set_stylebox("selected_focus", "ItemList", selected_item_stylebox) + + var hovered_selected_item_stylebox := item_stylebox.duplicate() + hovered_selected_item_stylebox.bg_color = flat_button_color_hovered_pressed + theme.set_stylebox("hovered_selected", "ItemList", hovered_selected_item_stylebox) + theme.set_stylebox("hovered_selected_focus", "ItemList", hovered_selected_item_stylebox) static func _setup_lineedit(theme: Theme) -> void: theme.add_type("LineEdit") diff --git a/src/utils/ThemeUtils.gd.uid b/src/utils/ThemeUtils.gd.uid new file mode 100644 index 00000000..ff89c584 --- /dev/null +++ b/src/utils/ThemeUtils.gd.uid @@ -0,0 +1 @@ +uid://dkfgxn7nol2sd diff --git a/src/utils/TranslationUtils.gd.uid b/src/utils/TranslationUtils.gd.uid new file mode 100644 index 00000000..87fcd249 --- /dev/null +++ b/src/utils/TranslationUtils.gd.uid @@ -0,0 +1 @@ +uid://bh0by0rmefgm2 diff --git a/src/utils/Translator.gd.uid b/src/utils/Translator.gd.uid new file mode 100644 index 00000000..f2037426 --- /dev/null +++ b/src/utils/Translator.gd.uid @@ -0,0 +1 @@ +uid://dndkpdcpb3fgr diff --git a/src/utils/Utils.gd b/src/utils/Utils.gd index 35f43f57..7f08c887 100644 --- a/src/utils/Utils.gd +++ b/src/utils/Utils.gd @@ -6,6 +6,9 @@ const MAX_ANGLE_PRECISION = 4 enum InteractionType {NONE = 0, HOVERED = 1, SELECTED = 2, HOVERED_SELECTED = 3} +static func num_simple(number: float, decimals := -1) -> String: + return String.num(number, decimals).trim_suffix(".0") + static func is_string_upper(string: String) -> bool: return string.to_upper() == string diff --git a/src/utils/Utils.gd.uid b/src/utils/Utils.gd.uid new file mode 100644 index 00000000..8ecb0a14 --- /dev/null +++ b/src/utils/Utils.gd.uid @@ -0,0 +1 @@ +uid://diebxgr3x3uog diff --git a/src/utils/Utils64Bit.gd.uid b/src/utils/Utils64Bit.gd.uid new file mode 100644 index 00000000..2e31e274 --- /dev/null +++ b/src/utils/Utils64Bit.gd.uid @@ -0,0 +1 @@ +uid://djykilfoxdxk diff --git a/src/utils/XIDUtils.gd b/src/utils/XIDUtils.gd index c444551a..fde52942 100644 --- a/src/utils/XIDUtils.gd +++ b/src/utils/XIDUtils.gd @@ -4,10 +4,9 @@ class_name XIDUtils extends RefCounted static func compare(xid1: PackedInt32Array, xid2: PackedInt32Array) -> bool: var smaller_xid_size := mini(xid1.size(), xid2.size()) for i in smaller_xid_size: - if xid1[i] < xid2[i]: - return true - elif xid1[i] > xid2[i]: - return false + if xid1[i] == xid2[i]: + continue + return xid1[i] < xid2[i] return xid1.size() > smaller_xid_size static func compare_reverse(xid1: PackedInt32Array, xid2: PackedInt32Array) -> bool: @@ -26,16 +25,25 @@ static func is_parent(parent: PackedInt32Array, child: PackedInt32Array) -> bool return false return true -static func is_parent_or_self(parent: PackedInt32Array, -child: PackedInt32Array) -> bool: - return is_parent(parent, child) or parent == child +static func is_parent_or_self(parent: PackedInt32Array, child: PackedInt32Array) -> bool: + if parent.is_empty(): + return false + var parent_size := parent.size() + if parent_size > child.size(): + return false + + for i in parent_size: + if parent[i] != child[i]: + return false + return true + static func get_parent_xid(xid: PackedInt32Array) -> PackedInt32Array: var parent_xid := xid.duplicate() parent_xid.resize(xid.size() - 1) return parent_xid -static func are_siblings(xid1: PackedInt32Array, xid2: PackedInt32Array) -> bool: +static func are_siblings_or_same(xid1: PackedInt32Array, xid2: PackedInt32Array) -> bool: if xid1.size() != xid2.size(): return false for i in xid1.size() - 1: diff --git a/src/utils/XIDUtils.gd.uid b/src/utils/XIDUtils.gd.uid new file mode 100644 index 00000000..11bf8844 --- /dev/null +++ b/src/utils/XIDUtils.gd.uid @@ -0,0 +1 @@ +uid://cuc2vp2ns1phg diff --git a/src/utils/XNodeChildrenBuilder.gd.uid b/src/utils/XNodeChildrenBuilder.gd.uid new file mode 100644 index 00000000..017e2444 --- /dev/null +++ b/src/utils/XNodeChildrenBuilder.gd.uid @@ -0,0 +1 @@ +uid://conhjkr5jmnr1