Commit graph

7895 commits

Author SHA1 Message Date
Adam Scott 59c6642f2a Add missing packed scene cache clear inside GDScriptCache::clear() 2022-12-07 15:29:18 -05:00
Rémi Verschelde 907c3e06f6
Merge pull request #69717 from Chaosus/gds_fix_lookup
Fix lookup to docs for variables initialized with `get_node`
2022-12-07 13:26:32 +01:00
Rémi Verschelde 62f7f378d4
Merge pull request #69690 from BastiaanOlij/display_refresh_type
Fix property type for OpenXR display refresh rate
2022-12-07 13:25:48 +01:00
Rémi Verschelde a565ddcd09
Merge pull request #69654 from BastiaanOlij/openxr_submit_depth_optional
Make submitting depth buffer in OpenXR optional
2022-12-07 13:25:42 +01:00
Rémi Verschelde df2b41f3b7
Merge pull request #69627 from RumblingTurtle/editor-scene-importer-crash-fix
Fix crash on old scene reimport
2022-12-07 13:24:26 +01:00
Yuri Rubinsky b229a19688 Fix lookup to docs for variables initialized with get_node 2022-12-07 15:16:04 +03:00
Bastiaan Olij 0b48ca0303 Fix property type for OpenXR display refresh rate 2022-12-07 10:17:34 +11:00
Eduard Zalyaev 627b9ca049 EditorSceneFormatImporterGLTF: check if "animation/trimming" parameter from import settings exists
Fixes godotengine#69625
2022-12-06 19:11:21 +03:00
Rémi Verschelde 9bd7ad53f7
Merge pull request #69506 from adamscott/move-gdscript-uninit-to-finalize
Move GDScript uninitialization to `GDScriptLanguage::finish()`
2022-12-06 16:11:21 +01:00
Adam Scott 88f3045301 Move GDScript uninitialization to GDScriptLanguage::finalize()
Co-authored-by: Ricardo Buring <ricardo.buring@gmail.com>
Co-authored-by: kleonc <9283098+kleonc@users.noreply.github.com>
2022-12-06 09:35:39 -05:00
Bastiaan Olij 484cd90d29 Make submitting depth buffer in OpenXR optional 2022-12-06 22:37:33 +11:00
Bastiaan Olij a35d792e65 Fix typo that resulted in left eye depth buffer being submitted for the right eye 2022-12-06 21:30:55 +11:00
Rémi Verschelde 18f7461db8
Merge pull request #69606 from red1939/bug/vscode_crash
Keep GDScriptAnalyzer alive for whole parse()
2022-12-06 11:00:51 +01:00
Rémi Verschelde 85602efef6
Merge pull request #69639 from Chaosus/gds_fix_completion
Fix completion for the raw `get_node` call
2022-12-06 11:00:15 +01:00
Bartosz Bielecki 2af4f7f762 Keep GDScriptAnalyzer alive for whole parse()
Analyzed data is allocated by Parser but kept as a reference in the cache
which in turn is held by the Analyzer. If Analyzer goes away Parser is left
with a tree of dangling references.

Code is analogous to all other usages of Analyzer + Parser pair.
2022-12-06 10:01:18 +01:00
Yuri Rubinsky 20660bb23a Fix completion for the raw get_node call 2022-12-06 10:42:44 +03:00
rune-scape e79be6ce07 Unify String and StringName 2022-12-05 21:46:47 -05:00
Dmitrii Maganov 97280279ee Fix incomplete shadowing of member properties by parameters 2022-12-06 00:22:56 +02:00
Rémi Verschelde 8ff2ca35c5
Merge pull request #69169 from akien-mga/embree-wasm-win32
embree: Enable raycast module build for Web and Windows x86_32
2022-12-05 10:14:25 +01:00
Rémi Verschelde 8912f3e4a7
Merge pull request #69578 from dsnopek/android-native-handles
Clean up DisplayServerAndroid::window_get_native_handle() with the GLES3 renderer
2022-12-05 00:31:12 +01:00
David Snopek 61cec0b023 Clean up DisplayServerAndroid::window_get_native_handle() with the GLES3 renderer 2022-12-04 13:07:51 -06:00
bruvzg ecec415988
Use system fonts as fallback and improve system font handling.
Add support for font weight and stretch selection when using system fonts.
Add function to get system fallback font from a font name, style, text, and language code.
Implement system font support for Android.
Use system fonts as a last resort fallback.
2022-12-04 18:44:20 +02:00
rune-scape 6f8ffd5591 GDScript: preload should make native type 2022-12-04 05:36:17 -05:00
Adam Scott 7bcaa9df9e Fix missing parent class name identifier crash 2022-12-02 21:30:19 -05:00
Raul Santos fbd41a6eda
C#: Always convert float Variants to System.Double
Godot floats are always 64-bit.
The real_t feature only affects vectors, not scalars.
2022-12-02 17:04:11 +01:00
Rémi Verschelde f3c68d6c83
Merge pull request #69391 from NeilKleistGao/sln
Fix C# Solution Directory Project Settings
2022-12-02 16:48:30 +01:00
Rémi Verschelde d746b618be
Merge pull request #69428 from neikeq/no
C#: Cleanup of Marshaling methods
2022-12-02 16:48:17 +01:00
NeilKleistGao 2bab84c8c7 Fix C# solution directory settings
Co-authored-by: Ignacio Roldán Etcheverry <neikeq@users.noreply.github.com>
2022-12-02 22:01:15 +08:00
Ignacio Roldán Etcheverry 17b2838f39 C#: Cleanup Variant marshaling code in source/bindings generators
This change aims to reduce the number of places that need to be changed
when adding or editing a Godot type to the bindings.

Since the addition of `Variant.From<T>/As<T>` and
`VariantUtils.CreateFrom<T>/ConvertTo<T>`, we can now replace a lot of
the previous code in the bindings generator and the source generators
that specify these conversions for each type manually.

The only exceptions are the generic Godot collections (`Array<T>` and
`Dictionary<TKey, TValue>`) which still use the old version, as that
one cannot be matched by our new conversion methods (limitation in the
language with generics, forcing us to use delegate pointers).

The cleanup applies to:

- Bindings generator:
  - `TypeInterface.cs_variant_to_managed`
  - `TypeInterface.cs_managed_to_variant`
- Source generators:
  - `MarshalUtils.AppendNativeVariantToManagedExpr`
  - `MarshalUtils.AppendManagedToNativeVariantExpr`
  - `MarshalUtils.AppendVariantToManagedExpr`
  - `MarshalUtils.AppendManagedToVariantExpr`
2022-12-02 14:47:12 +01:00
Ignacio Roldán Etcheverry f86c6b6ac4 C#: Replace most conversions between Variant and System.Object
This commit replaces most usages of `ConvertManagedObjectToVariant` and
`ConvertVariantToManagedObjectOfType`, by using the `Godot.Variant`
struct instead of `System.Object`.

The most notable change is to the `GetGodotPropertyDefaultValues` method
that's generated for scripts. The dictionary it returns now stores
`Godot.Variant` values.

Remaining usages are:

- The `DelegateUtils` class, for the serialization of closure display
  classes during assembly reloading by the editor. These display classes
  are compiler generated classes to store values captured by a closure.
  Since it's generated by the compiler, the only way we have to access
  the fields is through reflection. This leads to using `System.Object`.
- Converting parameters when invoking constructors from the engine.
  This will be replaced with source generators in the future.
- Legacy support for old `GetGodotPropertyDefaultValues` return values.
  We need to keep supporting the old version of this generated method
  for some time. Otherwise, if loading a project built with the previous
  version, it could lead to the loss of exported property values.
  Ideally, we should remove this legacy support before a stable release.
2022-12-02 14:47:12 +01:00
Rémi Verschelde 23c58be800
Merge pull request #69483 from akien-mga/openxr-3d-only
SCons: Disable openxr module with disable_3d=yes
2022-12-02 12:24:58 +01:00
Rémi Verschelde 7ef9947d0e
Merge pull request #68870 from dsnopek/master-webxr-input
Get WebXR fully working in Godot 4!
2022-12-02 12:24:40 +01:00
Rémi Verschelde 801080a6ab
Merge pull request #69448 from BastiaanOlij/fix_etc_rgba_bgra_issue
ETCPAK expects BGRA data for ETC
2022-12-02 12:23:49 +01:00
Rémi Verschelde 75d5dfe591
SCons: Disable openxr module with disable_3d=yes
Fixes #69470.
2022-12-02 11:40:24 +01:00
David Snopek 310bf39cd3 Get WebXR fully working in Godot 4! 2022-12-01 21:46:30 -06:00
Ignacio Roldán Etcheverry 3afeb28560 C#: Remove ConvertVariantToManagedObject
Its two usages were:

- The Array `ICollection.CopyTo` implementation.
  It's possible that this class shouldn't be implementing the
  non-generic `ICollection`, but this commit doesn't change that.
  The new implementation stores the elements as boxed `Variant` values.
- The `Variant.Obj` property.
  I'm not sure if this property's existence is justified, but for now
  I rewrote it as a simpler version of `ConvertVariantToManagedObject`.
2022-12-02 03:34:40 +01:00
Ignacio Roldán Etcheverry bcc061edae
Merge pull request #67023 from raulsntos/dotnet/fix-signal-callback-generation
C#: Fix signature of generated signal callbacks
2022-12-02 03:19:49 +01:00
rune-scape d531869a7c GDScript: Fix subclass script path issues 2022-12-01 20:43:27 -05:00
Yuri Sizov bf9cf7d034
Merge pull request #69166 from souplamp/icon-annotation-not-working
Update docs to clarify `@icon` only works with global script classes
2022-12-02 03:04:23 +03:00
souplamp 369c7d2422 Update docs to mention @icon only works with global script classes
Update the docs to clarify that the `@icon` annotation does not work
when only attaching a script to a node, and clarify that the script itself
must be a globally accessible script type.
2022-12-01 12:52:58 -06:00
Rémi Verschelde 4821de146e
Merge pull request #69423 from KoBeWi/parenture
Improve parent signature error
2022-12-01 18:10:31 +01:00
Rémi Verschelde 2d96f63e09
Merge pull request #68481 from dalexeev/gds-fix-dyn-arg-def-val
GDScript 2.0: Fix shift due to skip of non-constant default argument values
2022-12-01 18:09:25 +01:00
Bastiaan Olij ebec23d8d8 ETCPAK expects BGRA data for ETC 2022-12-02 01:34:05 +11:00
kobewi d1e4146462 Improve parent signature error 2022-12-01 15:16:16 +01:00
Rémi Verschelde eb555d7559
Merge pull request #69303 from Chaosus/gds_fix_loops
Reset unassigned local variables to null in the loops
2022-12-01 10:21:21 +01:00
VolTer bfc093c53f Fix unary op warnings never showing 2022-12-01 01:09:10 +01:00
Rémi Verschelde f5dbec2f73
Merge pull request #69392 from dsnopek/openxr-quest-fix
Fix OpenXR on the Meta Quest: XR_KHR_loader_init_android is not reported as available (but it works anyway)
2022-11-30 19:08:55 +01:00
Ignacio Roldán Etcheverry 6745e199fb
Merge pull request #69278 from rhofour/remove-namespaces
Remove unnecessary namespaces in generated PropertyDefVal files.
2022-11-30 18:31:52 +01:00
Rémi Verschelde c868e0b4b9
Merge pull request #69269 from red1939/red1939/master
Acknowledge that a CLASS kind of a DataType might not have an identifier
2022-11-30 10:49:09 +01:00
Bartosz Bielecki e10b0c5d98 Acknowledge that a CLASS kind of a DataType might not have an identifier 2022-11-30 09:26:50 +01:00
Aaron Franke 1bbbee384d
GLTF: Clean up lots of includes 2022-11-29 23:11:08 -06:00
R. Alex Hofer 215022c507 Remove unnecessary namespaces in generated PropertyDefVal files. 2022-11-29 22:12:34 -05:00
David Snopek aa5b42946c Fix OpenXR on the Meta Quest: XR_KHR_loader_init_android is not reported as available (but it works anyway) 2022-11-29 20:45:01 -06:00
Ignacio Roldán Etcheverry 5826e96014
Merge pull request #65905 from raulsntos/dotnet/marshaling-collections
C#: Fix marshaling generic Godot collections
2022-11-30 01:00:59 +01:00
clayjohn 9141984e7e Enable GLES3 on Android
Add necessary build flags and switch from using a
GLES2 context to a GLES3 one.

This also enables building for OpenXR

Co-authored-by: m4gr3d <fhuyakou@gmail.com>
Co-authored-by: dsnopek <dsnopek@gmail.com>
2022-11-29 14:18:24 -08:00
Rémi Verschelde 09e1db2148
Merge pull request #68665 from TokageItLab/cut-unkeyed-gltf-anim
Add "Trimming" option to cut un-keyed timeline before first key in glTF animation
2022-11-29 16:51:56 +01:00
trollodel c90d0bd84f Use forward-declarations in big editor classes 2022-11-29 09:59:43 +01:00
Silc Renew db7473672f Add trimming option to cut un-keyed timeline before first key in gltf 2022-11-29 13:53:33 +09:00
Yuri Rubinsky 8d2506e811 Reset unassigned local variables to null in the loops 2022-11-28 19:45:24 +03:00
Rémi Verschelde 4555ccdf98
Merge pull request #69224 from adamscott/fix-PackedScene-reload_from_file
Add `PackedScene::reload_from_file()` override
2022-11-28 16:53:36 +01:00
Adam Scott a34a26eb66 Add PackedScene::reload_from_file() override 2022-11-28 10:23:02 -05:00
Yuri Rubinsky afbea19a22 Fix lookup code to pass functions with the same name as built-ins 2022-11-28 15:53:14 +03:00
Rémi Verschelde 166066d9f7
Merge pull request #69259 from adamscott/fix-cyclic-reference-base-issue
Fix cyclic reference base being loaded but not valid (which is ok)
2022-11-28 11:45:11 +01:00
Rémi Verschelde c392093668
Merge pull request #69272 from rune-scape/rune-avoid-global-base
Avoid using `get_global_class_native_base`
2022-11-28 11:02:43 +01:00
Rémi Verschelde 8253c28200
Merge pull request #67031 from raulsntos/dotnet/string-extensions
C#: Cleanup and sync StringExtensions with core
2022-11-28 08:21:23 +01:00
Ignacio Roldán Etcheverry 4a82d71d73
Merge pull request #65907 from magian1127/4.0FixPropertiesGenerator
C#: Fix Generated ScriptProperty Error.
2022-11-28 01:48:52 +01:00
Raul Santos dc2ceef0ec
C#: Remove/deprecate unnecessary string extensions
- Removed `UnicodeAt`
- Removed `EndsWith`
- Removed `LPad` and `RPad`
- Deprecated `BeginsWith` in favor of `string.StartsWith`
- Deprecated `LStrip` and `RStrip` in favor of `string.TrimStart` and `string.TrimEnd`
2022-11-27 23:25:48 +01:00
Adam Scott 4e60689695 Fix cyclic reference base being loaded but not valid (which is ok) 2022-11-27 15:50:19 -05:00
Magian c41196f0f3 C#: Fix Generated ScriptProperty Error.
1. Add "this." to prevent errors caused by duplicate variable names.
2. Try to find the default value of property getters.
2022-11-27 17:40:40 +08:00
rune-scape 847c9bd248 GDScript: Avoid using get_global_class_native_base 2022-11-27 03:55:53 -05:00
Ignacio Roldán Etcheverry 690199b7dd
Merge pull request #69194 from raulsntos/dotnet/begone-variant-disposer
C#: Remove VariantSpanDisposer and use constants in stackalloc
2022-11-27 03:30:59 +01:00
Raul Santos 3ff181096a
C#: Remove VariantSpanDisposer and use constants in stackalloc
- Remove `VariantSpanDisposer`, no need to dispose of the Variant Spans
since we are now borrowing the Variants instead of copying them.
- Remove `VariantSpanExtensions.Cleared` that was only used so the
Span was initialized for `VariantSpanDisposer` to know what to dispose.
- Fix stackalloc Spans to use constant VarArgsSpanThreshold
and avoid bound checks.
2022-11-27 03:04:34 +01:00
Ignacio Roldán Etcheverry 68e3f49157
Merge pull request #69191 from raulsntos/dotnet/no-throw
Fix `VariantUtils.UnsupportedType` method throwing
2022-11-26 04:38:11 +01:00
Ignacio Roldán Etcheverry 50badbd1f4
Merge pull request #69088 from raulsntos/dotnet/global
C#: Add `global::` namespace to generated source
2022-11-26 04:36:26 +01:00
Raul Santos cfab6b0566
Fix VariantUtils.UnsupportedType method throwing
This method was not supposed to throw, just return the new constructed
exception so it can be thrown by the caller.
2022-11-26 03:05:00 +01:00
Raul Santos b9e1ca1e86
C#: Add global:: namespace to generated source
Adds `global::` to the fully qualified types in source generators to
prevent ambiguity.
2022-11-26 01:13:16 +01:00
Rémi Verschelde c7ceb94e37
Merge pull request #69079 from adamscott/fix-singleton-scene-cyclic-load
Fix singleton scene cyclic loading
2022-11-25 19:29:57 +01:00
Rémi Verschelde fcdded2e3d
Merge pull request #68310 from neikeq/csharp-opt-variant-generic-conv
C#: Optimize Variant conversion callbacks
2022-11-25 19:27:26 +01:00
Adam Scott 69bb7e5b11 Fix singleton scene cyclic loading 2022-11-25 12:43:55 -05:00
Raul Santos d0b166d8e4
C#: Cleanup and sync crypto/buffer StringExtensions with core
- Replaced `MD5Buffer`, `MD5Text`, `SHA256Buffer` and `SHA256Text` implementation to use the `System.Security.Cryptography` classes and avoid marshaling.
- Added `SHA1Buffer` and `SHA1Text`.
- Renamed `ToUTF8` to `ToUTF8Buffer`.
- Renamed `ToAscii` to `ToASCIIBuffer`.
- Added `ToUTF16Buffer` and `ToUTF32Buffer`.
- Added `GetStringFromUTF16` and `GetStringFromUTF32`.
2022-11-25 17:30:45 +01:00
Raul Santos d9c495f322
C#: Cleanup and sync IsValid* StringExtensions with core
- Renamed `IsValidInteger` to `IsValidInt`.
- Added `IsValidFileName`.
- Added `IsValidHexNumber`.
- Added support for IPv6 to `IsValidIPAddress`.
- Added `ValidateNodeName`.
- Updated the documentation of the `IsValid*` methods.
2022-11-25 17:30:45 +01:00
Raul Santos 6178407940
C#: Cleanup and sync StringExtensions with core
- Moved `GetBaseName` to keep methods alphabetically sorted.
- Removed `Length`, users should just use the Length property.
- Removed `Insert`, string already has a method with the same signature that takes precedence.
- Removed `Erase`.
- Removed `ToLower` and `ToUpper`, string already has methods with the same signature that take precedence.
- Removed `FindLast` in favor of `RFind`.
- Replaced `RFind` and `RFindN` implemenation with a ca ll to `string.LastIndexOf` to avoid marshaling.
- Added `LPad` and `RPad`.
- Added `StripEscapes`.
- Replaced `LStrip` and `RStrip` implementation with a call to `string.TrimStart` and `string.TrimEnd`.
- Added `TrimPrefix` and `TrimSuffix`.
- Renamed `OrdAt` to `UnicodeAt`.
- Added `CountN` and move the `caseSensitive` parameter of `Count` to the end.
- Added `Indent` and `Dedent`.
2022-11-25 17:30:32 +01:00
Rémi Verschelde b2373298a2
embree: Enable raycast module build for Web and Windows x86_32
Embree initially only supported x86_64, then got arm64 support added.
Now it seems to be possible to build it with Emscripten (wasm32) and
on x86_32 Windows.
2022-11-25 14:48:29 +01:00
Rémi Verschelde a9fbf3718d
Merge pull request #69144 from DeeJayLSP/update_embree
Update embree to 3.13.5
2022-11-25 14:05:19 +01:00
DeeJayLSP 5e4158eb48
Update embree to 3.13.5 2022-11-25 13:09:04 +01:00
Bastiaan Olij 96bbdf7249 Various fixes for OpenXR action map meta data and editing 2022-11-25 20:26:30 +11:00
Rémi Verschelde e81b787d36
Merge pull request #69123 from queezle42/queezle42/master
Fix GLAD-related build problems on Linux
2022-11-25 10:00:55 +01:00
Rémi Verschelde c3af45791c
Merge pull request #67511 from neikeq/issue-66060
C#: Load assemblies as collectible only in the Godot editor
2022-11-25 10:00:33 +01:00
Ignacio Roldán Etcheverry 3f645f980c C#: Optimize Variant conversion callbacks
These callbacks are used for marshaling by callables and generic Godot
collections.

C# generics don't support specialization the way C++ templates do.
I knew NativeAOT could optimize away many type checks when the types
are known at compile time, but I didn't trust the JIT would do as good
a job, so I initially went with cached function pointers.

Well, it turns out the JIT is also very good at optimizing in this
scenario, so I'm changing the methods to do the conversion directly,
rather than returning a function pointer for the conversion.

The methods were moved to `VariantUtils`, and were renamed from
`GetFromVariantCallback/GetToVariantCallback` to `ConvertTo/CreateFrom`.

The new implementation looks like it goes through many `if` checks
at runtime to find the right branch for the type, but in practice it
works pretty much like template specialization. The JIT only generates
code for the relevant branch. Together with inlining, the result is
very close or the same as doing the conversion manually:

```cs
godot_variant variant;

int foo = variant.Int;
int bar = VariantUtils.ConvertTo<int>(variant);
```

If the type is a generic Godot collection, the conversion still goes
through a function pointer call.

The new code happens to be much shorter as well, with the file going
from 1057 lines to 407.

Side note: `Variant.cs` was mistakenly created in the wrong folder,
so I moved it to the `Core` folder.
2022-11-25 03:14:10 +01:00
Jens Nolte 67f31f571e Fix GLAD-related build problems on Linux
- Use gl.h provided by GLAD in the OpenXR module
- Use non-EXT variants of some OpenGL defines
- Remove libGL-related code paths
2022-11-25 02:52:17 +01:00
Raul Santos ca5c51f47e
C#: Add Projection documentation
- Add documentation to Projection type
- Reorder Projection members to be consistent with other C# types
2022-11-25 00:29:58 +01:00
Rémi Verschelde 8b7efd2306
Merge pull request #69134 from jquinl/export_range_int_fix
GDScript: Properly respect `int` type hint for `@export_range`
2022-11-24 23:30:40 +01:00
unknown 5fd382c2ab GDScript: Properly respect int type hint for @export_range
Fixes #69104.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2022-11-24 22:14:05 +01:00
clayjohn 075cea1077 Ensure class name is printed in STATIC_CALLED_ON_INSTANCE warning 2022-11-24 12:06:11 -08:00
Rémi Verschelde e1b87cc6a5
Merge pull request #69127 from KoBeWi/redUNDOnt
Cleanup remaining EditorUndoRedoManager usages
2022-11-24 19:04:16 +01:00
kobewi 8a3d2f4e0c Cleanup remaining EditorUndoRedoManager usages 2022-11-24 18:56:22 +01:00
Rémi Verschelde 93be29be06
Merge pull request #69125 from raulsntos/dotnet/bezier_derivative
C#: Implement BezierDerivative
2022-11-24 18:56:02 +01:00
Rémi Verschelde 0d202cb5f1
Merge pull request #69111 from TokageItLab/put-together-interpolations
Refactor interpolating functions in some classes to use `Math` class
2022-11-24 18:54:30 +01:00
Rémi Verschelde 06bdc91afd
Merge pull request #69083 from fire/abstract_gltf_material
Cache materials in gltf as the abstract class of Material in GLTFDocument
2022-11-24 18:54:25 +01:00
K. S. Ernest (iFire) Lee baab97302a Cache materials in gltf as the abstract class of Material
Use the abstract material class instead of BaseMaterial3D. This allows inserting ShaderMaterials into gltf. Like in VRM.
2022-11-24 09:00:09 -08:00