Commit graph

415 commits

Author SHA1 Message Date
myaaaaaaaaa
5cc961627d Avoid sorting CallableCustomMethodPointers by their actual address values 2023-06-20 08:40:01 -04:00
Rémi Verschelde
c9c941e339
CI: Update static checks to black 23.3.0
And apply it to the codebase, removing empty lines at the start of blocks.
2023-06-19 23:33:02 +02:00
fuzzy@home
09fa22002a fixes #76473, where filling a large amount of tiles all at once crashes
the engine due to segmentation fault.
2023-06-18 22:32:23 +09:00
ajreckof
e9a2060b27 Fix wrong alphabetical order in autocompletion sorting.
Co-Authored-By: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
2023-06-16 14:04:07 +02:00
Rémi Verschelde
8c5c29f2a3
Merge pull request #78061 from dsnopek/gdextension-class-not-exposed
Fix wrapping Object's in GDExtension that aren't exposed
2023-06-15 10:50:27 +02:00
ajreckof
81aa5ad999 add backward_undo_ops as property for action 2023-06-13 15:32:05 +02:00
Rémi Verschelde
37d1dfef9d
Merge pull request #78000 from RandomShaper/let_users_mess_up
Let user scripts disable thread safety checks
2023-06-10 12:12:13 +02:00
David Snopek
36f4b99638 Fix wrapping Object's in GDExtension that aren't exposed 2023-06-09 13:41:57 -05:00
Pedro J. Estébanez
2b001db76e Let user scripts disable thread safety checks 2023-06-09 18:24:01 +02:00
myaaaaaaaaa
e28868e30c Implement parallel foreach() for easier multithreading 2023-06-09 08:27:32 -04:00
Rémi Verschelde
577ab3c565
Merge pull request #75746 from ajreckof/order_autocomplete
Sort code autocompletion with rules
2023-06-08 18:14:31 +02:00
Rémi Verschelde
aa5dfff3f0
Merge pull request #77410 from dsnopek/object-pointer-pointer-encoding
Standardize Object ptrcall encoding on `Object **`
2023-06-07 13:31:49 +02:00
Yuri Sizov
97a6b40e4e
Merge pull request #70386 from sfrembling/70141
Add Human Readable Error Message for Object::set_meta
2023-05-29 17:24:25 +02:00
David Snopek
77733faede Attempt to standardize Object ptrcall encoding on Object ** 2023-05-25 21:46:22 -05:00
ajreckof
006e899bb3 sort code completions with rules
Fixups

Add levenshtein distance for comparisons, remove kind sort order, try to improve as many different use cases as possible

Trying again to improve code completion

Sort code autocompletion options by similarity based on input

To make it really brief, uses a combination `String.similiary`, the category system introduced in a previous PR, and some filtering to yield more predictable results, instead of scattering every completion option at seemingly random.

It also gives much higher priority to strings that contain the base in full, closer to the beginning or are perfect matches.

Also moves CodeCompletionOptionCompare to code_edit.cpp

Co-Authored-By: Micky <66727710+Mickeon@users.noreply.github.com>
Co-Authored-By: Eric M <41730826+EricEzaM@users.noreply.github.com>
2023-05-23 05:12:34 +02:00
Rémi Verschelde
80bf8fd186
Merge pull request #73511 from dsnopek/gdextension-object-name
Add GDExtension function to get Object class name
2023-05-22 14:02:59 +02:00
David Snopek
c6b0d4aae3 Add GDExtension function to get Object class name 2023-05-22 06:58:59 -05:00
Rémi Verschelde
9ad9820f5d
Merge pull request #77229 from RandomShaper/fix_mt_issues
Fix message queue issues
2023-05-19 14:30:10 +02:00
Pedro J. Estébanez
c450260e3e Fix message queue issues
- Missing flush in resource loading.
- Wrong checks about message queue instance.
2023-05-19 13:11:34 +02:00
RedworkDE
9c9fd9ffbf Improve error message when disconnecting callable from signal it was not connected to 2023-05-18 00:46:27 +02:00
Rémi Verschelde
26f96aec9d
Merge pull request #77143 from RandomShaper/fix_wtp_deadlocks
Avoid multiple possibilites of deadlock in resource loading
2023-05-17 15:59:18 +02:00
Rémi Verschelde
56fc6316b7
Merge pull request #64789 from derammo/derammo_const_ref
Change Ref<T> to allow non const access to ptr
2023-05-17 11:25:13 +02:00
Pedro J. Estébanez
a6e43f71b6 Avoid multiple possibilites of deadlock in resource loading 2023-05-17 01:52:39 +02:00
Rémi Verschelde
8cfa19a078
Merge pull request #77000 from reduz/make-more-base-nodes-thread-safe
Make more base nodes thread safe
2023-05-16 00:31:56 +02:00
Shea Frembling
0d6487073f update error from Object::set_meta to be more human readable
update error from Object::set_meta to be more human readable

Add metadata to error message

Add metadata to identifier
2023-05-15 15:14:45 -05:00
Juan Linietsky
0a9f72d5a8 Make more base nodes thread safe
Ongoing work to make more of the base nodes thread safe.
2023-05-15 16:54:10 +02:00
Rémi Verschelde
5c653c27cd
Merge pull request #77093 from RandomShaper/fix_mq_copy
Fix transfer of messages between queues
2023-05-15 13:47:18 +02:00
Rémi Verschelde
70dcfdab1f
Merge pull request #76446 from reduz/add-gdextension-api-compatibility
Add a backwards-compatibility system for GDExtension
2023-05-15 13:43:46 +02:00
Juan Linietsky
d8078d3f4c Add a backwards-compatibility system for GDExtension method
This adds a way to ensure that methods that were modified in the Godot API will continue working in older builds of GDExtension even if the new signature is different.

```C++
// New version (changed)
ClassDB::bind_method(D_METHOD("add_sphere","radius","position"),&MyShapes::add_sphere);
// Compatibility version (still available to extensions).
ClassDB::bind_compatibility_method(D_METHOD("add_sphere","radius"),&MyShapes::_compat_add_sphere);
```

**Q**: If I add an extra argument and provide a default value (hence can still be called the same), do I still have to provide the compatibility version?
**A**: Yes, you must still provide a compatibility method. Most language bindings use the raw method pointer to do the call and process the default parameters in the binding language, hence if the actual method signature changes it will no longer work.

**Q**: If I removed a method, can I still bind a compatibility version even though the main method no longer exists?
**A**: Yes, for methods that were removed or renamed, compatibility versions can still be provided.

**Q**: Would it be possible to automate checking that methods were removed by mistake?
**A**: Yes, as part of a future PR, the idea is to add a a command line option to Godot that can be run like : `$ godot --test-api-compatibility older_api_dump.json`, which will also be integrated to the CI runs.
2023-05-15 12:05:40 +02:00
Pedro J. Estébanez
93de52942a Fix transfer of messages between queues 2023-05-15 11:51:58 +02:00
Rémi Verschelde
20ed51a912
Merge pull request #72704 from myaaaaaaaaa/single-main-thread
Partial fixes for `threading/worker_pool/max_threads` = 0
2023-05-12 15:09:50 +02:00
Pedro J. Estébanez
123ba9d464 WorkerThreadPool: Handle exit signal in the tentative scheduling done during waits 2023-05-12 13:31:04 +02:00
myaaaaaaaaa
fcd8ce52e9 Partial fixes for threading/worker_pool/max_threads = 0 2023-05-12 07:27:35 -04:00
Rémi Verschelde
8f17f26233
Merge pull request #76978 from raulsntos/property-hint-compat
Reorder `PropertyHint` enum to avoid breaking compat
2023-05-12 10:06:32 +02:00
Raul Santos
a34207b812
Reorder PropertyHint enum to avoid breaking compat
Also syncs the Core enum with the C# enum for the source generators.
2023-05-12 01:48:07 +02:00
Pedro J. Estébanez
9077bb9232 Fix multiple issues in WorkerThreadPool
- Fix project settings being ignored.
- Made usages of `native_thread_allocator` thread-safe.
- Remove redundant thread-safety from `low_priority_threads_used`, `exit_threads`.
- Fix deadlock due to unintended extra lock of `task_mutex`.
2023-05-11 16:10:09 +02:00
Pedro J. Estébanez
5a4613f551 Avoid sync issues in resources with deferred updates 2023-05-10 18:53:41 +02:00
Rémi Verschelde
74e5ad5c60
Merge pull request #76165 from and-rad/safe-credentials
Store sensitive export options in dedicated credentials file
2023-05-10 12:47:07 +02:00
Rémi Verschelde
5271186f2f
Merge pull request #75901 from reduz/refactor-node-processing
Refactor Node Processing to allow Scene Multithreading
2023-05-10 12:46:44 +02:00
Andreas Raddau
fab160ce70 Store sensitive export options in dedicated credentials file 2023-05-10 11:40:17 +02:00
smix8
a6ac305f96 Rework Navigation Avoidance
Rework Navigation Avoidance.
2023-05-10 05:01:58 +02:00
Juan Linietsky
98c655ec8d Refactor Node Processing
* Node processing works on the concept of process groups.
* A node group can be inherited, run on main thread, or a sub-thread.
* Groups can be ordered.
* Process priority is now present for physics.

This is the first steps towards implementing https://github.com/godotengine/godot-proposals/issues/6424.
No threading or thread guards exist yet in most of the scene code other than Node. That will have to be added later.
2023-05-09 19:17:51 +02:00
Rémi Verschelde
ee931e2be5
Merge pull request #76814 from KoBeWi/underdata
Don't refresh inspector when changing internal meta
2023-05-09 17:44:49 +02:00
Rémi Verschelde
3e6a731904
Merge pull request #76418 from reduz/method-bind-validated-call
Add ValidatedCall to MethodBind
2023-05-08 13:52:42 +02:00
Rémi Verschelde
353efd774f
Merge pull request #76754 from RandomShaper/mq_less_lock
Avoid redundant locking in CallQueue
2023-05-08 12:20:53 +02:00
Rémi Verschelde
0daa634f24
Merge pull request #76747 from RandomShaper/fix_mq_redundant
Mend some checks in CallQueue
2023-05-08 12:20:45 +02:00
kobewi
5e3a985c91 Don't refresh inspector when changing internal meta 2023-05-07 22:12:22 +02:00
Pedro J. Estébanez
5a0c186bc0 Avoid redundant locking in CallQueue 2023-05-05 19:39:11 +02:00
Pedro J. Estébanez
8654e90759 Mend some checks in CallQueue 2023-05-05 17:37:44 +02:00
RedworkDE
1a4eccf7e7 Prevent infinite loop when signal disconnection fails during object deletion. 2023-05-05 13:34:25 +02:00
Juan Linietsky
1c93606e47 Add ValidatedCall to MethodBind
* This should optimize GDScript function calling _enormously_.
* It also should simplify the GDScript VM considerably.

NOTE: GDExtension calling performance has most likely been affected until going via ptrcall is fixed.
2023-04-30 20:01:26 +02:00
Pedro J. Estébanez
a79e71ad58 Add peace-of-mind checks to API hash caching 2023-04-26 10:44:52 +02:00
Rémi Verschelde
e0e93ce094
Merge pull request #72421 from myaaaaaaaaa/signal-hashmap
Store Object signals in a HashMap rather than a VMap
2023-04-25 19:26:35 +02:00
Rémi Verschelde
aa622dae53
Merge pull request #76431 from RandomShaper/fix_doc_help_cache
Improve reliability of editor docs cache
2023-04-25 14:44:17 +02:00
Pedro J. Estébanez
e1ce0340b7 Improve reliability of editor docs cache 2023-04-25 11:40:56 +02:00
Rémi Verschelde
15d952147c
Merge pull request #74101 from RandomShaper/fix_gds_obj_temps
Fix edge cases of object lifetime when signals involved
2023-04-25 09:58:17 +02:00
Pedro J. Estébanez
33f674d0f7 Complete support of callables of static methods 2023-04-12 18:12:19 +02:00
Juan Linietsky
6055e4424a Redo of Message Queue
* Functionality moved to a base class CallQueue, which will be used for inter-thread communication within the scene.
* MessageQueue now uses growing pages, starts from a single 4k page.
* Limit still exists, but because its not allocated by default, it can be much higher.
2023-04-12 16:31:23 +02:00
Rémi Verschelde
347a8e20ae
Merge pull request #69324 from RedMser/advanced-settings-errors
Make it easier to solve warnings/errors referring to project settings
2023-04-11 19:39:53 +02:00
Pedro J. Estébanez
2f4168daeb Fix edge cases of object lifetime when signals involved 2023-04-11 17:27:39 +02:00
Juan Linietsky
8950943356 Optimize Object::get_class_name
* Run the static function once per class instead of one per instance.
* Saves some memory in Object derived classes.
2023-04-08 19:25:50 +02:00
RedMser
ed960453b7 Make solving project setting errors easier
Show full project setting path in error messages.
Force filtering for advanced settings if filter is not empty.
2023-03-27 08:10:35 +02:00
kobewi
8f8178bda6 Fix auto-translations in editor 2023-03-22 23:57:12 +01:00
voidedWarranties
bd5ab9f9b4 Remove unused ScriptLanguage methods 2023-02-26 22:30:56 -08:00
myaaaaaaaaa
1ec5381c16 Store Object signals in a HashMap rather than a VMap 2023-02-25 18:44:09 -05:00
voidedWarranties
0a58025e40 Add missing virtual bind for ScriptExtension::_get_global_name 2023-02-15 19:48:01 -08:00
AndreaCatania
02f2107620
Improve error reporting when the Message Queue is out of Memory.
The function `statistics()`, called when the MessageQueue is out of memory,
will still use the MessageQueue so it crashes.
Moving the error above will improve the behavior since the developer will
find the crash reasons and the instruction on how to fix it.
2023-02-11 22:45:14 +01:00
Rémi Verschelde
532381562e
Merge pull request #72654 from RandomShaper/ptrcall_ret_raw_obj
Avoid losing references to objects in the native-scripting boundary
2023-02-11 15:35:01 +01:00
Emmanuel Leblond
58f4139164
Add Engine::unregister_script_language and make Engine::register_script_language returns a Error 2023-02-10 19:50:24 +01:00
Pedro J. Estébanez
0bcc7bb5c7 Avoid losing references to objects in the native-scripting boundary 2023-02-03 17:48:41 +01:00
kobewi
c1cc8fd87f Remove unused has_global_classes() 2023-02-03 15:43:56 +01:00
Rémi Verschelde
e52213e2fa
More codespell fixes, do more changes from previous ignore list 2023-02-01 12:11:36 +01:00
Juan Linietsky
79897dd5bc Restore script class cache if removed
I have no idea why anyone would do this, but this fixes it.

Fixes #72154. Depends on #72444 being merged to function properly.
2023-01-31 11:28:21 +01:00
Rémi Verschelde
2b55ac445b
Merge pull request #72111 from raulsntos/method-info-metadata
Add `GodotTypeInfo::Metadata` to `MethodInfo`
2023-01-27 15:41:38 +01:00
Raul Santos
cac7a784d6
Add GodotTypeInfo::Metadata to MethodInfo 2023-01-26 15:51:34 +01:00
Aaron Franke
2a65f6812b
Add PROPERTY_USAGE_NEVER_DUPLICATE flag and use for script
Co-authored-by: Yakov Borevich <j.borevich@gmail.com>
2023-01-24 16:37:50 -06:00
Aaron Franke
2bc0bcbd26
PropertyUsage: Rename "DO_NOT_SHARE_ON_DUPLICATE" to "ALWAYS_DUPLICATE" 2023-01-24 16:05:07 -06:00
kobewi
615c517034 Use range iterators in LocalVector loops 2023-01-21 18:44:42 +01:00
Rémi Verschelde
ebd0b40f6e
Merge pull request #71687 from reduz/support-script-class-name-in-efs
Support script global resource name in EditorFileSystem
2023-01-21 16:54:23 +01:00
Juan Linietsky
dddd8d43f6 Support script global resource name in EditorFileSystem
* Works for binary and text files.
* Makes EditorQuickOpen work with custom resources again.
* Information is cached and easily accessible.

Properly fixes #66179. Supersedes #66215 and supersedes #62417

**WARNING**: This required breaking backwards binary compatibility (.res and .scn files). Files saved after this PR is merged will no longer open in any earlier versions of Godot.
2023-01-21 14:19:27 +01:00
Juan Linietsky
3dcf380161 Implement a quick script inheritance check
Optimizes, simplifies and fixes EditorResourcePicker (was not refreshing custom clases).
2023-01-19 16:47:01 +01:00
Juan Linietsky
5bdc0d97d3 Clean up EditorFileSystem script parsing
* Optimize only update modified/added/removed files.
* Clean up documentation parsing.
2023-01-18 20:56:45 +01:00
kobewi
6444c7d127 Move global script class cache to separate file 2023-01-16 10:16:30 +01:00
Juan Linietsky
33d3b7eea7 Fix Callable call error reporting.
* Fix potential crash when using bind in `Variant::get_callable_error_text()`
* Properly compute bound arguments so they can be properly shown.
* Add a function to obtain the actual bound arguments.
2023-01-10 13:56:27 +01:00
Juan Linietsky
0e0a6bb39b
Removed unused property hints and Object::get_translatable_strings()
* Remove unused `EditorPropertyMember` and related hints, previouly used by
  VisualScript. Such logic should be implemented in the VS module itself.
* As the above broke compatibility with the VS module, clean up the other
  hacks that were still in core in support of VisualScript.
* `PROPERTY_USAGE_INTERNATIONALIZED` was only used in Object's
  `get_translatable_strings()`, which is a legacy function not used anywhere.
  So both are removed.
* Reordered some usage flags after the above removal to minimize the diff.
* General clean up.

Fixes #30203.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2023-01-09 16:56:01 +01:00
Rémi Verschelde
31f94574d4
Merge pull request #70996 from reduz/properly-report-callable-bound-arguments
Properly report Callable bound arguments
2023-01-09 08:34:28 +01:00
Rémi Verschelde
e7905f4f48
Merge pull request #71045 from reduz/use-bitfield-in-core-types
Use BitField<> in core type masks
2023-01-09 08:33:26 +01:00
Juan Linietsky
0e0ca01bce Properly report Callable bound arguments
Fixes #63213
Adds a function: Callable::get_amount_of_arguments_bound() to query this in callables. Exposed to the engine API.
2023-01-08 23:35:11 +01:00
Juan Linietsky
2b815df3c1 Use BitField<> in core type masks
* All core types masks are now correctly marked as bitfields.
* The enum hacks in MouseButtonMask and many other types are gone. This ensures that binders to other languages non C++ can actually implement type safe bitmasks.
* Most bitmask operations replaced by functions in BitField<>
* Key is still a problem because its enum and mask at the same time. While it kind of works in C++, this most likely can't be implemented safely in other languages and will have to be changed at some point. Mostly left as-is.
* Documentation and API dump updated to reflect bitfields in core types.
2023-01-08 22:17:40 +01:00
voidedWarranties
411719a399 Fix ScriptInstanceExtension::get_property_default_value return value 2023-01-06 19:55:02 -08: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
Rémi Verschelde
1816f49886
Merge pull request #64253 from heppocogne/Fix-native-enum-release-1
Register enum type names in release build
2023-01-06 00:10:31 +01: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
heppocogne
6f31f7b0bc Register native base class name of enum types when release build 2022-12-30 00:30:18 +09:00
Bastiaan Olij
7502e1dc0d Improve logic around using Ref<T> with GDExtension virtual functions 2022-12-13 10:54:29 +11:00
Rémi Verschelde
f1edd03d4c
Merge pull request #69718 from groud/finally_rename_gdnative_to_gdextension
Rename all gdnative occurences to gdextension
2022-12-12 11:43:59 +01:00
Gilles Roudière
be1c9d677d Rename all gdnative occurences to gdextension
Non-exhaustive list of case-sensitive renames:

GDExtension -> GDNative
GDNATIVE -> GDEXTENSION
gdextension -> gdnative
ExtensionExtension ->Extension (for where there was GDNativeExtension)
EXTENSION_EXTENSION ->EXTENSION (for where there was GDNATIVE_EXTENSION)
gdnlib -> gdextension
gdn_interface -> gde_interface
gdni -> gde_interface
2022-12-12 11:04:57 +01:00
kobewi
7c6b659bd7 Add PropertyInfo overload for GLOBAL_DEF 2022-12-11 21:36:48 +01:00
Micky
885f2a4eca Fix unable to disconnect signal in Editor once created
Adds a CONNECT_INHERITED flag to connections, only available in editor builds. This flag denotes that the signal has been inherited from a previous Scene in the instancing hierarchy.
2022-12-08 13:36:48 +01:00
Rémi Verschelde
a50e4fed18
Merge pull request #69343 from YuriSizov/core-missing-property-revert-getters
Add missing public `property_*_revert` getters
2022-12-05 18:05:59 +01:00