Commit Graph

94 Commits (cb1569345a6f17da08241e645ab03cb2e1b78d2f)

Author SHA1 Message Date
kobewi e14263f917 Remove empty constructors and destructors from core/ 2025-11-17 20:09:05 +07:00
DeeJayLSP a149280cea `ClassDB`: Use `AHashMap` for `property_setget` and `constant/signal_map` 2025-10-28 16:24:54 +07:00
Lukas Tenbrink 9d44b68867 Remove `rw_lock.h` and `rb_map.h` includes from `object.h`. 2025-10-05 23:29:04 +07:00
Thaddeus Crews fdf32d1b2a
Merge pull request #108577 from YYF233333/global_class_list
Simplify `ScriptServer::get_global_class_list`
2025-09-30 11:19:10 +07:00
Thaddeus Crews 38d80598f5
Merge pull request #108121 from Repiteo/core/disabled-class-rework
Core: Handle disabled class detection in `ClassDB`
2025-09-17 11:34:16 +07:00
Yufeng Ying a50fc5acd8 Change ClassDB::get_class_list and related stuff. 2025-09-16 15:00:33 +07:00
aaronp64 cfde73ac17 Remove unused parameter in __constant_get_enum_name/__constant_get_bitfield_name
Removed unused String parameter in __constant_get_enum_name() and __constant_get_bitfield_name() to avoid creating/destroying extra Strings.
2025-09-02 13:13:12 +07:00
Thaddeus Crews 555e7ad073
Core: Handle disabled class detection in ClassDB 2025-08-26 09:31:14 +07:00
Lukas Tenbrink df7dab4946 Use idiomatic templating vargs in a few places to reduce code. 2025-06-08 12:24:07 +07:00
Michael Alexsander 454e4f817c
Make build profile project detection also set build options 2025-06-03 11:11:33 +07:00
Yufeng Ying 3545e945f6 Simplify implementation of errarray. 2025-05-23 23:14:59 +07:00
Thaddeus Crews d237e31a89
Style: Remove redundant `DEBUG_METHODS_ENABLED`
• Replaced with functionally identical and far more ubiquitous `DEBUG_ENABLED`
2025-05-15 13:09:41 +07:00
Thaddeus Crews 4b36c0491e
Merge pull request #105020 from YYF233333/opt_get_inheriters
Optimize `ClassDB::get_inheriters_from_class`
2025-04-04 17:40:59 +07:00
Thaddeus Crews 046c9f540c
Merge pull request #105030 from Ivorforce/class-is-enabled-object
Move `GD_IS_CLASS_ENABLED` and respective include from `class_db.h` to `object.h`, as this is where it's needed.
2025-04-04 17:40:58 +07:00
Lukas Tenbrink aa5ca4f1a2 Move `GD_IS_CLASS_ENABLED` and respective include from `class_db.h` to `object.h`, as this is where it's needed. 2025-04-04 23:45:35 +07:00
Thaddeus Crews 78922d756a
Core: Decouple `GDCLASS` from ClassDB 2025-04-04 16:21:30 +07:00
Yufeng Ying 4029051bb1 Change ClassDB::get_inheriters_from_class. 2025-04-04 23:47:19 +07:00
Daylily-Zeleen 1cc879afc0 Allow instantiate unexposed EditorPlugin form GDExtension. 2025-04-02 23:52:14 +07:00
Alexander Montag b79a6ca3e7 Remove redundant ClassDB::locker declaration 2025-03-26 21:14:11 +07:00
Pedro J. Estébanez 2d885a3163
Sanitize ClassDB locking 2025-03-25 16:50:46 +07:00
Michael Alexsander 090358afcf
Disable `ResourceFormatLoader/Saver`s of disabled classes 2025-03-21 14:23:05 +07:00
Thaddeus Crews 324512e11c
Style: Replace header guards with `#pragma once` 2025-03-07 17:33:47 +07:00
David Snopek 39f16e70f8 GDExtension: Add compatibility system for virtual methods 2025-01-10 16:00:05 +07:00
Hilderin 27d1fb63e1 Fix Unable to use ResourceLoader in C# after threaded load in GDScript #92798 2024-09-11 19:03:55 +07:00
Hilderin ef6f873938 Fix editor needs restart after adding GDExtensions 2024-08-29 06:15:32 +07:00
Rémi Verschelde b4f268fae8
Merge pull request #91018 from Daylily-Zeleen/daylily-zeleen/optionally_postinitialization_for_extension_owner
Allow ClassDB to create a Object without postinitialization for GDExtension.
2024-08-26 10:51:17 +07:00
Rémi Verschelde 091212b4f1
Merge pull request #93602 from aaronp64/inspector_latency
Improve Editor Inspector/Theme item lookup performance
2024-08-22 00:10:26 +07:00
aaronp64 7593e55527 Improve Editor Inspector/Theme item lookup performance
Changes to reduce the latency between changing node selection in the editor and seeing the new node reflected in the Inspector tab

- Use Vector instead of List for ThemeOwner::get_theme_type_dependencies and related functions
- Use Vector instead of List for ThemeContext::themes, set_themes(), and get_themes()
- Add ClassDB:get_inheritance_chain_nocheck to get all parent/ancestor classes at once, to avoid repeated ClassDB locking overhead
- Update BIND_THEME_ITEM macros and ThemeDB::update_class_instance_items to use provided StringNames for call to ThemeItemSetter, instead of creating a new StringName in each call

These changes reduce the time taken by EditorInspector::update_tree by around 30-35%
2024-08-20 13:39:40 +07:00
Daylily-Zeleen 3d575801ce Allow ClassDB to create a Object without postinitialization for GDExtension. 2024-08-20 20:19:02 +07:00
Rémi Verschelde fe5d567917
Merge pull request #93942 from MikeSchulze/73525
Fix GDScript analyzer error when instantiating EditorPlugins.
2024-07-11 09:41:09 +07:00
baptr 810fcc7431 Fix gdscript analyzer error when instantiating EditorPlugins.
Editor code is not instantiable outside of the editor
(1d14c054a1/core/object/class_db.cpp (L369)).
This is fine for editor plugins and the like, but the GDScript analyzer
balks at it, causing F5 runs to fail: #73525.

Instead, we really just want to know if the type is abstract - so add
a new ClassDB method to check that and nothing else.

Update core/object/class_db.cpp

Apply code review comments

Co-Authored-By: Bryce <1522777+baptr@users.noreply.github.com>
2024-07-10 10:24:57 +07:00
David Snopek 91fcdff01e GDExtension: Fix setting base class properties on a runtime class 2024-07-08 12:33:55 +07:00
Thaddeus Crews 127025679b
Core: Use `<type_traits>` where applicable 2024-04-11 13:13:59 +07:00
Rémi Verschelde 453485aede
Merge pull request #89270 from Repiteo/enforce-typename-in-templates
Enforce template syntax `typename` over `class`
2024-03-14 22:34:37 +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 9903e6779b
Enforce template syntax `typename` over `class` 2024-03-07 22:39:09 +07:00
David Snopek 4d0b989bb8 Allow registering "runtime classes" in modules (not just GDExtension) 2024-02-22 14:50:41 +07:00
David Snopek ea75307a11 Allow registering "runtime classes" 2024-02-20 09:20:58 +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
vittorioromeo 55ed34e37c Use '_v' shorthand for type traits and 'if constexpr' where appropriate 2024-02-02 15:43:21 +07:00
Pedro J. Estébanez a1d8fc1af9 Polish & fix editor help cache generation
- Isolated the generation of extensions's docs. They're now not cached and refreshed as needed.
- Removed superfluous sorting of the class list.
- Removed some superfluous/unused elements.
- Renamed some items for clarity.
2023-11-02 13:46:37 +07:00
Rémi Verschelde 017541bcec
Merge pull request #80527 from raulsntos/dotnet/generate-compat-methods-from-classdb
C#: Generate and use compat methods
2023-09-26 13:44:52 +07:00
David Snopek 2733a6f762 Implement reloading of GDExtensions 2023-09-25 22:10:17 +07:00
Raul Santos 5f6082a96b
C#: Generate and use compat methods
- Implements `ClassDB::get_method_list_with_compatibility` to retrieve all methods from a class including compat methods.
- C# bindings generator now also generates compat methods.
- All generated C# methods now use `ClassDB::get_method_with_compatibility`.
2023-09-19 20:35:11 +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
Daylily-Zeleen 41ffe5461f Allow GDExtension to register unexposed class. 2023-09-04 10:18:20 +07:00
A Thousand Ships c638238fae Add check to ensure registered classes are declared
Checks that all classes registered to `ClassDB` have been properly
declared with `GDCLASS`
2023-08-28 12:16:49 +07:00
Pedro J. Estébanez cac4d44cde Re-enable docs cache with fixes 2023-07-05 10:44:58 +07: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 +07:00