Commit Graph

523 Commits

Author SHA1 Message Date
Rémi Verschelde
c34ff742a8 Style: clang-format: Disable AllowShortCaseLabelsOnASingleLine
Part of #33027.
2020-05-10 13:13:54 +02:00
Rémi Verschelde
950027c9fa 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
Juan Linietsky
3dcee28bb2 Add ability to bind typed arrays to script API
Note: Only replaced 2 instances to test, Node.get_children and TileMap.get_used_cells
Note: Will do a mass replace on later PRs of whathever I can find, but probably need
a tool to grep through doc.
Warning: Mono will break, needs to be fixed (and so do TypeScript and NativeScript, need to ask respective maintainers)
2020-04-21 10:15:40 +02:00
Rémi Verschelde
f26b6c0f9e Merge pull request #37890 from nicomitchell/FixPosModTypeReturn
Change MATH_POSMOD return type back to INT
2020-04-15 00:05:35 +02:00
Nico Mitchell
9ea27c8c0c Change MATH_POSMOD return type back to INT 2020-04-14 17:23:35 -04:00
Rémi Verschelde
27d836488e Merge pull request #37851 from nicomitchell/FixMathRoundTypeReturn
Change visual script round function output type to float
2020-04-13 21:39:03 +02:00
Nico Mitchell
e1b48823b0 Change round return type to float 2020-04-13 13:02:40 -04:00
Rémi Verschelde
ca6c1f6fa9 Merge pull request #37542 from swarnimarun/patch_vs_02
Update visualscript graph nodes on visual script variable edit
2020-04-12 11:30:15 +02:00
Rémi Verschelde
e2677b8551 Merge pull request #37530 from swarnimarun/patch_vs_01
VisualScript support for newly added Variant types
2020-04-10 12:06:38 +02:00
Tomasz Chabora
db22f4548b Remove Node.get_position_in_parent() 2020-04-06 01:19:20 +02:00
Swarnim Arun
e0c774c92c Update vsnodes on editing vs variables 2020-04-03 15:05:51 +05:30
Swarnim Arun
0e1531ff29 VisualScript styling for new Variant Types 2020-04-03 05:07:35 +05:30
Swarnim Arun
5c69913666 Deconstruct VSNodes for new Variant types 2020-04-02 23:24:18 +05:30
Rémi Verschelde
e2f0f77322 Merge pull request #37338 from lupoDharkael/nullprt
Replace NULL with nullptr
2020-04-02 14:52:36 +02:00
lupoDharkael
93b9053b54 Replace NULL with nullptr 2020-04-02 13:38:00 +02:00
Rémi Verschelde
4927bac811 Merge pull request #37421 from akien-mga/python-format-black
SCons: Format buildsystem files with psf/black
2020-03-30 15:07:00 +02:00
Rémi Verschelde
3015876064 SCons: Format buildsystem files with psf/black
Configured for a max line length of 120 characters.

psf/black is very opinionated and purposely doesn't leave much room for
configuration. The output is mostly OK so that should be fine for us,
but some things worth noting:

- Manually wrapped strings will be reflowed, so by using a line length
  of 120 for the sake of preserving readability for our long command
  calls, it also means that some manually wrapped strings are back on
  the same line and should be manually merged again.

- Code generators using string concatenation extensively look awful,
  since black puts each operand on a single line. We need to refactor
  these generators to use more pythonic string formatting, for which
  many options are available (`%`, `format` or f-strings).

- CI checks and a pre-commit hook will be added to ensure that future
  buildsystem changes are well-formatted.
2020-03-30 09:05:53 +02:00
Rémi Verschelde
39122c8671 Merge pull request #37317 from akien-mga/display-server-rebased
Separate DisplayServer from OS and add multiple windows support
2020-03-26 17:23:11 +01:00
Juan Linietsky
1d3f44a694 Popups are now windows also (broken!) 2020-03-26 15:49:42 +01:00
Juan Linietsky
0e883a5e21 Working multiple window support, including editor 2020-03-26 15:49:40 +01:00
Juan Linietsky
2ddf49ff5e 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
57ca02499b 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
30c7dc7b32 Refactored Input, create DisplayServer and DisplayServerX11 2020-03-26 15:49:32 +01:00
Rajat Goswami
c94fc4f330 Adding missing include guards to header files identified by LGTM.
This addresses the issue godotengine/godot#37143
2020-03-23 04:52:36 -04:00
Rémi Verschelde
e43b111923 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
283f8c48d8 Merge pull request #36723 from AndreaCatania/fix-rset
Fixed rset method for gdscript and visual script
2020-03-13 10:18:56 +01:00
Rémi Verschelde
c3c7343716 Merge pull request #36987 from luzpaz/typos
Fix various typos
2020-03-12 10:25:48 +01:00
luz.paz
126cae162e Fix various typos
Found via `codespell`
2020-03-11 13:59:18 -04:00
Rémi Verschelde
d5b4943ec9 Merge pull request #36751 from Faless/debugger/threads_and_profilers
ScriptDebugger refactor, threading, profilers.
2020-03-09 19:08:07 +01:00
Andrii Doroshenko (Xrayez)
1a11dbf677 Fix missing module editor icons
Module icons need to be renamed to PascalCase as well
for them to be registered in 4.0.

See godotengine/godot#36513.
2020-03-08 19:32:25 +02:00
Fabio Alessandrelli
e317586132 Refactor ScriptDebugger.
EngineDebugger is the new interface to access the debugger.
It tries to be as agnostic as possible on the data that various
subsystems can expose.

It allows 2 types of interactions:

- Profilers:
  A subsystem can register a profiler, assigning it a unique name.
  That name can be used to activate the profiler or add data to it.
  The registered profiler can be composed of up to 3 functions:
    - Toggle: called when the profiler is activated/deactivated.
    - Add: called whenever data is added to the debugger
      (via `EngineDebugger::profiler_add_frame_data`)
    - Tick: called every frame (during idle), receives frame times.

- Captures: (Only relevant in remote debugger for now)
  A subsystem can register a capture, assigning it a unique name.
  When receiving a message, the remote debugger will check if it starts
  with `[prefix]:` and call the associated capture with name `prefix`.

Port MultiplayerAPI, Servers, Scripts, Visual, Performance to the new
profiler system.

Port SceneDebugger and RemoteDebugger to the new capture system.
The LocalDebugger also uses the new profiler system for scripts
profiling.
2020-03-08 12:36:39 +01:00
Andrea Catania
ecbb2fef9e Fixed rset method for gdscript and visual script 2020-03-02 10:22:07 +01:00
Rémi Verschelde
f03240e365 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
2e173556e8 Merge pull request #36426 from akien-mga/calling-all-stations
Signals: Port connect calls to use callable_mp
2020-02-28 17:19:08 +01:00
Rémi Verschelde
67b2e452d2 Signals: Port more uses of connect_compat
Those were problematic as they call a method of their parent class,
but callable_mp does not allow that unless it's public.

To solve it, we declare a local class that calls the parent class'
method, which now needs to be protected to be accessible in the
derived class.
2020-02-28 14:24:09 +01:00
Rémi Verschelde
006d63d0a8 Signals: Manually port most of remaining connect_compat uses
It's tedious work...

Some can't be ported as they depend on private or protected methods
of different classes, which is not supported by callable_mp (even if
it's a class inherited by the current one).
2020-02-28 14:24:09 +01:00
Rémi Verschelde
dc78638913 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
Rémi Verschelde
ed50cf32fd Merge pull request #36556 from RandomShaper/rework_mutex
Reimplement `Mutex` with C++'s `<mutex>` (plus more)
2020-02-28 00:26:01 +01:00
Pedro J. Estébanez
3ed8e24dca Reimplement Mutex with C++'s <mutex>
Main:
- It's now implemented thanks to `<mutex>`. No more platform-specific implementations.
- `BinaryMutex` (non-recursive) is added, as an alternative for special cases.
- Doesn't need allocation/deallocation anymore. It can live in the stack and be part of other classes.
- Because of that, it's methods are now `const` and the inner mutex is `mutable` so it can be easily used in `const` contexts.
- A no-op implementation is provided if `NO_THREADS` is defined. No more need to add `#ifdef NO_THREADS` just for this.
- `MutexLock` now takes a reference. At this point the cases of null `Mutex`es are rare. If you ever need that, just don't use `MutexLock`.
- Thread-safe utilities are therefore simpler now.

Misc.:
- `ScopedMutexLock` is dropped and replaced by `MutexLock`, because they were pretty much the same.
- Every case of lock, do-something, unlock is replaced by `MutexLock` (complex cases where it's not straightfoward are kept as as explicit lock and unlock).
- `ShaderRD` contained an `std::mutex`, which has been replaced by `Mutex`.
2020-02-26 20:40:10 +01:00
Yuri Roubinsky
43ecc57004 Fix resizer icon color in VisualScripts/Shaders when graph headers is on 2020-02-26 17:48:58 +03:00
Juan Linietsky
73ec47dbd7 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
ec0ea49176 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
e92dda8bb7 Merge pull request #36478 from qarmin/supsicious_operators_everywhere
Fix suspicious | and + operators
2020-02-23 10:30:06 +01:00
Rafał Mikrut
bedc513a9b Fix suspicious | and + operators 2020-02-23 09:28:54 +01:00
Rémi Verschelde
9537b971e1 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
Rémi Verschelde
e2e76facc3 doc: Sync classref with StringName/Callable changes 2020-02-22 14:59:09 +01:00
Rémi Verschelde
5c96c2a209 Merge pull request #36368 from reduz/variant-rework
Reworked signal system, added support for Callable and Signal
2020-02-20 11:30:56 +01:00
Juan Linietsky
6070e25d17 Reworked signal connection system, added support for Callable and Signal objects and made them default. 2020-02-20 08:24:50 +01:00
Rémi Verschelde
f8cabf372b doc: Sync classref with current source
Handle removal of Pool*Array types and other recent changes.
2020-02-18 14:02:02 +01:00
Juan Linietsky
88818b6a37 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