Commit Graph

111 Commits

Author SHA1 Message Date
e31bb5ffeb Rename CanvasItem.update() to queue_redraw()
Affects a lot of classes. Very thoroughly checked signal connections and deferred calls to this method, add_do_method/add_undo_method calls, and so on.

Also renames the internal `_update_callback()` to `_redraw_callback()` for consistency.

Just a few comments have also been changed to say "redraw".

In CPUParticles2D, there was a private variable with the same name. It has been renamed to `do_redraw`.
2022-08-29 14:59:47 +02:00
fd6453c45e Revert "Remove NOTIFICATION_ENTER_TREE when paired with NOTIFICATION_THEME_CHANGED"
This reverts commit 4b817a565c.

Fixes #64988.
Fixes #64997.

This caused several regressions (#64988, #64997,
https://github.com/godotengine/godot/issues/64997#issuecomment-1229970605)
which point at a flaw in the current logic:

- `Control::NOTIFICATION_ENTER_TREE` triggers a *deferred* notification with
  `NOTIFCATION_THEME_CHANGED` as introduced in #62845.
- Some classes use their `THEME_CHANGED` to cache theme items in
  member variables (e.g. `style_normal`, etc.), and use those member
  variables in `ENTER_TREE`, `READY`, `DRAW`, etc. Since the `THEME_CHANGE`
  notification is now deferred, they end up accessing invalid state and this
  can lead to not applying theme properly (e.g. for EditorHelp) or crashing
  (e.g. for EditorLog or CodeEdit).

So we need to go back to the drawing board and see if `THEME_CHANGED` can be
called earlier so that the previous logic still works?

Or can we refactor all engine code to make sure that:
- `ENTER_TREE` and similar do not depend on theme properties cached in member
  variables.
- Or `THEME_CHANGE` does trigger a general UI update to make sure that any
  bad theme handling in `ENTER_TREE` and co. gets fixed when `THEME_CHANGE`
  does arrive for the first time. But that means having a temporary invalid
  (and possibly still crashing) state, and doing some computations twice
  which might be heavy (e.g. `EditorHelp::_update_doc()`).
2022-08-29 11:11:29 +02:00
4b817a565c Remove NOTIFICATION_ENTER_TREE when paired with NOTIFICATION_THEME_CHANGED 2022-08-27 11:52:29 -06:00
8be27dc59e Replace Array return types with TypedArray 2022-08-22 22:42:36 +02:00
8823eae328 Rename OSX to macOS and iPhoneOS to iOS. 2022-07-21 09:37:52 +03:00
344ba0ffaf Refactor Font configuration and import UI, and Font resources. 2022-07-06 14:12:36 +03:00
336400dc42 Add the ability to drag the code completion scrollbar using the mouse click 2022-07-03 23:47:52 +02:00
900c676b02 Use range iterators for RBSet in most cases 2022-05-19 12:09:16 +02:00
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
081b6b8053 Add ALT NUM+ {hex code} character input support for LineEdit, TextEdit and CodeEdit. 2022-05-13 09:33:24 +03:00
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
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
925e54ad65 fix lines ending in comments causing auto indent 2022-04-28 20:07:10 -05:00
3073b85de9 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
88b09694e7 Fix inspector group name capitalization 2022-03-28 14:02:06 -05:00
360dea5348 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
0f5455230c Use switch consistently in _notification (scene folder) 2022-02-15 18:44:55 +01:00
29199579f7 Add sub-pixel glyph positioning support. 2022-02-12 19:55:52 +02:00
244db37508 Cleanup and move char functions to the char_utils.h header. 2022-02-04 11:35:01 +02:00
adbe948bda String: Add contains(). 2022-02-04 01:28:02 +05:45
f170d6a171 With auto_brace_complete enabled, selected text now gets wrapped by braces 2022-01-30 17:33:13 +01:00
899cd34426 Merge pull request #57281 from Rubonnek/rename-subsequence 2022-01-27 11:03:13 +01:00
3eb5e0ac50 Rename String::is_subsequence_ofi to String::is_subsequence_ofn 2022-01-26 18:03:56 -05:00
6f1089af86 Fix selection being deleted and indentation not being accounted for 2022-01-23 23:14:35 +00:00
1422c756ed Rename request_code_completion signal 2022-01-22 14:04:35 +01:00
f43f68f605 Convert TextEdit callbacks to Callable 2022-01-19 17:26:22 +00:00
85424afee6 Fix CodeEdit guidelines position. 2022-01-14 15:51:07 +02:00
b238218363 Merge pull request #55851 from Chaosus/better-completion-options-list_rebased 2022-01-06 09:40:44 +01:00
fe52458154 Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-03 21:27:34 +01:00
a124f1effe Fix various typos
Found via ` codespell -q 3 -S ./thirdparty,*.po,./DONORS.md -L ackward,ang,ans,ba,beng,cas,childs,childrens,dof,doubleclick,expct,fave,findn,gird,hist,inout,leapyear,lod,nd,numer,ois,ony,paket,seeked,sinc,switchs,te,uint,varn`
Update editor/import/resource_importer_layered_texture.cpp

Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update doc/classes/TileSetScenesCollectionSource.xml

Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/gui/graph_edit.cpp

Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/resources/animation.cpp

Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/resources/animation.cpp

Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/resources/animation.cpp

Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/gui/rich_text_label.cpp

Co-authored-by: Raul Santos <raulsntos@gmail.com>
Revert previously committed change
2022-01-02 01:03:58 -05:00
526390c048 Fix highlight for completion options match (rebased)
Co-authored-by: Gustav Andersson <gvekan@users.noreply.github.com>
2021-12-12 10:39:49 +03:00
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
41a20171eb align to horizontal_alignment, valign to vertical_alignment, related 2021-12-09 01:38:46 -06:00
1b89296fad Merge pull request #55227 from ator-dev/fix-code-folding 2021-11-25 22:21:46 +01:00
bac0a035c9 Fix code folding when end of block is unindented delimiter 2021-11-24 22:43:06 +00:00
e078f970db Rename remove() to remove_at() when removing by index 2021-11-23 18:58:57 -07:00
2a302f7097 Fix TextEdit mouse interactions when the last line is hidden 2021-11-17 18:29:19 +00:00
3c0fdcc8ac Use "enum class" for input enums 2021-11-12 15:37:54 -06:00
ebbc25e89c Ignore empty Font resources as theme override.
Add range hint to font_size properties.
Remove excessive `base_size` Font property.
2021-10-25 14:05:37 +03:00
0a381137bc Fix crash when executing CodeEdit._main_gutter_draw_callback 2021-10-18 19:26:47 +08:00
010e17b44f Merge pull request #53476 from Paulb23/breakpoint-move-up-fix 2021-10-06 16:25:17 +02:00
0caab00d66 Fix breakpointed_lines out of sync when removing lines above 2021-10-06 14:23:37 +01:00
ced7d51e23 Fix the "END" key behaving like "PAGE_DOWN" in code completion.
Before: behaved like page down.
After: goes to last item.
2021-10-06 01:28:29 +10:00
9c375170e4 Fix deleting selection at the first line do not work with backspace 2021-10-01 20:23:52 +02:00
c63b18507d Use range iterators for Map 2021-09-30 15:09:12 -06:00
e0f8410d16 Improved breakpoint gutter for CodeEdit.
Added preview of breakpoint placement on hover. Added override of icon for the Editor to use an SVG so it is no longer blurry.
2021-09-30 22:15:47 +10:00
e70a0d950a Fix incorrect offsets of tooltip content in CodeEdit
Fix incorrect offsets of tooltip content in `CodeEdit`
2021-09-24 16:33:39 +03:00
cc51b045da Construct values only when necessary. 2021-09-23 22:26:07 +05:45
35264d5782 Change completion prefixes to single char and unnecessary ui_cancel accept_event 2021-09-20 09:42:39 +01:00
72c813630f Merge pull request #52583 from e8newallm/52360
Removed updates that caused unnecessary window updates
2021-09-14 20:54:05 +02:00