Commit Graph

1959 Commits

Author SHA1 Message Date
7032b111ce Merge pull request #60007 from aaronfranke/gds-op-adj-tr3d
GDScript: Rename OPCODE_TYPE_ADJUST_TRANSFORM to have a 3D suffix
2022-04-15 08:17:27 +02:00
4bf99f4af2 Narrow FileAccess scope to prevent deadlocks. 2022-04-12 10:54:39 +03:00
9381acb6a4 Make FileAccess and DirAccess classes reference counted. 2022-04-11 13:28:51 +03:00
cdbd6056ef GDScript: Fix method call on singletons 2022-04-08 12:20:57 -03:00
f3eca5abef GDScript: Rename OPCODE_TYPE_ADJUST_TRANSFORM to have a 3D suffix 2022-04-07 23:32:56 -05:00
1f62965d26 Add built-in Variant types to autocompletion list
Co-authored-by: Gustav <gusan092@student.liu.se>
2022-04-07 11:10:19 -05:00
4d0fdf2e98 Merge pull request #59947 from vnen/gdscript-static-methods-classdb 2022-04-06 20:57:34 +02:00
4710e2b278 GDScript: Add support for static method calls in native types 2022-04-06 14:14:38 -03:00
f851c4aa33 Fix some issues found by cppcheck. 2022-04-06 14:34:37 +03:00
db8e6bd83f Merge pull request #59885 from Jayman2000/autoload-inheritance-message 2022-04-04 23:56:20 +02:00
1cc7e7ec33 Improve autoload inheritance error message
Autoloaded scripts should always inherit from Node. When you run a
project that tries to autoload a script which doesn’t inherit from Node,
then Godot gives an error.

Before this change, the error said “Script does not inherit a Node”.
That error message is a little bit misleading. If a class inherits a
Node, then one of its superclasses has a Node. If a class inherits
_from_ Node, then one of its superclasses is Node. This change corrects
that mistake.

Fixes #59884.
2022-04-04 15:51:02 -04:00
f8ab79e68a Zero initialize all pointer class and struct members
This prevents the pitfall of UB when checking if they have been
assigned something valid by comparing to nullptr.
2022-04-04 19:49:50 +02:00
c630c2001d Merge pull request #59633 from EricEzaM/better-code-complete-update
Improve sorting of Code Completion options.
2022-04-03 12:34:00 +02:00
4ab605d14d Improve sorting of Code Completion options.
Done by ordering options by their location in the code - e.g. local, parent class, global, etc.
2022-04-01 20:39:09 +10:00
947d7c8329 Fix some issues found by clang sanitizers. 2022-03-31 18:35:56 +03:00
a647fb3e62 Fix typos with codespell
Using codespell 2.2-dev from current git.

Fix a couple incorrect uses of gendered pronouns.
2022-03-31 14:07:29 +02:00
5ba3b993d5 Merge pull request #59694 from vnen/gdscript-better-call-super 2022-03-30 17:58:11 +02:00
be718285f7 GDScript: Fix issues with completion and super calls
- Make call errors use the call node instead of the calle, which will be
  empty on super calls.
- Don't allow `super()` to be used within lambdas.
2022-03-30 11:58:29 -03:00
0584387918 Fix autocompletion of static methods in built-in types in GDScript 2022-03-30 17:40:41 +03:00
c9b75431f3 Refactor GDScript/C# script templates logic to be editor-only
Not a full refactor as it still goes through ScriptLanguage so it's hacky,
but at least it can now compile without this.
2022-03-28 16:21:00 +02:00
143d13717b Merge pull request #59553 from reduz/script-extension-support 2022-03-28 13:35:21 +02:00
ed14ff5a08 Revert "Sort autocomplete/code completion options in a better way" 2022-03-28 13:31:32 +02:00
795304e34f Merge pull request #59612 from YeldhamDev/style_and_grace 2022-03-28 11:36:27 +02:00
7fe5bece45 Merge pull request #58931 from EricEzaM/proposals/4189-better-code-completion
Sort autocomplete/code completion options in a better way
2022-03-28 08:56:27 +02:00
c422dc5feb Merge pull request #59064 from Chaosus/gds_fix_narrowing_conv_warning
Prevent NARROWING_CONVERSION warning for `int(float)` function in GDScript
2022-03-28 08:55:52 +02:00
42df9ed059 Make script templates follow the GDScript style guide 2022-03-28 01:32:12 -03:00
360dea5348 Add GDExtension support to Script
* Ability to create script languages from GDExtension
* Some additions to gdnative_extension.h to make this happen
* Moved the GDExtension binder to core

This now allows creating scripting languages from GDExtension, with the same ease as if it was a module. It replaces the old PluginScript from Godot 3.x.
Warning: GodotCPP will need to be updated to support this (it may be a bit of work as ScriptInstance needs to be created over there again).
2022-03-27 16:13:00 +02:00
f9e1c094a2 Improve sorting of Code Completion options.
Done by ordering options by their location in the code - e.g. local, parent class, global, etc.
2022-03-24 22:24:14 +10:00
d7d528c15f Merge pull request #59065 from fabriceci/script-template-condition-too-wide 2022-03-23 12:13:07 +01:00
dae97909bd Restrict the condition when checking if a script is a template 2022-03-23 11:03:44 +01:00
c14043b166 Prevent NARROWING_CONVERSION warning for int(float) function in GDScript 2022-03-22 09:17:00 +03:00
6cba2143de Merge pull request #59056 from Chaosus/gds_fix_extends_crash 2022-03-22 08:27:03 +03:00
7befa7234d Merge pull request #58971 from Chaosus/gds_multiline_annotation 2022-03-22 08:25:37 +03:00
188fa0c846 Merge pull request #59194 from Chaosus/gds_export_flags_limit_error
Add an error emitting when the `@export_flags` arg count is exceeded
2022-03-21 21:21:49 +01:00
8a6ab899ec Add an error emitting when the @export_flags arg count is exceeded 2022-03-16 17:12:15 +03:00
5a99aa3b3a Fix default value count checking for inherited function 2022-03-14 18:00:42 +03:00
d009d96a92 Prevent crash due to empty error message on empty extends in GDScript 2022-03-12 09:46:51 +03:00
85488f12f3 Allow making multiline annotations in GDScript 2022-03-10 10:56:14 +03:00
21637dfc25 Remove VARIANT_ARG* macros
* Very old macros from the time Godot was created.
* Limited arguments to 5 (then later changed to 8) in many places.
* They were replaced by C++11 Variadic Templates.
* Renamed methods that take argument pointers to have a "p" suffix. This was used in some places and not in others, so made it standard.
* Also added a dereference check for Variant*. Helped catch a couple of bugs.
2022-03-09 18:39:13 +01:00
4fee0e3b7d Fix VisualShaderNodeCustom script template 2022-03-09 09:45:20 +03:00
8c3d8b12ed Merge pull request #58853 from V-Sekai/default-arg-values 2022-03-07 10:40:42 +01:00
2eaadb1b52 Restore building web platform by enclosing resolve_function_signature. 2022-03-07 00:35:11 -08:00
53cf5eff9a Merge pull request #58847 from KoBeWi/editor_settings_mess 2022-03-07 08:38:15 +01:00
2057ea2883 Remove duplicate editor settings definitions 2022-03-06 22:05:49 +01:00
1ebcb58e69 GDScript: Check if method signature matches the parent
To guarantee polymorphism, a method signature must be compatible with
the parent. This checks if:

1. Return type is the same.
2. The subclass method takes at least the same amount of parameters.
3. The matching parameters have the same type.
4. If the subclass takes more parameters, all of the extra ones have a
default value.
5. If the superclass has default values, so must have the subclass.

There's a few test cases to ensure this holds up.
2022-03-06 11:16:20 -03:00
7d48afa96d Add test cases for accessing parent elements from child class 2022-03-04 12:41:20 -05:00
79bbe57244 Merge pull request #56830 from strank/parent-signals 2022-03-04 17:29:49 +01:00
bb8c4acdc9 Merge pull request #58185 from V-Sekai/explicit_variant_assignment_fix 2022-03-04 14:56:38 +01:00
e133adeb8c Merge pull request #58201 from V-Sekai/debugger_locals 2022-03-04 14:50:56 +01:00
4bbd7417c4 Merge pull request #58320 from mphe/fix_object_typed_arrays 2022-03-04 14:49:06 +01:00