Commit Graph

77 Commits

Author SHA1 Message Date
780cf03051 Merge pull request #104556 from Ivorforce/string-extend-instead-of-parse
Use `append_` instead of `parse_` for `String` methods.
2025-03-29 10:16:33 -05:00
ffa6ef220b Use append_ instead of parse_ for String methods. 2025-03-27 17:51:02 +01:00
75881f8322 Use initializer list in Arrays 2025-03-26 18:38:15 +01:00
db5e843e46 Add clearing of static_gdscript_cache to GDScriptCache 2025-03-17 18:19:23 +01:00
daa074881b Revert "Fixed resource loader using not fully loaded scripts"
This reverts commit fd5fc9f3ee.

This caused significant regressions which are worse than the bug that #96499
aimed to address.

- Reverts #96499.
- Reopens #95909.
- Supersedes #102063.
- Fixes #99006.
- Fixes #101615.
2025-02-04 19:51:54 +01:00
83d4bde0a2 When calling code has length of string, pass it to parse_utf8 2024-12-01 08:31:22 +01:00
2584f75537 Merge pull request #96499 from beev1s/shallow-script-cache-error
Fix resource loader not resolving shallow loaded scripts through dependencies
2024-10-25 13:04:09 -05:00
6286f9d21d GDScript: Fix GDScriptCache::get_full_script() uses non-remapped path 2024-10-03 17:14:44 +03:00
fd5fc9f3ee Fixed resource loader using not fully loaded scripts 2024-09-14 17:21:32 +02:00
f4d76853b9 WorkerThreadPool (plus friends): Overhaul unlock allowance zones
This fixes a rare but possible deadlock, maybe due to undefined behavior. The new implementation is safer, at the cost of some added boilerplate.
2024-08-21 12:22:52 +02:00
d199f1f0d5 Fix resolve class inheritance after file rename 2024-08-10 19:21:24 -04:00
e680369d5b GDScript: Fix too many calls to 'remove_parser'
+fix excessive memory allocations when 'load'ing many dependant scripts
+fix excessive calls to vformat
2024-08-03 20:52:44 -07:00
86b23d0420 GDScriptCache: Clear abandoned parser refs 2024-07-23 12:54:45 -07:00
1ebd12ac5f Merge pull request #92616 from rune-scape/rune-invalidate-parser-chain
GDScript: Invalidate cached parser chain when reloading
2024-07-02 17:27:25 +02:00
6f8b90e412 Merge pull request #93032 from RandomShaper/wtp_antilock
GDScript: Avoid deadlock possibility in multi-threaded load
2024-06-28 14:42:48 +02:00
d334632908 GDScript: Avoid deadlock possibility in multi-threaded load 2024-06-19 14:01:54 +02:00
7f7114c008 GDScript: partially allow some functions on invalid scripts
+ always default initialize static variables
+ dont invalidate script when dependant scripts don't compile/resolve
2024-06-02 02:08:26 -07:00
ffc0d0981b GDScript: Invalidate cached parser chain when reloading 2024-05-31 18:49:48 -07:00
6b88c86cec GDScript: invalidate GDScriptParserRef when reloading 2024-04-18 14:05:58 -07:00
ee5ace10b7 Merge pull request #85501 from /remove-packed-scene-cache 2024-02-25 11:49:27 +01:00
b4d0a09f15 GDScript: Reintroduce binary tokenization on export
This adds back a function available in 3.x: exporting the GDScript
files in a binary form by converting the tokens recognized by the
tokenizer into a data format.

It is enabled by default on export but can be manually disabled. The
format helps with loading times since, the tokens are easily
reconstructed, and with hiding the source code, since recovering it
would require a specialized tool. Code comments are not stored in this
format.

The `--test` command can also include a `--use-binary-tokens` flag
which will run the GDScript tests with the binary format instead of the
regular source code by converting them in-memory before the test runs.
2024-02-08 11:20:05 -03:00
ef5dcccde7 Stop caching packed scenes in GDScript cache 2023-11-29 12:52:55 +02:00
a9c864dc35 Merge pull request #83039 from KoBeWi/it's_always_the_cache
Fix GDScript cache assigning UID as scene path
2023-11-10 10:44:33 +01:00
2d262c072b Fix GDScriptCache::get_full_script eating parsing errors because of early exit
Fixes #75545.
2023-10-18 18:21:59 -04:00
6849cf48d1 Fix GDScript cache assigning UID as scene path 2023-10-09 13:57:31 +02:00
517e9f8aef [Modules] Replace ERR_FAIL_COND with ERR_FAIL_NULL where applicable 2023-09-26 16:44:52 +02:00
955049670f GDScript: Add static analysis error reporting in GDScriptCache::get_full_script() 2023-07-07 11:16:22 -04:00
5f9175f969 Merge pull request #76954 from Rindbee/return-null-on-fail-load-script
Returns null and does not cache when the source code of the script fails to load
2023-06-19 21:17:47 +02:00
cbce374f68 Returns null and does not cache when the source code of the script fails to load
This usually means that an `ERR_FILE*` error occurred.

Previously, using `GDScriptCache::get_full_script()` would ignore errors during loading.
Now, all errors are not ignored.

Judging in which period the error occurred, it can be judged based on the return value:
1. null + err : Error during script loading (load_source_code()).
2. script + err: Error during script parsing.
2023-06-15 21:06:10 +08:00
25b2f1780a Style: Harmonize header includes in modules
This applies our existing style guide, and adds a new rule to that style
guide for modular components such as platform ports and modules:

Includes from the platform port or module ("local" includes) should be listed
first in their own block using relative paths, before Godot's "core" includes
which use "absolute" (project folder relative) paths, and finally thirdparty
includes.

Includes in `#ifdef`s come after their relevant section, i.e. the overall
structure is:

- Local includes
  * Conditional local includes
- Core includes
  * Conditional core includes
- Thirdparty includes
  * Conditional thirdparty includes
2023-06-15 14:35:45 +02:00
0ba6048ad3 Add support for static variables in GDScript
Which allows editable data associated with a particular class instead of
the instance. Scripts with static variables are kept in memory
indefinitely unless the `@static_unload` annotation is used or the
`static_unload()` method is called on the GDScript.

If the custom function `_static_init()` exists it will be called when
the class is loaded, after the static variables are set.
2023-04-27 09:51:44 -03:00
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
c3f12592da Cache script when reloading even if there's errors. 2023-01-01 14:09:17 -05:00
2dfc6d5b69 GDScript: Allow out of order member resolution 2022-12-14 21:44:05 -05:00
0139bd04b2 Fix GDScriptCache::clear() crash when clearing packed scenes 2022-12-10 19:10:12 -05:00
ff544df926 Fix GDScriptCache to not remove scripts/scenes individually when clearing 2022-12-10 12:48:07 -05:00
59c6642f2a Add missing packed scene cache clear inside GDScriptCache::clear() 2022-12-07 15:29:18 -05:00
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
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
a34a26eb66 Add PackedScene::reload_from_file() override 2022-11-28 10:23:02 -05:00
4e60689695 Fix cyclic reference base being loaded but not valid (which is ok) 2022-11-27 15:50:19 -05:00
69bb7e5b11 Fix singleton scene cyclic loading 2022-11-25 12:43:55 -05:00
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
eb62d241c0 [godot#61386] Fix autoload scenes implicit types 2022-11-21 23:39:31 -05:00
e86e15571f [godot#68971] Fetch cached scene if it exists in GDScriptCache 2022-11-21 15:57:45 -05:00
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
98ceb7ecf5 Add move_script check before executing logic 2022-11-20 15:21:57 -05:00
5ef971da1a GDScript: Cache scripts after parse error 2022-11-20 13:06:14 -05:00
a6410878db Fix empty text in editor 2022-11-20 03:17:16 -05:00
5704055d30 Fix cyclic references in GDScript 2.0 2022-11-18 16:41:31 -05:00