Commit graph

318 commits

Author SHA1 Message Date
Rémi Verschelde 07bc4e2f96 Style: Enforce separation line between function definitions
I couldn't find a tool that enforces it, so I went the manual route:
```
find -name "thirdparty" -prune \
  -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \
  -o -name "*.glsl" > files
perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files)
misc/scripts/fix_style.sh -c
```

This adds a newline after all `}` on the first column, unless they
are followed by `#` (typically `#endif`). This leads to having lots
of places with two lines between function/class definitions, but
clang-format then fixes it as we enforce max one line of separation.

This doesn't fix potential occurrences of function definitions which
are indented (e.g. for a helper class defined in a .cpp), but it's
better than nothing. Also can't be made to run easily on CI/hooks so
we'll have to be careful with new code.

Part of #33027.
2020-05-14 16:54:55 +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
Stanislav Labzyuk ac8814624d Bind set_suffix/get_suffix in Tree 2020-05-06 14:47:19 +07:00
Rémi Verschelde fdf58a5858 Rename InputFilter back to Input
It changed name as part of the DisplayServer and input refactoring
in #37317, with the rationale that input no longer goes through the
main loop, so the previous Input singleton now only does filtering.

But the gains in consistency are quite limited in the renaming, and
it breaks compatibility for all scripts and tutorials that access
the Input singleton via the scripting language. A temporary option
was suggested to keep the scripting singleton named `Input` even if
its type is `InputFilter`, but that adds inconsistency and breaks C#.

Fixes godotengine/godot-proposals#639.
Fixes #37319.
Fixes #37690.
2020-04-28 15:19:49 +02:00
theludovyc 875c994109 Remove unused ofs variable 2020-04-08 20:00:43 +02:00
lupoDharkael 95a1400a2a Replace NULL with nullptr 2020-04-02 13:38:00 +02:00
Juan Linietsky a6f3bc7c69 Renaming of servers for coherency.
VisualServer -> RenderingServer
PhysicsServer -> PhysicsServer3D
Physics2DServer -> PhysicsServer2D
NavigationServer -> NavigationServer3D
Navigation2DServer -> NavigationServer2D

Also renamed corresponding files.
2020-03-27 15:21:27 -03:00
Juan Linietsky b3080bc2f4 Popups have also been converted to windows
Controls using the old modal API have been replaced to use popups.
2020-03-26 15:49:44 +01:00
Juan Linietsky c7b4dcae2f Open sub-windows as embedded if the OS does not support them 2020-03-26 15:49:43 +01:00
Juan Linietsky 441f1a5fe9 Popups are now windows also (broken!) 2020-03-26 15:49:42 +01:00
Juan Linietsky 8e6960a69e Refactored input, goes all via windows now.
Also renamed Input to InputFilter because all it does is filter events.
2020-03-26 15:49:39 +01:00
Juan Linietsky 9e08742de8 Added a Window node, and made it the scene root.
Still a lot of work to do.
2020-03-26 15:49:38 +01:00
Juan Linietsky f8a79a97c7 Effective DisplayServer separation, rename X11 -> LinuxBSD 2020-03-26 15:49:34 +01:00
Juan Linietsky 4396e98834 Refactored Input, create DisplayServer and DisplayServerX11 2020-03-26 15:49:32 +01: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
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
Rémi Verschelde 2cf6ac6c50 Replace FALLTHROUGH macro by C++17 [[fallthrough]]
This attribute is now part of the standard we target so we no longer
need compiler-specific hacks.

Also enables -Wimplicit-fallthrough for Clang now that we can properly
support it. It's already on by default for GCC's -Wextra.

Fixes new warnings raised by Clang's -Wimplicit-fallthrough.
2020-02-23 00:52:50 +01:00
Juan Linietsky 3c0059650d Added StringName as a variant type.
Also changed all relevant properties defined manually to StringName.
2020-02-21 14:25:29 +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 cf8c679a23 ObjectID converted to a structure, fixes many bugs where used incorrectly as 32 bits. 2020-02-12 14:24:54 -03: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
Rémi Verschelde e420b85ba5
Merge pull request #35840 from timothyqiu/groups-match
Fixes add group in Group Editor dialog
2020-02-09 12:53:37 +01:00
Michael Alexsander 830dd5cd8d Fix text clipping in Tree items not working with negative values 2020-02-08 20:08:18 -03:00
Haoyu Qiu 421ea09195 Fixes add group in Group Editor dialog
Before this fix, new group can't be created if any existing group starts
with the new name.
2020-02-02 11:11:20 +08:00
Haoyu Qiu 229b398146 Better horizontal scroll for Tree
* Adds pan gesture support for horizontal scroll.
* Scrolls horizontally when needed to ensure cursor visiblility.
2020-01-03 20:16:32 +08:00
Haoyu Qiu 0ee93257e8 Fixes Tree item offset when root is hidden
Before this fix, one vseparation is counted for a hidden root item.
2020-01-02 09:20:43 +08:00
Haoyu Qiu a77e869b87 Ensures cursor visible for Tree with title 2020-01-01 22:47:42 +08:00
Rémi Verschelde f7715b58bd
Merge pull request #34724 from timothyqiu/tree-right
Fixes behavior of right arrow key in Tree
2020-01-01 12:13:28 +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
Haoyu Qiu 838d9519bc Fixes behavior of right arrow key in Tree 2020-01-01 17:57:40 +08:00
PouleyKetchoupp 47a4ca0022 Fixed crash when pressing down key on empty Tree
Fixes #33554
2019-11-12 08:15:29 +01:00
Rémi Verschelde 2143f46df2
Merge pull request #33516 from qarmin/small_fixes
Memory leaks and crash fixes
2019-11-10 10:17:19 +01:00
Rafał Mikrut 7dda9309f9 Memory leak and crash fixes 2019-11-10 09:49:13 +01:00
Gilles Roudiere 8eb2eeae0f Fixes the edit rect in TreeItems 2019-11-03 16:08:07 +01:00
dankan1890 b469ff17e2 Added missing bind_method to TreeItem::get_custom_color().
Fix #32595
2019-10-06 22:07:50 +02:00
Rémi Verschelde ee611d149b
Merge pull request #22834 from lupoDharkael/recursive-item
Add call_recursive method to TreeItem
2019-10-04 15:32:14 +02:00
MrCdK 03d6291aaf Handle scrolling correctly in Tree controls inside ScrollContainers 2019-10-02 12:34:04 +02:00
Rémi Verschelde d0e45e78a4 doc: Sync classref with current source
And various fixes to bindings, hyperlinks and an uninitialized variable.
2019-09-27 22:16:42 +02:00
Rémi Verschelde 5cb926a001
Merge pull request #29681 from swarnimarun/vs-graph-unification
Visual Script Graph Unification
2019-09-27 15:54:37 +02:00
Nolan Darilek 5629a006d9 #14011: Implement TreeItem.get_button_tooltip(column, idx).
When added to `TreeItem`, buttons are given tooltips. When returned via `get_button(...)`, however, the button is a `Texture` and the tooltip information isn't included.

For accessibility purposes, it is useful to have access to the tooltip text. As such, we can retrieve a button's tooltip to use as a button label.
2019-09-26 10:41:02 -05:00
Swarnim Arun 59738e3fa3
Visualscript editor graph unification & refactoring
Removes the need to have separate graphs per function for the VisualScript Nodes, and refactoring UI and other improvements such as fuzzy search, right click search boxes and in-graph editable nodes
2019-09-26 01:53:58 +05:30
Rémi Verschelde f7cd50e900
Merge pull request #32206 from Calinou/remove-unused-tree-constants
Remove an unused icon and constant in Tree
2019-09-20 23:14:50 +02:00
Hugo Locurcio 40a5de97e6
Remove an unused icon and constant in Tree 2019-09-20 17:50:13 +02:00
luz.paz 91ecd7b6a6 Fix misc. source comment typos
Found using `codespell -q 3 -S ./thirdparty,*.po -L ang,ba,cas,dof,doubleclick,fave,hist,leapyear,lod,nd,numer,ois,paket,seeked,sinc,switchs,te,uint -D ~/Projects/codespell/codespell_lib/data/dictionary.txt `
2019-09-19 14:36:52 -04:00
lupoDharkael 306e64a9f5 Add call_recursive method to TreeItem 2019-09-04 12:42:08 +02:00
Rémi Verschelde 331bb5a8c6
Merge pull request #31295 from fstiewitz/focus-rect-issue
Fix get_meta error and visual bug when editing scene with keyboard
2019-09-03 13:11:41 +02:00
merumelu eac0af5892 Tree: fix and expose icon modulation 2019-08-24 17:37:22 +02:00
Fabian Stiewitz dcf65433f1 fix(Tree): get_meta condition
If an item in a Tree has never been selected, its metadata "__focus_rect"
is not set. If an unselected item is then edited (Tree::edit_selected()),
an error is thrown in console.
2019-08-11 16:55:01 +02:00
Tomasz Chabora af5e0fff66 Remove ERR_EXPLAIN from scene/* code 2019-08-09 13:54:52 +02:00
Rémi Verschelde d844e30614 Inspector: Make default float step configurable
Also allow lifting the decimal step formatting with a hint range step
of 0. A new `range_step_decimals()` is added for this to avoid breaking
compatibility on the general purpose `step_decimals()` (which still
returns 0 for an input step of 0).

Supersedes #25470.
Partial fix for #18251.
2019-07-23 17:31:38 +02:00
qarmin 6cbaf7662f Changed some code showed in LGTM and Coverage 2019-07-20 08:09:57 +02:00
Rémi Verschelde 9580c2b13e TreeItem: Rename new button disable method to set_button_disabled
Follow-up to #30408.

Also sync classref with current source.
2019-07-09 09:17:42 +02:00
Meriipu fe9ec58028 TreeItem: Added a setter for the disabled-property of buttons 2019-07-07 16:18:36 +02:00
Rémi Verschelde eaaff9da31
Merge pull request #29941 from qarmin/redundant_code_and_others
Remove redundant code, possible NULL pointers and others
2019-06-27 01:05:18 +02:00
qarmin 4e5310cc60 Some code changed with Clang-Tidy 2019-06-26 15:08:25 +02:00
unknown c58b7ab094 Fixed script and visibility icons's highlight height in tree 2019-06-23 22:26:24 +05:30
Rémi Verschelde 5c66771e3e
Merge pull request #29283 from qarmin/fix_some_always_same_values
Remove always true/false values
2019-06-20 21:10:10 +02:00
qarmin 072e40368e Fix always true/false values 2019-06-20 16:59:48 +02:00
Rémi Verschelde 84d969a42a Cleanup some unecessary editor/ includes in scene/
Part of #29730, handles false positives.
2019-06-12 22:48:43 +02:00
Rémi Verschelde 434a1fddf3
Merge pull request #29648 from jbuck3/tree-tooltips
Fix Tree button tooltips
2019-06-12 13:29:36 +02:00
Rémi Verschelde 971b5160c6
Merge pull request #29306 from qarmin/small_code_fixes
Small fixes to unrechable code, possibly overflows, using NULL pointers
2019-06-12 12:49:21 +02:00
James Buck 215fed1fb3 Fix Tree button tooltips
Fixes #22777
2019-06-09 22:33:47 -05:00
Tomasz Chabora 2f75471f24 Fix crash when searching Tree with no selection 2019-06-04 01:50:50 +02:00
qarmin 8245db869f Small fixes to unrechable code, possibly overflows, using NULL pointers 2019-06-03 21:52:50 +02:00
Rémi Verschelde 64a88e8ef3
Merge pull request #28841 from KoBeWi/option_button_options
Improvements to incremental search
2019-06-01 11:47:06 +02:00
Tomasz Chabora 9de912caf5 Improvements to incremental search 2019-05-31 14:56:49 +02:00
Rémi Verschelde 8384582828
Merge pull request #27836 from turtletooth/right-click
Allow Right Click in Empty Space on FileSystemDock
2019-05-28 12:07:06 +02:00
volzhs 6f97022041 PageDown key selects last one when left items count is short 2019-05-21 15:32:17 +09:00
Rémi Verschelde a342131eba
Merge pull request #27673 from qarmin/small_fixes
Small fixes, mostly duplicated code
2019-04-22 12:00:34 +02:00
groud 14a901e88f Enhance tree scrolling when dragging 2019-04-12 21:58:48 +02:00
Juan Linietsky 9f4b5a91c0 Reorganized connection dialog for much improved ease of use.
-Removed dest path field
-Added a "Source" signal
-Added an "Advanced" button to hide complexity
-Fix bug on Tree to make sure "ensure visible" works on hidden trees
-Fix bug on TextEdit to ensure signals created with script not open sill focus the right line
2019-04-11 23:23:24 -03:00
Jeremy Bullock 36bdf78927 Allow Right Click in Empty Space on FileSystemDock 2019-04-09 11:22:14 -06:00
Rémi Verschelde c8994b56f9 Style: Apply new changes from clang-format 8.0
It seems to stay compatible with formatting done by clang-format 6.0 and 7.0,
so contributors can keep using those versions for now (they will not undo those
changes).
2019-04-09 17:09:48 +02:00
qarmin 856a8226a5 Small fixes, mostly dupicated code 2019-04-08 11:03:37 +02:00
Rémi Verschelde fc370b3feb Fix -Wimplicit-fallthrough warnings from GCC 8
Adds `FALLTHROUGH` macro to specify when a fallthrough is intentional.
Can be replaced by `[[fallthrough]]` if/when we switch to C++17.

The warning is now enabled by default for GCC on `extra` warnings level
(part of GCC's `-Wextra`). It's not enabled in Clang's `-Wextra` yet,
but we could enable it manually once we switch to C++11. There's no
equivalent feature in MSVC for now.

Fixes #26135.
2019-04-05 15:14:53 +02:00
Juan Linietsky 5f079e2ef9 -Make tileset and meshlibrary edit in a separate inspector, fixes #26671
-Made relationship lines appear based on theme settings, not previous hack
-Fix drawing of relationship lines (was broken)
-Fix double initialization of theme settings
2019-03-06 12:12:42 -03:00
marxin 8d51618949 Add -Wshadow=local to warnings and fix reported issues.
Fixes #25316.
2019-02-20 19:44:12 +01:00
Rémi Verschelde 5fc86026ca Fix typos with codespell
Using codespell 1.14.0.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
doubleclick
lod
nd
numer
que
te
unselect
EOF
$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2019-02-13 09:23:29 +01:00
volzhs 1e603b706e Update rect size on select 2019-01-16 20:44:34 +09:00
Juan Linietsky 6af8b7c955 Defer activated signal after tree has been traversed. 2019-01-14 17:20:54 -03:00
Rémi Verschelde b16c309f82 Update copyright statements to 2019
Happy new year to the wonderful Godot community!
2019-01-01 12:58:10 +01:00
volzhs 6a43f0a901 Draw relationship lines when its value is higher than 0 2018-12-25 09:18:18 +09:00
Guilherme Felipe 64e52f5bdb Fix tree item editable cell not updating when windows was resized 2018-12-14 12:09:47 -02:00
Ray Koopa fddffa9eb8 Unify editor class and reference search
Co-authored-by: Michael Alexsander Silva Dias <michaelalexsander@protonmail.com>
2018-11-20 20:52:27 -02:00
Juan Linietsky 0f7a86ca52 If using relationship lines (now default) hide guides. 2018-11-18 22:00:31 -03:00
K. S. Ernest (iFire) Lee 562d241b13 Fix creating a visual script virtual function after minimizing crashes #23536 2018-11-05 13:48:27 -08:00
M. Huri 967831d9a0 [Docs] Fixed 'get_button_count's link and a typo related to 'button'. 2018-10-13 17:34:57 +07:00
Fabio Alessandrelli e355a8fc4c Fix crash in Tree when moving using Joypad 2018-10-07 16:22:04 +02:00
Rémi Verschelde cdc411fd54 Fix various warnings: [-Waddress], [-Wpointer-arith], [-Wwrite-strings], [-Wreturn-local-addr] and more
Fixes the following GCC 5 warnings:
```
core/os/file_access.cpp:49:19: warning: the address of 'FileAccess::create_func' will always evaluate as 'true' [-Waddress]
servers/audio_server.cpp:192:70: warning: comparison with string literal results in unspecified behaviour [-Waddress]

drivers/gles2/rasterizer_storage_gles2.cpp:4095:90: warning: NULL used in arithmetic [-Wpointer-arith]

modules/gdnative/register_types.cpp:237:3: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
platform/android/export/export.cpp:207:1: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

modules/gdscript/gdscript.h:150:67: warning: returning reference to temporary [-Wreturn-local-addr]
servers/physics_2d/collision_object_2d_sw.h:119:56: warning: returning reference to temporary [-Wreturn-local-addr]
servers/physics_2d/collision_object_2d_sw.h:123:56: warning: returning reference to temporary [-Wreturn-local-addr]
servers/physics_2d/collision_object_2d_sw.h:127:50: warning: returning reference to temporary [-Wreturn-local-addr]
servers/physics_2d/collision_object_2d_sw.h:131:52: warning: returning reference to temporary [-Wreturn-local-addr]

editor/plugins/skeleton_editor_plugin.cpp:34:36: warning: extra tokens at end of #include directive
modules/bullet/bullet_types_converter.cpp:31:9: warning: #pragma once in main file

editor/import/editor_scene_importer_gltf.cpp:1996:51: warning: name lookup of 'i' changed
modules/visual_script/visual_script_property_selector.cpp:402:45: warning: name lookup of 'E' changed
scene/gui/tree.cpp:1268:25: warning: name lookup of 'i' changed
scene/resources/visual_shader.cpp:808:32: warning: name lookup of 'i' changed
```
2018-09-27 16:33:52 +02:00
Rémi Verschelde d8b30d42f5 Fix warnings for operator precedence disambiguation [-Wparentheses]
Fixes the following GCC 5 warnings:
```
core/io/resource_format_binary.cpp:1721:29: warning: suggest parentheses around arithmetic in operand of '|' [-Wparentheses]
core/typedefs.h:108:24: warning: suggest parentheses around comparison in operand of '!=' [-Wparentheses]
editor/plugins/spatial_editor_plugin.cpp:2202:58: warning: suggest parentheses around comparison in operand of '!=' [-Wparentheses]
editor/plugins/spatial_editor_plugin.cpp:5002:12: warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses]
main/input_default.cpp:346:59: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
main/input_default.cpp:348:60: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
main/input_default.cpp:579:57: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
modules/gridmap/grid_map_editor_plugin.cpp:613:14: warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses]
modules/theora/video_stream_theora.cpp:335:34: warning: suggest parentheses around '+' in operand of '&' [-Wparentheses]
modules/theora/video_stream_theora.cpp:336:35: warning: suggest parentheses around '+' in operand of '&' [-Wparentheses]
modules/visual_script/visual_script_property_selector.cpp:215:38: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
scene/gui/rich_text_label.cpp:424:84: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
scene/gui/rich_text_label.cpp:512:80: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
scene/gui/scroll_container.cpp:173:36: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
scene/gui/scroll_container.cpp:173:86: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
scene/gui/tree.cpp:1419:98: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
```
2018-09-27 10:29:48 +02:00
DualMatrix f483460e38 Removed obsoleted core/helper/value_evaluator.h and moved math_fieldwise to core/math/
Removed obsoleted core/helper/value_evaluator.h and moved math_fieldwise to core/math/
2018-09-23 14:58:15 +02:00
Rémi Verschelde 561a7772c6
Merge pull request #22198 from DualMatrix/input_was_eaten
Fixed ctrl+up/down shortcut no longer working in scene tree
2018-09-20 15:54:54 +02:00
DualMatrix f8ead1a2ee Fixed ctrl+up/down shortcut no longer working in scene tree
Fixed ctrl+up/down shortcut no longer working in scene tree.
2018-09-20 15:27:37 +02:00
Rémi Verschelde 1a16dabfb5
Merge pull request #21982 from luzpaz/misc-typos
Misc. typos
2018-09-13 10:59:00 +02:00
luz.paz 08bde5b2de Misc. typos
Found via `codespell -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"`
2018-09-12 21:39:17 -04:00
Rémi Verschelde 277b24dfb7 Make core/ includes absolute, remove subfolders from include path
This allows more consistency in the manner we include core headers,
where previously there would be a mix of absolute, relative and
include path-dependent includes.
2018-09-12 09:52:22 +02:00
Kelly Thomas 1dc8e7c05f Improve ClassDB information for some some signal parameters 2018-09-01 18:05:51 +08:00
Michael Alexsander Silva Dias 8c74257d68 Make "Search Classes" dialog have relationship lines if the setting is enabled 2018-08-31 21:48:56 -03:00