Commit Graph

338 Commits

Author SHA1 Message Date
Yuri Sizov 95b27fe8c7 Reorganize code related to editor theming
This change introduces a new EditorThemeManager class
to abstract theme generatio and its subroutines.

Logic related to EditorTheme, EditorColorMap, and editor
icons has been extracted into their respective files with
includes cleaned up.

All related files have been moved to a separate folder to
better scope them in the project. This includes relevant
generated files as well.
2024-01-16 11:57:45 +01:00
kobewi 0e8f90f4c8 Update deferred calls to use Callables 2024-01-09 16:11:47 +01:00
Rémi Verschelde 4baa634937
Merge pull request #84895 from rsubtil/fix_dap_race_condition
Prevent race condition on initial breakpoints from DAP
2024-01-09 15:30:44 +01:00
Rémi Verschelde 6c390b620d
Merge pull request #84445 from Rubonnek/add-const-references-clang-tidy
Add const references detected by clang-tidy
2024-01-04 14:25:33 +01:00
rune-scape cde478bda6 Hot-reload only changed scripts 2024-01-02 17:56:52 -08:00
Mateus Reis 105723b725 Fix internal profiling button being visible when disabled 2023-12-21 18:25:33 +02:00
msreis f1cc14d525 Fix missing time for some script functions in profiler
Fixes the issue by adding a mechanism by which the functions that were
previously disappearing can be profiled too. This is optional with
an editor setting, since collecting more information naturally slows the engine
further while profiling.

Fixes #23715, #40251, #29049
2023-12-19 19:42:21 +01:00
Wilson E. Alvarez a3cb1b096f
Add const references detected by clang-tidy 2023-12-16 13:36:44 -05:00
Ricardo Subtil 485342408b Prevent race condition on initial breakpoints from DAP 2023-11-14 15:56:03 +00:00
Rémi Verschelde c2d410a19e
Merge pull request #82868 from SaracenOne/multi_session_debugger_fixes
Fix debugger behaviour with multi-session debugging
2023-10-16 10:38:58 +02:00
Saracen 3700ce7318 Fix right-click menu position for the debugger breakpoint tree. 2023-10-06 19:47:19 +01:00
Saracen 3defc17646 Fix debugger behaviour with multi-session debugging:
Fixes script editor debug menu on sessions other than 1
Fixes breakpoint toggle from menu in sessions other than 1
Removes execution display when switching to non-breaked sessions
2023-10-06 19:20:37 +01:00
Yuri Sizov 4bd569be95 Replace flat buttons with flat-styled buttons with a visible pressed state 2023-09-19 22:36:29 +02:00
A Thousand Ships 75ee58fd04 [Editor] Replace `ERR_FAIL_COND` with `ERR_FAIL_NULL` where applicable 2023-09-15 20:15:39 +02:00
Yuri Sizov 8ecc0c4f47 Fix accessing editor theme items throughout the UI
This also exposes `EditorInterface::get_editor_theme`.
2023-09-15 14:51:01 +02:00
Yuri Sizov d8ff69d53c Extract ScriptInstance to simplify includes
This allows to include script_instance.h directly in the
generated gdvirtual.gen.inc, and remove excessive includes
from the codebase.

This should also allow Resource to use GDVIRTUAL macros,
which wasn't possible previously due to a circular dependency.
2023-09-06 22:54:38 +02:00
kobewi 6de34fde27 Add EditorStringNames singleton 2023-09-03 19:58:18 +02:00
Yuri Sizov 2445414aa0 Avoid unnecessary inspector updates when loading or switching scenes
This should result in some noticeable performance improvements,
aside from fixing bugs due to conflicts in logic.
This also simplifies some related code identified while debugging.
2023-08-12 13:32:59 +02:00
Chia-Hsiang Cheng 8da66412f6 Avoid retrieving the object ID of a Nil variable 2023-08-04 22:38:43 +08:00
Rémi Verschelde 8b6c867c81
Merge pull request #79280 from raulsntos/dotnet/better-push-error
C#: Improve `GD.PushError` and `GD.PushWarning`
2023-08-03 14:46:44 +02:00
Juan Linietsky 5e512b705e Support threads in the script debugger
* This implementation adds threads on the side of the client (script debugger).
* Some functions of the debugger are optimized.
* The profile is also now thread safe using atomics.
* The editor can switch between multiple threads when debugging.

This PR adds threaded support for the script language debugger. Every thread has its own thread local data and it will connect to the debugger using multiple thread IDs.
This means that, now, the editor can receive multiple threads entering debug mode at the same time.
2023-07-26 12:06:45 +02:00
Hendrik Brucker 7e21eb7e00 Extract and reorganize texture resource classes 2023-07-14 20:04:21 +02:00
Raul Santos 13ab2b6f4f
C#: Improve `GD.PushError` and `GD.PushWarning`
- Use the name, file path and line number of the caller that invokes
`GD.PushError` and `GD.PushWarning` instead of the location in the C++
`runtime_interop.cpp` file.
- Improvements to getting the C# stack trace.
  - Use C# type keywords for built-in types in method declarations.
  - Remove extra space before each parameter in method declarations.
  - Skip one more frame to avoid `NativeInterop.NativeFuncs`.
  - Skip methods annotated with the `[StackTraceHidden]` attribute.
- Improvements to `ScriptEditorDebugger` when source is in project.
  - Avoid overriding error metadata when the source is inside the
project file.
  - Use the source function in the title when the source is inside
the project file.

Users that use these methods would expect the reported location printed
by these methods to correspond to a location in their project source files.
Specifically, they'd expect to see the file path and line number at which
they call these methods, and not the location of the C++ code (which is
always the same). Now, these methods are a lot more useful since users
can know which line in their source code printed the error/warning.
2023-07-11 11:19:11 +02:00
Rémi Verschelde 080d471e98
Merge pull request #75200 from Calinou/debugger-editor-settings-add-property-hints
Add property hints for debugger/profiler editor settings
2023-06-19 21:39:10 +02:00
Fabio Alessandrelli 7b170d12cf
Merge pull request #75836 from rsubtil/bugfix-dap_windows_path
Fix DAP path mismatch on Windows
2023-06-19 16:38:19 +02:00
Rémi Verschelde 2d6b880987
i18n: Sync translations with Weblate (now tracking 4.1 strings) 2023-06-12 14:57:08 +02:00
samar-01 d9e64d7001 Changed error tree initialization to allow reselection 2023-06-10 22:47:16 -04:00
VolTer 6f1adb72db Fix profilers' GUI trees 2023-06-03 11:47:59 +02:00
Aaron Franke 74361b3d50
Rename the Debugger's stack debug section to Stack Trace 2023-05-11 21:22:24 -05:00
Hendrik Brucker dc46163b12 Improve editor state persistence 2023-05-11 04:17:03 +02:00
Rémi Verschelde b3bb92ae5e
CI: Use gh-cli for changed files, and workaround codespell skip list bug
For PRs, this should give a more accurate list, as the previous method would
diff to the tip of the `master` branch, which could include new commits (and
thus changed files) not present in the PR branch.

codespell's `--skip` option doesn't work at all with folders when used
together with an explicit list of paths to work with, so let's not use it.
2023-05-08 15:36:17 +02:00
Juan Linietsky 273a6eeb66 Redo how the remote filesystem works
Instead of reading files over the network, the new version uses a local file cache and only updates files when it changes.

The original remote filesystem was created 14 years ago, when ethernet was faster than hard drives or even flash. Also, mobile devices have a very small amount of storage.
Nowadays, this is no longer the case so the approach is changed to using a persistent cache in the target device.

Co-authored-by: m4gr3d
2023-05-08 11:57:54 +02:00
Yuri Sizov 8a74d8438f Extract editor run toolbar into its own component
- Simplify and update its logic.
- Simplify EditorScript.
- Improve EditorNode and other relevant includes.
- Fix scene-based path in the movie writer when
reloading a scene.
2023-04-19 17:12:28 +02:00
Danil Alexeev 36bedd341a
Fix misuses of error macros 2023-04-18 10:20:48 +03:00
Rémi Verschelde c5d9470c7c
Merge pull request #75765 from YuriSizov/editor-node-optimize-includes
Improve includes of `EditorNode` (and everything else)
2023-04-11 19:40:24 +02:00
Ricardo Subtil 4be4eeea3a Poll LSP/DAP clients for connection status updates 2023-04-09 12:36:01 +01:00
Ricardo Subtil b8ae1c218c Fix DAP path mismatch on Windows 2023-04-08 19:59:01 +01:00
Yuri Sizov 4154039832 Improve includes of EditorNode (and everything else)
Also start organizing editor-specific GUI components
into a dedicated folder, `editor/gui`.
Also move `editor_file_server` next to the rest of debugger classes.
2023-04-07 18:59:49 +02:00
Yuri Sizov 9b500ab53c Fix premature theme item access in editor tools 2023-04-03 18:01:11 +02:00
kobewi f289e74966 Refresh filesystem when saving remote branch 2023-03-24 19:38:08 +01:00
Hugo Locurcio f575ca09ae
Add property hints for debugger/profiler editor settings
This also adds descriptions for those settings.
2023-03-22 01:07:31 +01:00
Yuri Sizov 239eb31c90 Make sure Script Debugger is updated with the editor theme 2023-03-10 18:16:00 +01:00
Haoyu Qiu 84aee17901 Improvements and fixes based on Weblate comments
* Description of `ui_text_submit` action should be "Submit Text" instead of "Text Submitted".
* Spell out "Animation" instead of using "Anim.".
* Treat "Max" as regular word instead of writing "Max.".
* Use generic "Set %s" for action name instead of a dedicated "Set target_position".
* Add translator comment for:
    * "Inclusive" and "Self" in the profiler.
    * Places where it needs the context about being an editor progress label.
    * "Duplicated Animation Name" since it's refering to the new name of a duplicated animation.
    * Disambiguation of "View Plane Transform", "Paste Selects" and "Display Normal".
* Fix wrong undo action name for renaming an input action.
* Fix missing end quote in a shader error message.
* In class reference:
    * Fix duplicated "if" in the description of `signf()`.
    * Fix mismatched example output in `String.operator %()`.
    * Fix typo in the description of `Decal.texture_emission`.
    * Unify description of `String.match()` and `StringName.match()`.
2023-02-13 15:22:18 +08:00
Pedro J. Estébanez 31a4a0002e Pace debugger draw requests 2023-02-07 12:10:28 +01:00
Paul Joannon 0fb1cef42f
Restore missing info in the error tooltips 2023-01-28 12:34:12 +01:00
Paul Joannon c93eec4139
Better error display in debugger panel
- Use the right stack frame info as title of the error.
- Use the actual C# exception type as error for exceptions raised from C#.
- Show the right language instead of always **C++ Error**.
2023-01-27 10:01:55 +01:00
kobewi b58111588a Add EditorUndoRedoManager singleton 2023-01-16 01:11:52 +01:00
bruvzg 5406b001ca
Move remote debug buttons to a single menu. 2023-01-14 22:25:35 +02:00
kobewi dfc4367a47 Add expand modes to TextureRect 2023-01-12 17:06:03 +01:00
Juan Linietsky 2b815df3c1 Use BitField<> in core type masks
* All core types masks are now correctly marked as bitfields.
* The enum hacks in MouseButtonMask and many other types are gone. This ensures that binders to other languages non C++ can actually implement type safe bitmasks.
* Most bitmask operations replaced by functions in BitField<>
* Key is still a problem because its enum and mask at the same time. While it kind of works in C++, this most likely can't be implemented safely in other languages and will have to be changed at some point. Mostly left as-is.
* Documentation and API dump updated to reflect bitfields in core types.
2023-01-08 22:17:40 +01: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
kobewi bf74ff94c8 Improve remote tree node tooltips 2023-01-03 17:06:36 +01:00
stmSi def4087a40 Suggest Filename in Remote Tree File Dialog 2022-12-25 19:34:11 +06:30
stmSi 97e991929f Fix: Profiler and Visual Profiler start/stop state inconsistency 2022-12-23 08:14:53 +06:30
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
kobewi f764db1bdd Add remote history to EditorUndoRedoManager 2022-12-08 15:06:29 +01:00
trollodel c90d0bd84f Use forward-declarations in big editor classes 2022-11-29 09:59:43 +01:00
Fabio Alessandrelli aa80cfac97 [Editor] Add button to keep the debug server open.
The setting is stored in the project editor metadata, and the server is
automatically started/stopped when the option change (only stopped if no
session is currently active).

The CLI option `--debug-server` now also forces the server to stay open
(without saving the state, unlike the menu option).

This commit also removes the "Keep debugger open" option in the script
editor "debug" menu. That option was really confusing, it used to hide
the bottom panel if and only if the debugger pane was selected, so if
you had your output log open instead (default when pressing play) it
would effectively do nothing. Having an option to save a click in such
a very specific case seems very overkill.
2022-11-25 11:02:55 +01:00
Zae 50704f27ed FIx debugger can't inspect sub objects. 2022-11-25 11:09:18 +08:00
Rémi Verschelde 6d2a7cb46d
Merge pull request #68709 from MewPurPur/instance-begone-part3
Remove more instances of 'instance' being used as a verb
2022-11-16 14:41:42 +01:00
VolTer 3b4f5f8a04 Remove more instances of 'instance' being used as a verb 2022-11-16 14:01:53 +01:00
Markus Sauermann 3b14f0334c Remove redundant Variant-types initializations 2022-11-14 19:35:19 +01:00
Fabio Alessandrelli 67265d14f7 [MP] Move engine and editor profilers to a plugin.
Also refactor the editor plugin out of the ReplicationEditor.
2022-11-14 15:09:00 +01:00
Fabio Alessandrelli d568b25e36 [Editor] Better expose EditorDebuggerPlugin.
Now splitted into two classes:
- EditorDebuggerPlugin (RefCounted).
- EditorDebuggerSession (abstract).

This allows the EditorPlugin to be in control of the debugger plugin
lifecycle, be notified when sessions are created, and customize each of
them independently.

We should slowly transition the various profilers and captures in
ScriptEditorDebugger to their own plugins, and decouple
ScriptEditorDebugger from it's UI part (making it the "real"
EditorDebuggerSession potentially dropping the wrappers).
2022-11-14 14:55:22 +01:00
Hugo Locurcio a13cdfe096
Use a bold font for section titles in the editor performance monitor 2022-11-11 19:34:13 +01:00
Rémi Verschelde 778ffce1e3
Merge pull request #62416 from Calinou/movie-maker-request-attention-on-finish
Request attention on the editor window when done recording a movie
2022-10-31 23:03:21 +01:00
Rémi Verschelde 5947f22be9
Merge pull request #67578 from KoBeWi/GEDITOR
Unify usage of GLOBAL/EDITOR_GET
2022-10-31 13:15:58 +01:00
Micky 809dad907a Add buttons in Remote Scene Tree
A Scene button to any scene instantiated from file. When clicked, it opens the original PackedScene.

A toggle visibility button is also available.
2022-10-20 18:02:41 +02:00
kobewi e48c5daddf Unify usage of GLOBAL/EDITOR_GET 2022-10-18 19:01:48 +02:00
kobewi 072f6feaba Make some Image methods static 2022-10-14 14:34:15 +02:00
Micky fe56c1ff75 Use `JSON::stringify` where possible 2022-10-11 00:27:23 +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 4d29346a74 Debugger: Fix fetching source to link C++ error on GitHub
Fixes #66974.
2022-10-06 11:45:27 +02:00
Rémi Verschelde 49fcf4ffad Style: Cleanup header guards for consistency
Fix file names for {Static,Lightmap}RaycasterEmbree.
2022-09-26 13:51:17 +02:00
Rémi Verschelde 2d9583fa3b
Merge pull request #65490 from halgriffiths/profiler-fix
Fix broken profiler in 4.0
2022-09-14 00:04:56 +02:00
halgriffiths 026e0811b9 Fix profiler being disabled at wrong times
Co-authored by: Will Whitty <tavurth@gmail.com>
2022-09-13 10:21:11 +01:00
Rémi Verschelde f391107830
Merge pull request #63640 from mbe9/fix_noneditable_remote_objects 2022-09-09 09:09:02 +02:00
SaracenOne 3c2e7b38cd Remove read-only status from EditorDebuggerRemoteObject 2022-09-08 14:34:31 +01: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 322c812231
Merge pull request #65023 from Faless/js/4.x_is_web 2022-08-29 13:00:32 +02:00
Fabio Alessandrelli d20b32186f [Web] Rename JavaScript platform to Web.
Also rename export name from "HTML5" to "Web".
2022-08-29 11:52:00 +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
Rémi Verschelde f7f8af232c
Merge pull request #64885 from Mickeon/rename-tooltip-hint
Rename `hint_tooltip` to `tooltip_text` & setter getter
2022-08-28 17:43:01 +02:00
Aaron Record 4b817a565c Remove NOTIFICATION_ENTER_TREE when paired with NOTIFICATION_THEME_CHANGED 2022-08-27 11:52:29 -06:00
Micky ef5b9a06a9 Rename `hint_tooltip` to `tooltip_text` & setget
`hint_tooltip` -> `tooltip_text`
`set_tooltip` -> `set_tooltip_text`
`_get_tooltip` -> `get_tooltip_text`

Updates documentation, too.
2022-08-27 01:35:01 +02:00
SaracenOne dd814a0dca Disable editing properties in foreign resources
from imported scenes or objects returning
true from a function named '_is_read_only' and
disable resaving imported resources.
2022-08-23 23:16:13 +01:00
Rémi Verschelde b8a64313f0
Merge pull request #59564 from KoBeWi/FINALLY,_ULTIMATE_UNDO_REDO 2022-08-22 22:37:33 +02:00
kobewi ece3df3938 Add per-scene UndoRedo 2022-08-22 18:05:10 +02:00
kobewi ccb1720cb3 Make Debugger/Misc LineEdits uneditable 2022-08-18 21:34:12 +02:00
Pavel Pletnev 770cd6764e Fix editing of remote objects in the inspector 2022-08-02 23:15:03 +03:00
Rémi Verschelde f2791a75b3
Merge pull request #56063 from KoBeWi/dragging_nodes_over_wifi 2022-07-31 23:52:54 +02:00
Yuri Sizov 9f55bd971e Extract EditorResourceConversionPlugin into its own source files and clean up editor includes 2022-07-31 21:14:15 +03:00
kobewi 64d133747b Add node path drag from remote tree 2022-07-31 18:24:56 +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
Aaron Franke e53ae13178
Split up editor export code into multiple files 2022-07-26 08:28:19 -05:00
Rémi Verschelde 3bd74cd67b
Merge pull request #63436 from Calinou/editor-debugger-require-script-instance 2022-07-25 15:18:11 +02:00
Hugo Locurcio 829c824755
Require ScriptInstance to be valid in the editor debugger
This fixes an issue with visual scripts spamming error messages
in the editor when running the project with the remote scene tree
visible.
2022-07-25 14:29:47 +02:00
Rémi Verschelde 90019676b0 Code quality: Fix header guards consistency
Adds `header_guards.sh` bash script, used in CI to validate future
changes. Can be run locally to fix invalid header guards.
2022-07-25 11:17:40 +02:00