Commit Graph

311 Commits (fe84b84b51df1ff6db658f521d1040aa563cedd0)

Author SHA1 Message Date
David Snopek 14506a4282 GDExtension: Prevent crash during shutdown as singletons are deleted 2024-05-10 13:17:36 +07:00
A Thousand Ships a0dbdcc3ab
Replace `find` with `contains/has` where applicable
* Replaces `find(...) != -1` with `contains` for `String`
* Replaces `find(...) == -1` with `!contains` for `String`
* Replaces `find(...) != -1` with `has` for containers
* Replaces `find(...) == -1` with `!has` for containers
2024-05-08 12:37:42 +07:00
Lyuma 0e5e743258 Bind compatibility GDExtension methods removed in 88418
These functions were likely not used, but we must ensure they are still bound to ensure API stability.
2024-05-07 01:36:36 +07:00
Rémi Verschelde 4b070e8031
Fix various typos with codespell
Using 2.2.7.dev217+g10c2abcf.

Had to add `colour` to the ignore list as we used it as an alias/keyword for the
documentation of color-related APIs.
Also ignore recommendations to change `thirdparty` to either `third-party` or
`third party`, which are correct but we use the former fairly consistently.
2024-05-07 10:08:42 +07:00
A Thousand Ships 955d5affa8
Reduce and prevent unnecessary random-access to `List`
Random-access access to `List` when iterating is `O(n^2)` (`O(n)` when
accessing a single element)

* Removed subscript operator, in favor of a more explicit `get`
* Added conversion from `Iterator` to `ConstIterator`
* Remade existing operations into other solutions when applicable
2024-05-04 16:08:55 +07:00
K. S. Ernest (iFire) Lee f9b488508c
Add PackedVector4Array Variant type
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2024-05-03 00:58:27 +07:00
Jan Haller 27a637d287 GDExtension: provide `free_property_list_func` with length of array 2024-04-27 14:13:17 +07:00
David Snopek 45463f75d6 Fix ptrcalls to static GDExtension methods 2024-04-25 08:20:22 +07:00
Rémi Verschelde e22743298a
Merge pull request #90961 from Lateasusual/gdextension-hot-reloading-borked
GDExtension: Fix missing library path breaking hot reloading
2024-04-22 22:18:34 +07:00
Chris Clyne 8564e94547 GDExtension: Fix missing library path breaking hot reloading 2024-04-20 21:08:11 +07:00
Fredia Huya-Kouadio 764de7fe31 Collapse the gdextension arguments into the `GDExtensionData` struct
This is used to reduce the number of arguments to `OS::open_dynamic_library(...)`.
2024-04-19 07:56:02 +07:00
Fredia Huya-Kouadio ede88cf59d Fix loading GDExtension dependencies on Android 2024-04-19 07:55:08 +07:00
Rémi Verschelde e73f40e260
Merge pull request #87117 from DmitriySalnikov/rename_pdb
Add renaming of PDB files to avoid blocking them
2024-04-11 11:02:31 +07:00
A Thousand Ships 64146cb7f3
[Core] Add iteration support to `Array` 2024-04-10 14:49:34 +07:00
DmitriySalnikov b73e740786 Add renaming of PDB files to avoid blocking them 2024-04-05 00:14:23 +07:00
Samuel Nicholas 5f89b15098
Print correct path when unable to find GDExtension library 2024-03-26 00:13:56 +07:00
ppphp d4e1a74efb Add 'override' mark to ResourceFormat class 2024-03-25 04:06:34 +07:00
A Thousand Ships 0c19d0f5a0
Add extension support for argument count to `ScriptInstance` 2024-03-13 22:40:09 +07:00
Rémi Verschelde a1c476f9d7
Merge pull request #87680 from AThousandShips/the_angry_count
Add methods to get argument count of methods
2024-03-13 22:16:43 +07:00
Thaddeus Crews 5a6e3cbcb0
SCons: Remove `run_in_subprocess` dependency 2024-03-11 13:20:09 +07:00
Rémi Verschelde 810f127022
Merge pull request #89365 from Repiteo/scons/run_in_subprocess-to-env.Run
SCons: Convert remaining `run_in_subprocess` to `env.Run`
2024-03-10 21:13:22 +07:00
Thaddeus Crews 8116d70d4b
SCons: Convert remaining `run_in_subprocess` to `env.Run` 2024-03-10 14:01:23 +07:00
Thaddeus Crews fb299d0fb1
SCons: Ensure `with` statement where applicable 2024-03-10 12:57:57 +07:00
A Thousand Ships 59bcc2888c
Add methods to get argument count of methods
Added to:
* `Callable`s
* `Object`s
* `ClassDB`
* `Script(Instance)`s
2024-03-10 11:02:43 +07:00
Thaddeus Crews d9fa40f2df
Enforce `\n` eol for Python writes
• Ensure utf-8 encoding if previously unspecified
2024-03-09 14:29:24 +07:00
Rémi Verschelde 50ca190286
Merge pull request #89055 from dsnopek/gdextension-script-free-lists
GDExtension: Pass count when freeing method and property lists for script instances
2024-03-04 13:33:45 +07:00
David Snopek 0badf07657 GDExtension: Pass count when freeing method and property lists for script instances 2024-03-02 10:13:37 +07:00
Rémi Verschelde 3a08c646ee
Pre-commit: Update to clang-format 17.0.6 and black 24.2.0 2024-02-28 14:25:35 +07:00
Robert Yevdokimov 13e82094ee Remove word duplicates in comments and strings, and fix casing and punctuation 2024-02-23 17:28:28 +07:00
Rémi Verschelde b652a81da7
Merge pull request #82554 from dsnopek/gdextension-placeholders
Allow registering "runtime classes" from GDExtension
2024-02-20 17:13:24 +07:00
David Snopek ea75307a11 Allow registering "runtime classes" 2024-02-20 09:20:58 +07:00
Rémi Verschelde e076405f30
GDExtension: Fix `-Wtype-limits` warning in `compatibility_maximum` patch check
And cleanup some dead code in `version.h`, we now always define `VERSION_PATCH`.
2024-02-19 01:19:30 +07:00
Rémi Verschelde dc41f2504b
Merge pull request #88417 from dsnopek/gdextension-compatibility-maximum
Allow GDExtensions to set a `compatibility_maximum`
2024-02-19 00:08:14 +07:00
David Snopek 99fd6ca98c Unbind GDExtension methods that can't reasonably be used 2024-02-16 16:31:09 +07:00
David Snopek 2afa3557b4 Allow GDExtensions to set a compatibility_maximum 2024-02-16 16:02:55 +07:00
Muller-Castro a8bc9f3e78 Add const lvalue ref to core/* container parameters 2024-02-14 11:20:36 +07:00
Rémi Verschelde fd43a7f3be
Merge pull request #88188 from dsnopek/gdextension-api-double-compatibility-hashes
Fix `gdextension_compat_hashes.cpp` for double precision builds
2024-02-12 23:29:41 +07:00
Rémi Verschelde 306dd5be3f
Merge pull request #87758 from dsnopek/gdextension-register-virtual-method
Allow GDExtensions to register virtual methods and call them on scripts
2024-02-12 23:29:37 +07:00
David Snopek be11002e41 Allow GDExtensions to register virtual methods and call them on scripts 2024-02-12 13:29:18 +07:00
David Snopek 445e3018f5 Fix `gdextension_compat_hashes.cpp` for double precision builds 2024-02-10 19:05:33 +07:00
Mikhail Tishin dc4c6cfb9b Add null check for gdextension deinitialization 2024-02-04 18:38:59 +07:00
Riteo f468e59efd GDExtension: add an interface for loading extra documentation
Adds two new GDExtension interface methods:
 - `editor_help_load_xml_from_utf8_chars`
 - `editor_help_load_xml_from_utf8_chars_and_len`

Both of these methods parse the XML passed into an extra documentation
container which, when needed, is merged into the main doc container.

Co-Authored-By: Rémi Verschelde <rverschelde@gmail.com>
2024-01-26 13:53:33 +07:00
Muller-Castro 96a95cb974 Add const lvalue ref to container parameters 2024-01-05 14:49:57 +07:00
Daylily-Zeleen fe6b073811 Distinguishs between dynamic library not found and can't be opened. 2024-01-01 20:01:57 +07:00
Ricardo Buring 82afe58aca Fix operator documentation in GDExtension API dump with docs
The type of the right operand is now taken into account.
2023-12-12 18:55:31 +07:00
David Snopek 5cf6d08dda Check that GDExtensionCompatHashes are valid when generating extension_api.json 2023-11-16 06:40:06 +07:00
Rémi Verschelde dfe2df989d
Merge pull request #84493 from bruvzg/gde_ios_static_fix
[iOS, GDExtension] Fix loading and exporting static libraries and xcframeworks.
2023-11-10 10:44:56 +07:00
bruvzg d4d5d68eda
[iOS, GDExtension] Fix loading and exporting static libraries and xcframeworks. 2023-11-09 20:04:40 +07:00
David Snopek 09fcc3a1ad Change `GDExtension`'s `library_path` back to an absolute path 2023-11-09 11:24:57 +07:00
David Snopek f86054e3a0 GDExtension: Save and compare modification times separately for reload 2023-11-02 08:29:22 +07:00
Rémi Verschelde f7c43a8a19
Merge pull request #83800 from dsnopek/gdextension-callable-custom-object-id
GDExtension: Use `ObjectID` when creating custom callable
2023-10-25 10:29:58 +07:00
David Snopek b0a33cac7c GDExtension: Use ObjectID when creating custom callable 2023-10-23 09:05:17 +07:00
Mario Liebisch f2bcd7d61f
GDExtension: Fixed error on loading extensions
Previously, before loading an extension, the editor just tried to
retrieve the extension by path to test if it's been loaded already.

While this is handled gracefully, it ignored an error thrown inside
`GDExtensionManager::get_extension()`, that would essentially still
report a not yet loaded extension to the engine's log:

```
ERROR: Condition "!E" is true. Returning: Ref<GDExtension>()
   at: GDExtensionManager::get_extension (core\extension\gdextension_manager.cpp:165)
```

This change actively checks whether the extension path is known and only
then proceeds to actually return the already loaded extension or loads
and returns the new one otherwise.
2023-10-21 17:00:18 +07:00
David Snopek b14f359c94 GDExtension: Fix `variant_iter_get()` actually calling `iter_next()` 2023-10-20 10:07:46 +07:00
Yuri Sizov 582ed157b5 Fix StringName leaks in GDExtension, core, and editor themes 2023-10-18 17:36:20 +07:00
Emmanuel Leblond fd33c7b32f
Merge pull request #83415 from touilleMan/fix-comment-gdextension_interface
Fix comment in `gdextension_interface.h`
2023-10-16 21:42:01 +07:00
Emmanuel Leblond 5aa9f1ce64
Fix comment in gdextension_interface.h 2023-10-16 21:40:45 +07:00
Rémi Verschelde eb9903b4ce
Merge pull request #83285 from dsnopek/gdextension-double-reload
GDExtension: Prevent issues with the editor trying to reload GDExtensions through its usual mechanism
2023-10-16 18:44:51 +07:00
Ricardo Buring c87b2a606e Add brief description in GDExtension API dump with docs
Also rename the "documentation" key to "description" for internal
consistency.
2023-10-14 12:06:37 +07:00
David Snopek 16a86b9604 GDExtension: Prevent issues with the editor trying to reload GDExtensions through its usual mechanism 2023-10-13 13:24:29 +07:00
Rémi Verschelde b40d90d333
Merge pull request #83107 from dsnopek/validated-method-vararg-message
GDExtension: Fix incorrect error message about vararg methods
2023-10-10 22:51:41 +07:00
David Snopek 87cb0bfa50 GDExtension: Fix incorrect error message about vararg methods 2023-10-10 08:46:25 +07:00
David Snopek 88b6fee547 GDExtension: Use correct return pointer for validated calls that return `Variant` 2023-10-10 08:31:08 +07:00
A Thousand Ships f18aa00e85 Replace `ERR_FAIL_COND` with `ERR_FAIL_NULL` where applicable 2023-10-08 17:23:33 +07:00
Rémi Verschelde a6a2d0d159
Merge pull request #82794 from dsnopek/gdextension-validated-call
GDExtension: Convert `validated_call()` to `ptrcall()` (rather than `call()`)
2023-10-06 16:50:57 +07:00
Rémi Verschelde 7c56631419
Merge pull request #82861 from mihe/gdext-entry-false
Fix extensions loading/initializing even when entry point fails
2023-10-05 22:50:35 +07:00
Mikael Hermansson 5c6353ae17 Fix extensions loading/initializing even when entry point fails 2023-10-05 18:24:58 +07:00
Yuri Sizov d427851013 Resolve relative icon paths for GDExtensions 2023-10-05 12:49:31 +07:00
Ced Naru 0a246e9b54 expose Object::free_instance_binding to GDExtension 2023-10-04 19:24:37 +07:00
David Snopek 55596eaac6 GDExtension: Convert `validated_call()` to `ptrcall()` (rather than `call()`) 2023-10-04 10:53:17 +07:00
Rémi Verschelde dbd4c79c38
Merge pull request #82682 from dsnopek/gdextension-dont-deprecate-script-category
GDExtension: Don't deprecate old method of getting script category
2023-10-03 17:26:41 +07:00
David Snopek cbf939e121 GDExtension: Don't deprecate old method of getting script category 2023-10-02 09:23:27 +07:00
kkolyan 43f92e4752 Fix inconsistent last_modified_time handling (prevent GDExtension reload spam on Windows 10) 2023-10-01 22:05:57 +07:00
Yuri Sizov 5f53ec9129 Merge pull request #78995 from Gallilus/master
Allow implementing `get_class_category` in GDExtension
2023-09-27 19:07:50 +07:00
David Cambré 531f56e830 add GDExtensionScriptInstanceGetClassCategory
Change GetClassCategory so it is handled in native directly
2023-09-27 17:45:48 +07:00
Rémi Verschelde 251fb83d53
Merge pull request #82331 from rburing/gdextension_dump_docs
Optionally include documentation in GDExtension API dump
2023-09-26 22:46:34 +07:00
Ricardo Buring 8ee04c5f87 Optionally include documentation in GDExtension API dump 2023-09-26 21:39:24 +07:00
David Snopek 2733a6f762 Implement reloading of GDExtensions 2023-09-25 22:10:17 +07:00
Rémi Verschelde d8c31155a8
Merge pull request #82191 from dsnopek/gdextension-redundant-hash-check
GDExtension: Remove redundant method bind hash check
2023-09-24 23:35:45 +07:00
Rémi Verschelde 40b48b13ee
Merge pull request #78580 from Bromeon/feature/gdextension-stringname-ctor
Add GDExtension function to construct StringName directly from char*
2023-09-24 23:30:04 +07:00
Jan Haller c770937db5 More precise documentation for GDExtension String constructors (bytes vs. character count) 2023-09-24 20:57:58 +07:00
Jan Haller ed3015e979 GDExtension: construct StringName directly from char*
So far, an indirection via String was necessary, causing at least 2 allocations and copies (String; String inside StringName).
Since StringNames often refer to string literals, this allows them to be directly constructed from C strings.

There are two formats: Latin-1 and UTF-8.

The Latin-1 constructor also provides the `p_is_static` flag: when the source has static storage duration, no copy/allocation will be needed.
However, the extension developer needs to uphold this lifetime guarantee.
2023-09-24 18:18:05 +07:00
David Snopek 0967fe6217 GDExtension: Remove redundant method bind hash check 2023-09-23 08:48:33 +07:00
Rémi Verschelde 6fc1d50db3
Merge pull request #81521 from dsnopek/method-bind-default-argument-hash-fix
Fix method hashes with default arguments
2023-09-22 22:03:30 +07:00
David Snopek 0d13727c97 Fix method hashes with default arguments 2023-09-21 12:39:04 +07:00
Jeff Ward 60851af4da Add functions for non-ptr style virtual calls in GDExtension
This adds two functions to `GDExtensionClassCreationInfo` that allow for developers to supply a generic virtual call function along with user data to be sent to that call.

If `get_virutal_call_data_func` is not null, extensions call this function to get user data to pass to a supplied `call_virtual_with_data_func`. Both must be provided is one is provided.

If `get_virtual_call_data_func` is null, Godot falls back to the old `get_virtual_func` logic.

Fixes #63275

Co-authored-by: David Snopek <dsnopek@gmail.com>
2023-09-19 22:33:32 +07:00
Rémi Verschelde 8dfc3f1864
Merge pull request #79005 from maiself/gde-custom-callable
Allow CallableCustom objects to be created from GDExtensions (extended)
2023-09-19 09:02:49 +07:00
David Snopek 6554ccf86d GDExtension: Delete left-over DLL copy before making a new copy 2023-09-12 09:57:40 +07:00
A Thousand Ships 893f889d74 [Core] Replace `ERR_FAIL_COND` with `ERR_FAIL_NULL` where applicable 2023-09-11 19:45:49 +07:00
Rémi Verschelde 43c7e8d3b5
Merge pull request #81515 from dsnopek/gdextension-validate-property-object
Allow implementing `Object::_validate_property()` from GDExtension
2023-09-11 15:40:05 +07:00
Rémi Verschelde 786dab42fd
Merge pull request #70329 from Daylily-Zeleen/daylily-zeleen/register_internal_class
Allow GDExtension to register unexposed classes.
2023-09-11 15:35:31 +07:00
David Snopek abef8e3874 Allow implementing `Object::_validate_property()` from GDExtension 2023-09-10 11:17:59 +07:00
Rémi Verschelde d1c94eef06
Merge pull request #81261 from dsnopek/gdextension-validate-property
Allow implementing `ScriptInstance::validate_property()` from GDExtension
2023-09-07 13:51:44 +07:00
David Snopek 3e7a6e058a Allow implementing `ScriptInstance::validate_property()` from GDExtension 2023-09-04 13:55:48 +07:00
Daylily-Zeleen 41ffe5461f Allow GDExtension to register unexposed class. 2023-09-04 10:18:20 +07:00
Fredia Huya-Kouadio 8cc7739197 Godot Android plugin re-architecture 2023-09-03 17:04:10 +07:00
Jan Haller 4e202bcec7 GDExtension: fix `bool` unknown in C 2023-09-02 21:04:49 +07:00
David Snopek 83faf84ec9 GDExtension: Allocate `GDExtensionScriptInstanceInfo2` for compatibility on the heap to prevent crash 2023-08-31 15:19:31 +07:00
Mai Lavelle e0ee985f64 Allow CallableCustom objects to be created from GDExtensions
Co-authored-by: David Snopek <dsnopek@gmail.com>
2023-08-31 12:36:25 +07:00
Rémi Verschelde 8edc0b43b9
Merge pull request #78634 from Sauermann/fix-notification-order
Fix `Object::notification` order
2023-08-30 08:44:36 +07:00