Commit graph

290 commits

Author SHA1 Message Date
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
Aaron Franke
3f50954ced
Add generic support to PackedScene.Instance 2021-02-25 20:49:22 -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
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
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
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
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
Nathan Franke
3fda53c256
Update Rect intersection documentation, and rename method on Mono 2020-12-26 22:16:57 -06: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
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
Aaron Franke
5465e604bb
Improve argument names for core types 2020-12-07 05:01:33 -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
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
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
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
Aaron Franke
bea7d61fd9
Improve the Vector2 rotated code in C# 2020-10-06 15:57:47 -04: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
Zae
b5eea5cfd4 Fix C# string.IsAbsPath() 2020-09-23 13:53:35 +08:00
Raul Santos
d425cf6fed
Fix ExprMatch stackoverflow 2020-09-16 15:44:52 +02:00
Aaron Franke
a4dcd48d16
Add concatenation support and a new ctor to Godot.Collections.Array 2020-09-12 18:15:24 -04:00
Aaron Franke
d0a1399a1b
Change inequality comparison operators to use exact equality 2020-09-08 18:10:58 -04: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
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
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
mega-bit
0ca96ae2c1 Fix typos in GodotSharp code docs 2020-07-22 22:46:04 +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
Aaron Franke
5fd4fa0b73
Add C# XML documentation to core C# math types 2020-07-11 05:07:24 -04: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