Commit graph

1302 commits

Author SHA1 Message Date
Marcel Admiraal da5d7db610 Rename File::get_len() get_length() 2021-05-25 11:54:28 +01:00
Aaron Franke aa65c91618
Rename Vector2 Perpendicular to Orthogonal in C# 2021-05-21 21:02:38 -04:00
Rémi Verschelde 4219a4cb6f
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:38:56 +02:00
Pedro J. Estébanez 469fa47e06
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-17 15:06:19 +02:00
Rémi Verschelde bcbd480c32
Merge pull request #45144 from dalexeev/color-consts
Rename color constants (alternative)
2021-05-07 12:22:49 +02:00
Hugo Locurcio e905e8f145
Highlight control flow keywords with a different color
This makes them easier to distinguish from other keywords.
2021-05-05 22:38:12 +02:00
Rémi Verschelde 5b16020846
Replace remaining uses of NULL with nullptr
Follow-up to #38736 (these uses were likely added after this PR was merged).
2021-04-29 11:53:27 +02:00
Hugo Locurcio 5d124c4a8f
Remove uses of auto for better readability and online code reviews
The current code style guidelines forbid the use of `auto`.

Some uses of `auto` are still present, such as in UWP code (which
can't be currently tested) and macros (where removing `auto` isn't
easy).
2021-04-26 14:59:28 +02:00
Ignacio Roldán Etcheverry 27a66ee528 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:45:52 +02:00
Matthew A. Robinson be4671534c Add mutex to protect script bindings 2021-03-23 09:37:27 -04:00
Rémi Verschelde 2274d4eebc
Mono: Fix Android build after #46900 2021-03-18 17:58:21 +01:00
Ignacio Etcheverry 5b3b9cd63b C#: Fix disconnecting event signals twice
`disconnect_event_signals` can be called twice (when managed instance
is disposed and from the ScriptInstance destructor).
2021-03-15 07:08:10 +01:00
Rémi Verschelde 1066dbcecc
Merge pull request #46968 from sboronczyk/fix-editor-plugin-mono
Fix create c# script from editor after partial class type is necessary
2021-03-14 00:27:34 +01:00
Rémi Verschelde 7015027cbf
Merge pull request #46900 from Ev1lbl0w/bugfix-malloc_calls
Replace malloc's with Godot's memalloc macro
2021-03-13 21:55:52 +01:00
sboronczyk 094981b277 Fix create c# script after partial class type 2021-03-13 17:31:47 +01:00
Ev1lbl0w 838e7d0a8d
Replace malloc's with Godot's memalloc macro 2021-03-13 11:51:45 +00:00
Rémi Verschelde 8368f53941
Merge pull request #46954 from neikeq/reggr-46307
C#: Fix StringName leak warnings after generating bindings
2021-03-13 09:13:34 +01:00
Ignacio Etcheverry d9603b2d73 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.
2021-03-13 01:16:31 +01:00
Ignacio Etcheverry ee8e5146a4 C#: Fix ScriptPathAttribute generator with none or nested namespaces
The following two bugs were fixed:
- For classes without namespace we were still generating `namespace {`
without a namespace identifier, causing a syntax error.
- For classes with nested namespaces we were generating only the innermost
part of the namespace was being generated, e.g.: for `Foo.Bar` we were
generating `namespace Bar {` instead of `namespace Foo.Bar {`.
This wasn't causing any build error, but because of the wrong namespace
Godot wasn't able to find the class associated with the script.
2021-03-13 01:04:59 +01:00
Rémi Verschelde 26d1b30d35
Merge pull request #46174 from xill47/mono-appdomain-unhandled-exception-event
Added mono_unhandled_exception call to unhandled_exception hook
2021-03-08 13:26:47 +01:00
Ilya Kuznetsov 6061ff7ba1 Added mono_unhandled_exception call to unhandled_exception hook 2021-03-08 12:57:50 +01:00
Rémi Verschelde 15bd2bf03f
Merge pull request #46713 from neikeq/csharp-source-generators-init
Add C# source generator for ScriptPathAttribute
2021-03-07 01:04:47 +01:00
Ignacio Etcheverry e2afe700f6 Add C# source generator for a new ScriptPath attribute
This source generator adds a newly introduced attribute,
`ScriptPath` to all classes that:

- Are top-level classes (not inner/nested).
- Have the `partial` modifier.
- Inherit `Godot.Object`.
- The class name matches the file name.

A build error is thrown if the generator finds a class that meets these
conditions but is not declared `partial`, unless the class is annotated
with the `DisableGodotGenerators` attribute.

We also generate an `AssemblyHasScripts` assembly attribute which Godot
uses to get all the script classes in the assembly, eliminating the need
for Godot to search them. We can also avoid searching in assemblies that
don't have this attribute. This will be good for performance in the
future once we support multiple assemblies with Godot script classes.

This is an example of what the generated code looks like:

```
using Godot;
namespace Foo {
	[ScriptPathAttribute("res://Player.cs")]
	// Multiple partial declarations are allowed
	[ScriptPathAttribute("res://Foo/Player.cs")]
	partial class Player {}
}

[assembly:AssemblyHasScripts(new System.Type[] { typeof(Foo.Player) })]
```

The new attributes replace script metadata which we were generating by
determining the namespace of script classes with a very simple parser.
This fixes several issues with the old approach related to parser
errors and conditional compilation.
It also makes the task part of the MSBuild project build, rather than
a separate step executed by the Godot editor.
2021-03-06 21:50:32 +01:00
Shane Liesegang 42eb09ddcc Mono/macOS: Separate data dir into frameworks and resources for codesigning
Co-authored-by: Ignacio Etcheverry <ignalfonsore@gmail.com>
2021-03-03 13:54:34 +01:00
Aaron Franke 3f50954ced
Add generic support to PackedScene.Instance 2021-02-25 20:49:22 -05:00
Aaron Franke 4b4721f5bd
Fix C# bindings generator for default value types 2021-02-25 08:30:48 -05:00
Pedro J. Estébanez 23907e6f19 Make glue generation shutdown more graceful 2021-02-22 11:06:33 +01:00
Rémi Verschelde ed8333f6bc
Merge pull request #45158 from aaronfranke/cs-packedarray
Add C# array features from core PackedArrays
2021-02-20 09:42:30 +01:00
Rémi Verschelde 8eaea1db53
Merge pull request #45032 from neikeq/classdb-tests-for-44856
Add ClassDB tests to look for core API deps on editor API
2021-02-18 15:16:52 +01:00
Aaron Franke 614299aedb
Add C# array features from core PackedArrays 2021-02-16 15:24:44 -05:00
JestemStefan 2c71ff1119
Added signed_angle_to for Vector3 2021-02-16 05:07:33 -05:00
Xartorx 8e1da2e0e5 Fix Mono build after resource load cache changes 2021-02-13 22:13:45 +03:00
reduz f8d03b98e7 Improve resource load cache
-Added a new method in Resource: reset_state , used for reloading the same resource from disk
-Added a new cache mode "replace" in ResourceLoader, which reuses existing loaded sub-resources but resets their data from disk (or replaces them if they chaged type)
-Because the correct sub-resource paths are always loaded now, this fixes bugs with subresource folding or subresource ordering when saving.
2021-02-11 15:44:28 -03:00
Rafał Mikrut f7209b459b Initialize class/struct variables with default values in modules/ 2021-02-08 10:57:18 +01:00
bruvzg e304f716c7
[Mono] Use the same search logic for both MSBuild and dotnet, add custom search paths on macOS. 2021-02-04 22:39:38 +02:00
Aaron Franke f55445079a
Replace ColorN and from HTML with a string constructor 2021-02-01 17:27:19 -05:00
zaevi baac70c27e
Fix C# string.Hash() 2021-02-01 04:12:00 -05:00
Rémi Verschelde 5525cd85c6
Merge pull request #45315 from RandomShaper/modernize_thread
Modernize Thread
2021-01-31 15:24:56 +01:00
Pedro J. Estébanez 99fe462452 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-01-29 12:02:13 +01:00
Rémi Verschelde 329d4796ae
Merge pull request #45525 from van800/rider-line
Navigating to error line number in Rider from Godot editor debugger console is off-by-one.
2021-01-28 23:39:52 +01:00
Ivan Shakhov deef9a73a5 Fix off by one error navigating to line number in Rider
Fixes https://github.com/JetBrains/godot-support/issues/61
2021-01-28 22:41:12 +01:00
Aaron Franke e829b7aee4
Unify URI encoding/decoding and add to C#
http_escape and percent_encode have been unified into uri_encode, and http_unescape and percent_decode have been unified into uri_decode.
2021-01-28 07:45:01 -05:00
Aaron Franke a3e3bf8227
Make hex_to_int and bin_to_int handle the prefix automatically
Also add BinToInt to C#
2021-01-28 07:43:53 -05:00
Danil Alexeev a97f1a3dc6 Rename color constants (alternative)
Named color constants renamed to UPPERCASE. Unlike #41019, this PR
is complete and implements these changes in the simplest way possible.

Co-authored-by: Shivam Mukherjee <mshivam98@gmail.com>
2021-01-26 19:07:00 +03:00
Rémi Verschelde 9f6a2aa321
Merge pull request #45029 from neikeq/issue-40023
C#: Fix System.Collections.Generic.List marshalling
2021-01-26 15:30:44 +01:00
Rémi Verschelde 76c6007aa6
Cleanup: Remove executable bit from files which don't need it
Drop unused xpmfix.sh script.
2021-01-19 23:36:42 +01:00
magian1127 da234cdbc6 C # mono supports Unicode code 2021-01-19 21:44:07 +08:00
Rémi Verschelde 0b409d89d0
Merge pull request #45136 from akien-mga/clang-format-11
CI: Update to clang-format 11 and apply ternary operator changes
2021-01-13 16:10:44 +01:00
Marcel Admiraal 3ee860e3d1 Update Mono module to use new execute method. 2021-01-13 09:34:14 +00:00
Rémi Verschelde af878716f2
CI: Update to clang-format 11 and apply ternary operator changes 2021-01-12 19:32:53 +01:00
Ignacio Etcheverry fafdc0b0c1 Add ClassDB tests to look for core API deps on editor API
The ClassDB tests will detect when the core API has dependencies on
the editor API, which is not allowed.

This should prevent or warn early about issues like #44856
2021-01-09 00:18:03 +01:00
Ignacio Etcheverry da90364adf C#: Fix System.Collections.Generic.List marshalling 2021-01-08 21:51:25 +01:00
Rémi Verschelde b5334d14f7
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 🎆
2021-01-01 20:19:21 +01:00
Rémi Verschelde 09212fba1e
Fix missed renamings from empty() to is_empty()
Those were missed in #44401 or added by later PRs.
2020-12-29 09:55:07 +01:00
Rémi Verschelde 6cebb8c117
Merge pull request #44586 from madmiraal/rename-stepify
Rename Math::stepify to snapped
2020-12-28 21:46:43 +01:00
Marcel Admiraal b743a2ef3c Rename Math::stepify to snapped 2020-12-28 13:01:30 +00:00
Marcel Admiraal b628912af0 Rename Rect2 and Rect2i grow_margin() to grow_side() 2020-12-28 12:47:33 +00:00
Marcel Admiraal 5b937d493f Rename empty() to is_empty() 2020-12-28 10:39:56 +00:00
Rémi Verschelde 4425f7c2c1
Merge pull request #44515 from eddsanity/master
Fixed #42149: bug where the default C# script template would sometimes produce an invalid class name
2020-12-27 21:40:30 +01:00
Nathan Franke 3fda53c256
Update Rect intersection documentation, and rename method on Mono 2020-12-26 22:16:57 -06:00
Eyad be1c161b0b Fixes #42149 and fixes indentation errors to pass clang-format 2020-12-19 13:47:16 +02:00
Rémi Verschelde b07a3f503b
Merge pull request #44105 from neikeq/mono-wasm-m2n-hook
Mono: Make Godot provide its own WASM m2n trampolines
2020-12-17 09:58:24 +01:00
Ignacio Etcheverry 2af8a72663 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-14 21:16:09 +01:00
Ignacio Etcheverry 7439b5595d 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 21:16:01 +01:00
Ignacio Etcheverry b98e8b11e6 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
2020-12-14 20:55:29 +01:00
Rémi Verschelde 90bdba576a
Merge pull request #43742 from qarmin/editor_modules_default_values
Initialize class/struct variables with default values in platform/ and editor/
2020-12-08 15:53:42 +01:00
Rémi Verschelde d94bf9f7b6
Merge pull request #44136 from neikeq/scons-mono-bcl-option
Mono: Add mono_bcl SCons option for a custom BCL location
2020-12-08 09:43:50 +01:00
Rémi Verschelde a834055c63
Merge pull request #44148 from Calinou/tweak-log-file-names
Tweak log file names for consistency between Mono and non-Mono logs
2020-12-08 09:42:54 +01:00
Aaron Franke 5465e604bb
Improve argument names for core types 2020-12-07 05:01:33 -05:00
Hugo Locurcio 4d81776fc9
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.
2020-12-06 20:17:02 +01:00
Rémi Verschelde d834789f47
Merge pull request #44106 from neikeq/mono-invoke-no-params-boxing
Don't box params on Native->C# calls with Variant params
2020-12-06 09:41:03 +01:00
Ignacio Etcheverry a946f84e3d Don't box params on Native->C# calls with Variant params
Godot uses Variant parameters for calls to script methods.
Up until now we were boxing such parameters when marshalling
them for invokation, even if they were value types.

Now Godot allocates the marshalled parameters on the stack,
reducing the GC allocations resulted from boxing.
2020-12-06 01:36:20 +01:00
Ignacio Etcheverry dd5ace219d 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).
2020-12-06 01:15:20 +01:00
Rémi Verschelde 83cdc9d7b7
Merge pull request #44109 from neikeq/fix-await-to-signal-many-at-once
C#: Fix multiple awaits to same signal result in connect error
2020-12-05 16:42:19 +01:00
Rémi Verschelde 45ecb21901
Merge pull request #44108 from neikeq/editor-fix-unhandled-exception-rethrown
Fix unhandled exception re-thrown in the editor
2020-12-05 16:41:47 +01:00
Rémi Verschelde af61ad5e36
Merge pull request #44107 from neikeq/fix-slow-build-log-update
C#: Fix very slow build log update in the editor
2020-12-05 16:41:24 +01:00
Ignacio Etcheverry b0eb9061e4 C#: Fix very slow build log update in the editor 2020-12-05 00:43:24 +01:00
Ignacio Etcheverry bbaf854956 Fix unhandled exception re-thrown in the editor 2020-12-05 00:40:31 +01:00
Ignacio Etcheverry e2f7037824 C#: Fix multiple awaits to same signal result in connect error
Multiple calls to the same `await ToSignal` were resulting in
"signal already connected to slot" error because the custom
callable comparer was wrong. Comparing only the signal awaiter
handle is the correct way (it's unique for the target).
2020-12-05 00:32:57 +01:00
Rémi Verschelde 0c06fbe6db
Mono: Fix Android build after #36311 2020-12-03 11:17:03 +01:00
Rafał Mikrut e1811b689b Initialize class/struct variables with default values in platform/ and editor/ 2020-12-02 16:09:11 +01:00
Thakee Nathees 42bfa16996 Refactor DocData into core and editor (DocTools) parts 2020-12-02 00:48:39 +05:30
Thakee Nathees d0e7d9b62f Documentation generation for GDScript
- ClassDoc added to GDScript and property reflection data were extracted
from parse tree

- GDScript comments are collected from tokenizer for documentation and
applied to the ClassDoc by the GDScript compiler

- private docs were excluded (name with underscore prefix and doesn't
have any doc comments)

- default values (of non exported vars), arguments are extraced from the
parser

- Integrated with GDScript 2.0 and new enums were added.

- merge conflicts fixed
2020-11-29 19:45:36 +05:30
bruvzg 99666de00f
[Complex Text Layouts] Refactor Font class, default themes and controls to use Text Server interface.
Implement interface mirroring.
Add TextLine and TextParagraph classes.
Handle UTF-16 input on macOS and Windows.
2020-11-26 14:25:48 +02:00
Rémi Verschelde d76806d322
Core: Always enable ptrcall, remove PTRCALL_ENABLED define
ptrcall is now also used to optimize calls in GDScript, on top of the existing
use by the GDNative and Mono modules.

It no longer makes sense to make it optional.
2020-11-25 14:08:17 +01:00
Aaron Franke 02161aad5a
Remove empty lines around braces with the formatting script 2020-11-16 23:38:11 -05:00
Rémi Verschelde f763a2a3db
Merge pull request #43250 from aaronfranke/strext-lstrip
Add LStrip, RStrip, and HexEncode to C#
2020-11-16 09:15:45 +01:00
Aaron Franke 4b272b18ea
Improve comments in Color documentation 2020-11-13 23:31:19 -05:00
Grzegorz Puławski c49810046e Removing unneeded FuncRef code in C# 2020-11-11 21:57:42 +01:00
Aaron Franke ee79fc627c
Minor clamp and float fixes 2020-11-10 14:30:07 -05:00
Adrian Adeva 74f98de223
Updated gd_glue.cpp to work with the latest changes in the variant refactoring
Without this change the engine dont compile with the mono module enabled.
2020-11-10 11:13:54 +01:00
Rémi Verschelde 9d2e8f2f27
Variant: Rename Type::_RID to Type::RID
The underscore prefix was used to avoid the conflict between the `RID` class
name and the matching enum value in `Variant::Type`.

This can be fixed differently by prefixing uses of the `RID` class in `Variant`
with the scope resolution operator, as done already for `AABB`.
2020-11-09 16:29:04 +01:00
Aaron Franke 6b54d7dde1
Add HexEncode to C# 2020-11-09 03:25:51 -05:00
Aaron Franke c89af1d433
Add LStrip and RStrip to C# strings 2020-11-09 03:24:46 -05:00
reduz 127458ed17 Reorganized core/ directory, it was too fatty already
-Removed FuncRef, since Callable makes it obsolete
-Removed int_types.h as its obsolete in c++11+
-Changed color names code
2020-11-07 20:17:12 -03:00
Yuri Roubinsky 156e4043b4 [Mono] Added Shuffle method to Array 2020-11-07 11:26:54 +03:00
Yuri Roubinsky 38fb26794b Exposed randi_range to global funcs + renamed rand_range to randf_range 2020-11-06 17:06:26 +03:00
Hugo Locurcio 7adb6b91b3
Remove Color.contrasted() as its behavior is barely useful
Returning the most contrasting color isn't a trivial task, as there
are often many possible choices. It's usually best left for the user
to implement using a script.
2020-11-03 04:46:08 -05:00
Rémi Verschelde c11992ed48
Merge pull request #43029 from neikeq/offline-nuget-fallback
C#: Make editor create NuGet fallback folder for Godot packages
2020-10-27 08:07:58 +01:00
Rémi Verschelde f594f31823
Merge pull request #43088 from neikeq/fix-custom-event-signal-hot-reload
C#: Fix custom event signals crash on hot-reload
2020-10-27 08:07:33 +01:00
Ignacio Etcheverry 34960cb936 C#: Fix custom event signals crash on hot-reload
Cleanup and re-initialization of event signals before
and after hot-reload should be working correctly now.
2020-10-26 07:00:51 +01:00
Hugo Locurcio a1d9c67f43
Optimize SVG using svgcleaner --multipass
This decreases the editor binary size by about 8 KB.
2020-10-25 10:02:37 +01:00
Ignacio Etcheverry 64b5ee7010 C#: Make editor create NuGet fallback folder for Godot packages
Main benefits:
- Projects can be built offline. Previously you needed internet
  access the first time building to download the packages.
- Changes to packages like Godot.NET.Sdk can be easily tested
  before publishing. This was already possible but required
  too many manual steps.
- First time builds are a bit faster, as the Sdk package doesn't
  need to be downloaded. In practice, the package is very small
  so it makes little difference.

Bumped Godot.NET.Sdk to 4.0.0-dev3 in order to enable the
recent changes regarding '.mono/' -> '.godot/mono/'.
2020-10-23 10:54:49 +02:00
Ignacio Etcheverry f06f91281c 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 'MSBuild' and now display an error/warning icon
  if the last build had issues.
2020-10-23 07:49:39 +02:00
reduz ee06a70ea6 Refactor MethodBind to use variadic templates
Removed make_binders and the old style generated binders.
2020-10-18 12:28:44 +02:00
Aaron Franke 029de52001
Add GetStringFromUTF8 and GetStringFromASCII 2020-10-17 04:17:29 -04:00
opl- e4d20ae373 Fix code duplication in CSharpScript
Removes code duplication between `CSharpScript::reload()` and `CSharpScript::initialize_for_managed_type()`.

Removes a redundant `CSharpScript::update_exports()` call in `CSharpLanguage::reload_assemblies()` as `CSharpScript::reload()` already calls it when appropriate.

Fixes missing update of RPC information in `CSharpScript::initialize_for_managed_type()`.
2020-10-13 06:46:34 +02:00
Rémi Verschelde 1af3cf15c2
Mono: Fix typo in Godot.NET.Sdk.nuspec
Fixes #42666.
2020-10-09 13:37:07 +02:00
Lorenz Junglas 7e2b495435 Adressed Review
Identifier "macOS" => "MacOS"
Platform/SDK name reverted to "osx"
2020-10-08 13:51:19 +02:00
Lorenz Junglas 519f369795 C# GodotTools: Replace platform Identifier "OSX" with "macOS"
Because `Strings OS_OSX::get_name() const` now returns "macOS" (15a9f94346)
The C# GodotTools were still using "OSX" as identifier a few things were borken (e.g. dotnet/msbuild detection).
2020-10-08 13:51:19 +02:00
Aaron Franke bea7d61fd9
Improve the Vector2 rotated code in C# 2020-10-06 15:57:47 -04:00
Sergey Minakov 3cd1cb53a0 iOS: Refactoring
Enabled ARC for iOS.
Weakify/Strongify macros for objc blocks.
Removed old version checks.
Specific types for ObjC++ modules to exclude unneeded bridging.
Separate DeviceMetrics class for device specific data.
Replaced old/deprecated functionality.
2020-10-02 15:04:51 +03:00
Eduardo Rodrigues aca0cede67 Fix error message when exporting a write-only property without a setter 2020-09-29 15:48:56 -03:00
Rémi Verschelde bd12dc33d9
Merge pull request #38704 from aaronfranke/mono-dotgodot
Rename the ".mono" folder to ".godot/mono"
2020-09-28 14:35:18 +02:00
Rémi Verschelde 41c735fe50
Style: Fix black formatting after #42332
Somehow it did not run CI checks so we missed that one.

Also pin `black` version to latest upstream release.
2020-09-25 15:49:37 +02:00
Hugo Locurcio cfd564b385
Enable the copy_mono_root SCons option by default
This closes #41652.
2020-09-25 11:08:01 +02:00
Rémi Verschelde a6bb4f70e0
Merge pull request #42293 from ricardoalcantara/fix_basis_csharp
Basis RotationQuat should be public.
2020-09-24 08:16:24 +02:00
Ricardo Alcantara a676b8ea66 Basis RotationQuat should be public. 2020-09-24 00:59:54 -03:00
Aaron Franke 42e70a77ef
Rename the ".mono" folder to ".godot/mono" 2020-09-23 15:42:29 -04:00
Zae b5eea5cfd4 Fix C# string.IsAbsPath() 2020-09-23 13:53:35 +08:00
Rémi Verschelde 3e78963bb9
Fix typos with codespell
Using codespell 1.17.1.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
dof
doubleclick
fave
findn
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
```
2020-09-18 13:44:25 +02:00
Raul Santos d425cf6fed
Fix ExprMatch stackoverflow 2020-09-16 15:44:52 +02:00
Tom Daffin c15fb42d45 Add mono log message to error for fatal errors 2020-09-13 19:53:06 -06:00
Rémi Verschelde 4331bea18c
Merge pull request #42000 from aaronfranke/cs-arr-concat
Add concatenation support and a new constructor to Godot.Collections.Array
2020-09-13 08:12:48 +02:00
Ignacio Etcheverry 1db0395950 C#: Fix csproj not synced on file move/removal from FS dock
When NormalizePath was called with an absolute
path (with drive letter) on Windows, it would
prepend a file path separator to the path, e.g.:
'\C:\Program Files\'.
Apparently this was still accepted as a valid
path by DotNetGlob and it stopped working when
we switched to MSBuildGlob.
2020-09-13 03:46:27 +02:00
Aaron Franke a4dcd48d16
Add concatenation support and a new ctor to Godot.Collections.Array 2020-09-12 18:15:24 -04:00
Marcel Admiraal 3070d0b735 Remove unused Python local variables. 2020-09-11 11:39:15 +01:00
Marcel Admiraal e3d698dae9 Remove unused Python imports. 2020-09-10 11:38:52 +01:00
Aaron Franke d0a1399a1b
Change inequality comparison operators to use exact equality 2020-09-08 18:10:58 -04:00
Rémi Verschelde bd34d38bf8
Merge pull request #41888 from neikeq/sln-bom
C#: Use BOM when creating a solution
2020-09-08 20:22:30 +02:00
Ignacio Etcheverry 1c74fa4242 C#: Use BOM when creating a solution
At least on Windows there seems to be issues if
the solution has no BOM and contains a project
with cyrillic chars.
2020-09-08 20:06:07 +02:00
Ignacio Etcheverry ac471ff563 C#: Fix endless reload loop if project has unicode chars
The assembly modified time wasn't picked properly
as the path was treated as latin-1, so the file
watcher was constantly firing the event.
2020-09-08 19:53:39 +02:00
Marcel Admiraal 5a376cb061 Fix header guards in modules:
- Add missing header guards to various modules' register_types.h
- Add header guard to basis_universal/texture_basisu.h.
- Ensure header guard encloses entire header in
  webrtc/webrtc_data_channel_js.h.
2020-09-06 16:13:59 +01:00
Alex de la Mare 8dbd7155b5 Handle csproj "Remove" globs
MSBuild Item returns empty strings if an attribute isn't set (which
caused an IndexOutOfRangeException in NormalizePath).

We were treating Excludes incorrectly, Remove directives provide the
intended behaviour in the auto-including csproj format.
2020-09-06 11:34:04 +10:00
bruvzg 82cd97b675
Fix Mono path utils char types. 2020-09-04 22:20:08 +03:00
Rémi Verschelde 5c55c41c9d
Merge pull request #41753 from neikeq/csharp-hide-build-button-if-no-proj
C#: Hide Build button if there's no solution to build
2020-09-04 08:19:53 +02:00
Rémi Verschelde 15efe040f9
Merge pull request #41747 from neikeq/issue-41446
Fix parsing of C# files with spaces in the path
2020-09-04 08:16:56 +02:00
Rémi Verschelde 90601bb659
Merge pull request #41750 from neikeq/issue-41745
C#: Fix Godot failing to find class namespace
2020-09-04 08:15:49 +02:00
Rémi Verschelde d1b0b1962d
Merge pull request #41748 from neikeq/issue-41712
Fix 'Parameter "assembly" is null' error
2020-09-04 08:13:46 +02:00
Ignacio Etcheverry 173f7d800b C#: Hide Build button if there's no solution to build
Same as we do with the bottom panel. Mainly to
avoid bothering if the project is not using C#.
2020-09-04 02:07:12 +02:00
Ignacio Etcheverry a0ef3ba5c8 C#: Fix Godot failing to find class namespace 2020-09-04 01:26:05 +02:00
Ignacio Etcheverry 136181bb50 Fix 'Parameter "assembly" is null' error
This error was normally being printed when
trying to open the project assembly while
the project was not yet built.
The error should not be printed. It's the job
of this method's caller to decide whether to
print an error or not if loading failed.
2020-09-04 01:08:44 +02:00
Ignacio Etcheverry 9e8a5e4b5a Fix parsing of C# files with spaces in the path 2020-09-04 01:01:10 +02:00
bruvzg 80b8eff6aa
[Complex Test Layouts] Change String to use UTF-32 encoding on all platforms. 2020-09-03 19:56:24 +03:00
Ignacio Etcheverry 206501a45e C#: Fix Windows detection for copying MSBuild stub
Previous condition checked only the host
platform. This was a problem as our official
builds are from Linux.
2020-09-03 09:09:04 +02:00
Marcel Admiraal cba4a93a34 Merge python EnvironmentError, IOError and WindowsError into OSError. 2020-09-02 15:58:07 +01:00
Aaron Franke a6ff389a55
Simplify html_is_valid and allow it to work with 3 and 4 hex digits 2020-09-01 02:07:35 -04:00
Aaron Franke ecd6a893b4
Change Color HTML conversion from ARGB to RGBA
Also add support for 3 and 4 digit values in C#. Now it actually matches the HTML/CSS spec.
2020-09-01 02:07:35 -04:00
Hugo Locurcio c4903a603b
Add link titles for all links in the class reference
This makes them display in a nicer way in the editor help.
(The title will display instead of the full URL.)
2020-08-31 14:22:07 +02:00
Rémi Verschelde db5ea78b7b
Merge pull request #41613 from neikeq/possibly
Fix clang-tidy warnings due to semicolon after mono module macros
2020-08-30 12:04:16 +02:00
Rémi Verschelde 30029e1d7f
Merge pull request #41611 from neikeq/issue-41444
C#: Fix crash on export when incorrectly freeing MonoAssemblyName
2020-08-30 12:02:55 +02:00
Ignacio Etcheverry 8c7553a076 Fix clang-tidy warnings due to semicolon after mono module macros
This also enforces them to end with a semicolon.
2020-08-30 02:17:04 +02:00
Ignacio Etcheverry 99740850a2 C#: Fix InvalidCastException on export 2020-08-30 01:55:21 +02:00
Ignacio Etcheverry 7c7d724453 C#: Fix crash on export when incorrectly freeing MonoAssemblyName 2020-08-30 01:48:43 +02:00
Thaina Yu 5dc3900727
Mono: Improve MSBuildFinder logic on Windows
Support detecting both 32-bit and 64-bit installations of `vswhere.exe`.
2020-08-29 12:55:29 +02:00
Ignacio Etcheverry 2bd6252e92 C#: Fix 'Parameter toolsPath cannot be null' error 2020-08-24 11:24:08 +02:00
Rémi Verschelde 0559d1001c
Merge pull request #41410 from neikeq/no-bom-on-csproj-creation
C#: Save newly created csproj files without BOM
2020-08-21 02:02:17 +02:00
Rémi Verschelde ebc194c258
Merge pull request #41409 from neikeq/fix-null-in-msbuild-logger
C#: Fix null exception in our MSBuild logger
2020-08-21 01:58:54 +02:00
Ignacio Etcheverry b5f6285f34 C#: Save newly created csproj files without BOM 2020-08-21 01:48:56 +02:00
Ignacio Etcheverry 7eed8c5a0c C#: Fix null exception in our MSBuild logger 2020-08-21 01:47:47 +02:00
Ignacio Etcheverry 8bb48ae57a Mono/C#: Fix editor using wrong project assembly path in rare cases
We were removing invalid path characters from the
name in C++ code, but the C# editor code wasn't.
2020-08-21 01:42:47 +02:00
Ignacio Etcheverry 6e7da72648 C#: Fix editor unable to play game after IDE PlayRequest
The editor wasn't clearing the debugger agent
settings properly after a processing a play
request from an IDE. This caused consequent play
attempts to fail if not launched from the IDE,
as the game would still attempt and fail to
connect to the debugger.

The concrete cause: Forgetting to clear the
`GODOT_MONO_DEBUGGER_AGENT` environment variable.
2020-08-19 00:14:57 +02:00
Aaron Franke 56e2c6c704
Make all String float conversion methods be 64-bit 2020-07-27 18:38:53 -04:00
Nhiqill 42d1b4f389 Pop from front to avoid infinite loop with nested classes 2020-07-27 16:36:56 -04:00
Rémi Verschelde dc456059a4
Merge pull request #40595 from neikeq/godot-net-sdk-and-net-standard
C#: Switch games to MSBuild Sdks and .NET Standard
2020-07-26 20:47:35 +02:00
Rémi Verschelde f940e5e000 CI: Install master version of psf/black
Until https://github.com/psf/black/pull/1328 makes it in a stable release,
we have to use the latest from Git.

Apply new style fixes done by latest black.
2020-07-26 19:48:25 +02:00
Ignacio Etcheverry ced77b1e9b C#: Switch games to MSBuild Sdks and .NET Standard
Godot.NET.Sdk
-------------

Godot uses its own custom MSBuild Sdk for game
projects. This new Sdk adds its own functionality
on top of 'Microsoft.NET.Sdk'.

The new Sdk is resolved from the NuGet package.

All the default boilerplate was moved from game
projects to the Sdk. The default csproj for
game project can now be as simple as:

```
<Project Sdk="Godot.NET.Sdk/4.0.0-dev2">
  <PropertyGroup>
    <TargetFramework>netstandard2.1</TargetFramework>
  </PropertyGroup>
</Project>
```

Source files are included by automatically so
Godot no longer needs to keep the csproj in sync
when creating new source files.

Define constants
----------------

Godot defines a list of constants for conditional
compilation. When exporting games, this list also
included engine 'features' and platform 'bits'.
There were a few problems with that:

- The 'features' constants were only defined when
  exporting games. Not when building the game for
  running in the editor player.
- If the project was built externally by an IDE,
  the constants wouldn't be defined at all.

The new Sdk assigns default values to these
constants when not built from the Godot editor,
i.e.: when built from an IDE or from the command
line. The default define constants are determined
from the system MSBuild is running on.

However, it's not possible for MSBuild to
determine the set of supported engine features.
It's also not possible to determine if a project
is being built to run on a 32-bit or 64-bit
Godot executable.

As such the 'features' and 'bits' constants had
to be removed.
The benefit of checking those at compile time
was questionable, and they can still be checked
at runtime.

The new list of define constants includes:

- GODOT
- GODOT_<PLATFORM>
  Defaults to the platform MSBuild is running on.
- GODOT_<PC/MOBILE/WEB>
- TOOLS
  When building with the 'Debug' configuration
  (editor and editor player).
- GODOT_REAL_T_IS_DOUBLE
  Not defined by default unless $(GodotRealTIsDouble)
  is overriden to be 'true'.

.NET Standard
-------------

The target framework of game projects was changed
to 'netstandard2.1'.
2020-07-25 19:22:01 +02:00
George Marques 2b9d9bc364
Remove multilevel calls
In general they are more confusing to users because they expect
inheritance to fully override parent methods. This behavior can be
enabled by script writers using a simple super() call.
2020-07-24 14:13:58 -03:00
mega-bit 0ca96ae2c1 Fix typos in GodotSharp code docs 2020-07-22 22:46:04 +02:00
Ignacio Etcheverry 4a30289eee C#: Fix restore not called when building game projects 2020-07-22 14:28:47 +02:00
Aaron Franke ad96b6314c
Fix XML in Plane.cs 2020-07-21 20:13:51 -04:00
Aaron Franke 83e324d670
Update core documentation to match recent C# changes
Also a few minor API changes like adding AABB.abs()

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2020-07-21 14:44:53 -04:00
Rémi Verschelde 861c6c63b6
Merge pull request #40218 from aaronfranke/mono-docs
Add C# XML documentation to core C# math types
2020-07-14 10:17:10 +02:00
Aaron Franke 9986439352
Commit other files changed by file_format.sh 2020-07-13 14:14:11 -04:00
Aaron Franke 5fd4fa0b73
Add C# XML documentation to core C# math types 2020-07-11 05:07:24 -04:00
bruvzg 5d54c015b2
[macOS, Mono] Fix "Wdeprecated-declarations" build error. 2020-07-10 18:45:12 +03:00
George Marques 9654365547
Add a map of autoloads to ProjectSettings
So places that need to look into it can use the list instead of parsing
ProjectSettings details (like checking "*" in path for testing if it's
singleton).
2020-07-06 12:35:51 -03:00
Daniel Doran c3b16e825c Fix Mono PackedArray Marshalling 2020-07-05 14:54:31 -06:00
Rémi Verschelde 347a55d4c2
Merge pull request #40137 from neikeq/fix-clangtidy-warnings-mono
Mono/C#: Fix several clang-tidy warnings and cleanup
2020-07-05 22:32:27 +02:00
Ignacio Etcheverry 2511c43972 Mono/C#: Fix several clang-tidy warnings and cleanup 2020-07-05 19:19:36 +02:00
endlesstravel d2461bad63 fix crash when pass null in print array in GD.print
fix crash when pass null in print array in GD.print 2

fix crash when pass null in print array in GD.print 3

fix space
2020-07-03 16:55:09 +08:00
G'lek a5abacd1e7
Change assembly watcher after notification changes
Fixed Mono not building after #39986 was merged due to a constant that got renamed.
2020-06-30 17:41:38 -04:00
Rémi Verschelde 87d2397273
Merge pull request #39837 from neikeq/fix-invalid-unbox-long-as-int
Mono/C#: Fix InvalidCast because of attempt to unbox long as int
2020-06-26 07:56:42 +02:00
Rémi Verschelde aa42bd14ac
Merge pull request #39839 from neikeq/use-/restore-instead-of-/t-restore
Mono/C#: Use /restore instead of /t:restore when building
2020-06-26 07:49:40 +02:00
Ignacio Etcheverry 4b0c78b3ca Mono/C#: Use /restore instead of /t:restore when building
Documentation recommends not to use /t:restore
together with other targets (like /t:build),
as it messes with the environment.
2020-06-25 23:50:05 +02:00
Ignacio Etcheverry e8d632720f Mono/C#: Fix InvalidCast because of attempt to unbox long as int 2020-06-25 23:37:53 +02:00
Ignacio Etcheverry f87ae395ee Mono/C#: Fix unhandled exception not being printed
For some reason `mono_unhandled_exception` is not
printing the exception as its comment claims.
Use `mono_print_unhandled_exception` instead.
2020-06-25 23:28:53 +02:00
Rémi Verschelde 04795d7f1e
Merge pull request #39739 from MichaelBelousov/fix/long-enum-fix-rider-cast
fix underlying type of enum crashing cast in RiderPathManager
2020-06-24 22:51:07 +02:00
Michael Belousov 9f61f1ed54 Mono: fix bad long casts and wrong underlying enum types in GodotTools 2020-06-24 09:35:13 -04:00
Rémi Verschelde 7d60a88888
Merge pull request #39783 from neikeq/messaging-codecompletion-localize-fix
C#: Fix completion request with case insensitive resource path
2020-06-24 01:00:05 +02:00
Ignacio Etcheverry d569b447ff C#: Fix completion request with case insensitive resource path
Sometimes Visual Studio documents have the root path all in upper case.
Since Godot doesn't support loading resource files with a case insensitive path,
this makes script resource loading to fail when the Godot editor gets code
completion requests from Visual Studio.
This fix allows the resource path part of the path to be case insensitive. It
still doesn't support cases where the rest of the path is also case insensitive.
For that we would need a proper API for comparing paths. However, this fix
should be enough for our current cases.
2020-06-23 20:29:19 +02:00
Hugo Locurcio 31b7f02a29
Remove ToolButton in favor of Button
ToolButton has no redeeming differences with Button;
it's just a Button with the Flat property enabled by default.
Removing it avoids some confusion when creating GUIs.

Existing ToolButtons will be converted to Buttons, but the Flat
property won't be enabled automatically.

This closes https://github.com/godotengine/godot-proposals/issues/1081.
2020-06-19 20:49:49 +02:00
Rémi Verschelde d5c659c992
Merge pull request #39652 from paulloz/generics-getnodesingroup
[mono] Implement generics GetNodesInGroup
2020-06-19 18:52:36 +02:00
Paul Joannon 183dc04d70 [mono] implement generics GetNodesInGroup 2020-06-19 08:49:24 +02:00
Rémi Verschelde 9562fb900e
Merge pull request #39629 from MichaelBelousov/dont-slice-longs-to-mono
Dont slice 64-bit integers marshaled to mono in dynamic contexts
2020-06-19 07:50:34 +02:00
Hugo Locurcio 24a8d43272 Document Mono-specific classes
This fully documents all Mono-specific classes.
2020-06-18 10:32:34 +02:00
Michael Belousov 60fcefba69 return boxed long when marshalling a godot int to mono runtime in dynamic contexts 2020-06-17 17:16:17 -04:00
Rémi Verschelde ba0db95909 DocData: Skip language-specific ClassDoc without methods/constants
Removes the useless `@C#`, `@NativeScript` and `@VisualScript` entries.
2020-06-17 15:09:07 +02:00
Ignacio Etcheverry 7756351f47 Fix dynamic linking of MSVC Mono with MinGW Godot 2020-06-15 21:29:50 +02:00
Ignacio Etcheverry 54df72dcc6 C#: Add VisualStudio support 2020-06-15 21:29:16 +02:00