Graphite is now available under:
MIT OR MPL-2.0 OR LGPL-2.1-or-later OR GPL-2.0-or-later
We pick MIT which is the same as Godot's main license for simplicity.
Remove define to skip deprecation warnings, upstream fixed those.
Non-exhaustive list of case-sensitive renames:
GDExtension -> GDNative
GDNATIVE -> GDEXTENSION
gdextension -> gdnative
ExtensionExtension ->Extension (for where there was GDNativeExtension)
EXTENSION_EXTENSION ->EXTENSION (for where there was GDNATIVE_EXTENSION)
gdnlib -> gdextension
gdn_interface -> gde_interface
gdni -> gde_interface
This was a regression from 17b2838f39.
`MarshalUtils` was changed in the source generators to use
`ConvertTo<T>` and `CreateFrom<T>`, which don't support `GodotObject[]`
because it would need reflection.
As such, we need to keep the custom cases for `GodotObject[]` in
`MarshalUtils`.
- Exposes the properties of C# attribute so they can be accessed from
reflection, renaming them to PascalCase to follow .NET conventions.
- Added some documentation to the newly exposed members.
- Made attribute properties readonly to avoid giving the impression that
they could be modified.
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.
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.
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`
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.
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`.
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.
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>
- 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`
- 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.
- 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`.
- Renamed `IsValidInteger` to `IsValidInt`.
- Added `IsValidFileName`.
- Added `IsValidHexNumber`.
- Added support for IPv6 to `IsValidIPAddress`.
- Added `ValidateNodeName`.
- Updated the documentation of the `IsValid*` methods.
- 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`.
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.
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.