Commit Graph

210 Commits (cb1569345a6f17da08241e645ab03cb2e1b78d2f)

Author SHA1 Message Date
Haoyu Qiu c5d147b9b5 Allow configuring which translation domain Object.tr uses 2024-09-17 13:09:44 +07:00
Rémi Verschelde f7daa0fb2f
Merge pull request #96856 from RandomShaper/selfdestruct_correctness
Object: Let debug lock handle callee destruction within call chain gracefully
2024-09-16 13:35:06 +07:00
Pedro J. Estébanez 10e2318bde Object: Let debug lock handle callee destruction within call chain gracefully
Co-authored-by: lawnjelly <lawnjelly@gmail.com>
2024-09-12 08:51:24 +07:00
rune-scape 0dde931bc9 StringName: Fix empty hash
+Fixed compat hashes
2024-09-09 13:30:02 +07:00
Rémi Verschelde 58b3481eaf
Merge pull request #89649 from dalexeev/core-bind-and-doc-iter-virtual-methods
Core: Bind and document iterator API virtual methods
2024-09-06 11:10:58 +07:00
Rémi Verschelde 13a90e938f
Merge pull request #70096 from rune-scape/stringname-dict
StringName Dictionary keys
2024-09-03 17:38:06 +07:00
Danil Alexeev 49bcdf78a7
Core: Сheck `r_error` after calling `callp()` 2024-08-30 21:09:30 +07:00
Rémi Verschelde a5830f6eb9
Merge pull request #96317 from Chaosus/objectdb_write_path_instead_of_name_at_cleanup
Write path instead of name at verbose output of leaked instances
2024-08-30 11:43:13 +07:00
Rémi Verschelde 909629d9f9
Merge pull request #96166 from AThousandShips/more_lock_raii
Use `MutexLock` in more places
2024-08-30 09:59:19 +07:00
Chaosus 75055a8278 Write path instead of name at verbose output of leaked instances 2024-08-30 10:58:50 +07:00
rune-scape 154049ce17 StringName Dictionary keys
also added 'is_string()' method to Variant
and refactored many String type comparisons to use it instead
2024-08-29 13:39:27 +07:00
demolke c409e6d722 Import/export GLTF extras to node->meta
This is useful for custom tagging of objects with properties (for example in Blender) and having this available in the editor for scripting.

- Adds import logic to propagate the parsed GLTF extras all the way to the resulting Node->meta
- Adds export logic to save Godot Object meta into GLTF extras
- Supports `nodes`, `meshes` and `materials` (in GLTF sense of the words)
2024-08-29 19:17:04 +07:00
A Thousand Ships e33fdb4296
Use `MutexLock` in more places 2024-08-29 14:12:59 +07:00
Danil Alexeev be5068d44b
Core: Bind and document iterator API virtual methods 2024-08-27 21:57:22 +07:00
Haoyu Qiu 8bf4ecc026 Add `String.is_valid_unicode_identifier()`
- Adds `is_valid_unicode_identifier()`
- Adds `is_valid_ascii_identifier()`
- Deprecates `is_valid_identifier()`
- Renames `validate_identifier()` to `validate_ascii_identifier()`
2024-08-27 11:34:08 +07:00
Daylily-Zeleen 3d575801ce Allow ClassDB to create a Object without postinitialization for GDExtension. 2024-08-20 20:19:02 +07:00
Pedro J. Estébanez 32b7f835d8 Avoid potential crash on signal disconnection 2024-08-19 12:18:04 +07:00
Haoyu Qiu 7343dc3a5d Split TranslationServer into its own file 2024-08-15 15:00:47 +07:00
Pedro J. Estébanez 76bfe8e0fd Make errors on RefCounted.free() more accurate 2024-07-15 08:51:42 +07:00
rune-scape ca916a536a Object: use correct GDExtensionConstStringNamePtr 2024-06-17 19:06:40 +07:00
Raul Santos 29bf60cc02
Use GDExtension `to_string` in Node
Matches the `Object::to_string` implementation.
2024-06-11 17:40:51 +07:00
kobewi 413c11357d Use Core/Scene stringnames consistently 2024-05-13 23:41:07 +07:00
kobewi a262d2d881 Add shorthand for using singleton string names 2024-05-11 18:53:08 +07:00
David Snopek 14506a4282 GDExtension: Prevent crash during shutdown as singletons are deleted 2024-05-10 13:17:36 +07:00
Pedro J. Estébanez b834037841 Object: Add missing lock 2024-05-08 17:41:40 +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
Rémi Verschelde 947f5a8741
Merge pull request #91247 from AThousandShips/callable_fix
Fix unsafe uses of `Callable.is_null()`
2024-04-29 10:10:32 +07:00
A Thousand Ships 31e7ee63f2
Fix unsafe uses of `Callable.is_null()`
`Callable.is_null()` is not equivalent to `!Callable.is_valid()` and
doesn't guarantee the call is valid.
2024-04-27 16:22:57 +07:00
Jan Haller 27a637d287 GDExtension: provide `free_property_list_func` with length of array 2024-04-27 14:13:17 +07:00
Radiant e263b11cdd Implement remove_user_signal()
Co-authored-by: Timothe Bonhoure <tbonhoure@ymail.Com>
Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
2024-04-18 11:22:59 +07:00
A Thousand Ships 64146cb7f3
[Core] Add iteration support to `Array` 2024-04-10 14:49:34 +07:00
A Thousand Ships db455e5bee
[Core] Disconnect one-shot signals before calling callbacks
This prevents infinite recursion with one-shot connections emitting
themselves
2024-03-20 20:24:44 +07:00
Michael Alexsander 11937d3a79
Fix translation fallback not working in the Project Manager 2024-03-15 12:00:20 +07:00
Michael Alexsander 05f6c56a48
Fix some translations not properly falling back 2024-03-14 16:38:12 +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
Rémi Verschelde b85337b7ea
Merge pull request #87222 from RandomShaper/fix_obj_leaks_report
Fix inaccuracies in the report of leaked objects
2024-03-06 13:16:48 +07:00
Rémi Verschelde c1377920cd
Merge pull request #86743 from Mickeon/autocompletion-optimise-object
Optimise comparisons for Object's `get_argument_options`
2024-03-01 14:56:06 +07:00
Micky cd2032a90b Optimise Object's `get_argument_options` 2024-02-29 18:00:54 +07:00
Michael Alexsander d70c45b5c8
Add option to add built-in strings in the POT generation 2024-02-28 11:34:26 +07:00
Raul Santos 5ba92e5a57
Fix some DEFVALs to use the right type
- Use `StringName()` in DEFVAL for StringNames.
- Use `Variant()` in DEFVAL for Variants.
2024-02-23 01:50:18 +07:00
David Snopek ea75307a11 Allow registering "runtime classes" 2024-02-20 09:20:58 +07:00
EterDelta fee70558f8 Expose NOTIFICATION_EXTENSION_RELOADED to ClassDB 2024-02-02 14:57:00 +07:00
kobewi 2de8bc00a1 Simplify RefCounted check in free() 2024-01-18 12:29:58 +07:00
Pedro J. Estébanez a04a67ead6 Fix inaccuracies in the report of leaked objects 2024-01-15 19:35:14 +07:00
Wilson E. Alvarez 80fb8db31f
Remove unnecessary assignments
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
2023-12-13 11:06:26 +07:00
Raul Santos 9750e49c57
Add `NOTIFICATION_PREDELETE_CLEANUP` notification
New notification sent after `NOTIFICATION_PREDELETE` to let Objects cleanup at the very end, it should be the last notification sent.
2023-10-20 13:43:42 +07:00
Mai Lavelle 5e15586ec2 Fixes to allow object-less callables throughout Godot
This fixes #81887
2023-10-06 16:31:35 +07:00
Rémi Verschelde c7ed5d795e
Merge pull request #82799 from CedNaru/feature/expose_free_instance_binding
Expose `Object::free_instance_binding()` to GDExtension
2023-10-05 10:10:58 +07:00
Ced Naru 0a246e9b54 expose Object::free_instance_binding to GDExtension 2023-10-04 19:24:37 +07:00
Danil Alexeev ed0b3c08e1
Core: Fix `Object::has_method()` for script static methods 2023-10-04 19:44:32 +07:00
Danil Alexeev aff767ef07
Fix expected argument count for `Callable` call errors 2023-09-29 20:00:10 +07:00
Rémi Verschelde 55dfbd7761
Merge pull request #80284 from dsnopek/gdextension-hot-reload
Implement reloading of GDExtensions
2023-09-26 08:17:28 +07:00
David Snopek 2733a6f762 Implement reloading of GDExtensions 2023-09-25 22:10:17 +07:00
398utubzyt 2df37a237a C#: Abstract script class support 2023-09-15 20:35:25 +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
David Snopek abef8e3874 Allow implementing `Object::_validate_property()` from GDExtension 2023-09-10 11:17:59 +07:00
Rémi Verschelde fa3428ff25
Merge pull request #81221 from dalexeev/editor-inspector-and-signal-dock-improvements
Editor: Inspector and Signal docks improvements
2023-09-03 00:21:04 +07:00
Jan Haller 4e202bcec7 GDExtension: fix `bool` unknown in C 2023-09-02 21:04:49 +07:00
Danil Alexeev c33ca26e17
Editor: Inspector and Signal docks improvements 2023-09-02 08:50:28 +07:00
Markus Sauermann c4705a590b Fix Object::notification order
Previously the `p_reversed` parameter didn't influence the order
in a correct way.
Also script overridden _notification functions were not called in
the correct order.

To fix this some `notification` functions had to add a `p_reversed`
parameter.

This made it necessary to adjust cpp-bindings.

Co-authored-by: David Snopek <dsnopek@gmail.com>
2023-08-30 00:15:55 +07:00
kobewi 67db4693eb Expose _validate_property() for scripting 2023-08-28 15:18:48 +07:00
Marc Gilleron e8731f4821 GDExtension: fix _get_property_list not working correctly in parent classes 2023-07-20 02:24:04 +07:00
Angad Kambli 9c6c2f09e0
Check parameter validity in `Object::set_script`
Fixes #46120.
2023-07-07 16:13:33 +07:00
David Snopek 36f4b99638 Fix wrapping Object's in GDExtension that aren't exposed 2023-06-09 13:41:57 +07: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 +07: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 +07:00
David Snopek c6b0d4aae3 Add GDExtension function to get Object class name 2023-05-22 06:58:59 +07:00
RedworkDE 9c9fd9ffbf Improve error message when disconnecting callable from signal it was not connected to 2023-05-18 00:46:27 +07: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 +07: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 +07: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 +07: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 +07: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 +07:00
kobewi 5e3a985c91 Don't refresh inspector when changing internal meta 2023-05-07 22:12:22 +07:00
RedworkDE 1a4eccf7e7 Prevent infinite loop when signal disconnection fails during object deletion. 2023-05-05 13:34:25 +07: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 +07: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 +07:00
Pedro J. Estébanez 2f4168daeb Fix edge cases of object lifetime when signals involved 2023-04-11 17:27:39 +07: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 +07:00
kobewi 8f8178bda6 Fix auto-translations in editor 2023-03-22 23:57:12 +07:00
myaaaaaaaaa 1ec5381c16 Store Object signals in a HashMap rather than a VMap 2023-02-25 18:44:09 +07: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 +07:00
Raul Santos cac7a784d6
Add `GodotTypeInfo::Metadata` to `MethodInfo` 2023-01-26 15:51:34 +07: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 +07: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 +07: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 +07: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 +07: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 +07: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 +07:00
Yuri Sizov a9961b378a Add missing public property_*_revert getters 2022-11-29 23:07:40 +07:00
Emmanuel Leblond 1e8756c94b
Use StringName in the whole GDExtension API instead of const char * 2022-11-08 21:44:07 +07:00
Rémi Verschelde 6ad5637ffc Merge pull request #66427 from Mickeon/object-methods-autocompletion
Add autocompletion to several Object methods
2022-10-13 18:41:24 +07:00
Micky dc51ff8c5b Rename `set`/`get_indexed`'s "property" to "property_path"
Also touches up the Documentation slightly.
2022-10-12 10:27:44 +07:00
Micky 2a66ddb1bb Add autocompletion to several Object methods
Add autocompletion for the following Object methods:
-  `connect`, `is_connected`, `disconnect`, `emit_signal`, `has_signal`;
- `call`, `call_deferred`, `callv`, `has_method`;
- `set`, `set_deferred`, `get`;
- `set_meta`, `remove_meta`, `has_meta`, `remove_meta`.
2022-09-26 10:02:31 +07: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 +07:00
Hugo Locurcio 291d3aaabe
Improve null and object printing to avoid confusion with arrays
- Use different syntax for object printing to avoid confusion with arrays.
- Print null as `<null>` to avoid confusion with a string `"null"`.
- Display `<empty>` in editor resource pickers to avoid confusion
  with array-based properties.
2022-08-31 15:31:49 +07:00
Rémi Verschelde 91e5f48ea7
Merge pull request #64009 from KoBeWi/arrayy_lmao
Replace Array return types with TypedArray (part 2)
2022-08-24 08:18:56 +07:00
kobewi 1abdffe7a0 Replace Array return types with TypedArray 2 2022-08-23 23:21:32 +07:00
bruvzg 56101080cc
[GDExtension] Fix `_property_can_revert` and `_property_get_revert` methods using incorrect string type. 2022-08-23 14:58:28 +07:00
Yuri Sizov 1a24c9e14b Make `_validate_property` a multilevel method 2022-08-22 18:35:11 +07:00