Commit Graph

222 Commits

Author SHA1 Message Date
Juan Linietsky 223ce4fcb9 Optimize Node::add_child validation
Adding 10k nodes is almost twice as fast.
2023-04-07 13:18:47 +02:00
Yuri Sizov 1522762dc9 Make icons of scripted and custom classes fit the editor UI
Also:
- Add an option to limit the icon size in PopupMenu.
This is similar to how this works in Tree and TreeItem.
- Add the same option to TabBar.
- Add a theme constant for Tree, PopupMenu, Button, and
TabBar to apply this limit on the control level.

Co-authored-by: Daylily-Zeleen <daylily-zeleen@foxmail.com>
2023-03-31 21:39:02 +02:00
Robbie Cooper 907ba0d8f2 Have the Rename Node action use the targeted Node to determine the current undo/redo context
Formerly, we deduced context implicitly, but this failed and always used the global context instead of the context of the scene containing the Node.

This happened because the first argument to `add_do_method`, the SceneTreeEditor, is a descendant of Node and outside the current game scene's tree (it's part of the editor instead). This led the code in `EditorUndoRedoManager::get_history_id_for_object` to choose global context.

My solution is to explicitly use the renamed Node to deduce our context because it will always be in the current scene in this situation.

Fixes #67276
2023-03-15 16:03:30 +01:00
Yuri Sizov fab9926a95
Merge pull request #65137 from dalexeev/editor-naming
Rearrange `editor/naming/*` project settings
2023-01-24 22:26:03 +03:00
Rémi Verschelde 5b1df48c6c
Convert en_GB spelling to en_US with codespell 2023-01-23 11:02:20 +01:00
Rémi Verschelde bcaf048f33
Merge pull request #71379 from KoBeWi/destruction_of_compatibility_function
Remove set_drag_forwarding_compat()
2023-01-18 17:40:13 +01:00
kobewi b58111588a Add EditorUndoRedoManager singleton 2023-01-16 01:11:52 +01:00
kobewi 59ea36b87c Remove set_drag_forwarding_compat() 2023-01-14 15:16:51 +01:00
Rémi Verschelde 7dfcd55567
Merge pull request #71152 from nongvantinh/fix-70981
Fix node name in the SceneTreeEditor allows a node to have no name
2023-01-13 00:39:20 +01:00
Danil Alexeev 8f706be6fa
Rearrange `editor/naming/*` project settings 2023-01-12 11:41:13 +03:00
Juan Linietsky e6a4debede Change set_drag_forwarding() to use callables.
* This solution is much cleaner than the one in 3.x thanks to the use of callables.
* Works without issues in any language (no need to worry about camel or snake case).
* Editor code uses a compatibility function (too much work to redo).

Fixes #59899
2023-01-10 14:09:24 +01:00
Nong Van Tinh 98ed75f9e0 fixes: #70981 2023-01-10 16:18:38 +07:00
Rémi Verschelde d95794ec8a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".
2023-01-05 13:25:55 +01:00
Haoyu Qiu 207e52c161 Fix String::word_wrap() for long words
- Changes `TextServer.string_get_word_breaks()`
  - Returns pairs of boundary start and end offsets
  - Accepts `chars_per_line` to return line breaks
- Removes `String::word_wrap()`

Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>
2022-12-16 13:18:57 +08:00
trollodel c90d0bd84f Use forward-declarations in big editor classes 2022-11-29 09:59:43 +01:00
kobewi 15831e381b Unify usage of undo_redo in editor 2022-11-02 17:51:58 +01:00
Guilherme Sousa 5d06843fcf Added custom node export 2022-10-14 17:31:00 +02:00
bruvzg 0103af1ddd
Fix MSVC warnings, rename shadowed variables, fix uninitialized values, change warnings=all to use /W4. 2022-10-07 11:32:33 +03:00
Rémi Verschelde e3d140e21a Merge pull request #65939 from Mickeon/editor-scene-tree-filter-type-inherited
Include inherited classes in Filter Nodes' "type:" filter & fix "group:"
2022-10-07 09:13:59 +02:00
Micky 44738e1e15 Include inherited classes in Filter Nodes' "type:" filter & fix "group:"
Also fixes not all private, internal groups being skipped in the "group:" filter.
2022-10-06 16:13:11 +02:00
Micky 33092b6f45 Expose and warn about Node Filters in Scene Tree Dock
Adds "Filter by Type" and "Filter by Group" in the Scene Tree Dock's MenuButton.
Hovering on them displays an useful tooltip.
When selecting these items, the matching parameter is appended to the terms, and the caret is automatically brought to the end.

When typing a filter that cannot be identified, a warning icon is displayed. The reason is explained as a tooltip.

The same options are also quickly available by right-clicking or middle-clicking in the text field.
2022-10-06 13:36:40 +02:00
Micky c03377653e Fix selection applying to hidden Nodes when filtering Scene Tree Editor 2022-10-03 18:28:43 +02:00
RedMser 3183b7371d SceneTreeDialog: focus search bar by default 2022-09-23 18:04:48 +02:00
kobewi 3a2abf7486 Automatically use class name for empty renames 2022-09-22 00:43:38 +02:00
Rémi Verschelde 6f5704d86f Merge pull request #65630 from aaronfranke/no-defer-ste-warn-ch
_warning_changed` signal connection
2022-09-19 15:43:23 +02:00
Tomasz Chabora 882a4f8906 Port remaining connections to callable_mp 2022-09-18 13:08:54 +02:00
Aaron Franke 408ed2235b
Don't defer SceneTreeEditor::_warning_changed signal connection 2022-09-10 14:19:29 -05:00
Rémi Verschelde 211631801d
Merge pull request #65352 from Mickeon/try-scene-tree-filter-multi-word 2022-09-09 16:11:45 +02:00
Micky 1c4095a66a Improve Scene Tree Dock's Node filter (Allow multiple terms & more)
- Allows more than one parameter to be passed in the "Filter Node" search box, each term separated by spaces.
- Grays out any parent Node not matching the search, but still having to be there because a child is.
- Adds a `group:` filter. It matches any Node belonging to the passed group. If no argument is passed, it matches all Nodes belonging to any group. It also ignores groups used internally, and its alias is `g`.
2022-09-09 13:40:29 +02:00
Micky 65cc721eb9 Fix tool script button color overriding custom type color
Also adds a small note on the tooltip noting the custom type.
2022-09-06 10:14:28 +02:00
Micky ad5ff9f78f Mark Script button if it's tool in Scene Tree Editor
Also adds a note on the tooltip if the Script is tool.

The color is the same one used on the Script Editor's script list.
2022-09-01 12:29:18 +02:00
Rémi Verschelde ae349d8227
Merge pull request #64377 from Mickeon/rename-canvas-redraw
Rename `CanvasItem.update()` to `queue_redraw()`
2022-08-30 14:47:41 +02:00
Micky 97f8c9b97c Rename TreeItem's `set_tooltip` to `set_tooltip_text`
`set_tooltip` -> `set_tooltip_text`
`get_tooltip` -> `get_tooltip_text`

For consistency:
`get_button_tooltip` -> `get_button_tooltip_text`
And the `tooltip` parameter in `add_button` was renamed to `tooltip_text`
2022-08-30 11:16:23 +02:00
Micky 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
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
Rémi Verschelde 1190fbdf2b
Merge pull request #64733 from Mickeon/try-editor-warning-spacing 2022-08-23 18:16:26 +02:00
Micky d5f44bffe6 Add spacing after newline on editor warning tooltip 2022-08-23 10:56:38 +02:00
Rémi Verschelde 745e80fa8d
Merge pull request #58377 from MrBBBaiXue/type-filter
Add a way to filter nodes by type in scene tree dock.
2022-08-22 23:34:03 +02:00
kobewi ece3df3938 Add per-scene UndoRedo 2022-08-22 18:05:10 +02:00
MrBBBaiXue 296640ab8f Add a way to filter nodes by type.
Add a way to filter nodes by type.
Usage:  type:NodeType or t:NodeType

Co-Authored-By: Haoyu Qiu <timothyqiu@users.noreply.github.com>
2022-08-10 00:48:11 +08:00
Rémi Verschelde db523dd400
Merge pull request #63518 from timothyqiu/window-toggle 2022-08-08 16:13:30 +02:00
Hugo Locurcio 393cf40922
Distinguish multiple node configuration warnings in the scene tree dock
A number of dots is present next to the node configuration icon
warning when there is more than 1 warning.

Co-authored-by: Hendrik Brucker <hendrik.brucker@mail.de>
2022-08-04 02:20:11 +02:00
foxydevloper 1ff9a09e2c Improve tooltips for grouping/ungrouping nodes 2022-07-31 10:56:32 -04: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
Haoyu Qiu 42373df2d4 Add a Window visibility toggle button to the Scene tree 2022-07-27 08:57:45 +08:00
Chia-Hsiang Cheng 83d478ffcd Disable the OK button when no node is selected. 2022-07-14 12:03:27 +08:00
Rindbee 72a768b24f Avoid possibly showing two Dialogs at the same time
Update editor/scene_tree_editor.cpp

Add a comment to explain why

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2022-06-21 17:21:04 +08:00
kobewi d2c8741a69 Fix crash with empty scenes 2022-06-04 00:04:49 +02:00
Rémi Verschelde 26bfaf34dd
Merge pull request #61488 from fire-forge/filter 2022-05-30 02:03:45 +02:00