Commit graph

3843 commits

Author SHA1 Message Date
George Marques
a0983637cf
GDScript: Allow get_script() to be considered a type 2020-06-03 10:48:43 -03:00
Alex Bustin
8a024ca294 Respect 'mesh compression' editor import option in Assimp (ie. FBX) and glTF importers 2020-05-28 15:28:47 -07:00
Marcel Admiraal
08fa7cd8d9 Correct Bullet's default Area angular damp value. 2020-05-27 11:53:41 +01:00
Rémi Verschelde
7c332d9386
Merge pull request #39040 from Xrayez/modules-search-path-3.2
[3.2] Add `custom_modules` build option to compile external user modules
2020-05-25 17:02:27 +02:00
Ignacio Etcheverry
f0bc3482d4 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.

(cherry picked from commit d7e21ecd63)
2020-05-25 16:34:15 +02:00
Tan Wang Leng
48a2fd7a3d gdscript_parser: Fix "unreachable code" false positive for loops
Depending on the conditional statements of the 'for' and 'while' loops,
their body may not even execute once. For example:

    func a():
        var arr = []
        for i in arr:
            return i
        # can be reached, but analysis says cannot
        return -1

    func b():
        var should_loop = false
        while should_loop:
           return 1
        # can be reached, but analysis says cannot
        return 0

The parser will complain that the statements after the comment cannot
be reached, but it is clearly possible for our scenario. This is
because the parser falsely assumes that the loop body will always
execute at least once.

Fix the code to remove this assumption for both of those loops.

(cherry picked from commit 7b1423a61e)
2020-05-25 16:31:07 +02:00
James Buck
9347a6ad6a Trigger an error when trying to define a preexisting signal in GDScript
A class can't have multiple signals with the same name, but previously users
would not be alerted to a conflict while editing the script where it occurred.
Now a helpful error will appear in the editor during script parsing.

(cherry picked from commit 9e44739324)
2020-05-25 16:29:20 +02:00
Andrii Doroshenko (Xrayez)
133997654c Add custom_modules build option to compile external user modules
This patch adds ability to include external, user-defined C++ modules
to be compiled as part of Godot via `custom_modules` build option
which can be passed to `scons`.

```
scons platform=x11 tools=yes custom_modules="../project/modules"
```

Features:

- detects all available modules under `custom_modules` directory the
same way as it does for built-in modules (not recursive);
- works with both relative and absolute paths on the filesystem;
- multiple search paths can be specified as a comma-separated list.

Module custom documentation and editor icons collection and generation
process is adapted to work with absolute paths needed by such modules.
Also fixed doctool bug mixing absolute and relative paths respectively.

Implementation details:

- `env.module_list` is a dictionary now, which holds both module name as
  key and either a relative or absolute path to a module as a value.
- `methods.detect_modules` is run twice: once for built-in modules, and
  second for external modules, all combined later.
- `methods.detect_modules` was not doing what it says on the tin. It is
  split into `detect_modules` which collects a list of available modules
  and `write_modules` which generates `register_types` sources for each.
- whether a module is built-in or external is distinguished by relative
  or absolute paths respectively. `custom_modules` scons converter
  ensures that the path is absolute even if relative path is supplied,
  including expanding user paths and symbolic links.
- treats the parent directory as if it was Godot's base directory, so
  that there's no need to change include paths in cases where custom
  modules are included as dependencies in other modules.

(cherry picked from commit a96f0e98d7)
2020-05-25 17:08:38 +03:00
Thakee Nathees
d611bd970d regression: dictionary key no autocomplete fix
Fix: #38998
(cherry picked from commit 13c372b522)
2020-05-25 15:58:25 +02:00
Ignacio Etcheverry
0da84b50c0 Mono/C#: Fix values not updated in remote inspector
(cherry picked from commit 51e1614d28)
2020-05-25 11:46:03 +02:00
Ignacio Etcheverry
ce09d0c5e1 Add SCons option to not build C# solutions 2020-05-22 03:12:54 +02:00
Ignacio Etcheverry
6dfd80673a 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.

(cherry picked from commit 38cd2152e6)
2020-05-20 11:41:01 +02:00
Pedro J. Estébanez
8f90d423b9 Fix too eager GDScriptFunctionState stack cleanup
(cherry picked from commit 1f0548efd4)
2020-05-20 11:40:45 +02:00
bruvzg
d255cc9e4d
Fix GDNative Variant type size on 32-bit platforms, add size checking static asserts. [3.2] 2020-05-17 16:11:49 +03:00
pepegadeveloper123
23d51ac325 Fix inherited C# scene not inheriting parent's fields (3.2)
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.
This is a manual backport of PR #38638 for 3.2.
2020-05-16 11:18:58 +02:00
Thakee Nathees
9ee77179b5 break, continue outside of a loop, match statement handled
(cherry picked from commit c076a2b7e9)
2020-05-16 00:08:37 +02:00
Oliver Frank
2173d041af Fix incorrect capabilities notification in LSP 2020-05-15 16:43:48 -04:00
Oliver Frank
dac8b7b6f4 Improve jsonrpc error reporting 2020-05-15 16:42:24 -04:00
Thakee Nathees
d13f46bc41 shadowed var warning in nested block bug fix
Fix: #38552
(cherry picked from commit 79eee93b9a)
2020-05-14 22:01:45 +02:00
Thakee Nathees
40c43da96f set parser error when infer type is null
(cherry picked from commit 687b1941b4)
2020-05-14 22:01:26 +02:00
Thakee Nathees
e42318e41c regression: var declaration type info parser bug fix
(cherry picked from commit e5d735851d)
2020-05-13 16:14:22 +02:00
Thakee Nathees
6d7fb3d322 regression: static func can't access const fix
(cherry picked from commit e7f056dfac)
2020-05-13 16:14:08 +02:00
Thakee Nathees
72aa9ce7fc range() with non-numeric const argument crash fix
(cherry picked from commit 3e10392d48)
2020-05-13 16:08:33 +02:00
Rémi Verschelde
44c1c5840c
Merge pull request #38674 from madmiraal/fix-physicsw-warning-3.2
[3.2] Fix 'physicsw' may be used uninitialized warning in csg_shape.cpp
2020-05-11 21:19:34 +02:00
Ignacio Etcheverry
3928fe200f [3.2] 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 19:48:50 +02:00
Marcel Admiraal
b4302d0d04 Fix 'physicsw' may be used uninitialized warning in csg_shape.cpp 2020-05-11 13:33:20 +01:00
Ignacio Etcheverry
683e19306e 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.

(cherry picked from commit b61ffef0ab)
2020-05-11 11:01:13 +02:00
Ignacio Etcheverry
34132d2f67 Mono: Fix hot-reloading of nested classes
(cherry picked from commit e0a001549e)
2020-05-11 11:01:13 +02:00
Thakee Nathees
55b4e0c44a parser error for static func access non-static variables
Fix: #38408
(cherry picked from commit ce978517e0)
2020-05-11 11:01:13 +02:00
Thakee Nathees
e417528f67 fix: dict2inst crash when constructor has arguments
(cherry picked from commit 9f6b20936e)
2020-05-11 11:01:12 +02:00
Thakee Nathees
a446e8671d autocompleting with indexing for native types added
Fix: #37768
(cherry picked from commit 3c45377c6e)
2020-05-11 10:50:46 +02:00
Thakee Nathees
22053ed75f GDScript class var type resolve bug fixed
Fix: #37545
(cherry picked from commit e67eb5ca36)
2020-05-11 10:50:46 +02:00
Thakee Nathees
6b0cfc87af more clearer unexpected statement end error messages
(cherry picked from commit 5758d87f09)
2020-05-11 10:50:46 +02:00
Thakee Nathees
7111aa0688 pass keyword inside a class implemented
(cherry picked from commit 63ce1fc438)
2020-05-11 10:50:46 +02:00
Thakee Nathees
f3149817ff fixed: saving gdscript with cyclic inheritance crash the editor
Fix: #9609
(cherry picked from commit c2ab35bdde)
2020-05-11 10:50:45 +02:00
Rémi Verschelde
56a513d70d
Merge pull request #38639 from neikeq/3.2-godottools-new-messaging-protocol
[3.2] C#: Rewrite GodotTools messaging protocol
2020-05-11 07:55:29 +02:00
janglee
d16abbdee4 Improved go-to definition (Ctrl + Click)
Co-Authored-By: Bojidar Marinov <bojidar.marinov.bg@gmail.com>
(cherry picked from commit be7a353c70)
2020-05-11 09:33:21 +05:30
Ignacio Etcheverry
fb2e00a854 [3.2] C#: Rewrite GodotTools messaging protocol 2020-05-10 21:05:00 +02:00
Rémi Verschelde
aa57bb0473
Merge pull request #38482 from RandomShaper/improve_yield_3.2
Fix object leaks caused by unfulfilled yields (3.2)
2020-05-09 22:03:00 +02:00
Pedro J. Estébanez
64344e6d1d Fix object leaks caused by unfulfilled yields
Now the stack saved in a `GDScriptFunctionState` is cleared as soon as the `yield()` operation is known not to be resumed because either the script, the instance or both are deleted.

This clears problems like leaked objects by eliminating cases of circular references between `GDScriptFunctionState`s preventing them and the objects they refer to in their saved stacks from being released. As an example, this makes using `SceneTreeTimer` safer.

Furthermore, with this change it's now possible to print early warnings about `yield()`s to released script/instances, as now we know they won't be successfully resumed as the condition for that happens. However, this PR doesn't add such messages, to keep the observed behavior the same for the time being.

Also, now a backup of the function name in `GDScriptFunctionState` is used, since the script may not be valid by the time the function name is needed for the resume-after-yield error messages.
2020-05-05 17:53:47 +02:00
simpuid
92964c5889 Changed default for p_validate_certs to true.
Fixes #37084

(cherry picked from commit 2584eb9c69)
2020-05-05 13:41:40 +02:00
Rémi Verschelde
ef715f37d5
Merge pull request #35091 from Faless/dtls/enet
[3.2] DTLS support + optional ENet encryption
2020-05-05 13:40:59 +02:00
Steven Schoen
40125c7cce Mention offending function name in "Indented block expected" error
(cherry picked from commit e6e5ba32cd)
2020-05-04 16:10:22 +02:00
Rémi Verschelde
607d688d45 tinyexr: Enable C++11 threaded loading
(cherry picked from commit 2175397210)
2020-05-01 11:10:16 +02:00
Nannaquin
9e4de37e88 Fix growMargin() not returning modified Rect2/Rect2i
(cherry picked from commit 0ac6f4c40b)
2020-05-01 10:56:58 +02:00
Tom Evans
2859ceec6f Fix for marking assert lines as safe bug
Calling _reduce_node_type from GDScriptParser::_parse_block for assert
was using a current class with a scope that didn't include all
functions. Now calling in GDScriptParser::_check_block_types uses the
right class type. We also now check the assert node message. The assert
line was added to the set_errors associated with assert, since before
the error would be reported on the next line

(cherry picked from commit bd081df519)
2020-05-01 10:56:58 +02:00
Marcel Admiraal
966139ca4c Fix CSG vertex normal calculation.
(cherry picked from commit 9bd305bfe2)
2020-05-01 10:56:58 +02:00
Thakee Nathees
1a4530e84c export var type reduce() implemented
(cherry picked from commit cd487201c6)
2020-05-01 10:56:58 +02:00
Andrea Catania
b7dace75c7 Make softbody completelly stiff to attachment point
(cherry picked from commit ca7ee56759)
2020-05-01 10:56:57 +02:00
Pedro J. Estébanez
68cca6e619 Fix leaked objects when game ends with yields in progress 2020-04-29 14:13:36 +02:00
Rémi Verschelde
4dda00461f
Merge pull request #38011 from madmiraal/fix-csg-3.2
[3.2] Fix multiple issues with CSG module.
2020-04-27 17:05:47 +02:00
Ignacio Etcheverry
8cdcb410e0 Mono/C#: Fix load hook not called for some assemblies on domain reload
(cherry picked from commit f5510262bc)
2020-04-27 10:15:24 +02:00
Ignacio Etcheverry
a98d44f654 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.

(cherry picked from commit 81f13f6171)
2020-04-27 10:15:07 +02:00
Tom Evans
3bd5fc2e5e Mark assert lines as safe in gdscript
Now calling _reduce_node_type with debugging enabled to determine
if assert line is safe. Part of doing this required the assert line
to be stored away. Now the AssertNode line is being correctly set.
Newlines are now marked safe always

(cherry picked from commit 8dc8833782)
2020-04-27 10:10:20 +02:00
Umang Kalra
94d0f34f70 Fixed the bool _static logic
(cherry picked from commit b192c7d1ac)
2020-04-27 10:09:49 +02:00
Ignacio Etcheverry
6aca932659 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 15:36:01 +02:00
Ignacio Etcheverry
dfdb7bdc87 Mono/C#: Fix assemblies being reloaded a second time unnecesarily
(cherry picked from commit c9882e61e2)
2020-04-23 11:34:42 +02:00
Ignacio Etcheverry
cf729f2111 Mono/C#: Allow exporting System.Array of type Godot.Object
(cherry picked from commit 0fec3cb5ed)
2020-04-23 11:17:23 +02:00
Ignacio Etcheverry
317d8decad 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.

(cherry picked from commit 71fc87e101)
2020-04-23 11:15:35 +02:00
Ignacio Etcheverry
08f41f474b C#: Save copy of sln and csproj before applying fixes
(cherry picked from commit 93d7ec8836)
2020-04-23 11:14:57 +02:00
Thakee Nathees
95f6bdfa78 GDScript class name existance check enhanced
(cherry picked from commit 62280c3d47)
2020-04-23 11:10:51 +02:00
Thakee Nathees
12c776dba3 line unsafe for indexing with known base type & unkown identifier
(cherry picked from commit 0780ad2800)
2020-04-23 11:10:28 +02:00
Stoofin
243711e77f Pattern bind counts as assignment
Fixes #34697

(cherry picked from commit 44281f233d)
2020-04-23 11:10:06 +02:00
Rémi Verschelde
253fc093b8 DocData: Skip unexposed classes
Properly expose classes that we actually want accessible.

(cherry picked from commit 0ef8bcac4d)
2020-04-21 14:15:34 +02:00
Marcel Admiraal
11b7f050df Fix multiple issues with CSG module.
- Replaces BuildPoly with Build2DFaces, which creates faces as each
  pair of face intersections are processed, instead of trying to create
  them after all the intersections are processed. Ensures that faces are
  merged when possible, and removes degenerate triangles.

- Treats the child as inside the parent when faces are coplanar.

- General clean up of csg.h and csg.cpp.
2020-04-19 14:32:45 +01:00
Rémi Verschelde
cb1366f006 Mono: Fix include for Android support
This was a typo in #37153.

Co-authored-by: Ignacio Etcheverry <ignalfonsore@gmail.com>
(cherry picked from commit 408fab8442)
2020-04-18 22:02:07 +02:00
Nico Mitchell
616d106247 Change round return type to float
(cherry picked from commits c2ffaf5b2b
and f7cc2b090c)
2020-04-16 12:57:21 +02:00
Thakee Nathees
3d69fe95e5 autocomplete for disconnect, is_connected implemented
(cherry picked from commit efe90fce01)
2020-04-16 12:47:19 +02:00
lupoDharkael
c0047023e6 NoiseTexture: prevent race condition because of Ref::unref()
(cherry picked from commit 1f0f0b8cea)
2020-04-16 12:47:18 +02:00
Thakee Nathees
3658f7127e := fails on some nodes fix: #37357
(cherry picked from commit bdd7048cb5)
2020-04-16 11:46:23 +02:00
Ignacio Etcheverry
445f1c6e7b Mono/C#: Add iOS support
Right now, games only work on devices when exported with FullAOT+Interpreter.
There are some issues left that need to addressed for FullAOT alone. Right now,
it's giving issues with the Godot.NativeCalls static constructor.
2020-04-14 18:03:10 +02:00
Ignacio Etcheverry
6b38fe691a Mono/C#: Fix MinGW build not supporting .lib libraries
MinGW should support both its own format `.a` and MSVC's format `.lib`, but Mono's module was only using the former. With this change it's now possible to build with MinGW and link the official Mono for Windows which is built with MSVC.
2020-04-14 18:03:10 +02:00
Thakee Nathees
df87601c88 Fix for loop range bug: #37358
(cherry picked from commit 0b5bad78c0)
2020-04-06 20:58:21 +02:00
Hugo Locurcio
dd4569f15c Remove syntax highlighting for C# verbatim strings due to bugs
This closes #32336.

(cherry picked from commit 49efd6093e)
2020-04-06 18:18:38 +02:00
Thomas ten Cate
c2469d0c6d Add missing docs for assert message in GDScript
Seems like this was overlooked in PR #31142. See also issue #17082.

(cherry picked from commit 4c3c73ef9c)
2020-04-06 18:17:59 +02:00
Ivan.Shakhov
66e4c8be23 fix RiderPathLocator - searching for toolbox on Mac
(cherry picked from commit dc16b8742a)
2020-04-06 18:15:20 +02:00
Ignacio Etcheverry
bda993dd79 C#: Fix uses of old Configuration names
(cherry picked from commit 66c0b7ce98)
2020-04-06 18:14:07 +02:00
Rajat Goswami
19e71f94d8 Adding missing include guards to header files identified by LGTM.
This addresses the issue godotengine/godot#37143

(cherry picked from commit 2ecf928ae3)
2020-03-25 11:38:54 +01:00
Rémi Verschelde
bdde501594 opus/vorbis: Remove dead code not used since 3.0
Since the new audio system in 3.0 we switched the OGG support to
stb_vorbis, and the Opus stream support was disabled as incompatible
(see #7496).

We still build the libraries as they are needed by the theora and webm
modules, but we don't need any Godot code apart from `register_types`.

Fixes #7496.

(cherry picked from commit 7f6b62cef0)
2020-03-25 11:38:54 +01:00
Andrii Doroshenko (Xrayez)
8fedcfbed2 Generate command line help text for mono module
(cherry picked from commit 94b6c1363c)
2020-03-25 11:38:54 +01:00
Ivan.Shakhov
9d0518cf80 Fix warning: Property not found: mono/editor/editor_path_optional (#36995)
(cherry picked from commit 05946be2f1)
2020-03-25 11:38:54 +01:00
Ignacio Etcheverry
d46fcbb16a C#: Replace uses of old Configuration and update old csprojs
(cherry picked from commit 1b634785b5)
2020-03-25 11:38:54 +01:00
Ivan Shakhov
b874e84147 reorder solution configurations + migration
(cherry picked from commit ce01b83c4a)
2020-03-25 11:38:54 +01:00
Thakee Nathees
5798c8135f logic error in gdscript_parser.cpp for-loop-range
there was a logic error in for loop range argument that
check if all of the argument were constants, fixed

(cherry picked from commit bcbcf0f1ea)
2020-03-25 09:45:47 +01:00
Thakee Nathees
40b53bc29a duplicate arguments in a function handled
(cherry picked from commit 5424b626f9)
2020-03-25 09:44:51 +01:00
Rafael Delboni
5736e43fe4 fix: Return only scenes for script owners on LSP completion
Fix: #36680
(cherry picked from commit 2f08f4ef4e)
2020-03-25 09:44:09 +01:00
Rafael Delboni
ecfe9c24a2 Improve LSP completion using scene owner
Fixes: #36473

(cherry picked from commit 06bce137e3)
2020-03-25 09:43:49 +01:00
Oliver Frank
41500249e3 Fix crash after closing a GDScript LSP session
(cherry picked from commit ed482f6167)
2020-03-25 09:43:28 +01:00
of9
511105be67 Migrating language server from Websockets to raw TCP
(cherry picked from commit 24b27043fe)
2020-03-25 09:43:05 +01:00
Ignacio Etcheverry
d1a5f8dbf2 [3.2] Sync csproj when files are changed from the Godot FileSystem dock 2020-03-18 17:57:45 +01:00
Thakee Nathees
708aab7920 typo in gdscript_workspace.cpp/remove_cache_parser() fixed
(cherry picked from commit 07c99340d1)
2020-03-09 09:51:59 +01:00
Phischermen
69c1805735 Added parameters to Load()
(cherry picked from commit 1b0819bd59)
2020-03-06 23:55:25 +01:00
Rémi Verschelde
98d0bf7d7a assimp: Clean and document buildsystem, prepare for unbundling
- Improve the SCsub to allow unbundling and remove unnecessary code.
- Move files around to match upstream source.
- Re-sync with upstream commit 308db73d0b3c2d1870cd3e465eaa283692a4cf23
  to ensure we don't have local modifications.
- Doesn't actually build against current version 5.0.1 due to the lack
  of the new ArmaturePopulate API that Gordon authored. We'll have to
  wait for a public release with that API (5.1?) to enable unbundling.

(cherry picked from commit 9d8a9ea826)
2020-03-06 23:53:23 +01:00
Rémi Verschelde
4c325c0732 Mono: Fix detection of Apple platforms in build script
(cherry picked from commit 5b040ef2e8)
2020-03-06 23:51:26 +01:00
Ivan Shakhov
88f0cd0b27 On Windows find Rider installed for CurrentUser
(cherry picked from commit c95e20a089)
2020-03-04 12:40:15 +01:00
Raul Santos
447acafa97 Fix missing null check in Mono Binding of GD.print
(cherry picked from commit 6b9c22542f)
2020-03-04 12:40:15 +01:00
Hugo Locurcio
a78bbcf8ce Improve the RegEx class documentation
This closes https://github.com/godotengine/godot-docs/issues/2522.

(cherry picked from commit 5b78f5c464)
2020-03-04 12:40:14 +01:00
Hugo Locurcio
08cb8420f7 Mention the duration parameter unit in UPNP.add_port_mapping()
(cherry picked from commit 810be27c78)
2020-03-04 12:40:14 +01:00
Hugo Locurcio
d679edfa7f Add a practical example for @GDScript.linear2db()
One of its most common applications in games is for volume sliders.

See https://www.dr-lex.be/info-stuff/volumecontrols.html for
more information.

(cherry picked from commit a6fd6b78dd)
2020-03-04 12:40:14 +01:00
Hugo Locurcio
21a45dda7a Improve the @GDScript.inverse_lerp() documentation
This closes https://github.com/godotengine/godot-docs/issues/2589.

(cherry picked from commit 6b5573700b)
2020-03-04 12:40:14 +01:00