Commit Graph

161 Commits

Author SHA1 Message Date
K. S. Ernest (iFire) Lee
e548d607e0 Add a const call mode to Object, Variant and Script.
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-27 13:33:06 -07:00
Hugo Locurcio
668ed180f5 Improve stack overflow error message in GDScript and VisualScript
Stack overflow errors are generally the result of infinite recursion
within a script.
2022-06-15 16:20:01 +02:00
Rémi Verschelde
4518422945 i18n: Misc fixes translation strings
Adds some translator comments to solve some questions raised on Weblate.
2022-06-08 12:57:54 +02:00
reduz
a9e53b6d35 Add a new HashSet template
* Intended to replace RBSet in most cases.
* Optimized for iteration speed
2022-05-20 22:40:38 +02:00
Aaron Record
da2b5ff235 Use range iterators for RBSet in most cases 2022-05-19 12:09:16 +02:00
reduz
09fc804cff Replace most uses of Map by HashMap
* 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-16 10:37:48 +02:00
reduz
d6625fbe18 Add a new HashMap implementation
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-12 11:21:29 +02:00
kobewi
88a2685d82 Fix VisualScript export variables 2022-05-06 16:00:30 +02:00
FireForge
c0187cc0a1 Rename theme properties to include underscores
- check_vadjust -> check_v_adjust
- close_h_ofs -> close_h_offset
- close_v_ofs -> close_v_offset
- commentfocus -> comment_focus
- hseparation -> h_separation
- ofs -> offset
- selectedframe -> selected_frame
- state_machine_selectedframe -> state_machine_selected_frame
- table_hseparation -> table_h_separation
- table_vseparation -> table_v_separation
- vseparation -> v_separation
2022-04-23 11:16:18 -05:00
reduz
00e3a9b7a1 Remove VARIANT_ARG* macros
* 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-09 18:39:13 +01:00
Rémi Verschelde
83def92d87 Style: Cleanup single-line blocks, semicolons, dead code
Remove currently unused implementation of TextureBasisU, could be re-added
later on if needed and ported.
2022-02-16 14:06:29 +01:00
Rémi Verschelde
fa316dc084 Refactor some object type checking code with cast_to
Less stringly typed logic, and less String allocations and comparisons.
2022-02-08 10:08:34 +01:00
Rémi Verschelde
7a2dfcf238 Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-03 21:27:34 +01:00
fabriceci
f69d7f463f Improve editor template workflow
Co-Authored-By: jmb462 <jmb462@gmail.com>
2022-01-02 21:52:09 +01:00
Nathan Franke
c4524d0331 Replace String comparisons with "", String() to is_empty()
Also:
- Adds two stress tests to test_string.h
- Changes to .empty() on std::strings
2021-12-09 04:48:38 -06:00
Lightning_A
cb47e7f319 Rename remove() to remove_at() when removing by index 2021-11-23 18:58:57 -07:00
Hugo Locurcio
5507c243c3 Rename PROPERTY_USAGE_NOEDITOR to PROPERTY_USAGE_NO_EDITOR
This is consistent with other constants that include `NO`,
such as `PROPERTY_HINT_COLOR_NO_ALPHA`.
2021-11-03 23:06:17 +01:00
Rémi Verschelde
a8b1696509 clang-format: Various fixes to comments alignment from clang-format 13
All reviewed manually and occasionally rewritten to avoid bad auto formatting.
2021-10-28 15:43:36 +02:00
Gilles Roudière
efd8ba99d7 Implement toast notifications in the editor 2021-10-14 13:30:54 +02:00
Lightning_A
8cf95dee4d Use range iterators for Map 2021-09-30 15:09:12 -06:00
Fabio Alessandrelli
df4cc73fa5 [Net] Move multiplayer to core subdir, split RPCManager.
Move multiplayer classes to "core/multiplayer" subdir.

Move the RPCConfig and enums (TransferMode, RPCMode) to a separate
file (multiplayer.h), and bind them to the global namespace.

Move the RPC handling code to its own class (RPCManager).

Renames "get_rpc_sender_id" to "get_remote_sender_id".
2021-09-07 11:14:30 +02:00
reduz
399f322fbf Entirely removes BIND_VMETHOD in favor of GDVIRTUAL
* `_gui_input`, `_input`, `_unhandled_input` and `_unhandled_key_input` are now regular C++ virutal functions.
* Everything else converted to GDVIRTUAL
* BIND_VMETHOD is gone, always use the new syntax from now on.

Creating `_gui_input` method and using the binder to register events will no longer work, simply override the virtual function now.
2021-08-23 08:10:13 -03:00
Haoyu Qiu
61295c2a31 Validates VisualScript.add_node input node 2021-08-02 23:36:13 +08:00
Rémi Verschelde
62be51da64 Use const references where possible for List range iterators 2021-07-25 12:22:25 +02:00
Aaron Franke
9e78ea9ebf Use C++ iterators for Lists in many situations 2021-07-23 17:38:28 -04:00
reduz
c5931d7c14 Optimize StringName usage
* Added a new macro SNAME() that constructs and caches a local stringname.
* Subsequent usages use the cached version.
* Since these use a global static variable, a second refcounter of static usages need to be kept for cleanup time.
* Replaced all theme usages by this new macro.
* Replace all signal emission usages by this new macro.
* Replace all call_deferred usages by this new macro.

This is part of ongoing work to optimize GUI and the editor.
2021-07-18 21:20:02 -03:00
Fabio Alessandrelli
9a35f88f15 [Net] Rename NetworkedMultiplayerPeer to MultiplayerPeer. 2021-07-12 16:36:34 +02:00
Lightning_A
6db897c183 Rename instance()->instantiate() when it's a verb 2021-06-19 20:49:18 -06:00
Eric M
122875c4e7 Added support for scripts reporting multiple errors to ScriptTextEditor
Scripts can now report multiple errors to the scripting editors in the engine. UI elements were added to support multiple errors.
2021-06-19 22:20:30 +10:00
George Marques
c470e84518 Fix default value binding in VisualScriptFunctionState 2021-06-14 12:26:05 -03:00
Fabio Alessandrelli
34be5981b9 [Net] Refactor RPCs, remove RSETs
In this PR:
- Removed rset
- rpc_config can now optionally configure transfer mode
  (reliable/unreliable/ordered) and channel (channels are not actually
  implemented yet.)
- Refactor how the RPC id is computed to minimize the logic in Node and
  scripts that now only needs a single `get_rpc_methods` function.
2021-06-01 17:24:21 +02:00
Hugo Locurcio
5dc2c36069 Highlight control flow keywords with a different color
This makes them easier to distinguish from other keywords.
2021-05-05 22:38:12 +02:00
Rémi Verschelde
ada016cb1e Replace remaining uses of NULL with nullptr
Follow-up to #38736 (these uses were likely added after this PR was merged).
2021-04-29 11:53:27 +02:00
Rémi Verschelde
e9b5ec763b Core: Drop custom copymem/zeromem defines
We've been using standard C library functions `memcpy`/`memset` for these since
2016 with 67f65f66391327b2967a20a89c3627e1dd6e84eb.

There was still the possibility for third-party platform ports to override the
definitions with a custom header, but this doesn't seem useful anymore.
2021-04-27 16:26:27 +02:00
Rémi Verschelde
0abfd7b89c Style: Apply clang-tidy's readability-braces-around-statements 2021-04-05 14:09:59 +02:00
Rémi Verschelde
ce107dd3b6 Style: Apply clang-tidy's modernize-use-nullptr 2021-04-05 14:05:07 +02:00
jmb462
0180a45dcf Fix VisualScriptFunctionState connect to null object crash 2021-04-03 12:13:26 +02:00
Anshul7sp1
a579127541 Fixes small typos and grammar correction 2021-03-12 19:05:16 +05:30
Rafał Mikrut
72d6550244 Initialize class/struct variables with default values in modules/ 2021-02-08 10:57:18 +01:00
Rémi Verschelde
a4d3b5e412 Merge pull request #44914 from swarnimarun/master-visualscript-refactor
Fix doc for the VisualScript class after #39649 PR
2021-01-04 21:19:00 +01:00
Swarnim Arun
d82e2ea20d Fix doc for the VisualScript class. 2021-01-05 00:15:53 +05:30
Rémi Verschelde
0a46675f02 Merge pull request #39649 from swarnimarun/master-visualscript-refactor
Visual Script Refactor
2021-01-04 15:02:23 +01:00
Rémi Verschelde
3debf92210 Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆
2021-01-01 20:19:21 +01:00
Swarnim Arun
f396005107 Refactoring Visual Script
* for bloat from hacks for default function
* for ease of development nodes becoming detached from functions
2021-01-01 22:50:33 +05:30
Marcel Admiraal
661173bdfc Rename empty() to is_empty() 2020-12-28 10:39:56 +00:00
Aaron Franke
3706ea319f Remove connect *_compat methods 2020-12-05 17:56:47 -05:00
Aaron Franke
776b0c9f1d Remove empty lines around braces with the formatting script 2020-11-16 23:38:11 -05:00
reduz
67097782d5 Refactored variant constructor logic 2020-11-09 08:54:43 -03:00
reduz
4f7590cecf Reorganized core/ directory, it was too fatty already
-Removed FuncRef, since Callable makes it obsolete
-Removed int_types.h as its obsolete in c++11+
-Changed color names code
2020-11-07 20:17:12 -03:00
Rémi Verschelde
2f139a1299 VisualScript: Fix -Wduplicate-branches warning
When VSDEBUG is a no-op (default), those branches did the same (nothing).
2020-07-22 16:57:28 +02:00