summaryrefslogtreecommitdiff
path: root/core/object/object.cpp
AgeCommit message (Collapse)Author
2023-01-24Add PROPERTY_USAGE_NEVER_DUPLICATE flag and use for scriptAaron Franke
Co-authored-by: Yakov Borevich <j.borevich@gmail.com>
2023-01-10Fix Callable call error reporting.Juan Linietsky
* 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-09Removed unused property hints and `Object::get_translatable_strings()`Juan Linietsky
* 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-08Properly report Callable bound argumentsJuan Linietsky
Fixes #63213 Adds a function: Callable::get_amount_of_arguments_bound() to query this in callables. Exposed to the engine API.
2023-01-05One Copyright Update to rule them allRémi Verschelde
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".
2022-12-12Rename all gdnative occurences to gdextensionGilles Roudière
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-11-29Add missing public property_*_revert gettersYuri Sizov
2022-11-08Use StringName in the whole GDExtension API instead of const char *Emmanuel Leblond
2022-10-13Merge pull request #66427 from Mickeon/object-methods-autocompletionRémi Verschelde
Add autocompletion to several Object methods
2022-10-12Rename `set`/`get_indexed`'s "property" to "property_path"Micky
Also touches up the Documentation slightly.
2022-09-26Add autocompletion to several Object methodsMicky
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-06Rename CONNECT_ONESHOT TO CONNECT_ONE_SHOTMicky
For consistency. Every other exposed `one_shot` is spaced out like this.
2022-08-31Improve null and object printing to avoid confusion with arraysHugo Locurcio
- 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-24Merge pull request #64009 from KoBeWi/arrayy_lmaoRémi Verschelde
Replace Array return types with TypedArray (part 2)
2022-08-23Replace Array return types with TypedArray 2kobewi
2022-08-23[GDExtension] Fix `_property_can_revert` and `_property_get_revert` methods ↵bruvzg
using incorrect string type.
2022-08-22Make `_validate_property` a multilevel methodYuri Sizov
2022-08-18Make `property_*_revert` methods multilevel and expose them for scriptingYuri Sizov
2022-08-03Removed faulty function update after get_property_list.Hristo Stamenov
The function tried to rearrange properties but that lead to problems with duplication or deleted properties. Implemented the logic that that function did inside the get_property_list both for tool scripts and non-tool scripts.
2022-07-29Remove Signal connect bindsJuan Linietsky
Remove the optional argument p_binds from `Object::connect` since it was deprecated by Callable.bind(). Changed all uses of it to Callable.bind()
2022-06-29GDExtension: reuse code with constructor PropertyInfo(const ↵Jan Haller
GDNativePropertyInfo&)
2022-06-27Add a const call mode to Object, Variant and Script.K. S. Ernest (iFire) Lee
For this to work safely (user not call queue_free or something in the expression), a const call mode was added to Object and Variant (and optionally Script). This mode ensures only const functions can be called, making it safe to use from the editor. Co-Authored-By: reduz <reduzio@gmail.com>
2022-06-23Implement varargs in Methodinforeduz
Variadic templates are an awful thing. Implements #62233 using them in MethodInfo so less changes are required.
2022-06-19Allow autocompletion of "noslider" in export_rangeMarcus Elg
2022-06-14Change set/get binding to use StringNamekobewi
2022-05-16Replace most uses of Map by HashMapreduz
* Map is unnecessary and inefficient in almost every case. * Replaced by the new HashMap. * Renamed Map to RBMap and Set to RBSet for cases that still make sense (order matters) but use is discouraged. There were very few cases where replacing by HashMap was undesired because keeping the key order was intended. I tried to keep those (as RBMap) as much as possible, but might have missed some. Review appreciated!
2022-05-12Add a new HashMap implementationreduz
Adds a new, cleaned up, HashMap implementation. * Uses Robin Hood Hashing (https://en.wikipedia.org/wiki/Hash_table#Robin_Hood_hashing). * Keeps elements in a double linked list for simpler, ordered, iteration. * Allows keeping iterators for later use in removal (Unlike Map<>, it does not do much for performance vs keeping the key, but helps replace old code). * Uses a more modern C++ iterator API, deprecates the old one. * Supports custom allocator (in case there is a wish to use a paged one). This class aims to unify all the associative template usage and replace it by this one: * Map<> (whereas key order does not matter, which is 99% of cases) * HashMap<> * OrderedHashMap<> * OAHashMap<>
2022-05-03Implement missing Node & Resource placeholdersreduz
Implemented by request of @neikeq to advance in the GDExtension version of Mono. * If a Resource type is missing upon load, it will be remembered together with its data (Unless manually overriden). * If a Node type is missing upon load, it will be also be remembered together with its data (unless deleted). This feature makes working with GDExtension much easier, as it ensures that missing types no longer cause data loss.
2022-05-03Remove `RES` and `REF` typedefs in favor of spelled out `Ref<>`Hugo Locurcio
These typedefs don't save much typing compared to the full `Ref<Resource>` and `Ref<RefCounted>`, yet they sometimes introduce confusion among new contributors.
2022-04-11Make FileAccess and DirAccess classes reference counted.bruvzg
2022-03-30Make vararg method bind no return and returnPierre-Thomas Meisels
Type emit_signal exposed method return type set UndoRedo add_do_method and add_undo_method exposed return void Set TreeItem::_call_recursive_bind returns void Set _rpc_bind and _rpc_id_bind returns void in Node Set _call_group and _call_group_flags method returns void in SceneTree Set godot-cpp-test CI flag to false
2022-03-29Merge pull request #58608 from KoBeWi/metadefaultRémi Verschelde
2022-03-27GDExtension: change to_string signature to accept GDNativeStringPtr instead ↵Jan Haller
of returning const char*
2022-03-24Refactor Object metadatareduz
* API kept the same (Although functions could be renamed to set_metadata/get_metadata in a later PR), so not much should change. * Metadata now exposed as individual properties. * Properties are editable in inspector (unless metadata name begins with _) under the metadata/ namespace. * Added the ability to Add/Remove metadata properties to the inspector. This is a functionality that was requested very often, that makes metadata work a bit more similar to custom properties in Blender.
2022-03-22Add optional 'default' argument to get_meta()kobewi
2022-03-10Merge pull request #58690 from elmordo/bugfix-57553-gdextension-inheritance-fixRémi Verschelde
2022-03-09Remove VARIANT_ARG* macrosreduz
* Very old macros from the time Godot was created. * Limited arguments to 5 (then later changed to 8) in many places. * They were replaced by C++11 Variadic Templates. * Renamed methods that take argument pointers to have a "p" suffix. This was used in some places and not in others, so made it standard. * Also added a dereference check for Variant*. Helped catch a couple of bugs.
2022-03-02fix of reading property list from custom nodes imported from GDExtension ↵Ing. Petr Jindra
when inheritance between custom nodes is used
2022-02-16Style: Cleanup single-line blocks, semicolons, dead codeRémi Verschelde
Remove currently unused implementation of TextureBasisU, could be re-added later on if needed and ported.
2022-01-03Update copyright statements to 2022Rémi Verschelde
Happy new year to the wonderful Godot community!
2021-12-09Replace String comparisons with "", String() to is_empty()Nathan Franke
Also: - Adds two stress tests to test_string.h - Changes to .empty() on std::strings
2021-11-30Change gdnative interface so that Godot object initialization should be ↵Gilles Roudière
triggered from the extension side
2021-11-17Fix the exceptions in signal disconnectionXwdit
Use the correct method to get SignalData to fix exceptions in signal disconnection
2021-11-14Merge pull request #53710 from ↵Hugo Locurcio
CaptainProton42/fix-extension-class-inspector-properties
2021-11-04Add is_built_in() method to Resourcekobewi
2021-11-03Rename `PROPERTY_USAGE_NOEDITOR` to `PROPERTY_USAGE_NO_EDITOR`Hugo Locurcio
This is consistent with other constants that include `NO`, such as `PROPERTY_HINT_COLOR_NO_ALPHA`.
2021-10-28clang-format: Disable alignment of operands, too unreliableRémi Verschelde
Sets `AlignOperands` to `DontAlign`. `clang-format` developers seem to mostly care about space-based indentation and every other version of clang-format breaks the bad mismatch of tabs and spaces that it seems to use for operand alignment. So it's better without, so that it respects our two-tabs `ContinuationIndentWidth`.
2021-10-12Fetch extension class props from ClassDBCaptainProton42
Extension class properties that have been registered with ClassDB(`GDNativeInterface::classdb_register_extension_class_property`) were not fetched previously. (Only directly providing a property list using `GDNativeExtensionClassCreationInfo::get_property_list_func` would work.) This especially caused problems with the C++ bindings since they exclusively rely on ClassDB to register properties.
2021-10-01Merge pull request #47442 from Shatur/fix-connect-reference-countedRémi Verschelde
2021-08-22Replace BIND_VMETHOD by new GDVIRTUAL syntaxreduz
* New syntax is type safe. * New syntax allows for type safe virtuals in native extensions. * New syntax permits extremely fast calling. Note: Everything was replaced where possible except for `_gui_input` `_input` and `_unhandled_input`. These will require API rework on a separate PR as they work different than the rest of the functions. Added a new method flag METHOD_FLAG_OBJECT_CORE, used internally. Allows to not dump the core virtuals like `_notification` to the json API, since each language will implement those as it is best fits.