Commit graph

952 commits

Author SHA1 Message Date
NutmegStudio a77f633161 Fixes building mono release templates 2020-05-30 12:21:24 +07:00
Maganty Rushyendra 3d03be7a56 Update Mono C# warning to reflect latest list of platforms supported
Simple fix for #38627. iOS (#20268) and HTML5 (#20270) removed from list of exceptions
for platforms supported in warning message.
2020-05-26 09:19:45 +08:00
Rémi Verschelde 2a3f650bf6
Merge pull request #38962 from neikeq/4.0-scons-option-build-cil
Add SCons option to not build C# solutions
2020-05-22 18:29:13 +02:00
Ignacio Etcheverry e3a54152e4 Add SCons option to not build C# solutions 2020-05-22 17:44:33 +02:00
Rémi Verschelde 07ada02cb4
Merge pull request #38943 from neikeq/yakamashi
Mono/C#: Don't try to load project assembly in project manager
2020-05-22 09:16:26 +02:00
Ignacio Etcheverry d7e21ecd63 Mono/C#: Don't try to load project assembly in project manager
This was causing an error message when launching the manager,
because there is no project assembly to load.
2020-05-22 02:17:59 +02:00
Ignacio Etcheverry 51e1614d28 Mono/C#: Fix values not updated in remote inspector 2020-05-22 00:58:38 +02:00
Rémi Verschelde cba1f492cc
Merge pull request #38863 from neikeq/csharp-no-false-error-objtype-reload
Mono/C#: Remove script load error about not a Godot.Object
2020-05-19 20:48:59 +02:00
Ignacio Etcheverry 38cd2152e6 Mono/C#: Remove script load error about not a Godot.Object
Any C# file can be loaded as script and at load
time we don't yet know if it's actually meant to
be used as a script. As such, such an check can
result in a lot of false errors.

If the file is really meant to be used as a
script, an error would be printed later when
attempting to instantiate it any way.
2020-05-19 17:51:56 +02:00
Ignacio Etcheverry 9fa4b402a7 Added tests for ClassDB 2020-05-16 17:32:58 +02:00
Rémi Verschelde 07bc4e2f96 Style: Enforce separation line between function definitions
I couldn't find a tool that enforces it, so I went the manual route:
```
find -name "thirdparty" -prune \
  -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \
  -o -name "*.glsl" > files
perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files)
misc/scripts/fix_style.sh -c
```

This adds a newline after all `}` on the first column, unless they
are followed by `#` (typically `#endif`). This leads to having lots
of places with two lines between function/class definitions, but
clang-format then fixes it as we enforce max one line of separation.

This doesn't fix potential occurrences of function definitions which
are indented (e.g. for a helper class defined in a .cpp), but it's
better than nothing. Also can't be made to run easily on CI/hooks so
we'll have to be careful with new code.

Part of #33027.
2020-05-14 16:54:55 +02:00
Rémi Verschelde 0be6d925dc Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to
will now be changed automatically to remove the first empty line.

This makes us lean closer to 1TBS (the one true brace style) instead
of hybridating it with some Allman-inspired spacing.

There's still the case of braces around single-statement blocks that
needs to be addressed (but clang-format can't help with that, but
clang-tidy may if we agree about it).

Part of #33027.
2020-05-14 16:54:55 +02:00
Rémi Verschelde 1a8167867b Modernize remaining uses of 0/NULL instead of nullptr (C++11)
Using clang-tidy's `modernize-use-nullptr`.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
2020-05-14 13:45:01 +02:00
Rémi Verschelde 1f6f364a56 Port member initialization from constructor to declaration (C++11)
Using `clang-tidy`'s `modernize-use-default-member-init` check and
manual review of the changes, and some extra manual changes that
`clang-tidy` failed to do.

Also went manually through all of `core` to find occurrences that
`clang-tidy` couldn't handle, especially all initializations done
in a constructor without using initializer lists.
2020-05-14 10:01:56 +02:00
Rémi Verschelde dbd90b9478
Merge pull request #38638 from pepegadeveloper123/mono_inherited_scene_bug
Fix inherited C# scene not inheriting parent's fields
2020-05-11 10:19:15 +02:00
Rémi Verschelde 54bb4cb6d6
Merge pull request #38650 from neikeq/dotnet-cli-support
C#: Support for building with the dotnet CLI
2020-05-11 10:16:01 +02:00
Ignacio Etcheverry dcf1dc4fe0 C#: Support for building with the dotnet CLI
By adding a reference to the 'Microsoft.NETFramework.ReferenceAssemblies' nuget
package, we can build projects targeting .NET Framework with the dotnet CLI.
By referencing this package we also don't need to install Mono on Linux/macOS
or .NET Framework on Windows, as the assemblies are taken from the package.
2020-05-11 08:17:37 +02:00
Ignacio Etcheverry 840255a04b Implement CSharpScript::inherits_script 2020-05-10 21:49:15 +02:00
pepegadeveloper123 4e00d8520d Inherited C# scene not inheriting parent's fields
When a child scene inherits a parent scene with a C# root node, the
parent scene's export variables appear to assume values set in the
parent scene, in the child scene's Inspector. However, when the child
scene is played, the parent scene's export variables assume default
values.
When a node is created, it inherits its parent C# script's fields from
the map CSharpScriptInstance::script->member_info. However this map was
not initialized outside the editor, and this commit ensured it is. This
fixes issues #36480 and #37581.
2020-05-11 03:20:11 +09:00
Rémi Verschelde 94721f5ab8 Revert "Renamed plane's d to distance"
This reverts commit ec7b481170.

This was wrong, `d` is not a distance but the `d` constant in the
parametric equation `ax + by + cz = d` describing the plane.
2020-05-10 16:47:11 +02:00
Rémi Verschelde 6ab92464bc
Merge pull request #38621 from akien-mga/stylé-comme-jamais
Style: clang-format: Disable if statements and case labels on single line
2020-05-10 15:38:53 +02:00
Ignacio Roldán Etcheverry 54b20a25b9
Merge pull request #38600 from neikeq/no
Switch to nuget Microsoft.Build and rewrite GodotTools messasing protocol
2020-05-10 13:33:03 +02:00
Rémi Verschelde 69de7ce38c Style: clang-format: Disable AllowShortCaseLabelsOnASingleLine
Part of #33027.
2020-05-10 13:13:54 +02:00
Rémi Verschelde e956e80c1f Style: clang-format: Disable AllowShortIfStatementsOnASingleLine
Part of #33027, also discussed in #29848.

Enforcing the use of brackets even on single line statements would be
preferred, but `clang-format` doesn't have this functionality yet.
2020-05-10 13:12:16 +02:00
Marcus Elg ec7b481170 Renamed plane's d to distance 2020-05-10 12:12:51 +02:00
Ignacio Etcheverry 3ce09246d1 C#: Rewrite GodotTools messaging protocol 2020-05-09 21:49:40 +02:00
Ignacio Etcheverry f3bcd5f8dd C#: Use Sdks in GodotTools csprojs and switch to nuget Microsoft.Build 2020-05-09 21:36:31 +02:00
Ignacio Etcheverry af4acb5b11 C#/Mono: Check assembly version when loading
Not sure if we should check revision too, but this is good enough for what we want.
This will be needed to load the correct Microsoft.Build when we switch to the nuget version.
2020-05-09 20:54:16 +02:00
Ignacio Etcheverry 4441222194 C#: Remove StringExtensions.Empty() function
Causes issues with some editors as it's confused with `string.Empty`.
Should use `string.IsNullOrEmpty(str)` instead.
2020-05-09 20:48:00 +02:00
Ignacio Roldán Etcheverry 61306eb830
Merge pull request #38596 from neikeq/msbuild-restore
Mono: Use msbuild instead of nuget.exe for restoring
2020-05-09 20:16:52 +02:00
Ignacio Etcheverry b61ffef0ab Mono: Use msbuild instead of nuget.exe for restoring
- Make GodotTools output directly to the SCons output directory.
- Removed xbuild_fallback from the build system.
2020-05-09 19:45:04 +02:00
Ignacio Etcheverry e0a001549e Mono: Fix hot-reloading of nested classes 2020-05-09 19:18:28 +02:00
Rémi Verschelde ae33cf5f45
Merge pull request #36379 from aaronfranke/color-constructors
Add a Color constructor for Color with alpha
2020-05-07 21:16:51 +02:00
Hugo Locurcio 596d426151
Remove some C++11 polyfill defines that are no longer needed 2020-05-03 00:42:04 +02:00
Aaron Franke 90df1d67cb
Color with alpha constructor 2020-04-29 14:41:12 -04:00
Nannaquin 0ac6f4c40b Fix growMargin() not returning modified Rect2/Rect2i 2020-04-29 11:29:57 -04:00
Aaron Franke ad3c3e1bbb
[Mono] Rename LinearInterpolate to Lerp 2020-04-29 04:02:24 -04:00
Rémi Verschelde 41af228b76
Merge pull request #36960 from pycbouh/docs-improve-shortcuts
Improve shortcut formatting in docs
2020-04-29 09:40:52 +02:00
Ignacio Etcheverry f5510262bc Mono/C#: Fix load hook not called for some assemblies on domain reload 2020-04-23 18:55:44 +02:00
Ignacio Etcheverry 81f13f6171 C#: Fix always saving copy of csproj even with no changes
This was a regression from 93d7ec8836 (#38110).
Mono's old implementation of Microsoft.Build hardcodes HasUnsavedChanges to
always return true.
This workaround can be reverted once we switch to official Microsoft.Build.
2020-04-23 16:18:55 +02:00
Rémi Verschelde 8012be867c
Merge pull request #38123 from neikeq/fix-hotreload-twice
Mono/C#: Fix assemblies being reloaded a second time unnecesarily
2020-04-23 11:34:28 +02:00
Ignacio Etcheverry 20b9dbb1d5 C#: Revert marshalling of IDictionary/IEnumerable implementing types
Added marshalling for `System.Collections.Generic.List<T>` and
`System.Collections.Generic.Dictionary<TKey, TValue>`.
2020-04-23 02:26:43 +02:00
Ignacio Etcheverry c9882e61e2 Mono/C#: Fix assemblies being reloaded a second time unnecesarily 2020-04-23 02:23:25 +02:00
Ignacio Roldán Etcheverry 28f0b15c9d
Merge pull request #38117 from neikeq/export-mono-array-godot-object
Mono/C#: Allow exporting System.Array of type Godot.Object
2020-04-22 17:41:34 +02:00
Ignacio Roldán Etcheverry 3ad9652a5d
Merge pull request #38110 from neikeq/csproj-safer-migration
C#: Save copy of sln and csproj before applying fixes
2020-04-22 17:27:07 +02:00
Ignacio Etcheverry 0fec3cb5ed Mono/C#: Allow exporting System.Array of type Godot.Object 2020-04-22 17:19:45 +02:00
Ignacio Etcheverry 93d7ec8836 C#: Save copy of sln and csproj before applying fixes 2020-04-22 16:50:43 +02:00
Ignacio Etcheverry 71fc87e101 Mono/C#: Allow debugging exported games
- Include PDB files in exported games.
- Release export templates also allow debugging now.

Right now the only way to enable debugging in exported games is with the  environment variables, which may be cumbersome or not even possible on some platforms.
2020-04-22 16:44:03 +02:00
Juan Linietsky 5d4dc2d45c Add ability to bind typed arrays to script API
Note: Only replaced 2 instances to test, Node.get_children and TileMap.get_used_cells
Note: Will do a mass replace on later PRs of whathever I can find, but probably need
a tool to grep through doc.
Warning: Mono will break, needs to be fixed (and so do TypeScript and NativeScript, need to ask respective maintainers)
2020-04-21 10:15:40 +02:00
Juan Linietsky ae09b55a19 Exposed RenderingDevice to script API
Also added an easier way to load native GLSL shaders.

Extras:

Had to fix no-cache for subresources in resource loader, it was not properly working, making shaders not properly reload.

Note:

The precommit hooks are broken because they don't seem to support enums from one class being used in another.
Feel free to fix this after merging this PR.
2020-04-20 21:21:58 -03:00