Commit Graph

858 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
reduz
54a9731241 Remake resource thread safety and API
* Ensures thread safety when resources are destroyed.
* Simplified API by always forcing `ResourceCache::get_ref`, which needs less hacks and is fully thread safe.
* Removed RWLock for resources because its not possible to use for the new logic. Should not be a problem.

Supersedes #57533
2022-06-22 13:46:46 +02: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
d59b7b6fec Merge pull request #61804 from akien-mga/i18n-fixes 2022-06-08 13:17:58 +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
Hendrik Brucker
d99e73db21 Fix visual editor settings change propagation 2022-06-07 19:17:47 +02:00
Raul Santos
f5696eec5e Support explicit values in flag properties, add C# flags support
- Add support for explicit values in properties using `PROPERTY_HINT_FLAGS`
that works the same way it does for enums.
- Fix enums and flags in VisualScriptEditor (it wasn't considering the
explicit value).
- Use `PROPERTY_HINT_FLAGS` for C# enums with the FlagsAttribute instead
of `PROPERTY_HINT_ENUM`.
2022-06-03 05:19:01 +02:00
Yuri Rubinsky
7692cc01b1 Merge pull request #61541 from Geometror/graphedit-connections-improvements 2022-05-30 19:05:36 +03:00
Hendrik Brucker
2f2e0a6874 Improve Graphedit connection lines 2022-05-30 17:33:01 +02:00
Rémi Verschelde
dd1988dd19 Merge pull request #47665 from trollodel/tree_more_buttons_signals 2022-05-24 10:50:55 +02:00
Rémi Verschelde
fb92cf6c58 Merge pull request #61017 from derammo/derammo_58121
display of large help text in visual script
2022-05-22 01:26:33 +02:00
derammo
2a4531af67 display of large help text in visual script
implemented vertical scroller for help text in popup
disabled broken positioning code
2022-05-21 18:38:40 -04:00
trollodel
99d251e5ab Add the button pressed to some signals in Tree 2022-05-21 17:16:52 +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
Rémi Verschelde
72d2be199c Merge pull request #61173 from LightningAA/update-set-iterators 2022-05-19 13:26:15 +02:00
Aaron Record
da2b5ff235 Use range iterators for RBSet in most cases 2022-05-19 12:09:16 +02:00
Rémi Verschelde
6dfc6ed11f Merge pull request #60463 from Geometror/improve-vs-1 2022-05-16 13:50:42 +02:00
Rémi Verschelde
f2438cd29d Merge pull request #61010 from derammo/visual_script_selector_paths 2022-05-16 13:49:31 +02:00
Rémi Verschelde
0dbcdcbabe Merge pull request #60999 from reduz/replace-rbhash-by-hashmap 2022-05-16 11:59:38 +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
derammo
9caea16a53 fixed path calculations in visual script selector
incorrect usage of lstrip was mangling file names
2022-05-13 19:26:27 -04:00
Rémi Verschelde
07c7c88ae8 Merge pull request #60881 from reduz/new-hash-map 2022-05-12 12:36:43 +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
Rémi Verschelde
7e10f7dd7d Merge pull request #60821 from KoBeWi/👀📜 2022-05-06 16:26:28 +02:00
kobewi
88a2685d82 Fix VisualScript export variables 2022-05-06 16:00:30 +02:00
Rémi Verschelde
803b440a4f Merge pull request #59804 from KoBeWi/sponsored_by_Meta
Cleanup metadata usage
2022-05-06 07:43:52 +02:00
kobewi
f8d511a327 Cleanup metadata usage 2022-05-06 00:27:10 +02:00
Rémi Verschelde
668c41e363 Merge pull request #60723 from reduz/refactor-module-initialization 2022-05-04 19:08:43 +02:00
reduz
8a7ec21eba Refactor module initialization
* Changed to use the same stages as extensions.
* Makes the initialization more coherent, helping solve problems due to lack of stages.
* Makes it easier to port between module and extension.
* removed the DRIVER initialization level (no longer needed).
2022-05-04 17:34:51 +02:00
Hugo Locurcio
fb199547ff Remove RES and REF typedefs in favor of spelled out Ref<>
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-05-03 01:43:50 +02:00
Rémi Verschelde
26d51fa0c3 Style: Partially apply clang-tidy's cppcoreguidelines-pro-type-member-init
Didn't commit all the changes where it wants to initialize a struct
with `{}`. Should be reviewed in a separate PR.

Option `IgnoreArrays` enabled for now to be conservative, can be
disabled to see if it proposes more useful changes.

Also fixed manually a handful of other missing initializations / moved
some from constructors.
2022-05-02 16:28:25 +02:00
Hendrik Brucker
8e72d8332b Improve the VisualShader/VisualScript editor UI 2022-04-30 03:56:57 +02:00
Rémi Verschelde
387efc7900 Merge pull request #60261 from fire-forge/theme-prop-renames 2022-04-25 16:20:19 +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
David Cambré
ea620759ca Improve VisualScript search and instancing of nodes
Constructors are more accessible.
Basic type methods are now based on ClassDB and not registerd_node_names.
Selecting search_classes now automatically changes the scope.
2022-04-17 15:21:26 +02:00
Nicholas Huelin
d2a3675ec8 Fix Visual Script's jump to function relative to zoom
When double-clicking on a function name the graph will now correctly jump to the function relative to the zoom ratio.
2022-04-12 15:27:49 +02:00
Rémi Verschelde
860d2f7d15 Merge pull request #59911 from bruvzg/cppcheck_fixes 2022-04-06 15:47:20 +02:00
bruvzg
4a042e3d08 Fix some issues found by cppcheck. 2022-04-06 14:34:37 +03:00
Rémi Verschelde
cb57575743 Merge pull request #59867 from akien-mga/refactor-zero-initialize-all-pointers 2022-04-04 21:24:27 +02:00
Rémi Verschelde
b00aef8f29 Zero initialize all pointer class and struct members
This prevents the pitfall of UB when checking if they have been
assigned something valid by comparing to nullptr.
2022-04-04 19:49:50 +02:00
reduz
bfa2d0d0d9 Add GDExtension support to Script
* Ability to create script languages from GDExtension
* Some additions to gdnative_extension.h to make this happen
* Moved the GDExtension binder to core

This now allows creating scripting languages from GDExtension, with the same ease as if it was a module. It replaces the old PluginScript from Godot 3.x.
Warning: GodotCPP will need to be updated to support this (it may be a bit of work as ScriptInstance needs to be created over there again).
2022-03-27 16:13:00 +02:00
Aaron Franke
d1feea8ccb Initialize bools in the headers in editor 2022-03-12 13:34:06 -06:00
Rémi Verschelde
398c124b9a Merge pull request #59035 from timothyqiu/vs-rtr
Use `RTR()` for `VisualScriptNode` captions and texts
2022-03-11 19:26:11 +01:00
Haoyu Qiu
34614b544a Use RTR() for VisualScriptNode captions and texts 2022-03-11 23:36:16 +08:00
reduz
8c4feb0e52 Discern between virtual and abstract class bindings
* Previous "virtual" classes (which can't be instantiated) are not corretly named "abstract".
* Added a new "virtual" category for classes, they can't be instantiated from the editor, but can be inherited from script and extensions.
* Converted a large amount of classes from "abstract" to "virtual" where it makes sense.

Most classes that make sense have been converted. Missing:

* Physics servers
* VideoStream
* Script* classes.

which will go in a separate PR due to the complexity involved.
2022-03-10 12:28:11 +01: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
Raul Santos
e9e0b643ef Sort variables in VisualScriptEditor
Sorts the script variables in alphabetical order to display them
in VisualScriptEditor.
2022-02-24 21:18:02 +01:00
megalobyte
f649a96f6a Don't process VisualScriptNodes 2022-02-19 14:33:27 -05:00
Rémi Verschelde
de2d041f6e Merge pull request #58187 from jakobbouchard/notification-switch-chunk-c
Convert _notification methods to switch - Chunk C
2022-02-16 20:58:55 +01:00
Jakob Bouchard
2768f4bb23 Convert _notification methods to switch - Chunk C 2022-02-16 13:03:05 -05:00