Commit graph

162 commits

Author SHA1 Message Date
Muller-Castro
1638c1b28f Add const lvalue ref to editor/* container parameters 2024-02-26 15:28:15 -03:00
K. S. Ernest (iFire) Lee
04d43947bf
Add ufbx for FBX importing
This update introduces a new import method for FBX files using ufbx. If the fbx2gltf import fails, it will use the most recently cached scene from the ufbx import. The process is sped up by introducing threads to load the ufbx portion.

Key changes include:

- Support for importing geometry helper nodes in FBX files.
- Addition of cameras and lights with updated names.
- Removal of the fbx importer manager.
- Introduction of ModelDocument3D and updates to its methods.
- Changes to FBX import options and visibility.
- Updating the documentation and handling some errors.
- Store the original non-unique node, mesh and animation names in FBX and glTF.

Co-Authored-By: bqqbarbhg <bqqbarbhg@gmail.com>
2024-02-23 22:33:04 +01:00
Jakub Marcowski
06534f8ad5 Add deprecation notice to a duplicate method of class Window 2024-01-12 18:18:28 +01:00
Rémi Verschelde
e72e63a6b5
Merge pull request #85837 from akien-mga/clang-format-16
Style: Mark clang-format 16 as supported for pre-commit hook
2024-01-05 12:04:44 +01:00
Rémi Verschelde
6c390b620d
Merge pull request #84445 from Rubonnek/add-const-references-clang-tidy
Add const references detected by clang-tidy
2024-01-04 14:25:33 +01:00
pancelor
d4d5a14234 project upgrade tool: better space handling in "export"
the regex had two problems; they were not recognizing export statements
that had spaces after "export", or export statements with no space
before "var".

These are both valid syntax, but the conversion was unsuccessful.
This commit fixes both cases.

test case 1:    `export(int)var x = 1`
old conversion: `@export(int)var x = 1`
new conversion: `@export var x: int = 1`

test case 2:    `export (int) var y = 2`
old conversion: `@export (int) var y = 2`
new conversion: `@export var y: int = 2`
2023-12-28 21:10:54 -08:00
Wilson E. Alvarez
a3cb1b096f
Add const references detected by clang-tidy 2023-12-16 13:36:44 -05:00
Rémi Verschelde
49f4860ce3
Style: Mark clang-format 16 as supported for pre-commit hook
It only introduced a difference in a .glsl file, which I've worked
around by removing an empty line. This keeps formatting consistent
between clang-format 15 and 16.

Also added a change in the 3-to-4 project converter to fix bogus
formatting in clang-format < 17.
2023-12-06 13:26:53 +01:00
emacser0
4c65ff52e4 Fix some typos in source. 2023-10-04 19:55:11 +09:00
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