summaryrefslogtreecommitdiff
path: root/core/object.cpp
AgeCommit message (Collapse)Author
2020-06-10Fix potential crash when listing leaked objectsPedro J. Estébanez
Note: Casting to the C++ classes and calling the methods there would work as well, but would require including he header files for the specific object types handled here, which wouldn't be OK either.
2020-06-08Core: Add hints to run with --verbose when leaking nodes/resources at exitRémi Verschelde
2020-05-19Style: Remove unnecessary semicolons from `core`Rémi Verschelde
Semicolons are not necessary after function definitions or control flow blocks, and having some code use them makes things inconsistent (and occasionally can mess up `clang-format`'s formatting). Removing them is tedious work though, I had to do this manually (regex + manual review) as I couldn't find a tool for that. All other code folders would need to get the same treatment.
2020-05-14Style: Enforce braces around if blocks and loopsRémi Verschelde
Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14Style: Enforce separation line between function definitionsRémi Verschelde
I couldn't find a tool that enforces it, so I went the manual route: ``` find -name "thirdparty" -prune \ -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \ -o -name "*.glsl" > files perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files) misc/scripts/fix_style.sh -c ``` This adds a newline after all `}` on the first column, unless they are followed by `#` (typically `#endif`). This leads to having lots of places with two lines between function/class definitions, but clang-format then fixes it as we enforce max one line of separation. This doesn't fix potential occurrences of function definitions which are indented (e.g. for a helper class defined in a .cpp), but it's better than nothing. Also can't be made to run easily on CI/hooks so we'll have to be careful with new code. Part of #33027.
2020-05-14Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocksRémi Verschelde
Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
2020-05-14Port member initialization from constructor to declaration (C++11)Rémi Verschelde
Using `clang-tidy`'s `modernize-use-default-member-init` check and manual review of the changes, and some extra manual changes that `clang-tidy` failed to do. Also went manually through all of `core` to find occurrences that `clang-tidy` couldn't handle, especially all initializations done in a constructor without using initializer lists.
2020-05-10Style: clang-format: Disable AllowShortIfStatementsOnASingleLineRémi Verschelde
Part of #33027, also discussed in #29848. Enforcing the use of brackets even on single line statements would be preferred, but `clang-format` doesn't have this functionality yet.
2020-04-02Replace NULL with nullptrlupoDharkael
2020-03-23Added has_signal method for ObjectPouleyKetchoupp
2020-02-25Merge pull request #36481 from nekomatata/fix-crash-connect-callableRémi Verschelde
Fixed crash when connecting a signal in GDScript
2020-02-23Fixed crash when connecting a signal in GDScriptPouleyKetchoupp
2020-02-21Added StringName as a variant type.Juan Linietsky
Also changed all relevant properties defined manually to StringName.
2020-02-20Reworked signal connection system, added support for Callable and Signal ↵Juan Linietsky
objects and made them default.
2020-02-19Fix two signal errorsnathanwfranke
Update
2020-02-18PoolVector is gone, replaced by VectorJuan Linietsky
Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are sugar for `Vector<Type>`.
2020-02-15Changed logic and optimized ObjectID in ObjectDB and Variant, removed RefPtr.Juan Linietsky
2020-02-12ObjectID converted to a structure, fixes many bugs where used incorrectly as ↵Juan Linietsky
32 bits.
2020-02-05Remove duplicate ERR_PRINT macro.Marcel Admiraal
2020-01-22Make sure we know when deleting an emitting objectFabio Alessandrelli
We used a lock signals in the signal_map while emitting, because it was not allowed to disconnect them while being emitted. We used that lock to check if we where deleting an object during signal emission. Now that we allow to disconnect signals while they are being emitted, if an object first disconnects, then gets deleted we can't know that a signal was being emitted during the destructor. This commit adds a new `_emitting` boolean member to Object to be set while emitting and checked in the destructor, while removing the old signal lock which is now unused.
2020-01-13Object: Avoid error on emit_signal with freed targetRémi Verschelde
As advised by @reduz.
2020-01-13Object: Remove error on disconnect of locked signalsRémi Verschelde
According to https://github.com/godotengine/godot/commit/22637beb2ed625c3e43ab75ab5865b57d7470948#commitcomment-36651823 and as confirmed by @reduz, this seems not to be necessary now that we copy-on-write. This triggered freeze scenarios in cases where a node would be deleted while being used as a target in a signal emission. Fixes #34650. Fixes #34769. Now those two errors go back to reporting: ``` ERROR: emit_signal: Condition ' !target ' is true. Continuing..: At: core/object.cpp:1191. ```
2020-01-02Merge pull request #34745 from timothyqiu/vararg-return-nil-34743Rémi Verschelde
Allows to doc vararg method return type as void
2020-01-02Object::disconnect: Better errors when no signal or lockedRémi Verschelde
It will now give information about the originating object instance and when locked, the target callback. This should help debugging editor and game issues that are now being reported due to adding signal locking in 22637beb2ed625c3e43ab75ab5865b57d7470948.
2020-01-02Allows to doc vararg method return type as voidHaoyu Qiu
2020-01-01Update copyright statements to 2020Rémi Verschelde
Happy new year to the wonderful Godot community! We're starting a new decade with a well-established, non-profit, free and open source game engine, and tons of further improvements in the pipeline from hundreds of contributors. Godot will keep getting better, and we're looking forward to all the games that the community will keep developing and releasing with it.
2019-12-18Suggest use of deferred or oneshot on disconnect if the signal is locked. ↵Juan Linietsky
Closes #34443.
2019-12-17Improve error message and do not spam forever.Juan Linietsky
2019-12-17Restore signal locking, for some reason missing.Juan Linietsky
2019-09-28Ensure object metadata is uniqueBojidar Marinov
Closes #32415
2019-09-25Added some obvious errors explanationsqarmin
2019-08-18Merge pull request #31423 from Calinou/improve-node-signal-group-tooltipRémi Verschelde
Improve the scene tree signals/groups tooltip
2019-08-17Improve the scene tree signals/groups tooltipHugo Locurcio
The tooltip now displays the number of connections and groups that are assigned to the hovered node.
2019-08-17Replace 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG' in 'core/' and 'editor/'Braden Bodily
Condensed some if and ERR statements. Added dots to end of error messages Couldn't figure out EXPLAINC. These files gave me trouble: core/error_macros.h, core/io/file_access_buffered_fa.h (where is it?), core/os/memory.cpp, drivers/png/png_driver_common.cpp, drivers/xaudio2/audio_driver_xaudio2.cpp (where is it?)
2019-07-22Revert "Expose "meta" to the Inspector"Rémi Verschelde
2019-07-19Merge pull request #22642 from YeldhamDev/inspector_metadataRémi Verschelde
Expose "meta" to the Inspector
2019-07-01Merge pull request #30126 from qarmin/remove_unnecessary_codeRémi Verschelde
Remove unnecessary code and add some error explanations
2019-07-01Remove unnecessary code and add some error explanationsqarmin
2019-06-27Merge pull request #30096 from akien-mga/doc-misc-updatesRémi Verschelde
doc: Proofread and complete various nodes
2019-06-26doc: Proofread and complete various nodesRémi Verschelde
All 100% completed: MainLoop, Node, Object, Path, Performance, Reference, Resource, SceneState, SceneTree, UndoRedo. Also fixed some en_GB occurrences as the reference spelling is en_US.
2019-06-26Some code changed with Clang-Tidyqarmin
2019-05-20Merge pull request #27886 from LeonardMeagher2/obj_to_stringRémi Verschelde
Allow overriding how scripted objects are converted to strings
2019-05-16Fix Object::get_indexed for simple properties.Fabio Alessandrelli
Object::get_indexed was not correctly reporting invalid keys if the name was a direct property (not a subproperty), causing for example Tween to not report correctly a bad interpolate_property key.
2019-05-09Change "ID" to lowercase "id"Aaron Franke
Reasoning: ID is not an acronym, it is simply short for identification, so it logically should not be capitalized. But even if it was an acronym, other acronyms in Godot are not capitalized, like p_rid, p_ip, and p_json.
2019-05-03Allow overriding how scripted objects are converted to stringsLeonard Meagher
solves #26796 - ADD `String to_string()` method to Object which can be overriden by `String _to_string()` in scripts - ADD `String to_string(r_valid)` method to ScriptInstance to allow langauges to control how scripted objects are converted to strings - IMPLEMENT to_string for GDScriptInstance, VisualScriptInstance, and NativeScriptInstance - ADD Documentation about `Object.to_string` and `Object._to_string` - Changed `Variant::operator String` to use `obj->to_string()`
2019-04-26Undo support for locking and grouping for both 2D and 3DSintinium
2019-04-20Object::script may not be a valid Ref<Script>Hein-Pieter van Braam-Stewart
It appears that Object::script may be a valid ScriptInstance but not be castable to Ref<Script>. There were only 5 places in the code that made this assumption. This commit fixes that.
2019-04-09Style: Apply new changes from clang-format 8.0Rémi Verschelde
It seems to stay compatible with formatting done by clang-format 6.0 and 7.0, so contributors can keep using those versions for now (they will not undo those changes).
2019-03-05Print errors comming from callvBojidar Marinov
Fixes #18386
2019-02-24Ensure all properties are refreshed when setting a script, fixes #24845Juan Linietsky