Commit graph

348 commits

Author SHA1 Message Date
Danil Alexeev
d4555ef5fb
Add String.to_{camel,pascal,snake}_case methods 2022-08-30 12:36:24 +03:00
Aaron Franke
10a56981dc
Rename String plus_file to path_join 2022-08-29 19:38:13 -05:00
Rémi Verschelde
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
Aaron Record
4b817a565c Remove NOTIFICATION_ENTER_TREE when paired with NOTIFICATION_THEME_CHANGED 2022-08-27 11:52:29 -06:00
kobewi
8be27dc59e Replace Array return types with TypedArray 2022-08-22 22:42:36 +02:00
Juan Linietsky
d4433ae6d3 Remove Signal connect binds
Remove the optional argument p_binds from `Object::connect` since it was deprecated by Callable.bind().
Changed all uses of it to Callable.bind()
2022-07-29 16:26:13 +02:00
Guh-Feng
1b8652e86a Color Pickers Respect Settings
Updated editor_node with function that sets up color pickers throughout Godot to respect editor's settings.
2022-07-21 18:11:09 -04:00
Rémi Verschelde
8351d75b7f
Merge pull request #63195 from Rindbee/fix-wrong-clear-edit-menu 2022-07-19 13:49:43 +02:00
Rindbee
8972dd8492 Fix incorrectly clearing edit menu
Delete only if `editor_enabled` is true, otherwise destructor may delete it repeatedly.
2022-07-19 19:09:27 +08:00
FireForge
97dfbea6ad Rename Control PRESET_WIDE to PRESET_FULL_RECT 2022-07-18 20:08:11 -05:00
Rémi Verschelde
7d3ff927de
Merge pull request #62075 from Vitika9/gsoc-colorpicker 2022-07-08 09:06:47 +02:00
Vitika9
0011d93c81 ColorPicker Refactor 2022-07-06 22:11:43 +05:30
Yuri Sizov
a9098e6147 Add support for documenting built-in annotations 2022-07-04 20:21:39 +03:00
K. S. Ernest (iFire) Lee
9ddebc0c22 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
Rémi Verschelde
68bf4eb100
Merge pull request #61440 from vnen/gdscript-scene-unique-nodes
GDScript: Support `%` in shorthand for `get_node`
2022-05-31 12:36:37 +02:00
Arne Stenkrona
6cd4d5f061 Ensure focus when dropping to script editor
This improves usability by making sure actions subsequent to drop
are performed within the script editor. For example, dropping a
node from the scene tree to the script editor and attempting undo
will now undo the drop instead of performing an undo in the scene
tree.

Fixes issue #61465
2022-05-28 19:58:46 +02: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
Aaron Record
900c676b02 Use range iterators for RBSet in most cases 2022-05-19 12:09:16 +02:00
Jummit
1101f6c660 Use % when dropping unique scene nodes into script
This expands uppon #60708, using `get_node("%NodeName")` for nodes that
have a unique scene name to avoid having to change the onready
statements when the paths of the nodes change.
2022-05-18 15:21:31 +02:00
kobewi
995bcd6218 Include quotes conditionally for dropped paths 2022-05-17 16:30:23 +02:00
Haoyu Qiu
3094e739f5 Create onready variables when dropping nodes and holding Ctrl 2022-05-17 11:51:22 +08: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
Yuri Rubinsky
a439832035 Fix signal completion in GDScript editor 2022-05-12 16:10:48 +03: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
Igor Kordiukiewicz
8462647871 Added button to add warning ignore annotations 2022-04-28 02:46:05 +02:00
Eric M
4ab605d14d Improve sorting of Code Completion options.
Done by ordering options by their location in the code - e.g. local, parent class, global, etc.
2022-04-01 20:39:09 +10:00
reduz
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
kobewi
42078dec9f Allow negative indexes in ItemList and PopupMenu 2022-03-12 01:14:03 +01:00
nova++
ce66f8a7a0 Add check to prevent "p_gutter = -1" error spam 2022-03-08 20:23:46 -05:00
kobewi
2057ea2883 Remove duplicate editor settings definitions 2022-03-06 22:05:49 +01:00
megalobyte
8824b6c5e9 Update if == NOTIFICATION_* to switch statements to match coding style 2022-02-16 08:44:37 -05:00
Hendrik Brucker
b396fd4eef Improve compilation speed (forward declarations/includes cleanup) 2022-02-12 02:46:22 +01:00
Rémi Verschelde
f425d403fe
Merge pull request #57066 from KoBeWi/in_the_name_of_the_custom 2022-02-08 11:15:01 +01:00
Rémi Verschelde
a66e55069e
Merge pull request #57796 from akien-mga/revert-sname-theme-setters 2022-02-08 11:13:24 +01:00
Rémi Verschelde
fc076ece3d
Revert "Add missing SNAME macro optimization to all theme methods call"
This reverts commit a988fad9a0.

As discussed in #57725 and clarified in #57788, `SNAME` is not meant to be used
everywhere but only in critical code paths. For theme methods specifically, it
was by design that only getters use `SNAME` and not setters.
2022-02-08 10:17:25 +01:00
Rémi Verschelde
317cd0b19a
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
kobewi
a08fc442a0 Fix script editor errors with CustomCallables 2022-02-07 14:34:42 +01:00
jmb462
a988fad9a0 Add missing SNAME macro optimization to all theme methods call 2022-02-06 23:06:11 +01:00
jmb462
1ce81dc5f2 Add missing SNAME macro optimization in some function calls 2022-02-06 15:54:04 +01:00
Anilforextra
adbe948bda String: Add contains(). 2022-02-04 01:28:02 +05:45
Yuri Roubinsky
050f746e19 Fix theming update of shader editor 2022-01-25 12:10:07 +03:00
Paulb23
f43f68f605 Convert TextEdit callbacks to Callable 2022-01-19 17:26:22 +00:00
Rémi Verschelde
3efa6644c4
Merge pull request #55541 from KoBeWi/outcognito_scripts 2022-01-14 21:04:13 +01:00
kobewi
f524ddebd5 Make script type distinguishable by icon 2022-01-13 12:29:05 +01:00
Rémi Verschelde
6d4ed65f4c
Merge pull request #56483 from vnen/gdscript-warning-annotation
Add annotation to ignore warnings
2022-01-05 09:05:56 +01:00
George Marques
923b7b2748
Remove action to ignore warning in the script editor
The way to ignore warnings changed so this isn't valid anymore.
2022-01-04 09:52:13 -03: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
Nathan Franke
41a20171eb
align to horizontal_alignment, valign to vertical_alignment, related 2021-12-09 01:38:46 -06:00