Commit graph

1211 commits

Author SHA1 Message Date
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
Thakee Nathees
687b1941b4 set parser error when infer type is null 2020-05-13 22:12:23 +05:30
Rémi Verschelde
e7c9d81876
Merge pull request #38609 from ThakeeNathees/range-crash-with-non-numeric-const-fix
range() with non-numeric const argument crash fix
2020-05-13 15:42:29 +02:00
Rémi Verschelde
dc649684be
Merge pull request #38708 from ThakeeNathees/init-assign-type-parser-bug-fix
regression: var declaration type info parser bug fix
2020-05-13 15:41:28 +02:00
Thakee Nathees
e7f056dfac regression: static func can't access const fix 2020-05-13 06:07:22 +05:30
Thakee Nathees
e5d735851d regression: var declaration type info parser bug fix 2020-05-13 05:58:27 +05:30
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
Rémi Verschelde
da898c116c
Merge pull request #37160 from ThakeeNathees/saveing-cyclic-inheritance-crash-fix
Fix: saving gdscript with cyclic inheritance crash the editor
2020-05-10 13:11:40 +02:00
Rémi Verschelde
a128dd97d6
Merge pull request #37020 from aaronfranke/range
Allow using integer vectors for iteration and make range() use them
2020-05-10 13:11:07 +02:00
Thakee Nathees
79eee93b9a shadowed var warning in nested block bug fix
Fix: #38552
2020-05-10 10:54:23 +05:30
Thakee Nathees
3e10392d48 range() with non-numeric const argument crash fix 2020-05-10 10:07:23 +05:30
Thakee Nathees
c2ab35bdde fixed: saving gdscript with cyclic inheritance crash the editor
Fix: #9609
2020-05-10 09:07:09 +05:30
Thakee Nathees
5758d87f09 more clearer unexpected statement end error messages 2020-05-10 02:35:27 +05:30
Rémi Verschelde
a4b829410c
Merge pull request #38481 from RandomShaper/improve_yield
Fix object leaks caused by unfulfilled yields
2020-05-09 22:02:52 +02:00
Rémi Verschelde
b61a496aa7
Merge pull request #38357 from ThakeeNathees/dict2inst-crash-fix
fix: dict2inst crash when constructor has arguments
2020-05-09 22:00:04 +02:00
Rémi Verschelde
cf0953fefa
Merge pull request #37598 from ThakeeNathees/GDScript-type-resolve-bug-fix
GDScript class var type resolve bug fixed
2020-05-09 21:59:26 +02:00
Rémi Verschelde
f5371bc6b8
Merge pull request #37033 from ThakeeNathees/python-like-str-escape
python like string escape implemented
2020-05-09 21:53:59 +02:00
Rémi Verschelde
c04cdc2bf1
Merge pull request #38412 from ThakeeNathees/static-func-var-access
parser error for static func access non-static variables
2020-05-09 21:32:28 +02:00
Aaron Franke
cf4482e8c4
Change get_completion_identifier_is_function to return a bool
A minor bugfix
2020-05-09 13:45:00 -04:00
Aaron Franke
f7b50992b5
Allow using integer vectors for iteration and make range() use them 2020-05-09 13:43:35 -04:00
Pedro J. Estébanez
46bfe4452f 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:54:15 +02:00
Rémi Verschelde
4d50f747d5
Merge pull request #37293 from Janglee123/ctrl-click-improvements
Improved go-to definition (Ctrl + Click)
2020-05-05 16:49:15 +02:00
janglee
be7a353c70 Improved go-to definition (Ctrl + Click)
Co-Authored-By: Bojidar Marinov <bojidar.marinov.bg@gmail.com>
2020-05-05 10:46:12 +05:30
Rémi Verschelde
3c200b23fb
Merge pull request #32534 from Xrayez/fix-dict2inst-init
Make `dict2inst` to work with arbitrary `_init` parameters
2020-05-03 09:58:07 +02:00
Thakee Nathees
ce978517e0 parser error for static func access non-static variables
Fix: #38408
2020-05-03 11:45:11 +05:30
Steven Schoen
e6e5ba32cd Mention offending function name in "Indented block expected" error 2020-05-02 17:10:34 -07:00
Fabio Alessandrelli
d883b90988
Merge pull request #38105 from AndreaCatania/AndreaCatania-patch-2
Removed noisy ERR check from Multiplayer API.
2020-05-01 13:53:55 +02:00
Andrii Doroshenko (Xrayez)
7001d06f9d Make dict2inst to work with arbitrary _init parameters
This is achieved by skipping initializer call while creating an instance
of a GDScript. This is implemented by passing -1 as an argument count
to `_new` and interpreting any value below 0 to mean that the initializer
should not be called during instantiation, because internal members of
an instance are going to be overridden afterwards.
2020-04-30 18:30:04 +03:00
Thakee Nathees
9f6b20936e fix: dict2inst crash when constructor has arguments 2020-04-30 17:35:53 +05:30
Rémi Verschelde
92d4a0cbd2
Merge pull request #38288 from RandomShaper/imvu/fix_not_freed_gdsfuncstate
Fix leaked objects when game ends with yields in progress
2020-04-29 17:30:28 +02:00
Rémi Verschelde
39a0cdac5f
Merge pull request #38279 from BigRed-118/assert_mark_as_safe_regression_bug
Fix for marking assert lines as safe bug
2020-04-29 16:24:38 +02:00
Pedro J. Estébanez
c427334393 Fix leaked objects when game ends with yields in progress 2020-04-29 13:55:10 +02:00
Aaron Franke
540156b387
[Core] Rename linear_interpolate to lerp 2020-04-29 04:02:49 -04:00
Tom Evans
bd081df519 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
2020-04-27 20:25:54 -05:00
Rémi Verschelde
f61587b158
Merge pull request #36927 from ThakeeNathees/export-var-type-reduce-implimented
Fix: export var type reduce() implemented
2020-04-27 17:01:04 +02:00
Thakee Nathees
cd487201c6 export var type reduce() implemented 2020-04-27 19:26:57 +05:30
Rémi Verschelde
97f04e42f6
Merge pull request #37172 from theoway/autoCompletionBug
Fixed the auto-completion bug in gdscript_editor
2020-04-24 17:27:04 +02:00
Rémi Verschelde
39f77f95b8
Merge pull request #37265 from BigRed-118/mark_assert_safe
Mark assert lines as safe in gdscript
2020-04-24 17:24:45 +02:00
Rémi Verschelde
514fb5fa8a
Merge pull request #37232 from ThakeeNathees/load()-autocomplete-imlpemented
autocomplete for load() function implemented
2020-04-24 17:24:23 +02:00
Rémi Verschelde
6aac75afc2
Merge pull request #37318 from ttencate/fix/argument_nulled_37312
Revert "Allow parameters passed to GDScript functions to be nulled"
2020-04-22 16:09:28 +02:00
Andrea Catania
4d8a3839d0
Removed noisy ERR check from Multiplayer API. 2020-04-22 08:12:58 +02:00
Rémi Verschelde
f914276951
Merge pull request #37537 from ThakeeNathees/const-parsing-datatype-bug-fix
GDScript: Fix type inference for const reference to global class
2020-04-21 23:04:46 +02:00
Rémi Verschelde
9716204555
Merge pull request #37712 from stoofin/pattern-bind-warning
Fix unassigned variable warnings for match bindings
2020-04-21 23:04:16 +02:00
Rémi Verschelde
4f03e302a7
Merge pull request #38041 from ThakeeNathees/class-name-check-enhance
GDScript class name existance check enhanced
2020-04-21 16:19:53 +02:00
Rémi Verschelde
a5a9bf6a19
Merge pull request #37955 from ThakeeNathees/lin-unsafe-base-know-index-unkonwn
Line marked unsafe when base known and index unkonwn
2020-04-21 16:19:34 +02:00
Rémi Verschelde
9cad835880
Merge pull request #37954 from ThakeeNathees/autocomplete-indexing-native-types
Autocompleting with indexing for builtin types added
2020-04-21 16:19:07 +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
Rémi Verschelde
2cd952bd84 Fix handling of PROPERTY_USAGE_SUBGROUP in DocData and editor
Subgroups were added in #37678 but not properly handled everywhere
where PROPERTY_USAGE_GROUP is.
2020-04-20 17:13:06 +02:00
Rémi Verschelde
0ef8bcac4d DocData: Skip unexposed classes
Properly expose classes that we actually want accessible.
2020-04-20 12:51:10 +02:00
Thakee Nathees
62280c3d47 GDScript class name existance check enhanced 2020-04-20 16:20:36 +05:30
Thakee Nathees
0780ad2800 line unsafe for indexing with known base type & unkown identifier 2020-04-17 16:52:22 +05:30
Thakee Nathees
3c45377c6e autocompleting with indexing for native types added
Fix: #37768
2020-04-17 12:13:57 +05:30
Umang Kalra
b192c7d1ac Fixed the bool _static logic 2020-04-16 21:23:17 +05:30
Rémi Verschelde
5e5103f460
Merge pull request #37861 from reduz/implement-decals
Implement decals
2020-04-14 17:13:20 +02:00
Juan Linietsky
5944eb6e7f Implement decals
Also implemented decal atlas, so projectors and other stuff can be added.
Sidenote: Had to make RID hashable, so some unrelated includes changed
in order to include it in hashfuncs.h
2020-04-14 11:13:34 -03:00
Rémi Verschelde
cfb00d4ed0
Merge pull request #37817 from ThakeeNathees/disconnect-autocomplete
autocomplete for disconnect implemented
2020-04-13 12:07:25 +02:00
Thakee Nathees
efe90fce01 autocomplete for disconnect, is_connected implemented 2020-04-13 12:35:06 +05:30
Rémi Verschelde
67f7ba2645
Merge pull request #37395 from ThakeeNathees/collon-equal-parser-bug-fix
`:=` fails on some nodes fix: #37357
2020-04-10 12:36:44 +02:00
Stoofin
44281f233d Pattern bind counts as assignment
Fixes #34697
2020-04-09 05:01:40 -07:00
Thakee Nathees
e67eb5ca36 GDScript class var type resolve bug fixed
Fix: #37545
2020-04-05 08:35:24 +05:30
Thakee Nathees
029b34da40 GDScript: Fix type inference for const reference to global class
Fixes #37529.
2020-04-03 12:43:52 +05:30
Rémi Verschelde
ea7b497065 Replace more occurrences of NULL with nullptr 2020-04-02 14:56:01 +02:00
lupoDharkael
95a1400a2a Replace NULL with nullptr 2020-04-02 13:38:00 +02:00
Thomas ten Cate
4c3c73ef9c Add missing docs for assert message in GDScript
Seems like this was overlooked in PR #31142. See also issue #17082.
2020-03-31 19:56:44 +02:00
Rémi Verschelde
f3c74afd28
Merge pull request #37436 from akien-mga/doc-node-renames
doc: Update classref with node renames
2020-03-30 20:32:11 +02:00
Rémi Verschelde
eaaee63b62 doc: Update classref with node renames
A few extra renames for classes which were missed in last week's PRs.
2020-03-30 18:23:02 +02:00
Rémi Verschelde
cd4e46ee65 SCons: Format buildsystem files with psf/black
Configured for a max line length of 120 characters.

psf/black is very opinionated and purposely doesn't leave much room for
configuration. The output is mostly OK so that should be fine for us,
but some things worth noting:

- Manually wrapped strings will be reflowed, so by using a line length
  of 120 for the sake of preserving readability for our long command
  calls, it also means that some manually wrapped strings are back on
  the same line and should be manually merged again.

- Code generators using string concatenation extensively look awful,
  since black puts each operand on a single line. We need to refactor
  these generators to use more pythonic string formatting, for which
  many options are available (`%`, `format` or f-strings).

- CI checks and a pre-commit hook will be added to ensure that future
  buildsystem changes are well-formatted.
2020-03-30 09:05:53 +02:00
Thakee Nathees
bdd7048cb5 := fails on some nodes fix: #37357 2020-03-29 16:01:54 +05:30
Rémi Verschelde
0ecca1abd0
Merge pull request #37364 from ThakeeNathees/fix-forloop-range-bug-#37358
Fix for loop range bug: #37358
2020-03-28 17:39:36 +01:00
Thakee Nathees
0b5bad78c0 Fix for loop range bug: #37358 2020-03-28 02:20:58 +05:30
Thomas ten Cate
23a8a8c667 Revert "Allow parameters passed to GDScript functions to be nulled"
This reverts commit f0efc7521e.

Fixes #37312.
2020-03-26 17:02:28 +01:00
Juan Linietsky
441f1a5fe9 Popups are now windows also (broken!) 2020-03-26 15:49:42 +01:00
Juan Linietsky
f8a79a97c7 Effective DisplayServer separation, rename X11 -> LinuxBSD 2020-03-26 15:49:34 +01:00
Tom Evans
8dc8833782 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
2020-03-25 08:42:04 -05:00
Rémi Verschelde
cfd84625f0 Move DocData and Collada out of their subfolders
Now that the unused DocDump was removed, the `editor/doc` subfolder is
redundant.

Similarly, there's no reason for Collada to have a subfolder for itself
when glTF or OBJ don't.
2020-03-24 09:56:04 +01:00
Rajat Goswami
2ecf928ae3 Adding missing include guards to header files identified by LGTM.
This addresses the issue godotengine/godot#37143
2020-03-23 04:52:36 -04:00
Thakee Nathees
d2664a0ff1 autocomplete for load() function implemented 2020-03-22 22:21:34 +05:30
Rémi Verschelde
cb282c6ef0 Style: Set clang-format Standard to Cpp11
For us, it practically only changes the fact that `A<A<int>>` is now
used instead of the C++03 compatible `A<A<int> >`.

Note: clang-format 10+ changed the `Standard` arguments to fully
specified `c++11`, `c++14`, etc. versions, but we can't use `c++17`
now if we want to preserve compatibility with clang-format 8 and 9.
`Cpp11` is still supported as deprecated alias for `Latest`.
2020-03-17 07:36:24 +01:00
Thakee Nathees
f6cee4a121 python like string escape implemented 2020-03-15 05:37:15 +05:30
Rémi Verschelde
5002f6de84
Merge pull request #36599 from AndreaCatania/gen_rpc_data_export
Generates the rpc and rset info for exported GDScript.
2020-03-13 10:19:30 +01:00
Rémi Verschelde
e147be6031
Merge pull request #36723 from AndreaCatania/fix-rset
Fixed rset method for gdscript and visual script
2020-03-13 10:18:56 +01:00
luz.paz
7bf6e5f773 Fix various typos
Found via `codespell`
2020-03-11 13:59:18 -04:00
Rémi Verschelde
cdbf033290
Merge pull request #36704 from ThakeeNathees/gdscript-duplicate-args-fix
GDScript duplicate arguments bug fixed
2020-03-10 13:10:00 +01:00
Rémi Verschelde
57ab10ccf3
Merge pull request #36767 from ThakeeNathees/class-pass-fix
fix: Classes can't have pass
2020-03-10 13:08:27 +01:00
Rémi Verschelde
95c9345b63
Merge pull request #36859 from ThakeeNathees/logic-error-for-loop-range-parsing
Fix: logic error in gdscript_parser.cpp for-loop-range
2020-03-10 13:08:01 +01:00
Rémi Verschelde
478337c412
Merge pull request #36751 from Faless/debugger/threads_and_profilers
ScriptDebugger refactor, threading, profilers.
2020-03-09 19:08:07 +01:00
Rémi Verschelde
d9524d8890
Merge pull request #36912 from Xrayez/resurrect-module-icons
Fix missing module editor icons
2020-03-09 12:15:44 +01:00
Andrii Doroshenko (Xrayez)
3acebdeecd Fix missing module editor icons
Module icons need to be renamed to PascalCase as well
for them to be registered in 4.0.

See godotengine/godot#36513.
2020-03-08 19:32:25 +02:00
Rémi Verschelde
7579a792be
Merge pull request #36683 from rafaeldelboni/master
Return only scenes for script owners on LSP completion
2020-03-08 16:19:31 +01:00
Fabio Alessandrelli
b8ddaf9c33 Refactor ScriptDebugger.
EngineDebugger is the new interface to access the debugger.
It tries to be as agnostic as possible on the data that various
subsystems can expose.

It allows 2 types of interactions:

- Profilers:
  A subsystem can register a profiler, assigning it a unique name.
  That name can be used to activate the profiler or add data to it.
  The registered profiler can be composed of up to 3 functions:
    - Toggle: called when the profiler is activated/deactivated.
    - Add: called whenever data is added to the debugger
      (via `EngineDebugger::profiler_add_frame_data`)
    - Tick: called every frame (during idle), receives frame times.

- Captures: (Only relevant in remote debugger for now)
  A subsystem can register a capture, assigning it a unique name.
  When receiving a message, the remote debugger will check if it starts
  with `[prefix]:` and call the associated capture with name `prefix`.

Port MultiplayerAPI, Servers, Scripts, Visual, Performance to the new
profiler system.

Port SceneDebugger and RemoteDebugger to the new capture system.
The LocalDebugger also uses the new profiler system for scripts
profiling.
2020-03-08 12:36:39 +01:00
Rafael Delboni
2f08f4ef4e
fix: Return only scenes for script owners on LSP completion
Fix: #36680
2020-03-07 09:17:25 -03:00
Thakee Nathees
bcbcf0f1ea 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
2020-03-06 23:14:21 +05:30
Thakee Nathees
5424b626f9 duplicate arguments in a function handled 2020-03-06 20:23:58 +05:30
Thakee Nathees
07c99340d1 typo in gdscript_workspace.cpp/remove_cache_parser() fixed 2020-03-05 20:51:02 +05:30
Thakee Nathees
63ce1fc438 pass keyword inside a class implemented 2020-03-05 16:19:06 +05:30
Andrea Catania
e967a92c1b Fixed rset method for gdscript and visual script 2020-03-02 10:22:07 +01:00
Juan Linietsky
475e4ea67b Removed interactive loader, added proper thread loading. 2020-02-28 11:20:45 -03:00
Andrea Catania
33ae58710b Generates the rpc and rset info for exported GDScript.
Improved the send rpc log message when fail.

This work has been kindly sponsored by IMVU.
2020-02-28 12:39:18 +01:00