Commit graph

295 commits

Author SHA1 Message Date
Paulb23 680dc9e81a Add comment and string tracking to CodeEdit 2021-06-01 15:38:45 +01:00
kobewi 4bee21bcc4 Add preload() to resource path when holding Ctrl 2021-05-27 12:22:32 +02:00
Hugo Locurcio 80f4e407b2
Add a keyboard shortcut to select the word under cursor in TextEdit
This also acts as a general-purpose "deselect" shortcut since pressing
it a second time will deselect text.

This is available both in the script editor and in TextEdit fields
in use, both in the editor and projects.

The Duplicate Line script editor shortcut was moved to Ctrl + Shift + D
since it conflicts with the new shortcut (Ctrl + D). The rationale for
doing so is that Duplicate Line is a less commonly used action, and
its behavior can be replicated by copying and pasting the current line
anyway. (With no selection active, the whole line will be copied.)
2021-05-22 23:47:43 +02:00
Paulb23 00e10a842f Add custom background line colour to TextEdit and remove marked lines 2021-05-22 14:41:55 +01:00
Rémi Verschelde 37c3b33253
Merge pull request #48605 from sent44/scripteditor_get_codeedit
Add `get_base_editor` to `ScriptEditorBase`
2021-05-16 23:06:01 +02:00
sent44 2b30728ebf Add get_base_editor to ScriptEditorBase 2021-05-15 18:47:00 +07:00
llschuster 6b55ec2ca9 text-editor: fix Clicking warning doesn't center around line 2021-05-13 17:07:39 +02:00
Kongfa Waroros 6294507acb Add Various ColorPicker shapes 2021-04-06 22:48:03 +07:00
Kyle 2b775bd698 Fixes ctrl-click function line centering
When ctrl-clicking in the code editor, the view will now be centered on the function result.

Also replaces a circumstance where goto_line_centered should be used.
2021-03-24 12:29:14 -04:00
Aaron Franke 10d7fccb54
Rename ButtonList enum and members to MouseButton 2021-03-23 07:13:23 -04:00
Eric M 49714b0963 Removed hardcoded shortcuts from /scene and converted to input actions
This removes hardcoded actions from things like LineEdit and TextEdit.

Previously, things like copy, paste, etc were all hardcoded to Ctrl+C, Ctrl+V, etc. They could not be changed. This allows the possibility of them being changed, by making them use the action map. This has the added benefit of greatly simplifying the input handling logic in those controls. The logic which was previously in a huge and hard to follow switch statement has been extracted to individual methods.
2021-02-18 16:22:51 +01: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
Marcel Admiraal 8eb39f4e8b Change themes *_color_* to *_*_color
Changed:
font_color_accel -> font_accelerator_color
font_color_bg -> font_unselected_color
font_color_disabled -> font_disabled_color
font_color_fg -> font_selected_color
font_color_hover -> font_hover_color
font_color_hover_pressed -> font_hover_pressed_color
font_color_pressed -> font_pressed_color
font_color_readonly -> font_readonly_color
font_color_selected -> font_selected_color
font_color_shadow -> font_shadow_color
font_color_uneditable -> font_uneditable_color
icon_color_disabled -> icon_disabled_color
icon_color_hover -> icon_hover_color
icon_color_hover_pressed -> icon_hover_pressed_color
icon_color_normal -> icon_normal_color
icon_color_pressed -> icon_pressed_color

Also includes:
font_outline_modulate -> font_outline_color
tab_fg -> tab_selected
tab_bg -> tab_unselected
2021-01-24 06:28:49 +00: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
Marcel Admiraal 5b937d493f Rename empty() to is_empty() 2020-12-28 10:39:56 +00:00
Marcel Admiraal 4b8b803931 Rename Control margin to offset 2020-12-23 06:25:56 +00:00
Rémi Verschelde a09846e015
Merge pull request #42109 from EricEzaM/PR/input-and-shortcuts-rework
Shortcuts rework - fixed issues with input propagation and triggering of unwanted shortcuts.
2020-11-28 09:04:25 +01:00
bruvzg 3be31c4960
[Complex Text Layouts] Refactor TextEdit and CodeEdit controls. 2020-11-26 14:25:50 +02:00
bruvzg 99666de00f
[Complex Text Layouts] Refactor Font class, default themes and controls to use Text Server interface.
Implement interface mirroring.
Add TextLine and TextParagraph classes.
Handle UTF-16 input on macOS and Windows.
2020-11-26 14:25:48 +02:00
Eric M efe5c250d5 Implement new shortcuts system.
unhandled_key_input changed to unhandled_button_input. Controls can set a 'shortcut_context' which they can then use to determine if their shortcuts should be triggered or not, based on if the viewport's focused GUI control is a child of their 'shortcut context'.
2020-11-23 21:14:26 +10:00
Paulb23 c0da97d29c Remove breakpoints from editor settings 2020-09-10 20:35:28 +01:00
Paulb23 33ab9cd621 Move safe line color into editor 2020-09-10 20:35:28 +01:00
Paulb23 d18a90b8f0 Move ConnectionGutter to editor code_editor 2020-09-10 20:35:28 +01:00
Paulb23 4d7df24d46 Add main_gutter (breakpoints, bookmarks, execution lines) to code_edit 2020-09-10 20:35:28 +01:00
Paulb23 a0b409cb14 Add and convert editor to use CodeEdit 2020-09-10 20:35:27 +01:00
Paulb23 b289bb514b Fixed script_editor info_clicked signal not being connected 2020-07-29 17:51:27 +01:00
Andrii Doroshenko (Xrayez) 7247247522 Make unsaved scripts in the script editor more user-friendly
Unsaved scripts were previously displayed with blank tabs, which are
mostly a result of deleted or improperly moved scripts.

This patch makes sure that those kind of scripts are displayed as
"[unsaved]" now, and ensures that scripts are removed from the list
while deleting scripts from the filesystem dock preventing the unsaved
tabs to appear in the first place (a user is already prompted with
"no undo" warning while deleting any file).

A user is always prompted to save those "[unsaved]" scripts if they
attempt to close them without saving in any case except as described
above.
2020-07-26 16:05:44 +03:00
Rémi Verschelde 5700429e4e
Merge pull request #33760 from nekomatata/script-editor-init-optimization
Optimized ScriptEditor initialization when many scripts are loaded
2020-07-26 14:05:56 +02:00
George Marques 95c0909290
Add warning checks in GDScript analyzer
Reenable checking those when validating code.
2020-07-20 11:38:40 -03:00
PouleyKetchoupp ccff2f2551 Optimized ScriptEditor initialization when many scripts are loaded
This change avoids the editor to freeze for several seconds when a
project with lots of scripts is loaded in the editor.

It focuses on a few heavy operations previously executed on all
previously loaded scripts:
- Initialize script resource (script validation/parsing) only
on focus
- ScriptTextEditor: code editor and edit menu are added to the
scene only on focus
- Add to recent scripts only when opening new scripts
(load/save scene metadata)
2020-07-17 09:02:24 +02: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
George Marques 9654365547
Add a map of autoloads to ProjectSettings
So places that need to look into it can use the list instead of parsing
ProjectSettings details (like checking "*" in path for testing if it's
singleton).
2020-07-06 12:35:51 -03:00
Yuri Roubinsky 25cb5a42e0 Fix error label clicking in status bar for shader editor 2020-06-23 11:10:33 +03:00
Hugo Locurcio 0c0ee427d2
Improve the text appearance in the script editor warnings panel
- Make the Ignore button's position identical across all warnings
  by moving it to the left.
- Change the Ignore button's text and color to make it more obvious
  that it can be clicked.
- Use the editor font instead of the default project font to match
  the rest of the editor.
2020-05-24 14:30:44 +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
Rémi Verschelde e956e80c1f Style: clang-format: Disable AllowShortIfStatementsOnASingleLine
Part of #33027, also discussed in #29848.

Enforcing the use of brackets even on single line statements would be
preferred, but `clang-format` doesn't have this functionality yet.
2020-05-10 13:12:16 +02:00
Rémi Verschelde 4d50f747d5
Merge pull request #37293 from Janglee123/ctrl-click-improvements
Improved go-to definition (Ctrl + Click)
2020-05-05 16:49:15 +02:00
janglee be7a353c70 Improved go-to definition (Ctrl + Click)
Co-Authored-By: Bojidar Marinov <bojidar.marinov.bg@gmail.com>
2020-05-05 10:46:12 +05:30
Rémi Verschelde 2cd952bd84 Fix handling of PROPERTY_USAGE_SUBGROUP in DocData and editor
Subgroups were added in #37678 but not properly handled everywhere
where PROPERTY_USAGE_GROUP is.
2020-04-20 17:13:06 +02:00
lupoDharkael 95a1400a2a Replace NULL with nullptr 2020-04-02 13:38:00 +02:00
Juan Linietsky 441f1a5fe9 Popups are now windows also (broken!) 2020-03-26 15:49:42 +01:00
Juan Linietsky 4758057f20 Working multiple window support, including editor 2020-03-26 15:49:40 +01:00
Rémi Verschelde cb282c6ef0 Style: Set clang-format Standard to Cpp11
For us, it practically only changes the fact that `A<A<int>>` is now
used instead of the C++03 compatible `A<A<int> >`.

Note: clang-format 10+ changed the `Standard` arguments to fully
specified `c++11`, `c++14`, etc. versions, but we can't use `c++17`
now if we want to preserve compatibility with clang-format 8 and 9.
`Cpp11` is still supported as deprecated alias for `Latest`.
2020-03-17 07:36:24 +01:00
Rémi Verschelde 951ecc4f79
Merge pull request #36518 from Janglee123/no-underlined-keywords
Removed underlining of not clickable symbols
2020-03-12 22:24:43 +01:00
janglee 50a570c9c1 Removed underlining for not clickable symbols 2020-03-11 08:57:21 +00:00
Rémi Verschelde e2b66cacf7
Merge pull request #18020 from bruvzg/input_fix_non_latin_and_add_hw_scancodes
Fix non-latin layout scancodes on Linux, adds access to physical scancodes.
2020-03-01 23:00:42 +01:00
Rémi Verschelde 01afc442c7 Signals: Port connect calls to use callable_mp
Remove now unnecessary bindings of signal callbacks in the public API.
There might be some false positives that need rebinding if they were
meant to be public.

No regular expressions were harmed in the making of this commit.
(Nah, just kidding.)
2020-02-28 14:24:09 +01:00
nathanwfranke 2dd498df70 Fix autocomplete and GDScript Highlighting for types
Types include new integer types and others
2020-02-26 16:13:28 -06:00
Juan Linietsky 33b5c57199 Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.

Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.

For Variant, the float datatype is always 64 bits, and exposed as `float`.

We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.

Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-25 12:55:53 +01:00
bruvzg 1af06d3d46
Rename scancode to keycode.
Add `physical_keycode` (keyboard layout independent keycodes) to InputEventKey and InputMap.
Fix non-latin keyboard layout keycodes on Linux/X11 (fallback to physical keycodes).
2020-02-25 12:30:33 +02:00
Fabio Alessandrelli cbc450c0e5 Huge Debugger/EditorDebugger refactor. 2020-02-21 11:12:03 +01:00
Juan Linietsky 69c95f4b4c Reworked signal connection system, added support for Callable and Signal objects and made them default. 2020-02-20 08:24:50 +01:00
Juan Linietsky 3205a92ad8 PoolVector is gone, replaced by Vector
Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are
sugar for `Vector<Type>`.
2020-02-18 10:10:36 +01:00
Hugo Locurcio 5c659dd399
Increase the width of the "Connections to method" dialog
This closes #36245.
2020-02-15 16:36:10 +01:00
Dominik 'dreamsComeTrue' Jasiński 4c80beab44 Added 'Replace in files' functionality to text editors
Fixes issue #31146
2020-02-13 23:45:05 +01:00
Juan Linietsky 3f335ce3d4 Texture refactor
-Texture renamed to Texture2D
-TextureLayered as base now inherits 2Darray, cubemap and cubemap array
-Removed all references to flags in textures (they will go in the shader)
-Texture3D gone for now (will come back later done properly)
-Create base rasterizer for RenderDevice, RasterizerRD
2020-02-11 11:53:26 +01:00
andrycodestuffs d0b3cb89f7 Fixed unknown symbol drawn instead of tabs in breakpoints/bookmarks lists
Tab characters were not rendered properly in the breakpoints and
bookmarks lists of the script editor if the bookmarked line was a
comment, resulting in unknown ASCII symbols “�”.

Fixes #34046.

Also changed formatting a bit to enclose the code in backticks (like in
Markdown) instead of quotes.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2020-01-16 13:50:30 +01:00
Rémi Verschelde a7f49ac9a1 Update copyright statements to 2020
Happy new year to the wonderful Godot community!

We're starting a new decade with a well-established, non-profit, free
and open source game engine, and tons of further improvements in the
pipeline from hundreds of contributors.

Godot will keep getting better, and we're looking forward to all the
games that the community will keep developing and releasing with it.
2020-01-01 11:16:22 +01:00
Rémi Verschelde e37ad996a1
Merge pull request #34625 from timothyqiu/i18n
Makes more editor strings translatable
2019-12-30 17:28:11 +01:00
Haoyu Qiu 8cf941a8cb Makes more editor strings translatable
* Title of Sprite Editor convert preview dialogs
* Title of UV Channel Debug dialog
* Various editor warnings
* GridMap popup menu item "Paste Selects"
* Tileset editor shape button texts
* MeshLibrary update confirmation text
2019-12-30 10:36:31 +08:00
Haoyu Qiu 078c0d75f2 Cleans up headers included in editor_node.h 2019-12-24 21:46:05 +08:00
Rémi Verschelde f7d8dd79e9
Merge pull request #34441 from KoBeWi/wrapping_things_up
Fix code editor not always centering to bookmarks
2019-12-22 12:34:03 +01:00
Yuri Roubinsky c89df816c1 Fix ScriptTextEditor encapsulation 2019-12-19 09:30:40 +03:00
Tomasz Chabora b8bbf5a55f Fix code editor not always centering to bookmarks 2019-12-18 21:58:47 +01:00
Yuri Roubinsky bb7b614da1 Prevent showing toggle scripts panel switch in shader editor 2019-12-17 11:19:43 +03:00
Tomasz Chabora f4d0e598a7 Center Script Editor when jumping to bookmarks/breakpoints 2019-12-01 18:43:52 +01:00
Paulb23 362d38ea67 Update connection info on script validation rather then saved copy 2019-11-02 14:41:59 +00:00
Paulb23 2e2a049d3c Improve performance of connection info in the script editor 2019-10-27 11:07:19 +00:00
David Sichma 94fb3f666c Fixed evaluation for types 2019-10-22 09:42:46 +02:00
Alexander Holland 35452e1ab4 Update ScriptEditor and ShaderEditor Tooltip
fix #32417
2019-10-02 11:21:59 +02:00
Bojidar Marinov db89fef8fa
Highlight singletons and class_names in GDScript
Also, implement a small QoL change for auto-typed variables.
Closes #5739
2019-09-28 13:13:18 +03:00
Paul Trojahn ba24bc1e04 Support menu key in TextEdit and LineEdit controls
Related to #15542
2019-09-22 12:06:24 +02:00
Bhupendra Aole 1de3ec911f Default ColorPicker color mode setting
There is a new setting for Default ColorPicker color mode in Editor Settings->Interface->Inspector. Initially this setting will be RGB. Editor ColorPicker will always start with mode defined in this settiing.
Fixes #30755 and #30754
2019-08-31 00:34:33 -04:00
merumelu e2459479de Editor: remove TOOLS_ENABLED guards
For code  inside editor/ `#ifdef TOOLS_ENABLED`
is always true so those checks are redundant.
2019-08-30 19:02:46 +02:00
Rémi Verschelde f8574da2c2
Merge pull request #31338 from Calinou/reorganize-menus
Reorganize various menus for consistency and conciseness
2019-08-13 16:52:42 +02:00
Hugo Locurcio 9e1c23a353
Reorganize various menus for consistency and conciseness
- Clean up the recent scripts dialog to match the recent scenes dialog
- Add "..." at the end of shortcuts that cause a modal dialog to appear

This closes #31148.
2019-08-13 11:52:10 +02:00
Michael Alexsander Silva Dias 3d86ef74e7 Add "Find in Files..." to the text editor 2019-08-12 11:49:45 -03:00
Rémi Verschelde b18747af4b
Merge pull request #31179 from KoBeWi/code_editor_magic
Add Evaluate Selection option to Script Editor
2019-08-12 11:19:26 +02:00
miwanczuk 7254284efd Adds support for undo/redo for in-editor color picker 2019-08-10 00:46:31 +02:00
Michael Alexsander Silva Dias 31584dd511 Move "Go to Function/Line" to "Go To" menu 2019-08-08 22:36:51 -03:00
iwek7 e7b07e1e58 Fixes color picker in code editor - now it only changes one color 2019-08-08 19:12:13 +02:00
Tomasz Chabora 282deb9a7a Add Evaluate Selection option to Script Editor 2019-08-08 00:28:33 +02:00
Paulb23 e51aa14208 Fix memory leaks with SyntaxHighlighters 2019-07-25 17:30:48 +01:00
Geequlim ed7ed52151 Parse more informations for code completion 2019-07-04 14:00:14 +08:00
Michael Alexsander Silva Dias 91d357f177 Add "Go To" menu to the script editor and move the bookmark and breakpoint menus there 2019-07-01 16:00:05 -03:00
Rémi Verschelde f5d9454a4b
Merge pull request #29071 from YeldhamDev/improve_bookmarks
Improve bookmarks
2019-07-01 16:34:17 +02:00
Rémi Verschelde d17eac735c
Merge pull request #29815 from NilsIrl/plus_file_1
Replace ` + "/" + ` with `String::file_add()`
2019-07-01 12:06:35 +02:00
Gwyneth Lowe 7142064110 Correct typo that broke custom selected font color
Change several font_selected_color to font_color_selected; the actual name of the override
2019-06-24 04:55:29 -05:00
Dawid Wdowiak 0f14489ecb Center script line when double clicked on error in debugger 2019-06-23 15:58:07 +02:00
Nils ANDRÉ-CHANG d2833d4f4d Replace + "/" + with String::file_add() 2019-06-23 13:33:50 +01:00
Rémi Verschelde 0ac3687d6f
Merge pull request #28766 from pgoral/editor_validation_issue
Changing method signature in other class in not recognized in working…
2019-06-17 23:13:08 +02:00
Michael Alexsander Silva Dias 28683237c5 Check for inherited methods before attempting to create one when connecting a signal 2019-06-13 15:15:17 -03:00
Rémi Verschelde a2a5273a07
Merge pull request #29703 from YeldhamDev/method_signal_warning_base
Check base scripts for signal receiving methods before warning about them missing
2019-06-12 13:11:17 +02:00
Rémi Verschelde a458365780
Merge pull request #29659 from YeldhamDev/script_connections_node_deleted
Fix connection info still appearing on scripts if the node source is deleted
2019-06-12 09:46:33 +02:00
Michael Alexsander Silva Dias 831dd19546 Check base scripts for signal receiving methods before warning about them missing 2019-06-11 22:11:26 -03:00
Rémi Verschelde 7842f4ca5c
Merge pull request #29262 from DarknessCatt/issue-27476
Automatically add new line to scripts
2019-06-11 15:07:09 +02:00
Michael Alexsander Silva Dias b3010d9734 Fix connection info still appearing on scripts if the node source is deleted 2019-06-10 19:37:56 -03:00