Commit graph

1576 commits

Author SHA1 Message Date
Hugo Locurcio 4bd5e4fd9b
Use the standard C INFINITY and NAN constants directly
The `Math_INF` and `Math_NAN` defines were just aliases for those
constants, so we might as well use them directly.

Some portions of the code were already using `INFINITY` directly.
2021-07-21 10:41:08 +02:00
Fabio Alessandrelli ddb68f76ff [Net] Single rpc annotation. "sync" no longer part of mode.
- Move the "sync" property for RPCs to RPCConfig.

- Unify GDScript annotations into a single one:
  - `@rpc(master)` # default
  - `@rpc(puppet)`
  - `@rpc(any)` # former `@remote`

- Implement three additional `@rpc` options:
  - The second parameter is the "sync" option (which also calls the
    function locally when RPCing). One of "sync", "nosync".
  - The third parameter is the transfer mode (reliable, unreliable,
    ordered).
  - The third parameter is the channel (unused for now).
2021-07-20 11:17:59 +02:00
reduz 6631f66c2a Optimize StringName usage
* Added a new macro SNAME() that constructs and caches a local stringname.
* Subsequent usages use the cached version.
* Since these use a global static variable, a second refcounter of static usages need to be kept for cleanup time.
* Replaced all theme usages by this new macro.
* Replace all signal emission usages by this new macro.
* Replace all call_deferred usages by this new macro.

This is part of ongoing work to optimize GUI and the editor.
2021-07-18 21:20:02 -03:00
Rémi Verschelde 06568bbfdf
Misc cleanup of header includes
Was looking for misuse of module headers without checking that the module is
actually enabled and got carried away...
2021-07-15 00:46:43 +02:00
reduz 5ad4f26659 Implement the ability to disable classes
* This PR adds the ability to disable classes when building.
* For now it's only possible to do this via command like:
  `scons disable_classes=RayCast2D,Area3D`
* Eventually, a proper UI will be implemented to create a build config file to do this at large scale, as well as detect what is used in the project.
2021-07-13 09:25:14 -03:00
Fabio Alessandrelli 88d68346ee [Net] Rename NetworkedMultiplayerPeer to MultiplayerPeer. 2021-07-12 16:36:34 +02:00
Francois Belair 10429019ad Implement didClose notification in LSP 2021-07-08 11:40:15 -04:00
Rémi Verschelde a02620f3a5
Merge pull request #50009 from reduz/fix-suffixes-and-degrees
Fix editor suffixes and degrees conversion
2021-06-30 18:47:40 +02:00
reduz 75688772b3 Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:

* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
2021-06-30 12:38:25 -03:00
K. S. Ernest (iFire) Lee 364416ecd8 Remove singleton variable shadowing. 2021-06-30 02:37:20 -07:00
Lightning_A e28fd07b2b Rename instance()->instantiate() when it's a verb 2021-06-19 20:49:18 -06:00
Rémi Verschelde 9b7c963d19
Merge pull request #48804 from EricEzaM/scripting-multi-error-support
Added support for scripts reporting multiple errors to ScriptTextEditor
2021-06-20 00:38:49 +02:00
Rémi Verschelde d88be9b70c
Merge pull request #44806 from madmiraal/consolidate_json
Consolidate JSON, JSONParseResults and JSONParser into JSON
2021-06-19 21:45:34 +02:00
Eric M d0e78c86d7 Added support for scripts reporting multiple errors to ScriptTextEditor
Scripts can now report multiple errors to the scripting editors in the engine. UI elements were added to support multiple errors.
2021-06-19 22:20:30 +10:00
Marcel Admiraal 2bafcd3422 Consolidate JSON, JSONParseResults and JSONParser into JSON
Renames JSON.parse_string() to parse()
Renames JSON.decode_data() to stringify()
2021-06-19 08:01:40 +01:00
Rémi Verschelde a9c53fa599
Merge pull request #49287 from reduz/expose-variant-internal-binders
Make some Variant internal functions public.
2021-06-19 01:11:03 +02:00
George Marques c4fcc678df
Merge pull request #49449 from SpectralDragon/fix-enum-equal-operation
Fix equal operation for typed enums
2021-06-18 17:18:44 -03:00
George Marques b5f1e88b2e
GDScript: Fix setting type of operator return value
Also write type adjust when needed for binary operators.
2021-06-18 13:09:35 -03:00
Francois Belair a56c2e459b Translate file path to URI on LSP symbol requests 2021-06-17 10:36:41 -04:00
Rémi Verschelde fed31b1827
Merge pull request #49616 from BastiaanOlij/more_rename_transform
Adding some more missing renames for Transform3D and Quaternion
2021-06-15 16:50:52 +02:00
Bastiaan Olij 2161fd117b
Adding some more missing renames for Transform3D and Quaternion 2021-06-15 16:01:50 +02:00
Rémi Verschelde cbcdda60c0
Merge pull request #49570 from RandomShaper/fix_slow_scene_io 2021-06-15 14:51:24 +02:00
Julien Nguyen d6ae7edd80 Fix "super" call when having at least one argument 2021-06-13 17:46:03 +02:00
Pedro J. Estébanez 2ca6b9c610 Fix slow load/save of scenes with many instances of the same script 2021-06-13 13:32:44 +02:00
Pedro J. Estébanez 04688b92ff Rename Reference to RefCounted 2021-06-11 18:48:42 +02:00
Rémi Verschelde 8d4046929c
Merge pull request #49511 from akien-mga/core-diraccess-fileaccess-io
Core: Move DirAccess and FileAccess to `core/io`
2021-06-11 16:51:10 +02:00
Rémi Verschelde 6b0183ec89
Merge pull request #49279 from Calinou/rename-string-is-abs-path-method
Rename `String.is_abs_path()` to `String.is_absolute_path()`
2021-06-11 15:58:16 +02:00
Rémi Verschelde 6107d9e180
Merge pull request #34566 from Heikki00/34541_to_json_precision
Increased String::num default decimal precision
2021-06-11 15:56:59 +02:00
Rémi Verschelde 9e328bb5b7
Core: Move DirAccess and FileAccess to core/io
File handling APIs are typically considered part of I/O, and we did have most
`FileAccess` implementations in `core/io` already.
2021-06-11 14:52:39 +02:00
Lyuma 771190a9db Fix regression from 160c260 causing export of non-@export properties. 2021-06-10 20:35:58 -07:00
Владислав Прусаков 6449c5f246 Fix equal operation for typed enums 2021-06-09 02:52:21 +03:00
Rémi Verschelde 69e6d65295
Merge pull request #49367 from Calinou/gdscript-highligher-add-annotations
Highlight annotations in the GDScript syntax highlighter
2021-06-07 17:20:11 +02:00
Rémi Verschelde 896aa94283
Merge pull request #49221 from Faless/mp/4.x_rpc_refactor
[Net] Refactor RPCs, remove RSETs
2021-06-07 17:00:08 +02:00
Hugo Locurcio 32e97cb805
Highlight annotations in the GDScript syntax highlighter
By default, a orange color is used to highlight annotations in the
script editor.
2021-06-06 21:33:23 +02:00
Marcel Admiraal 8acd13a456 Rename Quat to Quaternion 2021-06-04 18:14:32 +01:00
Hugo Locurcio 5ea1c75d63
Rename String.is_abs_path() to String.is_absolute_path()
This is more consistent with `NodePath.is_absolute()`.
2021-06-03 16:00:06 +02:00
Aaron Franke 08a85352fb
Rename Variant TRANSFORM to TRANSFORM3D
Also _transform to _transform3d
2021-06-03 07:30:01 -04:00
Aaron Franke de3f6699a5
Rename Transform to Transform3D in core 2021-06-03 07:30:01 -04:00
Fabio Alessandrelli d779b5aa3e [Net] Refactor RPCs, remove RSETs
In this PR:
- Removed rset
- rpc_config can now optionally configure transfer mode
  (reliable/unreliable/ordered) and channel (channels are not actually
  implemented yet.)
- Refactor how the RPC id is computed to minimize the logic in Node and
  scripts that now only needs a single `get_rpc_methods` function.
2021-06-01 17:24:21 +02:00
Rémi Verschelde 59b524ae4c
Merge pull request #49067 from JFonS/fix_gcc_warnings
Fix some warnings raised by GCC-11.1
2021-06-01 10:47:37 +02:00
Hugo Locurcio 1704be0a44
Rename the bundled text editor themes for consistency with themes
The Adaptive text editor theme is the default, and has therefore
been renamed Default for consistency with the Default theme preset.
It keeps its automatic dark/light switch status.

The Default text editor theme was actually a legacy Godot 2-style theme,
so it has been renamed to Godot 2 to match the theme preset.
Its background color has been changed to be a constant opaque color,
since the new editor theme made the theme look less good on a translucent
background. The previous background color on light theme also lacked
contrast.
2021-05-31 14:02:13 +02:00
Heikki Simojoki 09a905ca80
Increase String::num default decimal precision
Fixes #34541

Renamed MAX_DIGITS to MAX_DECIMALS, since it only changes the
amount of digits after the decimal point.

Increased MAX_DECIMALS to 32, and made String::num use
MAX_DECIMALS consistently. If -1 is passed as
decimal precision to String::num, it now gets changed to
the correct precision based on the number's magnitude,
instead of using printf default(which is 6)

String::num_real also calculates the correct precision now.

Also made the types used in floating-point math more
consistent in a few places.
2021-05-29 11:24:57 -04:00
Rémi Verschelde 364ea7f280
Merge pull request #49114 from vnen/gdscript-fix-self-function-type-check
GDScript: Fix function signature check for self calls
2021-05-26 20:59:17 +02:00
Rémi Verschelde 78bbb2cae1
Merge pull request #49112 from vnen/gdscript-assign-type-check
GDScript: Use analyzer data to decide assignment conversion
2021-05-26 20:34:43 +02:00
George Marques a23fc45727
GDScript: Fix function signature check for self calls 2021-05-26 15:33:18 -03:00
George Marques c7459e3855
GDScript: Use analyzer data to decide assignment conversion
Since there might be tricky cases in the analyzer (in the case of unsafe
lines) which would need to be properly checked again. Instead, this
splits the code generator in two functions and use information set by
the analyzer to tell which function to use, without a need to re-check.
2021-05-26 14:09:00 -03:00
jfons f8e34209af Fix some warnings raised by GCC-11.1 2021-05-25 17:23:53 +02:00
Marcel Admiraal da5d7db610 Rename File::get_len() get_length() 2021-05-25 11:54:28 +01:00
Rémi Verschelde 215e43242c
Merge pull request #49037 from vnen/fix-callable-freed-crash 2021-05-24 19:52:32 +02:00
George Marques ea44744e2d
Make Callable not crash on call when the object has been freed
Also add a GDScript test for this case.
2021-05-24 14:23:02 -03:00