Commit Graph

1066 Commits

Author SHA1 Message Date
Raul Santos 6a7ca43297
Expose `String.SimplifyPath` in C#
(cherry picked from commit 126b1ea149)
2021-09-14 13:41:26 +02:00
Paul Joannon e2b71de38b
Improve C# method listing
- implement CSharpInstance::get_method_list
- loop through parent classes in CSharpInstance::get_method_list and CSharpScript::get_script_method_list (#46408)

(cherry picked from commit 19f25b6847)
2021-09-14 13:41:26 +02:00
Haoyu Qiu 70853fd669 Remove do{ } while(0) wrapper around error macros 2021-09-12 15:04:53 +08:00
PouleyKetchoupp 781b979292 Fix NodePath default argument in mono bindings
Backport from master, mono was generating "" as default argument
instead of (NodePath)"".
2021-09-06 10:46:33 -07:00
Raul Santos cacf3e28fd Add documentation to GodotSharp
- Adds documentation to almost every class and member in `GodotSharp`
- Fixes some old documentation to more closely follow the XML comments convention
2021-09-04 20:15:53 +02:00
Raul Santos d76562ceb9 Fix constant tag documentation in C# bindings generator 2021-09-03 23:02:14 +02:00
Rémi Verschelde f0b37b1519
doc: Point URLs to 3.4 version of the online docs 2021-08-12 17:08:10 +02:00
Rémi Verschelde a418d09617
Merge pull request #51166 from RandomShaper/fix_can_reset_3.x 2021-08-09 09:19:25 +02:00
Raul Santos dd9c07ee46 Ensure MSBuildPanel buttons are instantiated 2021-08-06 22:32:54 +02:00
31 659b89c615
Fix 'script_class' null access when reloading a deleted C# script
(cherry picked from commit 6fd2edddc0)
2021-08-06 13:03:03 +02:00
Rémi Verschelde 70784f983b
Mono: Remove diagnostics incompatible with 3.x codebase 2021-08-06 12:59:17 +02:00
Raul Santos 332e31260e
Reduce C# Dictionary internal calls
- Implements new `KeyValuePairs` and `KeyValuePairAt` internal calls
to get the `key` and the `value` in one call.
- Caches the `DictionaryEntry` to reuse properties without repeating
internal calls.

(cherry picked from commit 2deefd938f)
2021-08-06 11:10:04 +02:00
Raul Santos ca32c18458
Add documentation to Dictionary in C#
Adds documentation to `Godot.Collections.Dictionary` in C#.

(cherry picked from commit 0669ffcd15)
2021-08-06 11:09:56 +02:00
Raul Santos 5c206c38f9
Simplify C# print methods
- Extracts the parameters logic to a single method
- Simplify the handling of null parameters

(cherry picked from commit ad460cde79)
2021-08-05 16:35:55 +02:00
Yuri Sizov 3857fd5ceb Fix the editor theme application for the Mono build log 2021-08-03 22:11:33 +03:00
Raul Santos ecb973ab02
Use `allowEmpty` parameter in Split
(cherry picked from commit b7a66a820b)
2021-08-03 09:15:33 +02:00
Ignacio Roldán Etchevery e72fdc4b95 C#+iOS: Cache AOT compilater output
Implemented some basic caching to avoid unnecessary AOT compilation
of unchanged assemblies that were already compiled previously.
This reduces iOS export times considerably for subsequent builds
since many dependencies never change, such as framework assemblies
and the Godot bindings.

The AOT compiler asm output and object files are now placed in
`res://.mono/temp/obj/<CONFIG>/godot-aot-cache/` instead of a
temporary directory.
2021-08-02 17:27:47 +02:00
Ignacio Etcheverry 417a69c643 Implement CSharpScript::inherits_script()
(cherry picked from commit 840255a04b)
2021-08-02 15:30:13 +02:00
Pedro J. Estébanez 7426b3fa91 Add Script::inherits_script()
Partial cherry-pick of 5d4dc2d45c.

Co-authored-by: Juan Linietsky <reduzio@gmail.com>
2021-08-02 15:18:30 +02:00
Raul Santos 9fd201c7a4
Ignore paths with invalid chars in PathWhich
(cherry picked from commit d636ebbfe9)
2021-07-27 12:17:14 +02:00
Raul Santos 2d60a64260
Use Array.Empty instead of allocating a every time
Use `System.Array.Empty<T>` to get an empty array instead of allocating
a new one every time. Since arrays are immutable there is no need to
allocate them every time.

(cherry picked from commit accd05f4ad)
2021-07-27 12:17:09 +02:00
Aaron Franke 1180256090
Add documentation to Array in C#
(cherry picked from commit 080f44a3b7)
2021-07-26 13:35:52 +02:00
Raul Santos 6ea8334012
Fix documentation in StringExtensions
(cherry picked from commit ba99387bf3)
2021-07-26 13:35:12 +02:00
Aaron Franke 17551fe29e
[3.x] Add a simple C# .editorconfig 2021-07-24 16:27:57 -04:00
Rémi Verschelde f8264abb46
Mono: Remove info dialog discouraging use in production
While there are still various bugs to solve and features to implement, the C#
support as of Godot 3.4 is fairly mature and already used by a number of users
in production. Now that we default to dotnet CLI as build tool, it also seems
to be more reliable than MSBuild.

The documentation can (and does for the most part) point out some caveats that
users should be aware of, but this info dialog has outlived its intended
purpose.

(cherry picked from commit 671467b888)
2021-07-20 13:05:04 +02:00
JestemStefan 9513354f68 Added signed_angle_to for Vector3
Added signed_angle_to method for Vector3

Added signed_angle_to for Vector3

formatting fix...
2021-07-09 12:49:12 +02:00
Hugo Locurcio 3b11b1022d
Remove unused code related to Travis CI
(cherry picked from commit 257a8a337e)
2021-07-06 11:19:56 +02:00
Aaron Franke 85a0345d57
[3.x] Add Quat angle_to method 2021-06-18 11:00:44 -04:00
Marcel Admiraal 7e03bd1671 Remove duplicate WARN_PRINTS macro 2021-06-18 12:57:59 +01:00
Aaron Franke b3ac1669c0
[3.x] Fix C# bindings generator for default value types 2021-06-18 01:07:28 -04:00
Pedro J. Estébanez 2d1943b8d1
Fix slow load/save of scenes with many instances of the same script
(cherry picked from commit 2ca6b9c610)
2021-06-17 12:47:54 +02:00
Marcel Admiraal 5a58516231 Remove duplicate ERR_PRINTS macro 2021-06-16 11:56:25 +01:00
Rémi Verschelde 80e1585a6e
Style: Cleanup uses of double spaces between words
Or after punctuation. Tried to leave third-party stuff alone, unless it has
been heavily modified for Godot.

(cherry picked from commit c1c76850cb)
2021-06-07 12:06:59 +02:00
Ignacio Roldán Etchevery a3722a73aa C#+iOS: Fix crash at exit for passing NULL domain to mono_jit_cleanup 2021-06-02 01:34:00 +02:00
Ignacio Roldán Etchevery 4838e609ee C#+iOS: Fixes for games exported with `Use Interpreter` disabled
Added `SystemConfiguration.framework` to the Xcode project to fix
undefined symbols errors building without the interpreter, like:
`_SCNetworkReachabilityScheduleWithRunLoop`.

Added explicit static constructors to the generated `NativeCalls`
class to avoid a `TypeInitializationException` at startup when
Godot attempts to read the static fields (like `godot_api_hash`)
from this class.
This seems to be an issue with Mono's AOT compiler and classes
with the `beforefieldinit` attribute. Not sure if it only happens
when the fields are only accessed via reflection as was our case.
Explicitly declaring the static constructor makes the C# compiler
not add the `beforefieldinit` attribute to the class.
2021-06-02 01:34:00 +02:00
Ignacio Roldán Etchevery 21a739e3b1 C#+iOS: Fix P/Invoke symbols being stripped by the linker
We use `Mono.Cecil` to search for P/Invoke methods in assemblies in
order to collect symbols that we must prevent from being stripped.

We could pass the symbols as `-u` linker arguments (`-Wl,-u,symbol`)
for the native target (not for the project), but it was simpler to
generate referencing code and avoid changes to Godot's iOS exporter.
2021-06-02 01:34:00 +02:00
Ignacio Roldán Etchevery c9047de455 C#+iOS: Fix simulator builds
Replaced obsolete preprocessor check for simulator/device in C code.
Architecture can no longer be used to determine this with Apple Silicon.
The new code uses `TARGET_OS_SIMULATOR` from `TargetConditionals.h`.

We have some mono libs which can only be used in devide builds.
We were adding them as static libs. Previously it was only causing
warnings because missing arch for the simulator, but now this
is treated as an error.

To fix this we turn them into xcframeworks with dummy static libs
for the simulator and the actual ones for devices.
2021-06-02 01:34:00 +02:00
Ignacio Roldán Etchevery 7569f2dccb Fix copying Mono shared libs on macOS 2021-06-02 01:33:55 +02:00
bruvzg 683f96df35 Add separate `simulator` flag for iOS build, change main library to `xcframework`.
Build and export iOS Mono libs as `.xcframework`s, for Apple Silicon iOS simulator support.
2021-06-02 01:09:03 +02:00
Hugo Locurcio a38b447413
Highlight control flow keywords with a different color
This makes them easier to distinguish from other keywords.
2021-05-25 00:31:39 +02:00
Rémi Verschelde eb78f80f03
Fix typos with codespell
Using codespell 2.0.0.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
dof
doubleclick
fave
findn
GIRD
leapyear
lod
merchantibility
nd
numer
ois
ony
que
seeked
synching
te
uint
unselect
webp
EOF

$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2021-05-20 12:56:56 +02:00
Pedro J. Estébanez 817ffc01e1
Make all file access 64-bit (`uint64_t`)
This changes the types of a big number of variables.

General rules:
- Using `uint64_t` in general. We also considered `int64_t` but eventually
  settled on keeping it unsigned, which is also closer to what one would expect
  with `size_t`/`off_t`.
- We only keep `int64_t` for `seek_end` (takes a negative offset from the end)
  and for the `Variant` bindings, since `Variant::INT` is `int64_t`. This means
  we only need to guard against passing negative values in `core_bind.cpp`.
- Using `uint32_t` integers for concepts not needing such a huge range, like
  pages, blocks, etc.

In addition:
- Improve usage of integer types in some related places; namely, `DirAccess`,
  core binds.

Note:
- On Windows, `_ftelli64` reports invalid values when using 32-bit MinGW with
  version < 8.0. This was an upstream bug fixed in 8.0. It breaks support for
  big files on 32-bit Windows builds made with that toolchain. We might add a
  workaround.

Fixes #44363.
Fixes godotengine/godot-proposals#400.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2021-05-16 17:52:31 +02:00
Rémi Verschelde b5e1e05ef2
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks 2021-05-04 14:45:16 +02:00
Rémi Verschelde 64a63e0861
Style: clang-format: Disable AllowShortCaseLabelsOnASingleLine 2021-05-04 14:45:15 +02:00
Rémi Verschelde 3d15f04668
Style: clang-format: Disable AllowShortIfStatementsOnASingleLine 2021-05-04 14:45:15 +02:00
Rémi Verschelde 6e600cb3f0
Style: Set clang-format Standard to c++14 2021-05-04 14:45:15 +02:00
Rémi Verschelde 7e61be3cb0
Style: Remove executable bit from non-runnable files 2021-05-04 14:45:07 +02:00
Rémi Verschelde 62bea72601
doc: Sync classref with Mono build 2021-05-03 22:34:11 +02:00
kleonc 4d7f642fb3 Improve some argument names for core types 2021-04-23 15:34:24 +02:00
Ignacio Roldán Etcheverry 83494c30fe C#: Fix `double` casting in wasm m2n trampolines
The trampolines were casting double to `size_t` (likely a copy-paste
mistake), so the value was getting truncated.
2021-04-17 05:24:00 +02:00
Rémi Verschelde 015973df04
doc: Make all tutorial links point to 3.3 branch of docs 2021-03-26 10:43:43 +01:00
Matthew A. Robinson b4455ffd75 Add mutex protecting script bindings map from getting corrupted 2021-03-22 20:26:44 -04:00
Rémi Verschelde a0f56b5459
Mono: Fix Android build after #46900
(cherry picked from commit 2274d4eebc)
2021-03-18 17:58:49 +01:00
Ilya Kuznetsov cacf96962d
Added mono_unhandled_exception call to unhandled_exception hook
(cherry picked from commit 6061ff7ba1)
2021-03-17 15:17:02 +01:00
Rémi Verschelde e6b291b152
Mono: Bump Godot.NET.Sdk to 3.3.0
Using only 3.3 results in a build warning.

Follow-up to #47055.
2021-03-17 14:46:26 +01:00
Rémi Verschelde 0341251d0f
Bump version to 3.3-rc
We decided to rename the upcoming 3.2.4 release to 3.3 to better reflect that
it is a significant feature release, and not a maintenance update.

The `3.2` branch was also renamed to `3.x` and will now be the development
branch for future 3.x releases (3.3, 3.4, etc.).
2021-03-16 12:16:36 +01:00
Ev1lbl0w a586f9daae
Replace malloc's with Godot's memalloc macro
(cherry picked from commit 838e7d0a8d)
2021-03-13 22:01:27 +01:00
Ignacio Etcheverry 10c8438178
C#: Fix StringName leak warnings after generating bindings
`Main::cleanup()` prints warnings if it finds `StringName`s still alive.
We need the `BindingsGenerator` to be destructed before calling cleanup.

(cherry picked from commit d9603b2d73)
2021-03-13 21:56:31 +01:00
Rémi Verschelde 558d524bcb Mono: Don't use C++17 [[maybe_unused]] to preserve C++14 compatibility
The 3.2 branch compiles against the C++14 standard to keep good compatibility
with somewhat older compilers.

Fixes #45839.
2021-03-05 23:28:09 +01:00
Shane Liesegang 4d06a5c2b0 Mono/macOS: Separate data dir into frameworks and resources for codesigning
Co-authored-by: Ignacio Etcheverry <ignalfonsore@gmail.com>
(cherry picked from commit 42eb09ddcc)
2021-03-04 12:21:17 +01:00
Aaron Franke b2d723b039 Add generic support to PackedScene.Instance
(cherry picked from commit 3f50954ced)
2021-03-02 10:26:14 +01:00
Pedro J. Estébanez 6f4f49c1d5 Make glue generation shutdown more graceful
(cherry picked from commit 23907e6f19)
2021-02-22 21:40:16 +01:00
Pedro J. Estébanez 6d89f675b1 Modernize Thread
- Based on C++11's `thread` and `thread_local`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed (except for the few cases of non-portable functions)
- Simpler for `NO_THREADS`
- Thread ids are now the same across platforms (main is 1; others follow)
2021-02-18 11:58:08 +01:00
Pedro J. Estébanez 4ddcdc031b Modernize Mutex
- Based on C++11's `mutex`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed
- Simpler for `NO_THREADS`
- `BinaryMutex` added for special cases as the non-recursive version
- `MutexLock` now takes a reference. At this point the cases of null `Mutex`es are rare. If you ever need that, just don't use `MutexLock`.
- `ScopedMutexLock` is dropped and replaced by `MutexLock`, because they were pretty much the same.
2021-02-18 11:58:08 +01:00
bruvzg 9e4cecc8ea [Mono] Use the same search logic for both `MSBuild` and `dotnet`, add custom search paths on macOS.
(cherry picked from commit e304f716c7)
2021-02-05 09:29:29 +01:00
zaevi f94dffd2de
Fix C# string.Hash()
(cherry picked from commit baac70c27e)
2021-02-02 13:30:54 +01:00
Ivan Shakhov 7ecc2561cd
Fix off by one error navigating to line number in Rider
Fixes https://github.com/JetBrains/godot-support/issues/61

(cherry picked from commit deef9a73a5)
2021-02-02 13:02:46 +01:00
Aaron Franke 226528097e
[3.2] Backport hex_to_int/bin_to_int zero check and C# changes 2021-01-28 09:24:44 -05:00
Ignacio Etcheverry 44d8669364
C#: Fix System.Collections.Generic.List marshalling
(cherry picked from commit da90364adf)
2021-01-26 17:00:17 +01:00
Rémi Verschelde 9f2c24e8ce
Cleanup: Remove executable bit from files which don't need it
Drop unused xpmfix.sh script.

(cherry picked from commit 76c6007aa6)
2021-01-26 17:00:15 +01:00
magian1127 cb679dc434 C # mono supports Unicode code 2021-01-18 16:34:10 +08:00
Rémi Verschelde 49646383f1
Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆

(cherry picked from commit b5334d14f7)
2021-01-13 16:17:06 +01:00
Rémi Verschelde 188609e5ab
CI: Update to clang-format 11 and apply ternary operator changes
(cherry picked from commit af878716f2)
2021-01-13 16:14:35 +01:00
Eyad d4bfa5a684
Fixes #42149 and fixes indentation errors to pass clang-format
(cherry picked from commit be1c161b0b)
2020-12-29 16:02:01 +01:00
Ignacio Etcheverry bf942447a3
Mono: Add extra WASM framework assemblies on game export
This is needed with newer Mono versions, at least with Mono 6.12+

Depends on the following commit from our build scripts:
godotengine/godot-mono-builds@9d75cff174

(cherry picked from commit b98e8b11e6)
2020-12-29 16:01:59 +01:00
Ignacio Etcheverry 1a5e985ed4 [3.2] Mono: Make Godot provide its own WASM m2n trampolines
This depends on a custom Mono patch from this commit:
godotengine/godot-mono-builds@0e312939bd
2020-12-14 19:46:41 +01:00
Ignacio Etcheverry 2c89152b33 Mono: Don't use -rdynamic when compiling for WASM
`-rdynamic` was causing the emsdk linker to silently fail to
generate the output `.wasm` file (even though exit code was 0).
2020-12-13 21:46:38 +01:00
Rémi Verschelde 31cd9e560c
Mono: Fix GodotTools build after invalid cherry-pick
I wrongly resolved the cherry-pick conflict in c5acdfb5f5.
2020-12-10 17:54:37 +01:00
Hugo Locurcio 8542d6ecd5
Tweak log file names for consistency between Mono and non-Mono logs
- Avoid spaces in Mono log file names.
- Use a `.log` extension for Mono logs, just like non-Mono logs.
- Use periods to separate hours/minutes/seconds for non-Mono logs.

(cherry picked from commit 4d81776fc9)
2020-12-09 11:22:05 +01:00
Ignacio Etcheverry a624448197
Mono: Add mono_bcl SCons option for a custom BCL location
Makes it let's bothersome to work with builds from our
godotengine/godot-mono-builds scripts, as they write the
BCL into an output directory separate from the runtime
(which is good as two runtimes may share the same BCL).

(cherry picked from commit dd5ace219d)
2020-12-09 11:22:05 +01:00
Ignacio Etcheverry 2725ce6798
Fix unhandled exception re-thrown in the editor
(cherry picked from commit bbaf854956)
2020-12-09 11:22:05 +01:00
Ignacio Etcheverry c5acdfb5f5
C#: Fix very slow build log update in the editor
(cherry picked from commit b0eb9061e4)
2020-12-09 11:22:05 +01:00
Ignacio Etcheverry a07589e2ad C#: Bump Godot.NET.Sdk version to 3.2.4 2020-12-06 01:12:10 +01:00
Ignacio Etcheverry cd339ff002 C#: Remove ProjectTypeGuids from Godot.NET.Sdk
The property has no effect as the older VS project system doesn't
work with Sdk style projects.

The presence of the property was preventing Visual Studio for Mac
from opening the project if the Godot extension is not installed.
2020-12-06 01:12:10 +01:00
Ignacio Etcheverry d639941446 C#: Fix targeting .NETFramework with Godot.NET.Sdk and .NET 5
Our target was overriding the official one, while not doing its job
assuming it was already taken care of...
2020-12-06 01:12:10 +01:00
Ignacio Etcheverry 9b24d5f2d0 C#: Don't overwrite newer Godot.NET.Sdk patch version in csproj
Allow game projects to use a Godot.NET.Sdk with a newer patch version.
The major and minor version are still required to be the same.

For example: Allow a Godot 3.2.4 C# project to use a hypothetical
3.2.5 version of Godot.NET.Sdk.
2020-12-06 01:11:31 +01:00
Aaron Franke 3b10458a5d
Add HexEncode to C#
(cherry picked from commit 6b54d7dde1)
2020-11-17 12:02:00 +01:00
Aaron Franke e3419a7fe1
Add LStrip and RStrip to C# strings
(cherry picked from commit c89af1d433)
2020-11-17 12:01:59 +01:00
Aaron Franke 9c83b8ed70
[3.2] Improve comments in Color documentation 2020-11-14 04:56:18 -05:00
Yuri Roubinsky 23620ff046
[Mono] Added Shuffle method to Array
(cherry picked from commit 156e4043b4)
2020-11-11 15:30:57 +01:00
Aaron Franke 1bb81488bb
Minor clamp and float fixes
(cherry picked from commit ee79fc627c)
2020-11-11 15:30:57 +01:00
Rémi Verschelde 0237d42809
Merge pull request #42547 from neikeq/3.2-rework-csharp-build-panel
[3.2] C#: Re-work solution build output panel
2020-10-20 15:12:30 +02:00
Aaron Franke 730d42d8a4
Add GetStringFromUTF8 and GetStringFromASCII
(cherry picked from commit 029de52001)
2020-10-19 16:10:01 +02:00
Rémi Verschelde 9bbfa929bc
Mono: Fix typo in Godot.NET.Sdk.nuspec
Fixes #42666.

(cherry picked from commit 1af3cf15c2)
2020-10-19 16:09:59 +02:00
Ignacio Etcheverry fdfba05fab [3.2] C#: Re-work solution build output panel
- Removed item list that displayed multiple build
  configurations launched. Now we only display
  the last build that was launched.
- Display build output next to the issues list.
  Its visibility can be toggled off/on.
  This build output is obtained from the MSBuild
  process rather than the MSBuild logger. As such
  it displays some MSBuild fatal errors that
  previously couldn't be displayed.
- Added a context menu to the issues list with
  the option to copy the issue text.
- Replaced the 'Build Project' button in the panel
  with a popup menu with the options:
  - Build Solution
  - Rebuild Solution
  - Clean Solution
- The bottom panel button was renamed from 'Mono'
  to '.NET' and now display an error/warning icon
  if the last build had issues.
2020-10-11 16:51:54 +02:00
Sergey Minakov 5d1284204d iOS: port ARC support 2020-10-06 00:23:25 +03:00
Eduardo Rodrigues f14e569ab3
Fix error message when exporting a write-only property without a setter
(cherry picked from commit aca0cede67)
2020-10-01 16:00:43 +02:00
Hugo Locurcio 7b3f9ebb94
Enable the `copy_mono_root` SCons option by default
This closes #41652.

(cherry picked from commit cfd564b385)
2020-09-29 13:57:55 +02:00
Aaron Franke ea3bbbe0f2
Add concatenation support and a new ctor to Godot.Collections.Array
(cherry picked from commit a4dcd48d16)
2020-09-24 14:43:10 +02:00
Ricardo Alcantara 197b375b89
Basis RotationQuat should be public.
(cherry picked from commit a676b8ea66)
2020-09-24 14:43:08 +02:00