Commit graph

153 commits

Author SHA1 Message Date
Eric Liu
d94ad09903 Fix conversion of hex color strings in project converter 2023-09-29 15:04:35 +02:00
Rémi Verschelde
b8ed596769
Merge pull request #79277 from akien-mga/godot-4-ever
Change explicit 'Godot 4.0' references to 'Godot 4'
2023-07-10 13:18:32 +02:00
Rémi Verschelde
8a06ec979e
Change explicit 'Godot 4.0' references to 'Godot 4'
Fixes #79276.
2023-07-10 13:08:11 +02:00
Emmanouil Papadeas
256b99ca40 Fix Camera2D.rotating not being converted and reversed properly
Godot 3's Camera2D `rotating = true` and `rotating = false` are supposed to be converted and reversed to `ignore_rotation = false` and `ignore_rotation = true` respectively, but this wasn't the case before this PR, as the project converted was failing to properly read the `true` and `false` strings, thus resulting in `ignore_rotation = true` in all cases.
2023-07-10 12:52:48 +03:00
Rémi Verschelde
49dedd6ce4
Merge pull request #74567 from Garym3/3-to-4-converter-brace-aggregate-fix
Fix braces handling when parsing method arguments on project conversion
2023-06-20 09:19:33 +02:00
Garym3
4aecba68e3 Fix braces handling when parsing method arguments on project conversion 2023-06-20 07:20:35 +02:00
Rémi Verschelde
764193629f
Merge pull request #76179 from Maran23/pause-mode-convert-fix
Fix `pause_mode` may not be converted correctly in .tscn files.
2023-06-19 22:34:43 +02:00
Rémi Verschelde
a7a1012d98
Merge pull request #74580 from Garym3/3-to-4-converter-fix-ogg-import-file-conversion
Fix bad OGG importer's name inside .import files during project conversion
2023-06-16 10:18:23 +02:00
Garym3
e5d55e35c2 Fix runtime crash due to missing importer's name conversion inside .import files about OGG vorbis sound files 2023-06-15 22:55:02 +02:00
Rémi Verschelde
abb6744d6c
Merge pull request #77615 from jpcerrone/add_joypad_conversion
Add joypad input map conversion to project converter
2023-06-13 14:41:09 +02:00
Rémi Verschelde
efea8aed68
Merge pull request #75900 from Maran23/project-converter-declaring-inferring-types
Fix exported variables declaring or inferring the type were not converted correctly
2023-06-12 22:53:58 +02:00
Marius Hanl
55ba34a6d2 Fix exported variables declaring or inferring the type were not converted correctly. 2023-06-12 19:19:51 +02:00
Marius Hanl
bd599d0797 Improve function detection to avoid accidental conversion
When converting a function like "connect(", we do not want to detect a function like "reconnect(" as a possible candidate for conversion.
2023-06-12 19:19:19 +02:00
Alex Drozd
d053536b3b removing assert statement from the project converter 2023-06-10 23:33:11 +02:00
jpcerrone
c206c88adf Add joypad input map conversion to project converter.
Fixes godotengine#77314 (Input Map's joypad button numbers are not converted).
2023-05-29 11:35:35 -03:00
Ninni Pipping
ef4422e3e1 Ensure quotes are escaped when converting builtin scripts 2023-05-23 17:05:14 +02:00
jpcerrone
0985019c28 Fix Input Map key assignments missing after project conversion
Fixes #76336 (Input Map keys missing).
Moves the project.godot config_version stamping from the project manager
to the project converter. Now there's no difference between converting through
the project manager and the CLI tool.
Fixes being prompted to re-convert the project in the project manager after
having done so through the CLI tool.
2023-05-16 14:39:04 -03:00
Marius Hanl
1c271d00ae Fix pause_mode may not be converted correctly in .tscn files. 2023-04-17 19:53:50 +02:00
bruvzg
d72b563250
Add GDScript to_wchar_buffer and get_string_from_wchar functions. 2023-03-21 15:39:54 +02:00
Yuri Sizov
3bd5ba3bfe
Merge pull request #74624 from Maran23/converter-theme-overrides
Add conversion for common Theme Overrides
2023-03-15 14:34:53 +01:00
Marius Hanl
a40f559fe2 Add conversion for common Theme Overrides 2023-03-10 16:32:35 +01:00
clayjohn
3ee5fbdb73 Add parentheses around arguments when converting xform 2023-03-09 15:04:04 -08:00
Ryan Roden-Corrent
6b17c2b6e7
Add some missing renames to 3to4 tool.
MultiplayerPeerExtension isn't an exact replacement for
NetworkedMultiplayerCustom, but at least it gets you moving in the right direction.

Engine.editor_hint couldn't be fixed by the renames map, because you have to add a `()` at the end.
2023-03-06 18:53:55 -05:00
Ryan Roden-Corrent
9a474fb99f
Move tool declarations to top in 3to4.
In godot3, `tool` can follow keywords like `extends` and `class_name`
In godot4, `@tool` must be the first line in the file.
2023-03-06 06:34:56 -05:00
Rémi Verschelde
2a5fc1fe6c
Merge pull request #74306 from dalexeev/gds-var-colon-style
Fix GDScript code style regarding colon
2023-03-06 10:49:11 +01:00
Marius Hanl
8cf7ac3a45 Project Converter: Do not convert lines that start with a comment
Lines that start with # or // are ignored
2023-03-06 09:12:40 +01:00
Danil Alexeev
ea5fd3d732
Fix GDScript code style regarding colon 2023-03-05 17:03:20 +03:00
Ryan Roden-Corrent
53a00abb11
Correct superclass constructors in 3to4.
Fixes #70542.

The 3to4 conversion tool was not handling superclass constructors.
We should translate the godot3 syntax:

```gdscript
func _init(a,b,c).(a,b,c):
    pass

func _init(a,b,c):
    super(a,b,c)
```

Originally, the _init conversion was intended to remove `void` return types from _init functions, as this was disallowed due to #50589.
As that was resolved by #53366, I removed that part of the conversion logic. If a void return type is present on a constructor, the converter now leaves it.

Here's a sample diff from my own project:

```diff
@@ -103,10 +105,11 @@ class Real:
 class Text:
        extends Setting

-       var choices: PoolStringArray
-       var value: String setget set_value, get_value
+       var choices: PackedStringArray
+       var value: String : get = get_value, set = set_value

-       func _init(section: String, key: String, default: String, choice_list: Array).(section, key, default) -> void:
+       func _init(section: String, key: String, default: String, choice_list: Array) -> void:
+               super(section, key, default)
                choices = choice_list

        func normalize(val):
@@ -129,9 +132,10 @@ class Text:
 class Boolean:
        extends Setting

-       var value: bool setget set_value, get_value
+       var value: bool : get = get_value, set = set_value

-       func _init(section: String, key: String, default: bool).(section, key, default) -> void:
+       func _init(section: String, key: String, default: bool) -> void:
+               super(section, key, default)
                pass
```
2023-03-04 08:03:24 -05:00
Rémi Verschelde
743c86768a
Merge pull request #74237 from AThousandShips/convert_keycode
Add keycode project conversion
2023-03-03 11:09:03 +01:00
Ryan Roden-Corrent
d3684e662f
Don't strip whitespace when converting 3to4.
Fixes #74204.

The style guide says

> Always use one space around operators and after commas

The 3to4 conversion tool currently strips space in certain scenarios.
I've updated it to add space whenever it is generating new code.
In any case where it substitutes existing code, it leaves it as-is.

For example, connect(a,b,c) becomes `connect(a, callable(b, c))`, because the converter is adding new commads/parens.

However, `xform(Vector3(a,b,c))` becomes `Transform * Vector3(a,b,c)` because it uses the user's original Vector3 string whole. If the user originally had `xform(Vector3(a, b, c))`, then it becomes `Transform * Vector3(a, b, c)`.

Ideally we'd always preserve original formatting, but this seems quite difficult, so I tried to preserve it where we can, but air on the side of following the style guide whenever we're transforming code.
2023-03-02 18:00:19 -05:00
Ninni Pipping
fec630f360 Add keycode project conversion 2023-03-02 15:24:00 +01:00
Rémi Verschelde
7cf1ec1cd4
Add 3-to-4 renames for project settings in project.godot
In the ConfigFile format, the first subpath is the category and is not part
of the line that the regex would match.

Fixes #66125.
2023-02-27 13:34:35 +01:00
Rémi Verschelde
c6443e9a4e
Merge pull request #73954 from KoBeWi/BugEx
Fix wrong OS regex in project converter
2023-02-26 14:28:17 +01:00
Thomas Lobig
dbb5e377fb
Converter: Rename 3.x Vector2 clamped to limit_length 2023-02-26 13:41:26 +01:00
kobewi
0ba6e36e40 Fix wrong OS regex in project converter 2023-02-26 13:02:57 +01:00
Gordon MacPherson
8a86d8411e Implement automatic rename for project
- Import must rename nodes/root_type="Spatial" to "Node3D":
- Resolves ownership issues with calling:
	scene->replace_by(base_node);
  when the original root type was Spatial.
2023-02-22 02:10:55 +00:00
Rémi Verschelde
e19e6b09b9
Clean up ProjectConverter3To4 architecture, move renames map to separate file
This allows properly limiting what features depend on the RegEx module
(doing the actual conversion) and what features only require the renames
data (GDScript suggestions).

Also better excludes the conversion command line options when actually
disabling deprecated code.

Fixes #73029.
2023-02-10 14:35:22 +01:00
Rémi Verschelde
480e991656
Fix no-regex build for ProjectConverter3to4
Fixes #72649.
2023-02-03 15:26:06 +01:00
tbxMb
2c0446b893
Allow .gdshader files in 3to4 conversion 2023-02-02 10:27:26 +01:00
souplamp
5300daaff2
Audio rename (device, capture_device) -> (output_device, input_device)
Change instances of audio properties 'device' to 'output_device',
and instances of audio properties 'capture_device' to 'input_device',
as well as their subsequent getter & setter functions.

Update the docs to reflect these changes, as well as the
3-to-4 converter for GDScript and CSharp to make proper
conversions (only exception is 'device' since that name
is too vague and might replace non-AudioServer related
instances, such as user comments and variables).

This does not change internal references to references like
'Render Client' and 'Capture Client' in WASAPI; such is outside the
scope of this commit. This also does not change ALSA's references,
considering that it uses 'device' to mean input and output
interchangeably.

Other references are changed, however where applicable,
to be consistent with the new AudioServer methods and property
names.
2023-01-31 18:25:11 +01:00
Rémi Verschelde
361f3f1721
Merge pull request #57520 from jordigcs/gd-rename-map
Add hint for identifiers renamed from 3.x to 4.0
2023-01-31 15:55:25 +01:00
Rémi Verschelde
c8446754dd
Merge pull request #72357 from aaronfranke/area-gravity-unit-dist
Replace Area gravity point distance scale with unit distance
2023-01-31 10:53:16 +01:00
Juan Linietsky
28f51ba547 Refactor high quality texture import
* Only two texture import modes for low/high quality now:
  * S3TC/BPTC
  * ETC2/ASTC
* Makes sense given this is the general preferred and most compatible combination in most platforms.
* Removed lossy_quality from VRAM texture compression options. It was unused everywhere.
* Added a new "high_quality" option to texture import. When enabled, it uses BPTC/ASTC (BC7/ASTC4x4) instead of S3TC/ETC2 (DXT1-5/ETC2,ETCA).
* Changed MacOS export settings so required texture formats depend on the architecture selected.

This solves the following problems:

* Makes it simpler to import textures as high quality, without having to worry about the specific format used.
* As the editor can now run on platforms such as web, Mac OS with Apple Silicion and Android, it should no longer be assumed that S3TC/BPTC is available by default for it.
2023-01-30 15:53:23 +01:00
Aaron Franke
79215131b5
Replace Area gravity point distance scale with unit distance 2023-01-29 22:12:00 -06:00
Haoyu Qiu
ec10da604f Add window size settings in 3to4 conversion 2023-01-28 17:54:55 +08:00
Rémi Verschelde
91c0ed5e33
Merge pull request #71907 from TokageItLab/change-animated-sprite-api
Make `AnimatedSprite`'s playback API consistent with `AnimationPlayer`
2023-01-27 10:32:23 +01:00
Silc Renew
17bf6238fc Make AnimatedSprite's playback API consistent with AnimationPlayer 2023-01-26 12:40:19 +09:00
Danil Alexeev
b004f8180e
GDScript: Allow constant expressions in annotations 2023-01-25 18:43:56 +03:00
Aaron Franke
0e7785333f
Improve clarity of Tree's activated/double-clicked signals
Co-authored-by: Yuri Sizov <yuris@humnom.net>
2023-01-24 15:55:09 -06:00
jordi
bb9a00889a Add hint for identifiers renamed since Godot 3 2023-01-24 12:33:55 -06:00