Commit graph

68 commits

Author SHA1 Message Date
Raul Santos 525b5e0e16
Fix EditorScenePostImport templates for C# 2022-06-16 19:29:59 +02:00
Rémi Verschelde d82c227e2b
Merge pull request #61486 from jtnicholl/import_script_templates
Add script templates for EditorScenePostImport
2022-06-15 21:07:42 +02:00
Jonathan Nicholl 912d8e23ca Add script templates for EditorScenePostImport 2022-06-15 12:41:37 -04:00
George Marques eba3e0a9fc
GDScript: Support % in shorthand for get_node
The `%` is used in scene unique nodes. Now `%` can also be used instead
of `$` for the shorthand, besides being allowed generally anywhere in
the path as the prefix for a node name.
2022-05-27 13:46:18 -03:00
reduz 45af29da80 Add a new HashSet template
* Intended to replace RBSet in most cases.
* Optimized for iteration speed
2022-05-20 22:40:38 +02:00
reduz 746dddc067 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 8b7c7f5a75 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
Hugo Locurcio 180e5d3028
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 c9b75431f3 Refactor GDScript/C# script templates logic to be editor-only
Not a full refactor as it still goes through ScriptLanguage so it's hacky,
but at least it can now compile without this.
2022-03-28 16:21:00 +02:00
Hendrik Brucker b396fd4eef Improve compilation speed (forward declarations/includes cleanup) 2022-02-12 02:46:22 +01:00
bruvzg 244db37508
Cleanup and move char functions to the char_utils.h header. 2022-02-04 11:35:01 +02:00
Anilforextra adbe948bda String: Add contains(). 2022-02-04 01:28:02 +05:45
Paulb23 fffeecfd68 Improvments for SyntaxHighlighters
- Fix immedate Funcion in lamba highlight
- Highlight signals as one colour
- Highlight node paths as one colour
- Highlight escape chars in strings
2022-01-15 15:39:55 +00:00
Rémi Verschelde fe52458154
Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-03 21:27:34 +01:00
Nathan Franke 49403cbfa0
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
Gordon MacPherson 1881b3adc5
Improve GDScript Editor and Improve latency
Improvements:
- GDScript Highlighter is faster by 25% as keys are smaller (hashes instead of strings)
- Removes message queue from _apply_settings_change to allow resize to work correctly
- Some performance fixes are pending still

Note: this resolves the code editor behaving badly when resizing in debug builds
2021-09-21 13:56:47 +02:00
Lyuma 31f790299c Use OrderedHashMap for autoloads to preserve order 2021-08-26 21:55:26 -07:00
reduz 3682978aee Replace BIND_VMETHOD by new GDVIRTUAL syntax
* 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-22 08:23:58 -03:00
Max Hilbrunner 5161c97c9c Remove underscore hacks
Way less cruft. :)

Co-authored-by: Ignacio Roldán Etcheverry <neikeq@users.noreply.github.com>
2021-08-17 16:10:28 +02:00
Paulb23 bcfc591f86 Reorganise text editor settings 2021-08-16 17:18:49 +01:00
Rémi Verschelde ac3322b0af
Use const references where possible for List range iterators 2021-07-25 12:22:25 +02:00
Aaron Franke 4e6efd1b07
Use C++ iterators for Lists in many situations 2021-07-23 17:38:28 -04:00
reduz 6631f66c2a 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
Rémi Verschelde 06568bbfdf
Misc cleanup of header includes
Was looking for misuse of module headers without checking that the module is
actually enabled and got carried away...
2021-07-15 00:46:43 +02:00
Lightning_A e28fd07b2b Rename instance()->instantiate() when it's a verb 2021-06-19 20:49:18 -06:00
Hugo Locurcio 32e97cb805
Highlight annotations in the GDScript syntax highlighter
By default, a orange color is used to highlight annotations in the
script editor.
2021-06-06 21:33:23 +02:00
Hugo Locurcio 1704be0a44
Rename the bundled text editor themes for consistency with themes
The Adaptive text editor theme is the default, and has therefore
been renamed Default for consistency with the Default theme preset.
It keeps its automatic dark/light switch status.

The Default text editor theme was actually a legacy Godot 2-style theme,
so it has been renamed to Godot 2 to match the theme preset.
Its background color has been changed to be a constant opaque color,
since the new editor theme made the theme look less good on a translucent
background. The previous background color on light theme also lacked
contrast.
2021-05-31 14:02:13 +02:00
Hugo Locurcio e905e8f145
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
reduz f8d03b98e7 Improve resource load cache
-Added a new method in Resource: reset_state , used for reloading the same resource from disk
-Added a new cache mode "replace" in ResourceLoader, which reuses existing loaded sub-resources but resets their data from disk (or replaces them if they chaged type)
-Because the correct sub-resource paths are always loaded now, this fixes bugs with subresource folding or subresource ordering when saving.
2021-02-11 15:44:28 -03:00
Rafał Mikrut f7209b459b Initialize class/struct variables with default values in modules/ 2021-02-08 10:57:18 +01:00
Lucas Van Mol 749d0c708c Fix highlight color for class attributes that are also keywords 2021-01-26 15:17:18 +01:00
Rémi Verschelde b5334d14f7
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
Rafał Mikrut e1811b689b Initialize class/struct variables with default values in platform/ and editor/ 2020-12-02 16:09:11 +01:00
reduz 127458ed17 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
Paulb23 ee4a1c99a7 Switch from recursion to iterative for backfilling colour regions 2020-10-03 14:58:55 +01:00
bruvzg 80b8eff6aa
[Complex Test Layouts] Change String to use UTF-32 encoding on all platforms. 2020-09-03 19:56:24 +03:00
Rémi Verschelde d84954a281
Merge pull request #41459 from Paulb23/nested_color_regions
Fix colour region end key seach and start key order
2020-09-03 11:32:04 +02:00
Paulb23 6cdcdbc242 Fix color region end key seach and start key order 2020-08-22 19:55:44 +01:00
SkyJJ ce3461dc88 Update GDScriptTranslationParserPlugin to use GDSriptParser instead of RegEx. 2020-08-19 03:10:51 +02:00
SkyJJ 396f2eee82 Update POT generation to handle context and plurals 2020-08-19 03:01:52 +02:00
Paulb23 5cf2cf8646 Fix colour region continuation over blank lines, issue 41120 2020-08-08 15:36:46 +01:00
George Marques 5d6e853806
New GDScript tokenizer and parser
Sometimes to fix something you have to break it first.

This get GDScript mostly working with the new tokenizer and parser but
a lot of things isn't working yet. It compiles and it's usable, and that
should be enough for now.

Don't worry: other huge commits will come after this.
2020-07-20 11:38:39 -03:00
Paulb23 bc4cee4458 Extract Syntax highlighting from TextEdit and add EditorSyntaxHighlighter
- Extacted all syntax highlighting code from text edit
- Removed enable syntax highlighting from text edit
- Added line_edited_from signal to text_edit
- Renamed get/set_syntax_highlighting to get/set_syntax_highlighter
- Added EditorSyntaxHighligher
2020-07-11 17:09:58 +01:00
Paulb23 156daddaaf Expose Syntax highlighter for editor plugins 2020-07-11 15:40:00 +01:00
Paulb23 2f1080be9b Convert syntax highlighters into a resource 2020-07-11 15:26:58 +01:00
Marcel Admiraal 26fcf2b04c Add override keywords. 2020-07-10 13:56:54 +01:00
SkyJJ cae6f0bda2 Change translation parser plugin API to parse_file() 2020-07-05 12:14:56 +02:00
SkyJJ efb4609425 Add translation parser plugin support 2020-07-02 14:47:35 +02:00
Rémi Verschelde 0ee0fa42e6 Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14 21:57:34 +02:00
Rémi Verschelde 0be6d925dc Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
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-14 16:54:55 +02:00