Commit graph

2264 commits

Author SHA1 Message Date
Ivan Shakhov 7f8e3ab5cd Delegate opening files for Rider to the RiderPathLocator NuGet package, fix https://github.com/godotengine/godot/pull/78832#issuecomment-1633330344 2023-08-04 10:31:33 +02:00
Raul Santos 03598062fd
C#: Move build button to EditorRunBar
- Move C# build button to `EditorRunBar`.
- Add C# build icon.
- Add shortcut macros to `GodotTools`.
- Move C# build shortcuts to C#.
2023-08-03 17:55:52 +02:00
Rémi Verschelde 0606ba7c50
Merge pull request #80212 from raulsntos/dotnet/check_api_assemblies_dir_exists
Show alert if .NET assemblies dir does not exist
2023-08-03 14:47:02 +02:00
Rémi Verschelde 8b6c867c81
Merge pull request #79280 from raulsntos/dotnet/better-push-error
C#: Improve `GD.PushError` and `GD.PushWarning`
2023-08-03 14:46:44 +02:00
Raul Santos ef0e279fbb
Show alert if .NET assemblies dir does not exist 2023-08-03 13:52:13 +02:00
Raul Santos b9f1136d03
C#: Add platform name to the exported data directory 2023-08-03 13:12:45 +02:00
Yuri Sizov 0a9006a5aa Merge pull request #79501 from raulsntos/dotnet/warnings/NU5128
C#: Suppress NU5128 warning
2023-08-02 21:36:51 +02:00
Rémi Verschelde 2132638937
Merge pull request #79404 from raulsntos/dotnet/lines-open-in-external-editor
C#: Fix line in OpenInExternalEditor
2023-08-02 12:17:31 +02:00
Rémi Verschelde ed301a4078
Merge pull request #79249 from raulsntos/dotnet/dont-ignore-call-error
C#: Print error when MethodBind/Callable call fails
2023-08-02 12:16:15 +02:00
Yuri Sizov 02f04a3c1a Merge pull request #80047 from AbeniMatteo/dev-colors
Mono: Avoid dictionary lookup for common colors
2023-08-01 17:25:56 +02:00
Ignacio Roldán Etcheverry 54ba3cf768
Merge pull request #73257 from RedworkDE/net-android-support
C#: Support exporting for Android
2023-07-31 17:07:48 +02:00
AbeniMatteo e5d8ac4020 Avoid dictionary lookup for common colors 2023-07-30 09:17:59 +02:00
Raul Santos 77e5e195f5
C#: Print error when MethodBind/Callable call fails 2023-07-28 19:18:08 +02:00
Yuri Sizov 000bf3733e Merge pull request #79748 from Repiteo/dotnet-documentation-fixes
Fix issues in C# documentation comments
2023-07-25 21:51:28 +02:00
Yuri Sizov b78fe83ed4 Merge pull request #79239 from raulsntos/dotnet/document-generated-members
C#: Document generated members
2023-07-25 21:51:20 +02:00
Thaddeus Crews 0bfc52b02b
Fixes to existing C# documentation
• changes instances of `see paramref` to `paramref name`
• specifies `real_t` for ambiguous methods
2023-07-21 10:34:42 -05:00
Yuri Sizov f8f06d3d38
Merge pull request #78264 from magian1127/4.0StringName
C#: Add `PropertyHint.Enum` support to `Array<StringName>`
2023-07-18 12:19:37 +02:00
Raul Santos 132a1daf1a
C#: Fix line in OpenInExternalEditor 2023-07-17 18:44:17 +02:00
Yuri Sizov 9c74f3408b
Merge pull request #79082 from geowarin/master
Add missing useModelFront parameter to GodotSharp Basis and Transform
2023-07-17 16:50:28 +02:00
Raul Santos f2e9cbf9e8
C#: Suppress NU5128 warning
Suppress dependencies of SourceGenerators package to fix NU5128.
2023-07-15 15:25:37 +02:00
Yuri Sizov bb6879e7cc Merge pull request #79007 from 398utubzyt/dotnet/globalclass-analyzer
C#: Add a Roslyn analyzer for global classes
2023-07-14 18:49:16 +02:00
Yuri Sizov e4c89a0278 Merge pull request #78877 from mattdiener/master
C# Fix deserialization of delegates that are 0-parameter overloads
2023-07-12 15:09:36 +02:00
Raul Santos 13ab2b6f4f
C#: Improve GD.PushError and GD.PushWarning
- Use the name, file path and line number of the caller that invokes
`GD.PushError` and `GD.PushWarning` instead of the location in the C++
`runtime_interop.cpp` file.
- Improvements to getting the C# stack trace.
  - Use C# type keywords for built-in types in method declarations.
  - Remove extra space before each parameter in method declarations.
  - Skip one more frame to avoid `NativeInterop.NativeFuncs`.
  - Skip methods annotated with the `[StackTraceHidden]` attribute.
- Improvements to `ScriptEditorDebugger` when source is in project.
  - Avoid overriding error metadata when the source is inside the
project file.
  - Use the source function in the title when the source is inside
the project file.

Users that use these methods would expect the reported location printed
by these methods to correspond to a location in their project source files.
Specifically, they'd expect to see the file path and line number at which
they call these methods, and not the location of the C++ code (which is
always the same). Now, these methods are a lot more useful since users
can know which line in their source code printed the error/warning.
2023-07-11 11:19:11 +02:00
Raul Santos 12e4aa93b3
C#: Document generated members
Documents generated members and tries to discourage users from calling/overriding internal methods that only exist to be used by the engine.
2023-07-09 14:26:15 +02:00
Rémi Verschelde 157973ad5e
Merge pull request #79173 from RedworkDE/net-commandline-exporting
C#: Fix command line exporting
2023-07-08 18:23:06 +02:00
Rémi Verschelde 4a3c6629be
Merge pull request #78832 from van800/path_locator_4x
Update the RiderPathLocator to support the JetBrains Toolbox 2.0
2023-07-08 18:19:01 +02:00
398utubzyt 8e56c807cc C#: Add a Roslyn analyzer for global classes
Co-Authored-By: Raul Santos <raulsntos@gmail.com>
2023-07-07 16:37:16 -07:00
RedworkDE f3f3365abd C#: Fix command line exporting 2023-07-07 20:51:46 +02:00
RedworkDE 693e6e036b C#: Add null check before calling UnregisterGodotObject 2023-07-07 13:10:16 +02:00
Rémi Verschelde 26a58976e7
Merge pull request #79094 from raulsntos/dotnet/fix-symbol-comparison
C#: Compare symbol names without null flow state
2023-07-07 08:35:20 +02:00
Geoffroy Warin 6c6e5c482c Add missing useModelFront parameter to GodotSharp Basis and Transform
To LookAt methods.
Also adds Vector3 Model constants.

These were not added after #76082 was merged.
2023-07-06 19:01:02 +02:00
Raul Santos 671a5b4ea5
C#: Compare symbol names without null flow state 2023-07-06 16:10:14 +02:00
Rémi Verschelde 81064cc239
Doctool: Remove version attribute from XML header
We don't use that info for anything, and it generates unnecessary diffs
every time we bump the minor version (and CI failures if we forget to
sync some files from opt-in modules (mono, text_server_fb).
2023-07-06 10:08:21 +02:00
Yuri Sizov b7c2fd2e9a Bump version of module docs to 4.2 2023-07-05 22:58:30 +02:00
Rémi Verschelde 8a847d82a8
Merge pull request #78722 from RedworkDE/net-auto-version-defines
C#: Automatically generate version defines
2023-07-05 22:15:47 +02:00
Rémi Verschelde 346f1ab86b
Bump version to 4.2-dev
Keep on waitin'
2023-07-05 22:07:03 +02:00
Ivan Shakhov bf3af9fd48 Update the RiderPathLocator to support the JetBrains Toolbox 2.0 2023-07-02 20:55:26 +02:00
Ignacio Roldán Etcheverry 22aad32c69 C#: Fix NodePaths completion error for not calling from main thread
The node API we use for code completion changed and no longer allows
being called from threads other than the main one.
2023-07-02 03:48:15 +02:00
Matt Diener 783facf60b C# Fix deserialization of delegates that are 0-parameter overloads
Co-authored-by: Raul Santos <raulsntos@gmail.com>
2023-06-30 17:26:43 -04:00
RedworkDE f759cc00a3 C#: Enable exporting for Android 2023-06-28 22:34:14 +02:00
RedworkDE 7c456d2d0d C#: Remove old and unused android support code for mono 2023-06-28 22:34:14 +02:00
RedworkDE 777d959e05 C#: Add option to embed dotnet build outputs into the data file 2023-06-28 22:04:51 +02:00
RedworkDE fe7c27b086 C#: Automatically generate version defines 2023-06-28 21:45:58 +02:00
RedworkDE 60b9eb169e C# Fix reloading of non-tool scripts 2023-06-28 11:46:43 +02:00
Rémi Verschelde af16013905
Merge pull request #78571 from MewPurPur/include-extension-info
Document file extensions of GDScript, CSharpScript, and Shader
2023-06-22 18:32:25 +02:00
MewPurPur 8848c395b6 Add information about file extension to GDScript, CSharpScript, and Shader 2023-06-22 18:56:08 +02:00
Yuri Sizov 57e61db115
Merge pull request #75533 from RedworkDE/net-no-reload-noncollectible
C#: Fix editor integration breaking and causing error spam when reloading assemblies fails
2023-06-22 12:45:02 +02:00
Paul Joannon dbdbe5b042
Fix condition blocking .NET project build
Since #73015, the build commands are called on project files instead of solution ones.
2023-06-21 20:13:32 +02:00
RedworkDE e0f644a48d C#: Fix editor integration breaking and causing error spam when reloading assemblies fails
- Do not reload scripts from non-collectible assemblies
- Do not load GodotTools as collectible
- Do not attempt to reload the same project assembly forever
2023-06-21 12:47:52 +02:00
Rémi Verschelde af08b17f97
Merge pull request #78466 from raulsntos/dotnet/define-constants-without-whitespace
C#: Remove whitespace from define constants
2023-06-20 14:56:19 +02:00
Raul Santos 8f6166bd14
C#: Remove whitespace from define constants
Co-authored-by: RedworkDE <10944644+RedworkDE@users.noreply.github.com>
2023-06-20 14:33:45 +02:00
Raul Santos bd65ae633d
C#: Add compat overloads 2023-06-20 12:11:13 +02:00
Raul Santos 48e20c628a
C#: Set PropertyInfo.class_name for method parameters 2023-06-16 23:19:38 +02:00
Rémi Verschelde 7f5ef953b7
Merge pull request #78249 from RedworkDE/net-version-define
C#: Add version defines to help users deal with breaking changes
2023-06-15 15:26:31 +02:00
Rémi Verschelde 58416245ce
Merge pull request #78218 from raulsntos/dotnet/reserved-assembly-name
C#: Avoid GodotSharp as project assembly name
2023-06-15 15:26:22 +02:00
Rémi Verschelde 25b2f1780a
Style: Harmonize header includes in modules
This applies our existing style guide, and adds a new rule to that style
guide for modular components such as platform ports and modules:

Includes from the platform port or module ("local" includes) should be listed
first in their own block using relative paths, before Godot's "core" includes
which use "absolute" (project folder relative) paths, and finally thirdparty
includes.

Includes in `#ifdef`s come after their relevant section, i.e. the overall
structure is:

- Local includes
  * Conditional local includes
- Core includes
  * Conditional core includes
- Thirdparty includes
  * Conditional thirdparty includes
2023-06-15 14:35:45 +02:00
RedworkDE 1b466c6298 C#: Add version defines to help users deal with breaking changes 2023-06-15 13:18:04 +02:00
Raul Santos 7a031be769
C#: Avoid GodotSharp as project assembly name
The name GodotSharp conflicts with the name of the Godot assembly,
this causes a cyclic dependency.
2023-06-15 11:43:35 +02:00
Magian e8aeb6baa0 C# Array<StringName> support PropertyHint.Enum 2023-06-15 16:01:42 +08:00
RedworkDE 92f13ba9ea C#: Unify project name handling and fix issues with the handling of some special characters
Co-authored-by: Raul Santos <raulsntos@gmail.com>
2023-06-14 21:07:58 +02:00
RedworkDE d515fcc47a C#: Fix crash with DisposablesTracker_OnGodotShuttingDown 2023-06-13 07:49:21 +02:00
Mikael Hermansson 1c1d1a1e2e Fix crash when using base types of extension-based types from C# 2023-06-12 18:29:52 +02:00
Rémi Verschelde 5047892939
Merge pull request #73939 from raulsntos/dotnet/export-symbols
C#: Add option to disable exporting debug symbols
2023-06-09 12:14:15 +02:00
Rémi Verschelde aa5dfff3f0
Merge pull request #77410 from dsnopek/object-pointer-pointer-encoding
Standardize Object ptrcall encoding on `Object **`
2023-06-07 13:31:49 +02:00
RedworkDE e0efa3c357 C#: Always decode dotnet output as UTF-8 2023-06-07 10:58:34 +02:00
Rémi Verschelde 0a0132ccf4
Merge pull request #77904 from raulsntos/dotnet/obsolete-deprecated-members
C#: Add `[Obsolete]` attribute to deprecated members
2023-06-06 20:40:09 +02:00
Rémi Verschelde e2fcc4de34
Merge pull request #75188 from RedworkDE/net-synchronize-insert
C#: Synchronize adding ScriptInstances
2023-06-06 20:39:16 +02:00
Raul Santos 0484993121
C#: Add [Obsolete] attribute to deprecated members 2023-06-06 12:23:23 +02:00
VolTer 119456304b Reduce the total size of our SVGs by 15% 2023-06-04 15:11:48 +02:00
Raul Santos 0aa1f3440e
C#: Add option to disable exporting debug symbols
- Add export option to configure if the exported game should include debug symbols (PDB).
- Remove unused `outputDir` local variable.
- Replace `Process.GetCurrentProcess().Id` with `System.Environment.ProcessId` (CA1837).
2023-06-02 16:37:59 +02:00
Yuri Sizov f00641af9d
Merge pull request #77657 from vmedea/color-hex-doc
Clarify doc for Color.hex
2023-05-30 15:59:39 +02:00
mara 779ac20bb9 Clarify doc for Color.hex and C# Color()
The "alpha channel first" seems misleading to me. It doesn't match with
the examples, so remove it. Add a more detailed specification of the
expected number format in hex.
2023-05-30 15:15:04 +02:00
Raul Santos a1f454fee3
C#: Add global class support
Co-authored-by: willnationsdev <willnationsdev@gmail.com>
2023-05-29 19:04:02 +02:00
David Snopek 77733faede Attempt to standardize Object ptrcall encoding on Object ** 2023-05-25 21:46:22 -05:00
RedworkDE fa14b6d212 C#: Fix SendToScriptDebugger crash 2023-05-23 00:00:32 +02:00
RedworkDE 8fdebb85ef C#: Synchronize adding ScriptInstances 2023-05-22 21:40:14 +02:00
Rémi Verschelde 4fd64edc30
Merge pull request #77199 from RedworkDE/net-callable-hash
C#: Mostly fix hash of ManagedCallable
2023-05-22 13:48:58 +02:00
Yuri Sizov 156a2fabea
Merge pull request #76659 from shana/shana/75152-fix-crash-when-initializing-glue-generation
Skip initializing the C# runtime when generating glue bindings
2023-05-19 17:10:40 +02:00
Andreia Gaita e56fdc8a9a Skip initializing the C# runtime when generating glue bindings
The bindings generator doesn't require the C# runtime in order to generate
the glue, and when it the glue generation runs, it exits immediately
afterwards, so we can skip this initialization when the `--generate-mono-glue`
flag is passed in.

Fixes issue 75152
2023-05-18 13:57:42 +02:00
RedworkDE 1cfc382fe8 C#: Mostly fix hash of ManagedCallable
The hash can still change when reloading assemblies but in all other
cases the result should be correct.
2023-05-18 13:44:36 +02:00
Paul Joannon 178cd046bb
Link the right build property to REAL_T_IS_DOUBLE 2023-05-18 13:37:34 +02:00
Rémi Verschelde c64afeb017
Merge pull request #77018 from RedworkDE/net-glue-neg-enum
Fix C# glue generation for enums with negative values
2023-05-12 23:27:07 +02:00
Rémi Verschelde f26a2dbb1b
Merge pull request #75662 from goncalo/basis_looking_at
C#: Add Basis.LookingAt
2023-05-12 23:25:52 +02:00
RedworkDE 45659ce2d9 Fix C# glue generation for enums with negative values 2023-05-12 21:53:42 +02:00
Rémi Verschelde 8f17f26233
Merge pull request #76978 from raulsntos/property-hint-compat
Reorder `PropertyHint` enum to avoid breaking compat
2023-05-12 10:06:32 +02:00
Raul Santos a34207b812
Reorder PropertyHint enum to avoid breaking compat
Also syncs the Core enum with the C# enum for the source generators.
2023-05-12 01:48:07 +02:00
clayjohn f83a90192f Revert "Add API for HSL conversion"
This reverts commit 0b7fd664c1.
2023-05-10 17:45:56 -03:00
Rémi Verschelde 0f444f101a
Merge pull request #76661 from bonjorno7/hsl
Add API for HSL conversion
2023-05-09 19:28:35 +02:00
bonjorno7 0b7fd664c1 Add API for HSL conversion
Math ported pretty much 1:1 from https://en.wikipedia.org/wiki/HSL_and_HSV
Style doesn't match the existing HSV code exactly, but should be close enough.
2023-05-09 17:43:10 +02:00
Clay John 610877e326
Merge pull request #72288 from MewPurPur/use-string-repeat
Use `String.repeat()` to optimize several String methods
2023-05-05 09:56:48 -07:00
VolTer 6b84e258d2 Use String.repeat() in more places 2023-05-01 02:27:46 +02:00
Rémi Verschelde 8f7b09916d
Merge pull request #76026 from YuriSizov/editor-running-up-that-gui
Extract editor run toolbar into its own component
2023-04-26 12:15:29 +02:00
RedworkDE 692ad70fd7 C#: Do not use DocCache when generating glue code 2023-04-20 15:35:14 +02:00
Yuri Sizov 8a74d8438f Extract editor run toolbar into its own component
- Simplify and update its logic.
- Simplify EditorScript.
- Improve EditorNode and other relevant includes.
- Fix scene-based path in the movie writer when
reloading a scene.
2023-04-19 17:12:28 +02:00
RedworkDE 34b4128004 C#: Make include scripts contents an export option 2023-04-18 14:27:15 +02:00
Kevin Simpson c2b97ec1f7 Add the ability to set a custom C# editor
This allows users to still use the built-in Godot editor for GDScript.
2023-04-18 13:55:08 +02:00
Gonçalo Vasconcelos b74d4f45bb C#: Add Basis.LookingAt 2023-04-11 16:05:35 +01:00
RedworkDE 27124ed8e5 C#: Discontinue GodotNuGetFallbackFolder 2023-04-07 19:22:43 +02:00
bendn ca0feabbb0
add hex_decode() to String 2023-04-05 19:44:00 +07:00
Yuri Sizov ce03630f34
Merge pull request #75477 from kleonc/csharp-fix-vector234i-from-floats-creation
C# Truncate instead of round in Vector2/3/4 to Vector2I/3I/4I conversion
2023-03-31 13:01:48 +02:00
Yuri Sizov 8f6ce4c8f9
Merge pull request #71049 from alexdlm/dotnet-generator-selective-disable
Add fine-grained disabling of SourceGenerators
2023-03-31 12:56:03 +02:00
kleonc f53d3382af C# Truncate instead of round in Vector2/3/4 to Vector2I/3I/4I conversion 2023-03-31 10:59:11 +02:00
Redwarx008 eb1fb254a6 C#: Fix Array.AddRange index out of bounds
Fix Array.AddRange index out of bounds
2023-03-27 21:55:06 +08:00
Yuri Sizov 7ef4ada3a6
Merge pull request #75286 from AThousandShips/csharp_shadow
Fix "hides member" warnings in `csharp_script.cpp`
2023-03-25 16:15:25 +01:00
Ninni Pipping ff5d8c4a42 Fix "hides member" warnings in csharp_script.cpp 2023-03-25 14:44:12 +01:00
Alex de la Mare 8ab3295e57 Add fine-grained disabling of SourceGenerators
This allows manual testing and/or alternate source generators to
provide functionality without conflict.
2023-03-25 13:46:12 +11:00
RedworkDE 42cf684837 C#: Do not print errors about missing references to intentionally ignored members 2023-03-24 20:21:55 +01:00
Yuri Sizov 8402927d3f Prevent crashing on startup if project has scripted theme types
Also avoid order of operation conflicts by moving C# binding generation hook to main.cpp
2023-03-08 11:17:21 +01:00
Rémi Verschelde b8126b18dc
Merge pull request #73429 from bruvzg/macos_no_sc
[macOS] Re-add support for the _sc_ inside app bundle.
2023-03-07 08:36:51 +01:00
RedworkDE 6019f497b8 C#: Fix building projects for MSBuild before 17.3 2023-03-06 17:58:20 +01:00
Rémi Verschelde 5dccc940e7
Merge pull request #74375 from raulsntos/dotnet/ignore-explicit-interface-implementations
C#: Ignore explicit interface implementations
2023-03-05 13:39:45 +01:00
Rémi Verschelde b2622218f9
Merge pull request #74330 from aleksrutins/csharp-identifier-validation
Ensure that C# script names (and therefore class names) are valid identifiers
2023-03-05 13:29:26 +01:00
Rémi Verschelde afc9d381d5
Merge pull request #74312 from raulsntos/dotnet/godot-project-dir-base64
C#: Encode GodotProjectDir as Base64 to prevent issues with special characters
2023-03-05 13:28:14 +01:00
Raul Santos f949e94991
C#: Encode GodotProjectDir as Base64 to prevent issues with special characters 2023-03-04 23:33:30 +01:00
Raul Santos 0372bd56b6
C#: Ignore explicit interface implementations 2023-03-04 19:16:48 +01:00
Aleks Rutins ae8752a731 Validate that C# class names are valid identifiers 2023-03-04 10:30:40 -05:00
RedworkDE 16a2a164fe C#: Get singleton instances using the Core name 2023-03-03 16:30:18 +01:00
Rémi Verschelde 526f115752
Merge pull request #73904 from raulsntos/dotnet/tools-popup
C#: Always show "Create C# solution" option
2023-03-02 11:22:59 +01:00
Rémi Verschelde 880247ad54
Merge pull request #74127 from RedworkDE/net-debug-crash
C#: Fix crash when errors occur before language initialization.
2023-03-02 11:20:26 +01:00
Rémi Verschelde 1c1524a651
Bump version to 4.1-dev
Can't stop, won't stop, they said, huh?
2023-03-01 01:44:37 +01:00
RedworkDE c0ebc28136 C#: Fix crash when errors occur before language initialization. 2023-03-01 00:00:33 +01:00
voidedWarranties bd5ab9f9b4 Remove unused ScriptLanguage methods 2023-02-26 22:30:56 -08:00
Raul Santos a1a2fc2255
C#: Always show "Create C# solution" option
Prevents ending up with an empty C# menu.
The option to create the C# solution no longer disappears, to avoid confusing users.
If an user tries to use it when a C# solution already exists they are warned that it will override their sln and csproj files.
2023-02-26 02:56:34 +01:00
Raul Santos 3730d8e343
C#: Check if a class is a singleton using the Core name
Use the name of the class in Core, rather than the C# rename, when checking if a class is registered as a singleton.
2023-02-24 18:02:31 +01:00
RedworkDE 6b050a3502 C#: Fix editor crashing without a message when .NET is not installed 2023-02-23 13:52:45 +01:00
bruvzg b3c64675cc
[macOS] Replace all Alt/Option+Letter/Number default shortcuts to avoid conflicts with special character input. 2023-02-20 22:02:47 +02:00
RedworkDE 756a48023f C#: Fix line position when opening file in VSCode 2023-02-19 12:43:15 +01:00
bruvzg 174e0837e0
[macOS] Re-add support for the _sc_ inside app bundle. Update docs. 2023-02-17 09:55:56 +02:00
Rémi Verschelde 2527d4ce9b
Merge pull request #73458 from paulloz/csharp/actually-clean-solution
.NET: Clicking "Clean solution" should clean, not build
2023-02-17 00:30:55 +01:00
Rémi Verschelde 5cb32d8476
Merge pull request #73392 from raulsntos/dotnet/vscode-open-solution
C#: Open the solution directory when using VSCode
2023-02-16 18:34:34 +01:00
Paul Joannon 5e3d114829
Clicking "Clean solution" should clean, not build 2023-02-16 11:45:33 +01:00
RedworkDE fce8a05b58 C#: Fix internal source generator on the 7.0.200 SDK 2023-02-16 11:25:47 +01:00
Raul Santos d57cb460e2
C#: Open the solution directory when using VSCode
The solution directory used to be the same as the project
directory (`res://`). We now allow specifying a different
path for the solution and the other external editors already
use that (which seems more convenient for multi-project
scenarios).
2023-02-15 20:13:40 +01:00
Rémi Verschelde 49e8a2fb66
Merge pull request #73026 from SirUppyPancakes/sync-context-send
Implement GodotSynchronizationContext.Send
2023-02-12 22:34:18 +01:00
Caleb Kemper 103cb4bee6 Implement GodotSynchronizationContext.Send 2023-02-12 14:12:09 -07:00
Raul Santos 2a1523d751
Build C# csproj instead of the solution 2023-02-10 03:19:30 +01:00
Rémi Verschelde b53c4dda62
Merge pull request #72849 from RedworkDE/net-export-settings
C#: Rename export settings `mono` -> `dotnet` and remove unused AOT settings
2023-02-08 09:32:41 +01:00
RedworkDE bf47b62203 C#: Rename export settings mono -> dotnet and remove unused AOT settings 2023-02-07 18:20:23 +01:00
Paul Joannon c70c82b0fb
Try and match MSBuild and Godot UI languages 2023-02-07 16:48:23 +01:00
Paul Joannon 9bf2a0bcda
Add new settings about MSBuild
- toggle creation of binary logs
- manage log verbosity
- toggle logging in console
2023-02-07 16:48:23 +01:00
Paul Joannon 7cf42dbdee
Add button to open the msbuild logs folder 2023-02-07 16:48:23 +01:00
Paul Joannon e51a20b714
Rename existing editor settings mono -> dotnet 2023-02-07 16:48:18 +01:00
RedworkDE fb0adaff9f C#: Fix AppContext.BaseDirectory 2023-02-04 14:35:11 +01:00
Rémi Verschelde bbff9fd7a4
Merge pull request #71786 from raulsntos/dotnet/array
Sync C# Array with Core
2023-02-04 00:24:06 +01:00
Rémi Verschelde 1ff2204cfe
Merge pull request #72554 from RedworkDE/net-appcontext-basedirectory
C#: Set AppContext.BaseDirectory for editor builds
2023-02-03 15:35:29 +01:00
Rémi Verschelde 5a413894fc
Merge pull request #72635 from RedworkDE/net-nodepath-iequatable
C#: Implement `IEquatable<>` and equality operators in `NodePath`
2023-02-03 15:35:22 +01:00
RedworkDE ac96af1cc9 C#: Declare IEquatable<> interface for StringName 2023-02-03 00:26:18 +01:00
RedworkDE 7403a3a11b C#: Implement IEquatable<> and equality operators in NodePath
- Implement `IEquatable<>` interface.
- Implement `==` and `!=` operators.
- Override `Equals` and `GetHashCode`.
2023-02-03 00:25:48 +01:00
RedworkDE b9d1462d2a C#: Set AppContext.BaseDirectory for editor builds 2023-02-02 15:05:11 +01:00
Rémi Verschelde c5c6f2db89
Merge pull request #72553 from RedworkDE/net-output-directory
C#: Preserve directories in output during export
2023-02-02 13:59:05 +01:00
Rémi Verschelde 0a9e6e478e
Merge pull request #71800 from akien-mga/ci-codespell-action
CI: Add official codespell action with PR annotations
2023-02-01 13:25:23 +01:00
Rémi Verschelde c461d3880f
Merge pull request #72434 from Treer/master
Qualify Console's namespace to avoid mixup with plugin's objects
2023-02-01 13:24:47 +01:00
Rémi Verschelde e52213e2fa
More codespell fixes, do more changes from previous ignore list 2023-02-01 12:11:36 +01:00
RedworkDE 70ebb6378c C#: Preserve directories in output during export 2023-02-01 00:37:12 +01:00
Treer 086ce855a8
Update modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotPluginsInitializerGenerator.cs
Co-authored-by: Ignacio Roldán Etcheverry <neikeq@users.noreply.github.com>
2023-02-01 07:56:20 +11:00
Raul Santos 7eb8325180
Fix C# examples in documentation
- Fix documentation after C# renames.
- Add missing `partial` in C# class declarations.
- Change `delta` parameter type to `double` in C#.
- Ensure parameters match base declaration.
- Use `$` string interpolation in C#.
- Fix invalid or outdated C# code.
- Changed some examples to follow our style guide more closely.
2023-01-31 19:04:07 +01:00
Treer 273df44e1d Qualify Console's namespace to avoid mixup with plugin's objects
Avoid error when a plugin contains a class called "Console":
Godot.SourceGenerators\Godot.SourceGenerators.GodotPluginsInitializerGenerator\GodotPlugins.Game.generated.cs(32,25): error CS0117: 'Console' does not contain a definition for 'Error'
2023-01-31 16:23:17 +11:00
Raul Santos 8166568976
C#: Implement IEquatable in Rid
- Implement `IEquatable` interface.
- Implement `==` and `!=` operators.
- Add `IsValid` method.
- Override `Equals` and `GetHashCode`.
- Fix `ToString` to follow Core.
- Sync documentation with Core.
2023-01-31 04:44:18 +01:00
Rémi Verschelde 312011fade
Fix various typos with codespell
And include #72377.

Co-authored-by: Wiktor Kocielski <withaust@gmail.com>
2023-01-30 14:22:47 +01:00
Rémi Verschelde ab70b6ca8a
Merge pull request #72325 from raulsntos/dotnet/fix-72321
C#: Fix `Rotated` and `RotatedLocal`
2023-01-30 13:35:34 +01:00
Raul Santos 54f8fb010c
Sync C# Array with Core
- Add `AddRange` method.
- Add `Fill` method.
- Add `Max` and `Min` methods.
- Add `PickRandom` method.
- Add `Reverse` method.
- Add `RecursiveEqual` method.
- Add `Sort` method.
- Add `Slice` and `GetSliceRange` methods.
- Add `IndexOf` overload that takes an index parameter.
- Add `LastIndexOf` method.
- Add `BinarySearch` method.
- Add/update documentation.
2023-01-30 05:41:53 +01:00
Raul Santos cc80dda408
C#: Fix Rotated and RotatedLocal
Implementation was interchanged.
2023-01-29 18:43:54 +01:00
Raul Santos 2ef9e2933a
C#: Add Skew to Transform2D and fix InterpolateWith
- Add `Skew` property to `Transform2D`.
- Fix `InterpolateWith` in `Transform2D` to support skewed transforms.
2023-01-29 16:24:41 +01:00
Rémi Verschelde 80f59aa3d9
Merge pull request #72205 from raulsntos/dotnet/proxy-class
Fix lookup of C# types by their engine name
2023-01-28 15:41:28 +01:00
Rémi Verschelde 092bbfc2ea
Merge pull request #71992 from raulsntos/dotnet/rect-alt
C#: Remove `GetArea` and `GetVolume` methods
2023-01-28 15:41:04 +01:00
Raul Santos 65d0d05fa7
Fix lookup of C# types by their engine name 2023-01-27 21:28:15 +01:00
Rémi Verschelde 3c9b7ec26b
Merge pull request #72182 from raulsntos/dotnet/remove-obsolete-stringextensions
C#: Remove obsolete StringExtensions methods
2023-01-27 19:26:39 +01:00
Rémi Verschelde 6462e54acc
Merge pull request #71986 from raulsntos/dotnet/readonly-collections
C#: Implement readonly-ness in Array and Dictionary
2023-01-27 19:26:35 +01:00
Raul Santos b3af6141a2
C#: Remove GetArea and GetVolume methods
- Remove `GetArea` method in favor of the `Area` property in Rect2{i}.
- Replace `GetVolume` method with a `Volume` property in AABB.
2023-01-27 18:53:23 +01:00
Raul Santos 15066948d7
C#: Remove obsolete StringExtensions methods 2023-01-27 17:15:23 +01:00
Rémi Verschelde 2b55ac445b
Merge pull request #72111 from raulsntos/method-info-metadata
Add `GodotTypeInfo::Metadata` to `MethodInfo`
2023-01-27 15:41:38 +01:00
Raul Santos 1aa54141e6
C#: Implement readonly-ness in Array and Dictionary
- Expose `IsReadOnly` and add `MakeReadOnly` method.
2023-01-27 15:25:34 +01:00
Rémi Verschelde bd1df0f2e3
Merge pull request #71943 from paulloz/debugger/better-errors-printing
Better error display in debugger panel
2023-01-27 10:32:38 +01:00
Paul Joannon c93eec4139
Better error display in debugger panel
- Use the right stack frame info as title of the error.
- Use the actual C# exception type as error for exceptions raised from C#.
- Show the right language instead of always **C++ Error**.
2023-01-27 10:01:55 +01:00
Raul Santos 1aceacaa6b
C#: Rename Object to GodotObject 2023-01-27 02:04:18 +01:00
Raul Santos a968e51414
C#: Renames to follow .NET naming conventions
Renamed C# types and members to use PascalCase and follow .NET naming conventions.
2023-01-27 02:04:17 +01:00
Raul Santos 4788cb35c1
C#: Add global namespace to grouping property info 2023-01-27 01:15:19 +01:00
Rémi Verschelde 2edef2a795
Merge pull request #71825 from RedworkDE/net6-roll-forward
C#: Allow use of .NET 7
2023-01-27 00:13:54 +01:00
Rémi Verschelde 0d1b5f8832
Merge pull request #71356 from raulsntos/dotnet/get
C#: Lookup signals and methods in Get method
2023-01-27 00:13:13 +01:00
Rémi Verschelde 4f572d1587
Merge pull request #71535 from raulsntos/dotnet/pointers-are-yabai
C#: Skip methods with pointer parameters
2023-01-26 23:44:28 +01:00
Rémi Verschelde fdd3613de1
Merge pull request #71984 from raulsntos/dotnet/dictionary
Sync C# Dictionary with Core
2023-01-26 23:44:01 +01:00
Rémi Verschelde 239145d9cb
Merge pull request #71946 from raulsntos/dotnet/gd
C#: Sync GD with Core
2023-01-26 23:43:36 +01:00
Rémi Verschelde bacf594a49
Merge pull request #71583 from raulsntos/dotnet/math
C#: Add float an double overloads to Mathf
2023-01-26 23:43:11 +01:00
Rémi Verschelde c53066682b
Merge pull request #71787 from raulsntos/dotnet/restore-properties
C#: Restore `Scale` and `Rotation` properties
2023-01-26 23:42:46 +01:00
Rémi Verschelde fdd02b8827
Merge pull request #71988 from raulsntos/🦭-attributes
Seal C# attributes
2023-01-26 23:42:21 +01:00
Rémi Verschelde 0f840cb214
Merge pull request #72053 from raulsntos/dotnet/sync-context-dispose
C#: Implement disposable pattern and seal `GodotSynchronizationContext` class and related
2023-01-26 23:41:52 +01:00
Rémi Verschelde 63b5adf8a8
Merge pull request #72057 from raulsntos/dotnet/fix-must-be-variant
C#: Annotate API with `[MustBeVariant]`
2023-01-26 23:00:30 +01:00
Rémi Verschelde 2aa532ad6c
Merge pull request #65529 from magian1127/4.0FixDocTag
C# Improve the "Tag" conversion of documents
2023-01-26 22:58:26 +01:00
Raul Santos cac7a784d6
Add GodotTypeInfo::Metadata to MethodInfo 2023-01-26 15:51:34 +01:00
Raul Santos 256632a07e
C#: Skip documentation syntax in MustBeVariant analyzer 2023-01-25 17:29:08 +01:00
Raul Santos 0a0c730805
C#: Annotate API with MustBeVariant
- Add MustBeVariant attribute to generic parameters that are used in a Variant context
2023-01-25 17:28:59 +01:00
Raul Santos fc72604bef
C#: Implement disposable pattern and seal GodotSynchronizationContext class and related
- `GodotSynchronizationContext`
  - Implements `IDisposable` to dispose of the disposable field `_queue`.
  - Makes the class sealed.
- `GodotTaskScheduler`
  - Implements `IDisposable` to dispose of the disposable property `Context`.
  - Makes the class sealed.
- `Dispatcher`
  - Dispose of previous `GodotTaskScheduler` instances before creating a new one.
2023-01-25 17:04:41 +01:00
Aaron Franke 2a65f6812b
Add PROPERTY_USAGE_NEVER_DUPLICATE flag and use for script
Co-authored-by: Yakov Borevich <j.borevich@gmail.com>
2023-01-24 16:37:50 -06:00
Aaron Franke 2bc0bcbd26
PropertyUsage: Rename "DO_NOT_SHARE_ON_DUPLICATE" to "ALWAYS_DUPLICATE" 2023-01-24 16:05:07 -06:00
Raul Santos 47ca2f2e09
C#: Sync GD with Core
- Add overloads to print methods that take a single `string`.
- Use `StringBuilder` to append print parameters.
- Remove `PrintStack` method.
- Add `ErrorString`.
- Remove `Str` method.
- Add exception to `Range` when step is 0.
- Add `VarToBytesWithObjects` and `BytesToVarWithObjects`.
- Remove optional boolean parameter from `VarToBytes` and `BytesToVar`.
- Move `InstanceFromId` to `Godot.Object`.
- Add `Godot.Object.IsInstanceIdValid`.
- Update documentation.
2023-01-24 19:18:38 +01:00
Raul Santos e7b719b7ec
Seal C# attributes 2023-01-24 18:42:25 +01:00
Raul Santos 95ef4dc84f
Sync C# Dictionary with Core
- Implement `ICollection` methods explicitly.
- Add `Merge` method.
- Add `RecursiveEqual` method.
- Update documentation.
2023-01-24 17:19:52 +01:00
Raul Santos 8b07f95ba0
C#: Add float an double overloads to Mathf
- Add `float` and `double` overloads to all methods of `Mathf`.
This allows the methods to be usable with `float`, `double` or `real_t`.
- Use `System.MathF` in the `float` overloads which may result in
better performance.
- Constants remain as `real_t` for the time being.
- Add aggresive inlining for methods that wrap `System.Math` calls.
2023-01-24 15:01:26 +01:00
Magian 35bfce2afd C# Improve the "Tag" conversion of documents
[codeblocks] for Keep only the [CSharp] part.
[param] is changed to <c>.
[b] for bold text.
[i] for italic text.
4.0 now uses variant, so [variant] to <see cref="Godot.Variant"/>.
since Rider does not support [u], only comments have been modified.
2023-01-24 18:40:48 +08:00
Raul Santos b29193945d
C#: Move LinearToDb and DbToLinear to Mathf 2023-01-23 20:20:54 +01:00
Rémi Verschelde 5b1df48c6c
Convert en_GB spelling to en_US with codespell 2023-01-23 11:02:20 +01:00
RedworkDE 3f1241cb82 C#: Allow use of .NET 7
The editor will use .NET 7 if it is installed and fall back to .NET 6 otherwise.
Exported projects will use .NET 7 or .NET 6 depending on the value of TargetFramework in the csproj.
2023-01-21 23:11:37 +01:00
Juan Linietsky dddd8d43f6 Support script global resource name in EditorFileSystem
* Works for binary and text files.
* Makes EditorQuickOpen work with custom resources again.
* Information is cached and easily accessible.

Properly fixes #66179. Supersedes #66215 and supersedes #62417

**WARNING**: This required breaking backwards binary compatibility (.res and .scn files). Files saved after this PR is merged will no longer open in any earlier versions of Godot.
2023-01-21 14:19:27 +01:00
Raul Santos 04996df61e
C#: Restore Scale and Rotation properties 2023-01-21 04:59:13 +01:00
Rémi Verschelde 5dd3a6dbe2
Merge pull request #71638 from raulsntos/dotnet/export-plugin
C#: Implement `ExportPlugin::_get_name` and move `GLOBAL_DEF` to CSharpLanguage
2023-01-18 22:29:37 +01:00
Raul Santos 3425d43fed
C#: Move GLOBAL_DEFs to CSharpLanguage ctor
Also documents the .NET project settings.
2023-01-18 21:53:58 +01:00
Raul Santos 62106fe5e3
C#: Implement ExportPlugin::_get_name 2023-01-18 18:17:38 +01:00
Raul Santos 4bdcfe1443
Sync C# vectors with Core
- Remove `Vector2.Lerp` overload that takes a weight parameter of type `Vector2`.
- Remove `Vector3.Lerp` overload that takes a weight parameter of type `Vector3`.
- Remove `Color.Lerp` overload that takes a weight parameter of type `Color`.
- Remove `Angle` method from `Vector2i`.
- Remove `AngleTo` method from `Vector2i`.
- Remove `AngleToPoint` method from `Vector2i`.
- Remove `Cross` method from `Vector2i`.
- Remove `DistanceSquaredTo` method from `Vector2i` and `Vector3i`.
- Remove `DistanceTo` method from `Vector2i` and `Vector3i`.
- Remove `Dot` method from `Vector2i` and `Vector3i`.
- Remove `PosMod` method from `Vector2i` and `Vector3i`.
- Remove `Orthogonal` method from `Vector2i`.
- Remove `&` operator from `Vector2i` and `Vector3i`.
2023-01-17 18:07:33 +01:00
Rémi Verschelde 3a53990e9c
Merge pull request #71516 from raulsntos/dotnet/property-accessors
C#: Make property accessors internal
2023-01-17 17:30:49 +01:00
Raul Santos ab5e532f1a
C#: Skip methods with pointer parameters 2023-01-17 04:32:05 +01:00
Raul Santos 47e355f965
C#: Make property accessors internal 2023-01-16 15:15:26 +01:00
Raul Santos 0ccb5f3954
C#: Implement Mathf.SinCos
Implement `Mathf.SinCos` that wraps a call to `System.Math.SinCos`,
this allows us to use the `SinCos` method more conveniently with
`real_t`.

Using `Math.SinCos` is often cheaper than separate calls to `Math.Sin`
and `Math.Cos`, and they are often used together.
2023-01-16 13:29:32 +01:00
Rémi Verschelde ba551727ef
Merge pull request #71458 from raulsntos/dotnet/quaternion
C#: Make `Length` and `LengthSquared` into methods in `Quaternion`.
2023-01-16 09:20:53 +01:00
Rémi Verschelde 88c81bfbe5
Merge pull request #71456 from raulsntos/dotnet/sync-plane
C#: Sync `Plane` with Core
2023-01-16 09:20:30 +01:00
Rémi Verschelde 94312ab943
Merge pull request #71445 from raulsntos/dotnet/transforms
C#: Add missing `Transform{2D,3D}` and `Basis` constructors
2023-01-16 09:20:07 +01:00
Raul Santos 7a19c87c7e
C#: Sync Plane with Core
- Add `Plane(Vector3)` constructor.
- Rename `IntersectRay` to `IntersectsRay`.
- Rename `IntersectSegment` to `IntersectsSegment`.
- Replace `Center` property with `GetCenter` method.
- Add and fix documentation about the _normal_ parameter
to Core and C# documentation.
2023-01-15 19:47:42 +01:00
Raul Santos 5136366112
C#: Add missing Transform{2D,3D} and Basis constructors
- Remove `Transform3D(Quaternion, Vector3)` constructor from C#.
- Add `Transform3D(Projection)` constructor to C#.
- Add documentation to the `Transform3D(Projection)` constructor in Core.
- Add `Transform3D` constructor with only real_t params to C# that mirrors `Transform2D`.
- Expose `Basis` constructor with only real_t params in C#.
- Add `Transform2D(real_t, Vector2, real_t, Vector2)` constructor to C#.
2023-01-15 15:45:43 +01:00
Raul Santos 0476fc5a07
C#: Replace Rotation and Scale properties with get methods
- Replace `Rotation` property with `GetRotation` method in `Transform2D`.
- Replace `Scale` property with `GetScale` method in `Transform2D`.
- Replace `Scale` property with `GetScale` method in `Basis`.

Core does not expose set methods.
2023-01-15 14:06:16 +01:00
Raul Santos 28a8caac26
C#: Make Length and LengthSquared into methods in Quaternion.
The `Length` and `LengthSquared` members are implemented as methods
in every other C# struct, `Quaternion` was the only one implementing
them as properties.
2023-01-15 14:03:44 +01:00
Rémi Verschelde d6d87b6ca4
Merge pull request #71374 from raulsntos/dotnet/remove-spherical_interpolate_with
C#: Remove `SphericalInterpolateWith` from Transform3D
2023-01-15 13:08:15 +01:00
Rémi Verschelde e51426cab9
Merge pull request #71423 from raulsntos/dotnet/intersects-without-include_borders
C#: Remove `includeBorders` parameter from `Rect2i.Intersects` and `AABB.Intersects`
2023-01-15 13:07:13 +01:00
Raul Santos 949a2778ca
C#: Sync Basis with Core
- Remove `GetOrthogonalIndex` method (moved to `GridMap`).
- Remove `GetRow` and `SetRow` methods.
2023-01-14 20:06:45 +01:00
Raul Santos c990f7984e
C#: Remove includeBorders parameter from Rect2i.Intersects and AABB.Intersects 2023-01-14 04:39:40 +01:00
Raul Santos 4438315242
C#: Remove SphericalInterpolateWith from Transform3D 2023-01-14 02:10:59 +01:00
Raul Santos a6ba914f15
C#: Lookup signals and methods in Get method
Allows to retrieve `Callable`s and `Signal`s using `Get` like it works in GDScript.
2023-01-13 22:19:25 +01:00
Yuri Sizov 4c5e09f96a
Merge pull request #71339 from raulsntos/dotnet/is_finite
Add `IsFinite` to C# Variants
2023-01-13 23:34:51 +03:00
Yuri Sizov bdb3543c2a
Merge pull request #71343 from raulsntos/dotnet/is_zero_approx
Add `IsZeroApprox` to C# vectors
2023-01-13 23:31:24 +03:00
Raul Santos 14c16746f3
Add IsZeroApprox to C# vectors 2023-01-13 18:53:39 +01:00
Raul Santos f852004cf5
Add IsFinite to C# Variants 2023-01-13 17:57:52 +01:00
Juan Linietsky 6f0e210093 Refactor ProjectSetting overrides
* Overrides no longer happen for set/get.
* They must be checked with a new function: `ProjectSettings::get_setting_with_override()`.
* GLOBAL_DEF/GLOBAL_GET updated to use this

This change solves many problems:
* General confusion about getting the actual or overriden setting.
* Feature tags available after settings are loaded were being ignored, they are now considered.
* Hacks required for the Project Settings editor to work.

Fixes #64100. Fixes #64014. Fixes #61908.
2023-01-13 15:13:56 +01:00
Guillermo 6137929f52 Improve description of GetNodeOrDefault in C# API
Indenting with spaces and added a line break

Co-authored-by: Raul Santos <raulsntos@gmail.com>
2023-01-11 15:02:08 +01:00
Rémi Verschelde 64f2b970d8
Merge pull request #71114 from reduz/cleanup-property-hints
Removed unused property hints and `Object::get_translatable_strings()`
2023-01-09 16:57:31 +01:00
Juan Linietsky 0e0a6bb39b
Removed unused property hints and Object::get_translatable_strings()
* Remove unused `EditorPropertyMember` and related hints, previouly used by
  VisualScript. Such logic should be implemented in the VS module itself.
* As the above broke compatibility with the VS module, clean up the other
  hacks that were still in core in support of VisualScript.
* `PROPERTY_USAGE_INTERNATIONALIZED` was only used in Object's
  `get_translatable_strings()`, which is a legacy function not used anywhere.
  So both are removed.
* Reordered some usage flags after the above removal to minimize the diff.
* General clean up.

Fixes #30203.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2023-01-09 16:56:01 +01:00
Raul Santos 59e8fc1edf
C#: Add [Flags] attribute to core bitfield enums 2023-01-09 16:13:28 +01:00
Juan Linietsky 47592927b3 Use BitField<> hint for ArrayFormat
This was missing in the conversion of bitflags to BitField<>.
2023-01-08 18:47:48 +01:00
Rémi Verschelde e5f6e03490
Merge pull request #70547 from TokageItLab/pingpong-wrap
Fix pingpong-loop with `loop_wrap` is not working & clean-up cubic interpolation key retrieve process
2023-01-06 00:10:18 +01:00
Rémi Verschelde d95794ec8a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".
2023-01-05 13:25:55 +01:00
Ignacio Roldán Etcheverry 0daa86d70e
Merge pull request #70511 from raulsntos/dotnet/fix-update-script-class-info
C#: Skip getting class info for unbound generics
2022-12-30 01:29:53 +01:00
Raul Santos a43e8285a7
C#: Avoid generic types in the script path attribute generator
- Avoid generic types in `ScriptPathAttributeGenerator`, this
means they won't be added to the `[AssemblyHasScripts]` attribute
and a `[ScriptPath]` attribute won't be added to the class.
Since generic classes can't be used as scripts they shouldn't use
those attributes, this also makes CSharpScript consider those types
invalid since they won't be added to the script/type map.
- Avoid generic types in `ScriptManagerBridge.LookupScriptsInAssembly`.
- Set `outMethodsDest` in `ScriptManagerBridge.UpdateScriptClassInfo`.
2022-12-28 23:20:02 +01:00
Silc Renew 8745c206c4 Fix pingpong with loop wrap is not working 2022-12-25 18:16:38 +09:00
Ignacio Roldán Etcheverry f382a2b59b
Merge pull request #70509 from irwiss/reverse-Vector2.AngleToPoint
C#: reverse Vector2.AngleToPoint
2022-12-24 17:22:50 +01:00
Alexey Kim e9ace71c88 C#: reverse Vector2.AngleToPoint 2022-12-24 04:18:53 +02:00
Ignacio Roldán Etcheverry dfac8bb407 C#: Fix leak in Span to Variant conversions 2022-12-23 21:37:28 +01:00
Ignacio Roldán Etcheverry 5784bf1be0
Merge pull request #70486 from raulsntos/dotnet/convert-to
C#: Rename `ConvertToX` methods
2022-12-23 21:15:24 +01:00
Raul Santos 24e4ac9167
C#: Rename ConvertToX methods
- Renamed `ConvertToX` to `ConvertToNativeX`.
- Renamed `ConvertToXObject` to `ConvertToX`.
- Renamed `ConvertToXManaged` to `ConvertToX`.
- Fix `Signal` name in bindings generator and csharp script.
2022-12-23 19:40:32 +01:00
Raul Santos 03c26d6618
C#: Disallow init-only properties
ReadOnly properties are currently not allowed because the generated code
needs to set them, this also apply to `init` properties because they
need to be set after initialization.
2022-12-23 19:04:14 +01:00
Raul Santos 2be8cd6863
C#: Add note about the class name in instantiate error
Adds a note about the requirement that a C# class name must match the
script filename in which the they are defined to the instantiate error.
2022-12-17 20:02:01 +01:00
Ignacio Roldán Etcheverry df0cf08878
Merge pull request #69867 from raulsntos/dotnet/color
C#: Synchronize Color with Core
2022-12-16 13:17:03 +01:00
Raul Santos d843a7ab97
C#: Synchronize Color with Core
- Add `Luminance` readonly property.
- Add `LinearToSrgb` and `SrgbToLinear` static methods.
- Add `FromOkHsl` static method.
- Add `FromRgbe9995` static method.
- Add `FromString` static method.
- Expose `FromHtml` static method.
- Expose `HtmlIsValid` static method.
- Add and update some Color documentation.
2022-12-16 03:04:05 +01:00
Rémi Verschelde d4bbfc7075
Merge pull request #70125 from TokageItLab/cs-sync-usage-flags
Fix out of sync PropertyUsageFlags for cs
2022-12-15 23:55:44 +01:00
Silc Renew a52479f770 Fix out of sync PropertyUsageFlags for cs 2022-12-16 06:27:04 +09:00
Alberto Vilches 2d60b9c6e4 Added Projection to ConvertTo<T> and CreateFrom<T> 2022-12-15 13:38:09 +01:00
Rémi Verschelde 346efd29e0
Fix typos with codespell 2022-12-15 12:24:08 +01:00
Rémi Verschelde b8e1d6585c
Merge pull request #69971 from neikeq/csharp-vararg-ret-premature-free
C#: Fix premature free of returned Variant in vararg methods
2022-12-14 23:27:40 +01:00
Ignacio Roldán Etcheverry 833b252ce7 C#: Fix premature free of returned Variant in vararg methods
Notably, this fixes obscure issues after calling `script.New()` when
the returned instance is a `RefCounted`.
2022-12-12 17:54:28 +01:00
Raul Santos 1a4c8856ec
C#: Rename SignalInfo to Signal and make awaitable 2022-12-12 17:30:14 +01:00
Raul Santos 1ab4f26cc4
C#: Fix bindings generator for methods that return signals 2022-12-12 17:04:03 +01:00
Rémi Verschelde f1edd03d4c
Merge pull request #69718 from groud/finally_rename_gdnative_to_gdextension
Rename all gdnative occurences to gdextension
2022-12-12 11:43:59 +01:00
Gilles Roudière be1c9d677d Rename all gdnative occurences to gdextension
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
2022-12-12 11:04:57 +01:00
Rémi Verschelde 0580790140
Merge pull request #69933 from neikeq/issue-69822
C#: Fix exported properties of GodotObject[] type
2022-12-11 22:56:05 +01:00
Ignacio Roldán Etcheverry 51f2d7b59f
Merge pull request #69869 from raulsntos/dotnet/attributes
C#: Expose attribute properties and add documentation
2022-12-11 22:40:35 +01:00
Ignacio Roldán Etcheverry 5c6c766732 C#: Fix exported properties of GodotObject[] type
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`.
2022-12-11 22:29:31 +01:00
Raul Santos a86f076321
C#: Expose attribute properties and add documentation
- 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.
2022-12-10 20:11:17 +01:00
Hugo Locurcio 063637ec77
Rename float=64 SCons option to precision=double
This avoids confusion with the old `bits=64` option and building
for 64-bit CPUs in general.
2022-12-10 16:43:45 +01: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
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
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
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. Alex Hofer 215022c507 Remove unnecessary namespaces in generated PropertyDefVal files. 2022-11-29 22:12:34 -05: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
trollodel c90d0bd84f Use forward-declarations in big editor classes 2022-11-29 09:59: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
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
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 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
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 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
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 93be29be06
Merge pull request #69125 from raulsntos/dotnet/bezier_derivative
C#: Implement BezierDerivative
2022-11-24 18:56:02 +01:00
Raul Santos d2f7314716
C#: Implement BezierDerivative
Adds `BezierDerivative` method to Mathf, Vector2 and Vector3 (already exposed in Core).
2022-11-24 17:55:07 +01:00
Silc Renew b217c41d36 Refactor interpolating functions in some classes to use Math class 2022-11-24 20:31:43 +09:00
Rémi Verschelde 124594593f
Merge pull request #68580 from rhofour/fix-source-generation
First attempt at fully qualifying the default values of C# properties.
2022-11-23 17:19:26 +01:00
R. Alex Hofer 6ab93bd919 Fully qualify C# default values in exported fields.
This avoids issues when the default values rely on using
namespaces.
2022-11-22 18:10:34 -05:00
Rémi Verschelde 52c51563fd
Merge pull request #68866 from raulsntos/dotnet/godot-enums
C#: Synchronize Godot enums with core
2022-11-19 09:40:05 +01:00
Raul Santos 792e618749
C#: Synchronize Godot enums with core 2022-11-19 01:54:23 +01:00
Rémi Verschelde c3132b42cb
Merge pull request #66816 from raulsntos/dotnet/readonly
Add `readonly` to C# methods and types that don't mutate
2022-11-18 16:20:29 +01:00
Raul Santos ac8ea5c821
C#: Remove "?" from CEscape and CUnescape 2022-11-15 01:40:12 +01:00
Raul Santos 71df6d66ae
Add readonly to C# methods and types that don't mutate
Also removes a few unnecessary temp variables
2022-11-14 20:32:20 +01:00
Ignacio Roldán Etcheverry ec521a405a
Merge pull request #68253 from dzil123/fix_array_shuffle
Fix c# Array.Shuffle incorrect mono bindings
2022-11-04 23:54:53 +01:00
dzil123 2fd2a16d92 Fix c# Array.Shuffle incorrect mono bindings 2022-11-04 06:25:31 -07:00
Ignacio Roldán Etcheverry c0de8d32d5
Merge pull request #68092 from raulsntos/dotnet/variant-from-array
C#: Add implicit conversion from arrays to Variant
2022-11-03 14:46:26 +01:00
Aaron Franke 9e952c8386
Allow getting Quaternion rotation in different Euler orders 2022-11-02 19:20:10 -05:00
Raul Santos 99260d972f
C#: Add implicit conversion from arrays to Variant
Adds an implicit conversion from supported array types (the ones that
are equivalent to `Packed*Array` types in Godot) to Variant.
2022-11-02 21:46:32 +01:00
Aaron Franke 8556fdd4bc
Move EulerOrder enum to math_defs.h and global scope 2022-11-02 13:44:13 -05:00
Rémi Verschelde d2e1b4b9f0
Merge pull request #68118 from aaronfranke/quat-from-euler
Replace Quaternion Euler constructor with `from_euler` method
2022-11-02 18:51:59 +01:00
Yuri Rubinsky 9487a6ea32 Add missed Quaternion constructor to C# 2022-11-02 11:41:32 +03:00
Aaron Franke 83634119d4
Replace Quaternion Euler constructor with from_euler method 2022-11-01 09:28:12 -05:00
Rémi Verschelde 5947f22be9
Merge pull request #67578 from KoBeWi/GEDITOR
Unify usage of GLOBAL/EDITOR_GET
2022-10-31 13:15:58 +01:00
Ignacio Roldán Etcheverry f66a352c0f C#: Add Variant conversion callbacks for generic Godot collections
This allows using generic Godot collections as type arguments for other
generic Godot collections. This also allows generic Godot collections
as parameter or return type in dynamic Callable invocations.
2022-10-30 01:24:15 +02:00
Ignacio Roldán Etcheverry 282bd37e5c C#: Remove need for reflection to invoking callable delegates
We aim to make the C# API reflection-free, mainly for concerns about
performance, and to be able to target NativeAOT in refletion-free mode,
which reduces the binary size.

One of the main usages of reflection still left was the dynamic
invokation of callable delegates, and for some time I wasn't sure
I would find an alternative solution that I'd be happy with.

The new solution uses trampoline functions to invoke the delegates:

```
static void Trampoline(object delegateObj, NativeVariantPtrArgs args, out godot_variant ret)
{
    if (args.Count != 1)
        throw new ArgumentException($"Callable expected 1 arguments but received {args.Count}.");

    string res = ((Func<int, string>)delegateObj)(
        VariantConversionCallbacks.GetToManagedCallback<int>()(args[0])
    );

    ret = VariantConversionCallbacks.GetToVariantCallback<string>()(res);
}

Callable.CreateWithUnsafeTrampoline((int num) => "Foo" + num, &Trampoline);
```

Of course, this is too much boilerplate for user code. To improve this,
the `Callable.From` methods were added. These are overloads that take
`Action` and `Func` delegates, which covers the most common use cases:
lambdas and method groups:

```
// Lambda
Callable.From((int num) => "Foo" + num);

// Method group
string AppendNum(int num) => "Foo" + num;
Callable.From(AppendNum);
```

Unfortunately, due to limitations in the C# language, implicit
conversions from delegates to `Callable` are not supported.

`Callable.From` does not support custom delegates. These should be
uncommon, but the Godot C# API actually uses them for event signals.
As such, the bindings generator was updated to generate trampoline
functions for event signals. It was also optimized to use `Action`
instead of a custom delegate for parameterless signals, which removes
the need for the trampoline functions for those signals.

The change to reflection-free invokation removes one of the last needs
for `ConvertVariantToManagedObjectOfType`. The only remaining usage is
from calling script constructors with parameters from the engine
(`CreateManagedForGodotObjectScriptInstance`). Once that one is made
reflection-free, `ConvertVariantToManagedObjectOfType` can be removed.
2022-10-30 01:24:15 +02:00
Raul Santos 687633e5bd
Use .generated suffix for generated C# code
Use the `.generated` suffix instead of `_Generated` so .NET marks C#
file generated by Godot source generators as generated code.
2022-10-22 23:13:52 +02:00
kobewi e48c5daddf Unify usage of GLOBAL/EDITOR_GET 2022-10-18 19:01:48 +02:00
Ignacio Roldán Etcheverry 9afc8337bd
Merge pull request #67440 from raulsntos/dotnet/bindings-conflicts
Guard against more potential conflicts in C# bindings generator
2022-10-17 00:28:07 +02:00
Ignacio Roldán Etcheverry 2303c26783 C#: Load assemblies as collectible only in the Godot editor
We use collectible AssemblyLoadContexts as that's the only way to allow
reloading assemblies after building. However, collectible assemblies
have some restrictions:

- https://learn.microsoft.com/en-us/dotnet/framework/reflection-and-codedom/collectible-assemblies#restrictions-on-collectible-assemblies

Those restrictions can cause issues with third-party code, such as some
mocking libraries.

In order to work around this problem, we're going to load assemblies
as collectible only in Godot editor, and not when running games.
These issues will still exist in the editor, but this will be enough
for some users.
2022-10-17 00:22:48 +02:00
Yuri Rubinsky 04f7207009 Add a Plane(Vector3, Vector3) constructor for C# 2022-10-16 14:10:58 +03:00
Raul Santos 333f88dc49
Guard against more potential conflicts in C# bindings generator 2022-10-15 12:47:10 +02:00
Rémi Verschelde b9e924c806 Merge pull request #67216 from dotlogix/Bugfix/FixErrorWhenSerializingSignals
Fix crash when serializing empty delegates in C#
2022-10-13 09:05:22 +02:00
Alexander Schill 5f47873f10 Adding null check to prevent null reference exception when serializing delegates in C# 2022-10-13 00:19:46 +02:00
Rémi Verschelde f2248969db
Merge pull request #66952 from bruvzg/macos_net_export
Fix macOS .NET export.
2022-10-12 22:52:59 +02:00
Micky fe56c1ff75 Use JSON::stringify where possible 2022-10-11 00:27:23 +02:00
Raul Santos fbea89d4f1
C#: Generate symbols packages 2022-10-08 13:59:06 +02:00
bruvzg 6daf4c6593
[.NET Export] Improve .NET export process.
[macOS export] Fix incorrect file placement, search paths and architecture detection.
[macOS export] Automatically detect executable files and set +x flag.
[macOS export] Automatically apply "Disable Library Validation" entitlements when required.
[macOS export] Remove old Mono export code.
Fix folder tree creation for shared objects export.
Add arch suffix to the exported .NET "data" folder name.
Remove old Mono code from .NET "data" folder lookup.
2022-10-07 13:33:06 +03:00
Raul Santos 86f6662a8c
C#: Fix signature of generated signal callbacks
- Use `long` and `double` types since signals currently only support 64-bit types.
- Fix bug for checking if the type name is a class registered in ClassDB.
2022-10-07 12:11:24 +02:00
Rémi Verschelde 340f62d1ec .NET: Generate SdkPackageVersions.props from version.py
Ensures that the versions always match the Godot version, albeit following
SemVer 2.0 so inserting a dot between "beta" and the build number.

For "stable" status, we omit the suffix as this would be interpreted as a
pre-release build too.

So we have:

| Godot version  | Nupkg version  |
| -------------- | -------------- |
| 4.0.0-beta     | 4.0.0-beta     |
| 4.0.0-beta2    | 4.0.0-beta.2   |
| 4.0.0-rc1      | 4.0.0-rc.1     |
| 4.0.0-stable   | 4.0.0          |
2022-10-05 20:31:26 +02:00
Rémi Verschelde 52f5a58c38 Merge pull request #66873 from akien-mga/script-tweak-error-invalid-script-type
GDScript/C#: Tweak error message for invalid script type for object
2022-10-05 08:38:52 +02:00
Aaron Franke 2cea42cc7f
Rename Projection matrix to columns 2022-10-04 12:34:19 -05:00
Rémi Verschelde 5bf95518fd GDScript/C#: Tweak error message for invalid script type for object
See #66870.
2022-10-04 12:56:49 +02:00
Rémi Verschelde cd7f172cf8 Merge pull request #66804 from akien-mga/core-remove-NO_SAFE_CAST
Remove unsupported `NO_SAFE_CAST`/`-fno-rtti` from Android build
2022-10-04 10:22:24 +02:00
Raul Santos 67d058da30
C#: Use Span in Color to avoid string allocations 2022-10-03 12:11:37 +02:00
Rémi Verschelde 82b87d7a17 Remove unsupported NO_SAFE_CAST/-fno-rtti from Android build
Android was the last platform to still attempt to disable RTTI (for binary
size), but both the Android editor and now the ICU library used by templates
need RTTI.

There could still be the possibility to support this for non-ICU template
builds (i.e. without the TextServerAdvanced module), but since this isn't one
of the build configurations we test regularly it's pretty risky to keep this
option only for that specific use case. And our code is already littered with
`dynamic_cast`s which weren't guarded with `!defined(NO_SAFE_CAST)`.
2022-10-03 11:18:31 +02:00
Rémi Verschelde 9c2894180d Merge pull request #66387 from aaronfranke/cs-basis-euler
C#: Update Basis Euler angle code to match core
2022-10-03 09:26:16 +02:00
Patrick Dawson 161f295f52 ManagedCallable: use delegate target instead of middleman when possible
If the delegate target is an Object, the connected signal will be registered in that object instead of the middleman. So when that object is destroyed, the signal will be properly disconnected.
2022-10-01 02:09:58 +02:00
Rémi Verschelde ef8834a642 Merge pull request #64784 from yedpodtrzitko/yed/ci-add-mypy
ci: add Python static analysis check via mypy
2022-09-30 17:44:39 +02:00
Rémi Verschelde 166df0896c Fix typos with codespell
Using codespell 2.3-dev from current git.

And fix typo in `methods.py` for `vsproj=yes` option (still won't work
though).
2022-09-30 14:23:36 +02:00
Jiri Suchan c5bd2f9dce ci: add Python static analysis check via mypy 2022-09-30 19:03:17 +07:00
Rémi Verschelde 39facb35a0 SCons: Unify tools/target build type configuration
Implements https://github.com/godotengine/godot-proposals/issues/3371.

New `target` presets
====================

The `tools` option is removed and `target` changes to use three new presets,
which match the builds users are familiar with. These targets control the
default optimization level and enable editor-specific and debugging code:

- `editor`: Replaces `tools=yes target=release_debug`.
  * Defines: `TOOLS_ENABLED`, `DEBUG_ENABLED`, `-O2`/`/O2`
- `template_debug`: Replaces `tools=no target=release_debug`.
  * Defines: `DEBUG_ENABLED`, `-O2`/`/O2`
- `template_release`: Replaces `tools=no target=release`.
  * Defines: `-O3`/`/O2`

New `dev_build` option
======================

The previous `target=debug` is now replaced by a separate `dev_build=yes`
option, which can be used in combination with either of the three targets,
and changes the following:

- `dev_build`: Defines `DEV_ENABLED`, disables optimization (`-O0`/`/0d`),
  enables generating debug symbols, does not define `NDEBUG` so `assert()`
  works in thirdparty libraries, adds a `.dev` suffix to the binary name.

Note: Unlike previously, `dev_build` defaults to off so that users who
compile Godot from source get an optimized and small build by default.
Engine contributors should now set `dev_build=yes` in their build scripts or
IDE configuration manually.

Changed binary names
====================

The name of generated binaries and object files are changed too, to follow
this format:

`godot.<platform>.<target>[.dev][.double].<arch>[.<extra_suffix>][.<ext>]`

For example:
- `godot.linuxbsd.editor.dev.arm64`
- `godot.windows.template_release.double.x86_64.mono.exe`

Be sure to update your links/scripts/IDE config accordingly.

More flexible `optimize` and `debug_symbols` options
====================================================

The optimization level and whether to generate debug symbols can be further
specified with the `optimize` and `debug_symbols` options. So the default
values listed above for the various `target` and `dev_build` combinations
are indicative and can be replaced when compiling, e.g.:

`scons p=linuxbsd target=template_debug dev_build=yes optimize=debug`
will make a "debug" export template with dev-only code enabled, `-Og`
optimization level for GCC/Clang, and debug symbols. Perfect for debugging
complex crashes at runtime in an exported project.
2022-09-26 16:31:46 +02:00
Rémi Verschelde 49fcf4ffad Style: Cleanup header guards for consistency
Fix file names for {Static,Lightmap}RaycasterEmbree.
2022-09-26 13:51:17 +02:00
Aaron Franke fe7135344b
C#: Update Basis Euler angle code to match core 2022-09-25 22:28:52 -05:00
Ignacio Roldán Etcheverry 62792eeb9f
Merge pull request #66253 from raulsntos/dotnet/assembly-may-be-null
C#: Guard against null assemblies
2022-09-22 18:24:31 +02:00
Raul Santos 24ac82e235
C#: Suppress EventHandler suffix diagnostic for signals
Suppress CA1711 for signal delegates because they are used in events so
the naming follows the guidelines.
2022-09-22 14:23:01 +02:00
Raul Santos f6d60764d3
C#: Guard against null assemblies
A symbol's containing assembly will be null if the symbol is shared
across multiple assemblies.
2022-09-22 12:41:38 +02:00
Rémi Verschelde d96b7d767a Merge pull request #66110 from Zylann/reference_get_count
get_reference_count()`
2022-09-22 08:26:29 +02:00
Marc Gilleron 474cee7daf Rename and expose RefCounted::get_reference_count() 2022-09-21 21:18:54 +01:00
Raul Santos 5be5f167a1
C#: Rename PlusFile to PathJoin 2022-09-19 18:25:29 +02:00
kobewi 9f2dc68279 Replace File/Directory with FileAccess/DirAccess 2022-09-19 11:03:31 +02:00
Rémi Verschelde 956ea15e81 Merge pull request #65879 from magian1127/4.0GenSDoc
inheritdoc the "///" comment from EventHandler to the generated event
2022-09-19 09:23:05 +02:00