Commit Graph

2620 Commits

Author SHA1 Message Date
Rémi Verschelde ef01b49227
Merge pull request #71329 from vnen/gdscript-fix-enum-value-resolution
GDScript: Fix infinite recursion in resolution of enum values
2023-01-13 18:02:58 +01:00
Rémi Verschelde 4c2dea108e
Merge pull request #70540 from vaartis/multiline-arrays-dictionaries
Implement export_multiline support for Array[String] and Dictionary
2023-01-13 18:01:55 +01:00
Dmitrii Maganov 40613ebd21 GDScript: Fix typing of iterator in for loop 2023-01-13 15:36:11 +02:00
George Marques 3a5e41293c
GDScript: Fix infinite recursion in resolution of enum values 2023-01-13 10:17:30 -03:00
Rémi Verschelde aaa5158ff9
Merge pull request #70733 from vonagam/fix-assigning-untyped
GDScript: Fix some issues with assignments that involve untyped things
2023-01-12 20:08:55 +01:00
Rémi Verschelde 40b9c246b6
Merge pull request #71197 from adamscott/add-default-virtual-path-gdscript
Add default virtual `gdscript://` path to `GDScript` instances
2023-01-12 17:56:09 +01:00
Rémi Verschelde def592114f
Merge pull request #70700 from vonagam/fix-abstract-extends
GDScript: Fix extending abstract classes, forbid their construction
2023-01-12 17:19:51 +01:00
Dmitrii Maganov 274d49790d GDScript: Fix extending abstract classes, forbid their construction 2023-01-12 17:47:10 +02:00
Adam Scott e3e55b29ce Add default virtual `gdscript://` path to `GDScript` instances 2023-01-12 10:27:38 -05:00
Dmitrii Maganov ef81b344be GDScript: Fix wrong marking of some lines related to Variant as unsafe 2023-01-12 17:21:33 +02:00
Dmitrii Maganov 38c214d483 GDScript: Fix some issues with assignments that involve untyped things 2023-01-12 17:07:45 +02:00
Rémi Verschelde c6f4c0ac54
Merge pull request #70899 from adamscott/fix-vector-inf
Fix parse error using Vector{2,3,4}.INF
2023-01-12 15:59:01 +01:00
Dmitrii Maganov 5980abbcec GDScript: Fix getting type from PropertyInfo for Variant arguments 2023-01-12 16:47:06 +02:00
George Marques 75515e4303
Merge pull request #70987 from vonagam/fix-parameter-conversion-assign 2023-01-12 11:34:13 -03:00
George Marques 7319fa6082
Merge pull request #70713 from vonagam/fix-unnamed-enum-outer-conflicts 2023-01-12 11:22:01 -03:00
Dmitrii Maganov 0f184379de GDScript: Fix small inconsistencies with resolve_datatype 2023-01-12 15:52:55 +02:00
George Marques 66fda2aeea
GDScript: Fix temp values being written without proper clear
Temporary values in the stack were not being properly cleared when the
return value of calls were discarded, which can cause memory issues
especially for reference types like PackedByteArray.
2023-01-11 14:24:23 -03:00
Rémi Verschelde 5eb161a9c8
Merge pull request #70595 from adamscott/add-gdscript-editorconfig
Add GDScript `.editorconfig` rules
2023-01-11 01:10:10 +01:00
George Marques 04d0e851ea
GDScript: Fix use of conversion assign for variant values 2023-01-10 20:01:11 -03:00
Adam Scott 44d1d72af1 Add GDScript `.editorconfig` rules
- Uniformize `.gd` unit test files indentation to tabs (where needed)
2023-01-10 12:25:35 -05:00
Rémi Verschelde c894edd4cb
Merge pull request #71140 from vonagam/fix-const-index-subscript-type
GDScript: Fix type for index subscript on constant
2023-01-10 07:58:29 +01:00
Dmitrii Maganov ff505c9875 GDScript: Fix type for index subscript on constant 2023-01-10 07:10:00 +02:00
Adam Scott fb175d92da Fix GDScript base and outer classes, signals and functions lookup order
- Add outer class lookup test
- Add signal lookup test

Co-authored-by: Dmitrii Maganov <vonagam@gmail.com>
2023-01-09 20:12:10 -05:00
Rémi Verschelde d3fc9d9e41
Merge pull request #71051 from vonagam/consts-are-deep-start
GDScript: Begin making constants deep, not shallow or flat
2023-01-09 23:22:59 +01:00
Rémi Verschelde 509da86205
Merge pull request #69590 from anvilfolk/enums
GDScript enum fixes & refactor
2023-01-09 23:10:37 +01:00
ocean (they/them) 366ec895b1 Assorted enum and native type fixes 2023-01-09 11:08:07 -05:00
Rémi Verschelde df952a32f8
Merge pull request #71107 from vnen/gdscript-fix-nil-address-assign
GDScript: Don't use the NIL address to hold return value of functions
2023-01-09 14:22:16 +01:00
Rémi Verschelde c2f7c2d31a
Merge pull request #70655 from vonagam/fix-assert-multiline
GDScript: Fix multiline and trailing comma for assert
2023-01-09 14:19:37 +01:00
George Marques a1309f1f42
GDScript: Allow using await on calls to void functions 2023-01-09 09:55:05 -03:00
George Marques a3816434a6
GDScript: Don't use the NIL address to hold return value of functions
This prevents that the NIL address is filled with another value, which
causes problems for some instructions that read from NIL.
2023-01-09 09:20:18 -03:00
Rémi Verschelde b6be2ac621
Merge pull request #71028 from adamscott/make-gdscript-clear-less-prone-to-heap-use-after-free
Resolve `GDScript::clear()` `heap-use-after-free` ASAN errors
2023-01-09 09:22:39 +01:00
Adam Scott c45b9245ae Fix parse error using Vector{2,3,4}.INF 2023-01-08 16:14:40 -05:00
Dmitrii Maganov 71f7c8a9d3 GDScript: Fix multiline and trailing comma for assert 2023-01-08 20:18:46 +02:00
Dmitrii Maganov 5e2ac1a31e GDScript: Begin making constants deep, not shallow or flat 2023-01-08 07:29:10 +02:00
jordi d5e1b4a857 Force double quotes for NodePaths with apostrophes 2023-01-07 20:23:26 -06:00
Adam Scott d22199990e Resolve `GDScript::clear()` `heap-use-after-free` ASAN errors 2023-01-07 11:51:36 -05:00
Rémi Verschelde 163f6f5fe8
Merge pull request #68429 from KoBeWi/PropertySettings
Add PropertyInfo overload for GLOBAL_DEF
2023-01-06 22:59:29 +01:00
Dmitrii Maganov 532ffc30bd GDScript: Fix typing of lambda functions 2023-01-06 16:38:22 +02:00
Dmitrii Maganov a8c2f8a0e1 GDScript: Fix missing conversion for default argument values 2023-01-06 11:49:06 +02:00
Dmitrii Maganov 10e364bf43 GDScript: Fix array as default value for parameter 2023-01-06 06:25:55 +02:00
Dmitrii Maganov a1d06749f1 Unify typing of variables, constants and parameters in GDScript 2023-01-06 01:10:04 +02:00
Rémi Verschelde d95794ec8a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".
2023-01-05 13:25:55 +01:00
Rémi Verschelde fc4a734373
Merge pull request #70838 from reduz/gdscript-vm-optimization
Optimizations for GDScript VM
2023-01-05 12:57:31 +01:00
Rémi Verschelde dc3175e4cd
Merge pull request #70810 from adamscott/cache-gdscript-even-when-error
Cache script when reloading even if there's errors
2023-01-04 11:41:11 +01:00
Rémi Verschelde 8203e09330
Merge pull request #70859 from vonagam/fix-preload-native-type
GDScript: Fix wrong native type for preloaded class
2023-01-03 23:22:23 +01:00
Rémi Verschelde 26bed8aa85
Merge pull request #70875 from MewPurPur/stop-highlighting-invalid-node-refs
Stop NodeRef highlighting if you start with a number
2023-01-03 16:17:13 +01:00
VolTer 52cfd4551d Stop highlighting node refs if they are invalid identifiers 2023-01-03 16:00:16 +02:00
Rémi Verschelde 4e360ac612
Merge pull request #70702 from vnen/gdscript-error-on-assign-void
GDScript: Error when assigning return value of void function
2023-01-03 12:23:00 +01:00
Rémi Verschelde e4c1103af4
Merge pull request #70656 from vonagam/fix-void-returns
GDScript: Disallow return with value in void functions
2023-01-03 12:20:33 +01:00
Rémi Verschelde a797fa3b3d
Merge pull request #70503 from rune-scape/inner-class-docs
Inner classes get their docs back
2023-01-03 12:15:44 +01:00
Dmitrii Maganov 961b4ac5f5 GDScript: Fix wrong native type for preloaded class 2023-01-03 05:45:06 +02:00
Juan Linietsky 7211e041df Optimizations for GDScript VM
* Removed instruction argument count and instruction prefetching. This is now done on the fly. Reduces jumps.
* OPCODE_DISPATCH now goes directly to the next instruction, like in Godot 3.x.

I have nothing I can use to test performance, so if anyone wants to lend a hand and compare with master (both on debug and release), it would be very welcome.
2023-01-02 23:44:19 +01:00
Adam Scott c3f12592da Cache script when reloading even if there's errors. 2023-01-01 14:09:17 -05:00
George Marques 8a98110e3e
Merge pull request #62688 from cdemirer/assignments-and-types
Fixes https://github.com/godotengine/godot/issues/62650
2022-12-30 16:38:35 -03:00
George Marques bc739a4687
GDScript: Make using return of void function an error
Remove the `VOID_ASSIGNMENT` warning since those cases will be errors
now.
2022-12-30 13:35:38 -03:00
George Marques 33afa82fb0
Merge pull request #70613 from vonagam/fix-enum-as-constant
Fixes https://github.com/godotengine/godot/issues/54018
Fixes https://github.com/godotengine/godot/issues/70213
Fixes https://github.com/godotengine/godot/issues/70495
2022-12-30 12:10:50 -03:00
George Marques 0c15844551
GDScript: Error when assigning return value of void function
This also makes built-in method calls empty the return value when the
method is void, to avoid keeping returning a garbage value in such case.
2022-12-30 12:08:58 -03:00
Dmitrii Maganov 056066ee95 GDScript: Fix false name conflicts for unnamed enums 2022-12-29 22:04:13 +02:00
Dmitrii Maganov 9507f65e25 GDScript: Disallow return with value in void functions 2022-12-29 03:06:13 +02:00
Dmitrii Maganov b6aa4840d8 Fix usage of Enum as constant 2022-12-28 23:04:40 +02:00
Dmitrii Maganov f67aa3e46d GDScript: Fix return type of constructor call for extending class 2022-12-27 23:02:12 +02:00
cdemirer bbb21c3fd5 Fix type adjustment skipped when value is considered both not hard and not variant 2022-12-25 17:11:30 +03:00
Ekaterina Vaartis 60692b4e45 Implement export_multiline support for Array[String] and Dictionary
For arrays, specifically check if it's a string array and pass the
type on to the editor. For dictionaries, save the hint on the type and
use it later to draw the multiline editor, except for when adding a
string key, because that doesn't make much sense. All string values
however will be drawn as multiline.
2022-12-25 01:46:57 +03:00
rune-scape 1b77993257 Inner classes get their docs back 2022-12-23 17:39:24 -05:00
Rémi Verschelde ae4c025da9
Merge pull request #69991 from rune-scape/cast-type
GDScript: Fix cast producing null
2022-12-23 09:22:21 +01:00
Rémi Verschelde edfa1e8665
Merge pull request #70220 from adamscott/fix-external-enum
Fix external enums not assignable as constants
2022-12-23 09:20:50 +01:00
Rémi Verschelde e1657bd2a7
Merge pull request #70440 from rune-scape/null-again
Fix GDScript analyzer null literal
2022-12-22 16:02:19 +01:00
Rémi Verschelde 801ef6614d
Merge pull request #70138 from anvilfolk/signals
Add MethodInfo to signal datatype
2022-12-22 16:02:11 +01:00
rune-scape 3228fdb88a Fix GDScript analyzer null literal 2022-12-22 06:02:34 -05:00
Yuri Rubinsky abaedb54f1 Remove unused code paragraph from gdscript_editor.cpp/complete_code 2022-12-22 11:10:11 +03:00
ocean (they/them) d93dbab054 Add MethodInfo to signal datatype 2022-12-21 22:49:51 -05:00
ocean (they/them) fb418685a0 Unify GDScriptAnalyzer in-editor and runtime autoload checks 2022-12-20 19:01:28 -05:00
Aaron Franke 6590e1fd8a
Make script annotations placed before class_name and extends 2022-12-19 22:01:29 -06:00
Yuri Rubinsky 78d296d7ca Add a note for `inst_to_dict` to prevent using it on built-in instances 2022-12-19 19:12:00 +03:00
Rémi Verschelde e780dc332a
Merge pull request #70275 from rune-scape/autoload-subscript-regression
Fix autoload subscript regression
2022-12-19 01:12:35 +01:00
rune-scape 9f6ad59da7 Fix autoload subscript regression 2022-12-18 18:36:41 -05:00
Rémi Verschelde e9f3e7111f
Merge pull request #70237 from quentinguidee/refactor/fix-comma-instead-of-semicolon
Fix use of comma instead of semicolon
2022-12-18 16:55:10 +01:00
Quentin Guidée e0f1e02cc7
Fix use of comma instead of semicolon
Signed-off-by: Quentin Guidée <quentin.guidee@gmail.com>
2022-12-17 20:17:04 -05:00
Adam Scott 7fc814f697 Fix external enums not assignable as constants
- Add external enums test
- Rename external inner class test
- Clean up `GDScriptAnalyzer::reduce_identifier_from_base` class
  behavior
2022-12-17 17:59:38 -05:00
Adam Scott 1bbb2b4159 Fix outer class lookup 2022-12-17 17:57:00 -05:00
Adam Scott 2fefcf7329 Fix inner class constant assignment 2022-12-17 12:03:03 -05:00
Rémi Verschelde 8d52eea52b
Merge pull request #70000 from rune-scape/find-more-classes
GDScript: Fix built-in script `find_class` bugs
2022-12-17 16:30:34 +01:00
rune-scape 213c94b42f Fix enum value regression 2022-12-16 22:48:25 -05:00
Rémi Verschelde f18f2740da
Merge pull request #70131 from rune-scape/preload-type-regression
Fix preload type regression
2022-12-16 00:31:26 +01:00
stmSi 2a341a6321 Fixed GDScript crashed when two consecutive unary operators are analysed 2022-12-16 04:45:53 +06:30
rune-scape 17e03c29d6 Fix preload type regression 2022-12-15 16:47:13 -05:00
rune-scape e1c63fee86 GDScript: Fix built-in script and other `find_class` bugs 2022-12-15 14:56:23 -05:00
Adam Scott 3684fd249e Fix `GDScript::_get_gdscript_from_variant()` crash
The crash would happen, theoretically, when getting the type of a invalid
variant.
2022-12-15 12:29:01 -05:00
Rémi Verschelde 6debf86d51
Merge pull request #69471 from rune-scape/rune-out-of-order
GDScript: Out of order member resolution
2022-12-15 07:56:23 +01:00
rune-scape 2dfc6d5b69 GDScript: Allow out of order member resolution 2022-12-14 21:44:05 -05:00
rune-scape 7d0d6aa16f GDScript: Fix cast producing null 2022-12-12 19:57:26 -05:00
rune-scape 08449ab16e Fix String type compatibility being too permissive 2022-12-12 07:27:41 -05:00
Rémi Verschelde 1bfaa73e14
Merge pull request #69416 from anvilfolk/default-val
Add GDScript implicit type conversion for member variables with initializers
2022-12-11 23:58:22 +01:00
ocean (they/them) c8293a73b4 Add GDScript member initializer implicit type conversion 2022-12-11 16:55:02 -05:00
Rémi Verschelde 8410e7c9c6
Merge pull request #66733 from MewPurPur/unary-op-warnings
Fix unary op warnings never showing
2022-12-11 22:33:58 +01:00
kobewi 7c6b659bd7 Add PropertyInfo overload for GLOBAL_DEF 2022-12-11 21:36:48 +01:00
Rémi Verschelde 05097ded0a
Merge pull request #69897 from poohcom1/fix/function-return-completion
Fix autocomplete on functions returning variants
2022-12-11 15:18:24 +01:00
rune-scape 98e1a2031d Fix subscript of preloaded script 2022-12-11 07:59:43 -05:00
poohcom1 1845d927dc Fix autocomplete on functions returning variants
- When guessing return type, check type hints before last return value
2022-12-11 14:17:27 +07:00
Adam Scott 0139bd04b2 Fix `GDScriptCache::clear()` crash when clearing packed scenes 2022-12-10 19:10:12 -05:00
Rémi Verschelde 8f6f244680
Merge pull request #69587 from adamscott/fix-constant-base-typing-in-extended-class
Fix constants scope in extended or inner GDScript classes
2022-12-10 21:58:50 +01:00
Adam Scott beaef88abd Remove debug macro for GDScriptLanguage script_list 2022-12-10 14:09:04 -05:00
Adam Scott 65a49bad5a Fix constant base typing in extended GDScript class 2022-12-10 13:39:45 -05:00
Adam Scott ff544df926 Fix `GDScriptCache` to not remove scripts/scenes individually when clearing 2022-12-10 12:48:07 -05:00
Rémi Verschelde 1ac7e5a334
Merge pull request #69518 from rune-scape/rune-analyze-values
GDScript: Preload should make native type
2022-12-10 11:29:50 +01:00
Rémi Verschelde f6ea295bb1
Merge pull request #69467 from rune-scape/rune-subclass-script-path
GDScript: Fix subclass script path issues
2022-12-10 10:21:19 +01:00
Rémi Verschelde 907298d673
Merge pull request #68747 from rune-scape/rune-stringname-unification
GDScript: Unify StringName and String
2022-12-09 18:06:48 +01:00
Adam Scott da65b61edb Fix autocomplete crash as it would infinite loop 2022-12-08 23:40:17 -05:00
Adam Scott 59c6642f2a Add missing packed scene cache clear inside `GDScriptCache::clear()` 2022-12-07 15:29:18 -05:00
Yuri Rubinsky b229a19688 Fix lookup to docs for variables initialized with `get_node` 2022-12-07 15:16:04 +03:00
Rémi Verschelde 9bd7ad53f7
Merge pull request #69506 from adamscott/move-gdscript-uninit-to-finalize
Move GDScript uninitialization to `GDScriptLanguage::finish()`
2022-12-06 16:11:21 +01:00
Adam Scott 88f3045301 Move GDScript uninitialization to `GDScriptLanguage::finalize()`
Co-authored-by: Ricardo Buring <ricardo.buring@gmail.com>
Co-authored-by: kleonc <9283098+kleonc@users.noreply.github.com>
2022-12-06 09:35:39 -05:00
Rémi Verschelde 18f7461db8
Merge pull request #69606 from red1939/bug/vscode_crash
Keep GDScriptAnalyzer alive for whole parse()
2022-12-06 11:00:51 +01:00
Rémi Verschelde 85602efef6
Merge pull request #69639 from Chaosus/gds_fix_completion
Fix completion for the raw `get_node` call
2022-12-06 11:00:15 +01:00
Bartosz Bielecki 2af4f7f762 Keep GDScriptAnalyzer alive for whole parse()
Analyzed data is allocated by Parser but kept as a reference in the cache
which in turn is held by the Analyzer. If Analyzer goes away Parser is left
with a tree of dangling references.

Code is analogous to all other usages of Analyzer + Parser pair.
2022-12-06 10:01:18 +01:00
Yuri Rubinsky 20660bb23a Fix completion for the raw `get_node` call 2022-12-06 10:42:44 +03:00
rune-scape e79be6ce07 Unify String and StringName 2022-12-05 21:46:47 -05:00
Dmitrii Maganov 97280279ee Fix incomplete shadowing of member properties by parameters 2022-12-06 00:22:56 +02:00
rune-scape 6f8ffd5591 GDScript: preload should make native type 2022-12-04 05:36:17 -05:00
Adam Scott 7bcaa9df9e Fix missing parent class name identifier crash 2022-12-02 21:30:19 -05:00
rune-scape d531869a7c GDScript: Fix subclass script path issues 2022-12-01 20:43:27 -05:00
Yuri Sizov bf9cf7d034
Merge pull request #69166 from souplamp/icon-annotation-not-working
Update docs to clarify `@icon` only works with global script classes
2022-12-02 03:04:23 +03:00
kobewi e9a3e49086 Cleanup function state connections when destroying instance
Co-authored-by: Adam Scott <ascott.ca@gmail.com>
2022-12-02 00:20:11 +01:00
souplamp 369c7d2422 Update docs to mention `@icon` only works with global script classes
Update the docs to clarify that the `@icon` annotation does not work
when only attaching a script to a node, and clarify that the script itself
must be a globally accessible script type.
2022-12-01 12:52:58 -06:00
Rémi Verschelde 4821de146e
Merge pull request #69423 from KoBeWi/parenture
Improve parent signature error
2022-12-01 18:10:31 +01:00
Rémi Verschelde 2d96f63e09
Merge pull request #68481 from dalexeev/gds-fix-dyn-arg-def-val
GDScript 2.0: Fix shift due to skip of non-constant default argument values
2022-12-01 18:09:25 +01:00
kobewi d1e4146462 Improve parent signature error 2022-12-01 15:16:16 +01:00
Rémi Verschelde eb555d7559
Merge pull request #69303 from Chaosus/gds_fix_loops
Reset unassigned local variables to null in the loops
2022-12-01 10:21:21 +01:00
VolTer bfc093c53f Fix unary op warnings never showing 2022-12-01 01:09:10 +01:00
Rémi Verschelde c868e0b4b9
Merge pull request #69269 from red1939/red1939/master
Acknowledge that a CLASS kind of a DataType might not have an identifier
2022-11-30 10:49:09 +01:00
Bartosz Bielecki e10b0c5d98 Acknowledge that a CLASS kind of a DataType might not have an identifier 2022-11-30 09:26:50 +01:00
trollodel c90d0bd84f Use forward-declarations in big editor classes 2022-11-29 09:59:43 +01:00
Yuri Rubinsky 8d2506e811 Reset unassigned local variables to null in the loops 2022-11-28 19:45:24 +03:00
Rémi Verschelde 4555ccdf98
Merge pull request #69224 from adamscott/fix-PackedScene-reload_from_file
Add `PackedScene::reload_from_file()` override
2022-11-28 16:53:36 +01:00
Adam Scott a34a26eb66 Add PackedScene::reload_from_file() override 2022-11-28 10:23:02 -05:00
Yuri Rubinsky afbea19a22 Fix lookup code to pass functions with the same name as built-ins 2022-11-28 15:53:14 +03:00
Rémi Verschelde 166066d9f7
Merge pull request #69259 from adamscott/fix-cyclic-reference-base-issue
Fix cyclic reference base being loaded but not valid (which is ok)
2022-11-28 11:45:11 +01:00
Adam Scott 4e60689695 Fix cyclic reference base being loaded but not valid (which is ok) 2022-11-27 15:50:19 -05:00
rune-scape 847c9bd248 GDScript: Avoid using `get_global_class_native_base` 2022-11-27 03:55:53 -05:00
Rémi Verschelde c7ceb94e37
Merge pull request #69079 from adamscott/fix-singleton-scene-cyclic-load
Fix singleton scene cyclic loading
2022-11-25 19:29:57 +01:00
Adam Scott 69bb7e5b11 Fix singleton scene cyclic loading 2022-11-25 12:43:55 -05:00
Rémi Verschelde 8b7efd2306
Merge pull request #69134 from jquinl/export_range_int_fix
GDScript: Properly respect `int` type hint for `@export_range`
2022-11-24 23:30:40 +01:00
unknown 5fd382c2ab GDScript: Properly respect `int` type hint for `@export_range`
Fixes #69104.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2022-11-24 22:14:05 +01:00
clayjohn 075cea1077 Ensure class name is printed in STATIC_CALLED_ON_INSTANCE warning 2022-11-24 12:06:11 -08:00
Rémi Verschelde 910d6d8e62
GDScript: Only check if ignoring warnings in debug build 2022-11-24 11:50:32 +01:00
Adam Scott 2918689ff1 [godot#68977] Fix constants parameters 2022-11-23 08:15:54 -05:00
Rémi Verschelde 4abbb2d684
GDScript: Don't warn about RETURN_VALUE_DISCARDED by default
This happens too often with normal usage of the API.
The warning can still be useful to find actual bugs where discarding the return
value wasn't intentional, but this should stay enabled manually, at least until
we either improve the API to remove false positives, or improve the warning (e.g.
to only warn about unused return value on const functions).
2022-11-22 15:01:24 +01:00
Rémi Verschelde 0b2dc0f017
Merge pull request #68970 from Chaosus/gds_fix_lambda_signal
Fix using signals in lambda functions
2022-11-22 10:00:05 +01:00
Yuri Rubinsky f6c8c140f0 Fix using signals in lambda functions 2022-11-22 11:22:41 +03:00
Rémi Verschelde c474e2f639
Merge pull request #68987 from adamscott/fix-godot#61386-autoload-scenes-implicit-types
Fix autoload scenes implicit types
2022-11-22 08:31:36 +01:00
Rémi Verschelde 17b0c862ff
Merge pull request #68972 from adamscott/fix-godot#68971-cached-scene
Fetch cached scene if it exists in `GDScriptCache::get_packed_scene()`
2022-11-22 08:31:24 +01:00
Rémi Verschelde 28039094b3
Merge pull request #68911 from souplamp/return-value-discarded-error
Clarify what happens when return value is discarded in GDScript warning text
2022-11-22 08:30:51 +01:00
Adam Scott eb62d241c0 [godot#61386] Fix autoload scenes implicit types 2022-11-21 23:39:31 -05:00
souplamp 5bdd883dfd change RETURN_VALUE_DISCARDED GDScript warn text
changed RETURN_VALUE_DISCARDED GDscript warning text to mention how the return value of a function is discarded; update GDScript parser warning test to include new warning text.
2022-11-21 15:04:04 -06:00
Adam Scott e86e15571f [godot#68971] Fetch cached scene if it exists in `GDScriptCache` 2022-11-21 15:57:45 -05:00
Yuri Rubinsky 4a8276a773 Fix GDScript completion crash 2022-11-21 16:34:03 +03:00
Rémi Verschelde 190226098b
Merge pull request #68929 from adamscott/add-rename-check
Add `GDScriptCache::move_script` check before executing logic
2022-11-20 23:25:30 +01:00
Rémi Verschelde 15df1ffa9b
Merge pull request #68927 from rune-scape/rune-cache-parse-error
GDScript: Cache scripts after parse error
2022-11-20 23:25:19 +01:00
Adam Scott 98ceb7ecf5 Add move_script check before executing logic 2022-11-20 15:21:57 -05:00
rune-scape 5ef971da1a GDScript: Cache scripts after parse error 2022-11-20 13:06:14 -05:00
Rémi Verschelde f042a4e566
GDScript: Fix setting to disable all warnings
The boolean was never set with the value from the project settings.

Fixes #64559.
2022-11-20 18:54:09 +01:00
rune-scape a6410878db Fix empty text in editor 2022-11-20 03:17:16 -05:00
Adam Scott 6d7c8533d5 Remove fix leftover that caused cyclic load issues 2022-11-18 23:37:00 -05:00
Rémi Verschelde 5f73d55dfb
Merge pull request #68854 from anvilfolk/highlight-var
Add error highlighting for duplicate variables/constants
2022-11-18 23:08:11 +01:00
Rémi Verschelde 80b3813b15
Merge pull request #67714 from adamscott/fix-preload-cyclic-references-part2
Fix cyclic references in GDScript 2.0
2022-11-18 23:08:01 +01:00
Adam Scott 5704055d30 Fix cyclic references in GDScript 2.0 2022-11-18 16:41:31 -05:00
ocean (they/them) ef2aeca5df Add error highlighting for duplicate variables/constants 2022-11-18 15:20:26 -05:00
ocean (they/them) 13be0ab733 Fix ability to overload "script" variable 2022-11-17 17:21:12 -05:00
Yuri Rubinsky 95a85c9058
Merge pull request #68717 from rune-scape/rune-compiler-regression
Fixes https://github.com/godotengine/godot/issues/68716
2022-11-16 08:32:00 +03:00
Rune 61df8f4484 GDScript Compiler: regression fix 2022-11-15 22:20:49 -06:00
Rémi Verschelde 2d3197c525
Merge pull request #65372 from Mickeon/fix-treat-warnings-as-errors
Fix "Treat Warnings as Errors" Project Setting doing nothing
2022-11-15 16:25:25 +01:00
Yuri Rubinsky e2b60798fe
Merge pull request #68663 from Chaosus/gds_fix_completion 2022-11-15 18:21:20 +03:00
Rémi Verschelde 80dbcfd995
Merge pull request #68657 from Sauermann/fix-redundant-initialization
Remove redundant non-trivial Variant types initializations
2022-11-14 23:23:54 +01:00
Yuri Rubinsky 65d14679e7 Fix completion popup for the variables created with `get_node` call 2022-11-14 23:27:59 +03:00
Markus Sauermann 3b14f0334c Remove redundant Variant-types initializations 2022-11-14 19:35:19 +01:00
Rémi Verschelde 4d9adfea23
Merge pull request #65712 from Chaosus/gds_fix_completion
fix https://github.com/godotengine/godot/issues/64477
2022-11-14 17:20:54 +01:00
Rune bce6f1792e GDScript compiler subclass bugfixes 2022-11-13 02:29:21 -08:00
Danil Alexeev 0f8e28f818
GDScript 2.0: Fix shift due to skip of non-constant default argument values 2022-11-10 19:22:52 +03:00
Yuri Rubinsky f11b66b084 Fix named enums to use int64 type 2022-11-08 11:20:28 +03:00
Rémi Verschelde 7eb44fa47d
Merge pull request #68125 from kleonc/range-fix-single-arg-optimized-type-mismatch
[GDScript] Fix type mismatch in optimized single arg `range`
2022-11-02 14:18:24 +01:00
Rémi Verschelde b3c2db954f
Merge pull request #68136 from qarmin/projection_not_equal
Support for checking that Projection is(not) null
2022-11-02 14:17:29 +01:00
Rémi Verschelde 7c0e46f1c1
Merge pull request #68040 from adamscott/fix-property-getter-return-type
Fix property getter with custom return type
2022-11-02 14:16:37 +01:00
kleonc c268e3a235 GDScript Fix type mismatch in optimized single arg `range` 2022-11-02 13:20:47 +01:00
Rafał Mikrut d7d130295e Support for checking that Projection is(not) null 2022-11-01 20:49:52 +01:00
Rémi Verschelde 5947f22be9
Merge pull request #67578 from KoBeWi/GEDITOR
Unify usage of GLOBAL/EDITOR_GET
2022-10-31 13:15:58 +01:00
Rémi Verschelde 1e0edc48b5
Merge pull request #67826 from Chaosus/gds_fix_enum
Fix enum type to use int64_t instead of int in GDScript
2022-10-31 13:10:28 +01:00
Rémi Verschelde f4f98c4ecb
Merge pull request #67055 from GuilhermeGSousa/custom-node-export
Added custom node export
2022-10-31 11:11:07 +01:00
Rémi Verschelde 213ba46672
Merge pull request #68065 from zCubed3/fix_min_max_crash
`GDScriptAnalyzer` Fix math utilities crashing when invalid args are passed
2022-10-31 10:59:27 +01:00
Rémi Verschelde b43cc96535
Merge pull request #62695 from Spartan322/relax-constant-asserts
Allow non-constant string message for assert
2022-10-31 10:44:56 +01:00
zCubed3 b7f0ab13a4
Fix math utility functions crashing when invalid args passed 2022-10-30 15:18:03 -07:00
Adam Scott 26f0afdce2 [godot#68001] Fix property getter with custom return type 2022-10-29 20:38:26 -04:00
Yuri Rubinsky 9e04531938 Fix enum type to use int64_t instead of int in GDScript 2022-10-25 09:06:08 +03:00
Wei Guo d0edd36f80 Fix built-in script path of GDScript 2022-10-25 03:41:18 +08:00
Max Hilbrunner 13138b307b
Merge pull request #67656 from MewPurPur/instance🧹
Fix minor mistakes throughout the documentation
2022-10-21 18:19:32 +02:00
VolTer 05a9637d5d Fix small mistakes throughout much of the documentation 2022-10-21 00:20:59 +02:00
Max Hilbrunner cb36006f9e
Merge pull request #67100 from Mickeon/doc-peeves
Tweak `@GDScript` documentation overall
2022-10-19 21:45:35 +02:00
Micky a34cf161aa Tweak `@GDScript` documentation overall
- Made use of [param] more frequently,
- Link to other classes' documentation more often, improve the examples.
- Made the writing style closer to how the rest of the documentation is formatted.
- Ensure these are called "functions", not "methods".
- Add [b]Warning:[/b] where more appropriate than [b]Note:[/b]

Most notably, removed " It must be a static string, so format strings can't be used.", as this behavior is actually a bug.
2022-10-18 22:54:46 +02:00
kobewi e48c5daddf Unify usage of GLOBAL/EDITOR_GET 2022-10-18 19:01:48 +02:00
João Martins a0c4002520 Clarified reason why a resource cannot be loaded. 2022-10-16 17:27:00 -04:00
clayjohn 0a51bb4ca5 Add STATIC_CALLED_ON_INSTANCE warning to highlight
when static functions are called directly from objects
2022-10-14 10:43:42 -07:00
Guilherme Sousa 5d06843fcf Added custom node export 2022-10-14 17:31:00 +02:00
Rémi Verschelde 343bb9c07f Merge pull request #67361 from clayjohn/GDScript-unused-return-warning
Implement RETURN_VALUE_DISCARDED warning in GDscript
2022-10-14 10:19:55 +02:00
clayjohn be1e9acb7c Implement RETURN_VALUE_DISCARDED warning in GDscript 2022-10-13 11:56:45 -07:00
Rune 624af7e032 GDScript: fix highlighting '.' after global class name 2022-10-11 22:18:19 -07:00
Rémi Verschelde 62b066dbd6 Fix more MSVC C4702 (unreachable code) warnings 2022-10-07 14:43:59 +02:00
bruvzg 0103af1ddd
Fix MSVC warnings, rename shadowed variables, fix uninitialized values, change warnings=all to use /W4. 2022-10-07 11:32:33 +03:00
VolTer ac1761c8cd Fix outdated keywords autocompletion 2022-10-06 23:47:19 +02:00
Rémi Verschelde 9cd62741bb Merge pull request #66839 from aaronfranke/editor-prop-hide-slider
Fix `hide_slider` vs `no_slider` inconsistency in editor property code
2022-10-05 08:47:06 +02:00
Rémi Verschelde 52f5a58c38 Merge pull request #66873 from akien-mga/script-tweak-error-invalid-script-type
GDScript/C#: Tweak error message for invalid script type for object
2022-10-05 08:38:52 +02:00
Rémi Verschelde 8590721450 Merge pull request #66885 from atirut-w/lsp-doc-fix
LSP: Fix GDScript doc comments
2022-10-05 08:31:56 +02:00
Atirut Wattanamongkol f2522adb89 LSP: Fix GDScript doc comments 2022-10-05 11:25:52 +07:00
Hugo Locurcio 6afbf0bd5a
Improve dictionary printing to avoid confusion with arrays
- Add leading and trailing spaces within dictionaries, as the `{}`
  characters are hard to distinguish from `[]` on some fonts.
  This is especially helpful with empty arrays and dictionaries.
2022-10-04 20:33:40 +02:00
Rémi Verschelde 5bf95518fd GDScript/C#: Tweak error message for invalid script type for object
See #66870.
2022-10-04 12:56:49 +02:00
Rindbee ab0314938e Implement `GDScriptTextDocument::willSaveWaitUntil` to clean up outdated documents before saving
Implement `GDScriptTextDocument::willSaveWaitUntil` to clean up outdated documents before saving,
then update the document in `GDScriptTextDocument::didSave`.
2022-10-04 15:38:57 +08:00
Aaron Franke 094e8db97c
Fix hide_slider vs no_slider inconsistency in editor property code 2022-10-03 13:40:31 -05:00
Yuri Rubinsky 321251a133
Merge pull request #66759 from Chaosus/gds_fix_param_completion 2022-10-03 17:44:20 +03:00
Rémi Verschelde 6609f1b09f Merge pull request #66709 from MewPurPur/fix-unary-operators-being-STILL-broken
Fix more highlighting bugs
2022-10-03 09:30:01 +02:00
VolTer 2d48bf0b88 Fix more highlighting bugs 2022-10-02 17:44:39 +02:00
Yuri Rubinsky 7822378293 Fix completion of parameters in function call (2) 2022-10-02 13:30:15 +03:00
Yuri Rubinsky 6f75b0d79b
Merge pull request #64717 from Chaosus/gds_fix_param_completion 2022-09-30 18:34:33 +03:00
Yuri Rubinsky 5d4853f8ca Fix completion of parameters in function call 2022-09-30 15:42:05 +03:00
Rémi Verschelde 166df0896c Fix typos with codespell
Using codespell 2.3-dev from current git.

And fix typo in `methods.py` for `vsproj=yes` option (still won't work
though).
2022-09-30 14:23:36 +02:00
Rémi Verschelde f47979f087
Merge pull request #66242 from akien-mga/scons-unify-tools-target 2022-09-30 12:28:50 +02:00
Hugo Locurcio 530e31d4a3
Document `print_stack()` and `get_stack()` requiring a debugger connection 2022-09-28 12:24:39 +02:00
Rémi Verschelde cb39d7d08b Merge pull request #65074 from MewPurPur/booleans-highlighting-fix
Fix highlighting after value keywords
2022-09-27 09:58:58 +02:00
Rémi Verschelde 39facb35a0 SCons: Unify tools/target build type configuration
Implements https://github.com/godotengine/godot-proposals/issues/3371.

New `target` presets
====================

The `tools` option is removed and `target` changes to use three new presets,
which match the builds users are familiar with. These targets control the
default optimization level and enable editor-specific and debugging code:

- `editor`: Replaces `tools=yes target=release_debug`.
  * Defines: `TOOLS_ENABLED`, `DEBUG_ENABLED`, `-O2`/`/O2`
- `template_debug`: Replaces `tools=no target=release_debug`.
  * Defines: `DEBUG_ENABLED`, `-O2`/`/O2`
- `template_release`: Replaces `tools=no target=release`.
  * Defines: `-O3`/`/O2`

New `dev_build` option
======================

The previous `target=debug` is now replaced by a separate `dev_build=yes`
option, which can be used in combination with either of the three targets,
and changes the following:

- `dev_build`: Defines `DEV_ENABLED`, disables optimization (`-O0`/`/0d`),
  enables generating debug symbols, does not define `NDEBUG` so `assert()`
  works in thirdparty libraries, adds a `.dev` suffix to the binary name.

Note: Unlike previously, `dev_build` defaults to off so that users who
compile Godot from source get an optimized and small build by default.
Engine contributors should now set `dev_build=yes` in their build scripts or
IDE configuration manually.

Changed binary names
====================

The name of generated binaries and object files are changed too, to follow
this format:

`godot.<platform>.<target>[.dev][.double].<arch>[.<extra_suffix>][.<ext>]`

For example:
- `godot.linuxbsd.editor.dev.arm64`
- `godot.windows.template_release.double.x86_64.mono.exe`

Be sure to update your links/scripts/IDE config accordingly.

More flexible `optimize` and `debug_symbols` options
====================================================

The optimization level and whether to generate debug symbols can be further
specified with the `optimize` and `debug_symbols` options. So the default
values listed above for the various `target` and `dev_build` combinations
are indicative and can be replaced when compiling, e.g.:

`scons p=linuxbsd target=template_debug dev_build=yes optimize=debug`
will make a "debug" export template with dev-only code enabled, `-Og`
optimization level for GCC/Clang, and debug symbols. Perfect for debugging
complex crashes at runtime in an exported project.
2022-09-26 16:31:46 +02:00
Rémi Verschelde a587c0a45a Merge pull request #66366 from asmaloney/script-fix-redundant-if
_parse_function()
2022-09-26 15:50:46 +02:00
Rindbee 412e87349a Fix out of sync when the script is edited externally via lsp
Previously, external editing via lsp would modify the modified time of the script,
which caused the internal display of the script to not be refreshed when refocusing
the engine.

Now saving the script externally via lsp will automatically refresh the internal
display.
2022-09-25 23:30:35 +08:00
Rémi Verschelde 15ac442247 Merge pull request #63224 from Rindbee/update-GDScript-cache
Load/update GDScript from disk on load if cache mode is CACHE_MODE_IGNORE
2022-09-25 11:28:45 +02:00
Andy Maloney 127e2333f4 Remove redundant "if" condition in GDScriptCompiler::_parse_function()
Looking at the original PR, I believe this is the original intent, but it now means that previously dead code is now executed.
2022-09-24 12:30:43 -04:00
Rindbee f1a4041f52 Load/update GDScript from disk on load if cache mode is CACHE_MODE_IGNORE 2022-09-24 16:06:36 +08:00
Francois Belair 03e41d21e0 Prevent null crash when datatype not resolved 2022-09-23 11:13:57 -04:00
Rémi Verschelde 0aea7f2f0f Merge pull request #62411 from willnationsdev/gdres-gdscript
Add GDScript resource export.
2022-09-18 10:53:42 +02:00
willnationsdev 339aba1656 Add GDScript resource export. 2022-09-17 17:10:30 -05:00
I Woithe 4c785ae3f8
Spelling correction: change "no" to "not" 2022-09-17 21:02:54 +09:30
Abdelhafidh Belalia 4dca9975e7 Fix GDScript `preload` fails in standalone build unless files are present in directory
Fixes #56343.
2022-09-15 13:52:37 +02:00
Rémi Verschelde b2875d1acc
Merge pull request #65643 from voylin/fix_recurring_check_in_gdscript_cache.cpp 2022-09-13 10:45:50 +02:00
Rémi Verschelde 967938d15e
Merge pull request #65637 from Jummit/assert-example 2022-09-13 10:40:53 +02:00
Yuri Rubinsky b20aed2812 Fix completion for variables initialized by `get_node` call 2022-09-12 19:54:55 +03:00
Yuri Rubinsky 213bd4199b Fix last_modified_time on scripts 2022-09-12 09:35:46 +03:00
Voylin e5814c3f81 Fix for recurring check in gdscript_cach.cpp 2022-09-11 16:56:49 +09:00
Jummit 899b73e01d Remove outdated assert example 2022-09-11 07:55:03 +02:00
Micky dd26ecdd31 Rename CONNECT_ONESHOT TO CONNECT_ONE_SHOT
For consistency. Every other exposed `one_shot` is spaced out like this.
2022-09-06 19:00:33 +02:00
Micky 19571a8f44 Fix "Treat Warnings as Errors" Project Setting not working 2022-09-05 18:42:46 +02:00
Rémi Verschelde e64eb120a8 Merge pull request #65264 from MewPurPur/all-hail-icon-annotation 2022-09-02 23:15:31 +02:00
VolTer 126901cfce Remove old syntax for custom class icon 2022-09-02 22:06:47 +02:00
Hugo Locurcio f7292dbeb3
Rename `or_lesser` range property hint to `or_less`
"less" should be used for quantity, rather than "lesser".

Existing scripts that use `or_lesser` in `_get_property_list()`
will need to be updated to account for this change.
2022-09-02 19:08:20 +02:00
Rémi Verschelde 181019cea5 Merge pull request #65135 from reduz/export-customization-plugins 2022-09-01 23:43:39 +02:00
Juan Linietsky ef17c4668a Add support for scene/resource customization in export plugins
EditorExportPlugin adds a set of callbacks to allow customizing scenes, resources or subresources in all files exported:
* Can take scene files, resource files and subresources in all of them.
* Uses a cache for the converted files if nothing changes, so this work only happens if a file is modified.
* Uses hashing to differentiate export configuration caches.
* Removed the previous conversion code to binary, as this one uses existing stuff.

This API is useful in several scenarios:
* Needed by the "server" export platform to get rid of textures, meshes, audio, etc.
* Needed by text to binary converters.
* Needed by eventual optimizations such as shader precompiling on export, mesh merging and optimization, etc.

This is a draft, feedback is very welcome.
2022-09-01 11:16:00 +02:00
Rémi Verschelde 73021d491a
Merge pull request #65163 from MewPurPur/reuse-function-logic-for-global-funcs
Fix a case in global function highlighting
2022-09-01 09:18:39 +02:00