summaryrefslogtreecommitdiff
path: root/core/object/object.cpp
AgeCommit message (Collapse)Author
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.
2021-08-16Fix C# native instance bindings after recent re-writeIgnacio Roldán Etcheverry
This was needed after: 44691448911f1d29d4d79dbdd5553734761e57c4
2021-08-05Add a instance callback for extensionsGeorge Marques
This sends the Godot object instance back to the extension so they can keep a pointer for function calls. Incidentally fix argument order on instance bindings callback for free()
2021-07-25Use const references where possible for List range iteratorsRémi Verschelde
2021-07-23Use C++ iterators for Lists in many situationsAaron Franke
2021-07-22Make Object "meta" functions take StringName.Fabio Alessandrelli
The various get_meta, set_meta, has_meta, get_meta_list, remove_meta functions now uses StringName, allowing further optimizations via the SNAME macro when used from C++ (this PR does not change the various usage though).
2021-07-15Add ability to set object instance binding on creationreduz
* Required by binding generators * Makes it easier to create the bindings on construction.
2021-07-08Redo how instance bindings workreduz
* The harcoded 8 slots are no more and impose limits in the new extension system. * New system is limitless, although it will impose small performance hit with a mutex. * Use a token to request the instance binding. **Warning**: Mono will most likely break as a result of this, will need to be modified to use the new system.
2021-06-25Implement native extension systemreduz
* Deprecates GDNative in favor of a simpler, lower level interface. * New extension system allows registering core engine classes. * Simple header interface in gdnative_interace.h
2021-06-21Improved some error messages (from ERR_FAIL_*) in Object.Eric M
2021-06-19Rename `instance()`->`instantiate()` when it's a verbLightning_A
2021-06-11Rename Reference to RefCountedPedro J. Estébanez
2021-06-04Add API for registering native extensionsreduz
* First step for GDNative to behave more like modules * Only Object and ClassDB, the rest needs to happen on the GDNative side.
2021-05-20Fix typos with codespellRémi Verschelde
Using codespell 2.0.0. Method: ``` $ cat > ../godot-word-whitelist.txt << EOF ang curvelinear dof doubleclick fave findn GIRD leapyear lod merchantibility nd numer ois ony que seeked synching te uint unselect webp EOF $ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po" $ git diff // undo unwanted changes ```
2021-03-28Fix CONNECT_REFERENCE_COUNTEDShatur95
2021-03-12Fixes small typos and grammar correctionAnshul7sp1
2021-02-18Modernize atomicsPedro J. Estébanez
- Based on C++11's `atomic` - Reworked `SafeRefCount` (based on the rewrite by @hpvb) - Replaced free atomic functions by the new `SafeNumeric<T>` - Replaced wrong cases of `volatile bool` by the new `SafeFlag` - Platform-specific implementations no longer needed Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
2021-02-10Removed _change_notifyreduz
-For inspector refresh, the inspector now detects if a property change by polling a few times per second and then does update the control if so. This process is very cheap. -For property list refresh, a new signal (property_list_changed) was added to Object. _change_notify() is replaced by notify_property_list_changed() -Changed all objects using the old method to the signal, or just deleted the calls to _change_notify(<property>) since they are unnecesary now.
2021-01-01Merge pull request #44848 from mrushyendra/disconnect_err_msgRémi Verschelde
Issue correct error when disconnecting nonexistent connection with a valid signal