Commit graph

3596 commits

Author SHA1 Message Date
PouleyKetchoupp
d346c30269 Fix DebuggerMarshalls errors while profiling
Fixed check for array size before func_size: when func_size is 0 there's
only 1 entry left and not 3.
2020-11-23 07:59:56 -07:00
Pedro J. Estébanez
e79162ec4e Make warning about Reference singletons more accurate 2020-11-23 10:42:44 +01:00
Rémi Verschelde
ba989a1d39
Merge pull request #43627 from aaronfranke/pixelvi
Use Vector2i instead of Vector2 for Image get_pixelv and set_pixelv
2020-11-23 10:04:49 +01:00
Rémi Verschelde
4ed42bfc29
Merge pull request #43725 from vnen/gdscript-typed-vm-2
GDScript: Typed VM Take 2
2020-11-23 09:59:20 +01:00
George Marques
15b085e8db
Add extra functions to VariantInternal
- Allow getting an opaque pointer, no matter the type (for ptrcall).
- Allow setting object pointer and id directly.
- Allow initializing the data given a type, to allow properly setting
  return types on ptrcalls.
2020-11-21 13:24:49 -03:00
Aaron Franke
2c53e8b0e9
Use Vector2i instead of Vector2 for Image get_pixelv and set_pixelv
Co-authored-by: Andrii Doroshenko <xrayez@gmail.com>
2020-11-21 02:42:29 -05:00
George Marques
c8e3fb8b05
Variant: Merge get() and validated_get()
Since they do pretty much the same thing. The validated_get() was
renamed to get() since that is more performant.
2020-11-20 17:26:19 -03:00
George Marques
8a9e3524a9
Fix variant getters not setting return type
The validated getters were only setting the value without changing the
type, leading to wrong results. This uses the same path used for
methods to the same purpose.
2020-11-20 15:55:17 -03:00
Rémi Verschelde
6a683f8016
Merge pull request #43591 from madmiraal/fix-43520
Update joy button and stick names, enums and documentation
2020-11-19 20:43:44 +01:00
Marcel Admiraal
20f2b71e21 Update joy button and stick names, enums and documentation 2020-11-19 15:28:31 +00:00
Rémi Verschelde
b4f81e7b88
Merge pull request #43662 from EricEzaM/PR/INP3-command_serialization_optional
Made serialization of Command toggleable when saving InputEvents.
2020-11-19 13:38:55 +01:00
Rémi Verschelde
8cc01be213
Merge pull request #43682 from RandomShaper/warn_reference_singleton
Warn about singleton being a Reference
2020-11-19 13:37:45 +01:00
Eric M
c92f83d3ca Made serialization of Command toggleable when saving InputEvents.
Made serialization of Command optional. If command is serialized, Control (On Win/Linux) or Meta (on Mac) are not.
Example use case: You are on Windows and you set a shortcut to be Control + E. This would serialize as Command=true and Control=true. If you then run this project on Mac, you would need to press Command AND Control to activate the shortcut - which is not what is intended. Now, you can set store_command to true, and it will only serialize to Command = true (no Control serialized). On Windows, this means Control. On Mac, it means only command.
2020-11-19 21:05:45 +10:00
Pedro J. Estébanez
e1150bd912 Warn about singleton being a Reference 2020-11-19 12:01:54 +01:00
Rémi Verschelde
2ca1c17a5c
Merge pull request #43661 from EricEzaM/PR/INP2-rename_load_from_globals
load_from_globals() -> load_from_project_settings()
2020-11-19 07:40:21 +01:00
Eric M
e5376fb129 load_from_globals() -> load_from_project_settings() 2020-11-19 09:21:21 +10:00
Pedro J. Estébanez
e99cf6bfe5 Fix crash duplicating local-to-scene resources 2020-11-18 23:45:30 +01:00
George Marques
bd93547c83
Fix return type on builtin validated calls
Before it was being set to the base type instead of the actual return
type.
2020-11-18 10:35:16 -03:00
Rafał Mikrut
03f89a4481 Fix crash when printing leaked nodes 2020-11-17 22:10:05 +01:00
Rémi Verschelde
408effa688
Merge pull request #43612 from akien-mga/variant-utils-doc
doc: Sync classref with Variant utility methods
2020-11-17 13:50:08 +01:00
Rémi Verschelde
c6dcf3310d
doc: Sync classref with Variant utility methods
Copied relevant documentation from the original `@GDScript` built-ins,
which will likely be removed in a future commit.

Various fixups to `variant_utility.cpp` while working on this.
2020-11-17 11:26:24 +01:00
Rémi Verschelde
386ee52978
Merge pull request #43610 from RandomShaper/fix_res_duplicate
Fix crash in resoure duplicate
2020-11-17 11:21:53 +01:00
Pedro J. Estébanez
9450717571 Fix crash in resoure duplicate 2020-11-17 10:13:41 +01:00
Aaron Franke
02161aad5a
Remove empty lines around braces with the formatting script 2020-11-16 23:38:11 -05:00
Rémi Verschelde
fbe0386c65
Merge pull request #43233 from madmiraal/fix-42876
Remove unneeded filter on joy_axis()
2020-11-16 22:41:14 +01:00
Fabio Alessandrelli
efe3eaf6a4
Merge pull request #43493 from timothyqiu/request-absolute-authority
Allow HTTPClient to talk to a proxy server
2020-11-16 16:00:26 +01:00
Rémi Verschelde
6c2db73937
Merge pull request #43566 from Calinou/remove-pause-mode-script-property-groups
Remove property groups for Pause Mode and Script
2020-11-16 12:53:31 +01:00
Rémi Verschelde
19f27ab486
Merge pull request #42976 from aaronfranke/input-get-axis
Allow getting Input "axis" and "vector" values by specifying multiple actions
2020-11-16 09:30:34 +01:00
Rémi Verschelde
a6150eb267
Merge pull request #43289 from KoBeWi/removelease_action
Release pressed action if event is removed
2020-11-16 09:29:04 +01:00
Hugo Locurcio
5770e08c2a
Remove property groups for Pause Mode and Script
Each of those only grouped 1 property, making them useless.

This closes https://github.com/godotengine/godot-proposals/issues/1840.
2020-11-15 16:01:10 +01:00
Zae
fa3e0bdd73 fix custom loader/saver broken 2020-11-15 22:14:06 +08:00
Haoyu Qiu
d92ca6fbb1 Allows HTTPClient to talk to proxy server
* Makes request uri accept absolute URL and authority
* Adds Host header only when missing
2020-11-14 21:25:15 +08:00
Tomasz Chabora
b7c612bd54 Release pressed action if event is removed 2020-11-12 16:54:16 +01:00
reduz
635d33dc6c Refactor variant built-in methods yet again.
* Using C-style function pointers now, InternalMethod is gone.
* This ensures much better performance in typed code.
* Renamed builtin_funcs to utility_funcs, to avoid naming confusion
2020-11-11 16:36:36 -03:00
Rémi Verschelde
fb2151089c
Merge pull request #43372 from aaronfranke/clamp-fixes
Minor clamp and float fixes
2020-11-11 13:20:19 +01:00
Aaron Franke
4abf189e36
Allow getting Input axis/vector values by specifying multiple actions
For get_vector, use raw values and handle deadzones appropriately
2020-11-11 06:02:44 -05:00
Aaron Franke
195d58be0f
Add raw strength value for internal use 2020-11-11 05:58:21 -05:00
reduz
5288ff538d Create Variant built-in functions.
-Moved Expression to use this, removed its own.
-Eventually GDScript/VisualScript/GDNative need to be moved to this.
-Given the JSON functions were hacked-in, removed them and created a new JSONParser class
-Made sure these functions appear properly in documentation, since they will be removed from GDScript
2020-11-10 19:31:10 -03:00
Aaron Franke
ee79fc627c
Minor clamp and float fixes 2020-11-10 14:30:07 -05:00
Rémi Verschelde
03ae26bb74
Merge pull request #43398 from KoBeWi/add_an_array_to_another_array_but_with_a_method
Add append_array() method to Array class
2020-11-10 13:53:58 +01:00
Rémi Verschelde
32464e569f
Merge pull request #40748 from RandomShaper/improve_packed_fs_api
Improve/fix packed data API
2020-11-10 10:59:34 +01:00
Rémi Verschelde
0f249f5c0a
Variant: Sync docs with new constructors, fixups after #43403
Change DocData comparators for MethodDoc and ArgumentDoc to get a better
ordering of constructors.
2020-11-09 23:39:53 +01:00
reduz
9979abce74 Change how no-arg constructor is handled internally in Variant. 2020-11-09 16:28:15 -03:00
Rémi Verschelde
b4a0661885
Merge pull request #43419 from reduz/document-operators
Make sure operators appear in the docs too
2020-11-09 19:54:34 +01:00
Rémi Verschelde
aa6a1094a5
Merge pull request #43415 from bruvzg/var_ctr_af32
Fix duplicate variant constructor typo.
2020-11-09 19:21:20 +01:00
reduz
11bf2ec6d1 Make sure operators appear in the docs too
Add "operator" and "constructor" qualifiers to make it easier to
see in the docs.
2020-11-09 14:12:01 -03:00
bruvzg
a4a21654b1
Fix duplicate variant constructor typo. 2020-11-09 18:34:17 +02:00
Rémi Verschelde
9d2e8f2f27
Variant: Rename Type::_RID to Type::RID
The underscore prefix was used to avoid the conflict between the `RID` class
name and the matching enum value in `Variant::Type`.

This can be fixed differently by prefixing uses of the `RID` class in `Variant`
with the scope resolution operator, as done already for `AABB`.
2020-11-09 16:29:04 +01:00
Rémi Verschelde
8a318fe1dd
Merge pull request #43404 from akien-mga/color-fix-clamp-uint32_t-warning
Color: Fix -Wtype-limits GCC warning after refactoring
2020-11-09 14:59:11 +01:00
Rémi Verschelde
771b3c583d
Color: Fix -Wtype-limits GCC warning after refactoring
Warning from GCC 10.2.0 with `warnings=extra`:
```
./core/math/color.h: In member function 'int32_t Color::get_r8() const':
./core/typedefs.h:107:42: error: comparison of unsigned expression in '< 0' is always false [-Werror=type-limits]
  107 | #define CLAMP(m_a, m_min, m_max) (((m_a) < (m_min)) ? (m_min) : (((m_a) > (m_max)) ? m_max : m_a))
      |                                    ~~~~~~^~~~~~~~~
./core/math/color.h:201:49: note: in expansion of macro 'CLAMP'
  201 |  _FORCE_INLINE_ int32_t get_r8() const { return CLAMP(uint32_t(r * 255.0), 0, 255); }
      |                                                 ^~~~~
```

Also some code consistency changes while at it.
2020-11-09 14:11:21 +01:00
reduz
221a2a1742 Refactored variant constructor logic 2020-11-09 08:54:43 -03:00
Tomasz Chabora
9f23a94b8a Add append_array() method to Array class 2020-11-08 21:09:45 +01:00
reduz
127458ed17 Reorganized core/ directory, it was too fatty already
-Removed FuncRef, since Callable makes it obsolete
-Removed int_types.h as its obsolete in c++11+
-Changed color names code
2020-11-07 20:17:12 -03:00
reduz
05de7ce6ca Refactored variant setters/getters
-Discern between named, indexed and keyed
-Get direct access to functions for typed GDScript and GDNative bindings
-Small changes to some classes in order to work with the new setget binder
2020-11-07 15:16:15 -03:00
Rémi Verschelde
709964849f
Merge pull request #42896 from Calinou/httprequest-increase-chunk-size
Increase the default HTTPClient download chunk size to 64 KiB
2020-11-07 16:38:28 +01:00
Rémi Verschelde
329d2c1ced
Merge pull request #42947 from Calinou/image-load-bmp-from-buffer
Add `Image.load_bmp_from_buffer()` for run-time BMP image loading
2020-11-07 16:38:09 +01:00
Hugo Locurcio
13357095ee
Increase the default HTTPClient download chunk size to 64 KiB
This improves download speeds at the cost of increased memory usage.

This change also effects HTTPRequest automatically.

See #32807 and #33862.
2020-11-07 16:11:04 +01:00
reduz
f2397809a8 Refactored Variant Operators.
-Using classes to call and a table
-For typed code (GDS or GDNative), can obtain functions to call prevalidated or ptr.
2020-11-06 12:45:50 -03:00
Yuri Roubinsky
38fb26794b Exposed randi_range to global funcs + renamed rand_range to randf_range 2020-11-06 17:06:26 +03:00
Rémi Verschelde
52c1b5fc41
Merge pull request #43283 from Calinou/color-remove-contrasted
Remove `Color.contrasted()` as its behavior is barely useful
2020-11-06 10:17:12 +01:00
Andrii Doroshenko (Xrayez)
34ca426851 Remove unused PHI define in math funcs 2020-11-05 18:05:58 +02:00
Rémi Verschelde
35e6070a35
doc: Override default value for RandomNumberGenerator.seed
It's non-deterministic so it's better to show a fixed value like 0 instead of
having it potentially change whenever `randomize()` is called.

Fixes #43317.
2020-11-05 00:41:24 +01:00
Rémi Verschelde
424cd00f8b
doc: Sync classref with current source + fixup some bindings
Includes various changes triggered by the refactoring of method bindings.
2020-11-04 15:38:26 +01:00
reduz
f123981a96 Implement DirectionalLight2D
Also separated Light2D in PointLight2D and DirectionalLight2D.
Used PointLight2D because its more of a point, and it does not work
the same as OmniLight (as shape depends on texture).
Added a few utility methods to Rect2D I needed.
2020-11-04 10:03:01 -03:00
Hugo Locurcio
7adb6b91b3
Remove Color.contrasted() as its behavior is barely useful
Returning the most contrasting color isn't a trivial task, as there
are often many possible choices. It's usually best left for the user
to implement using a script.
2020-11-03 04:46:08 -05:00
Rémi Verschelde
873d461785
Merge pull request #40364 from marstaik/alpha2coverage_up
Alpha Hash and Alpha2Coverage Implementation
2020-11-03 07:50:49 +01:00
Marios Staikopoulos
e5d7c7d5fc Alpha Hash and Alpha2Coverage Implementation 2020-11-02 20:11:20 -08:00
Rémi Verschelde
e8794b24bd
Merge pull request #43260 from HaSa1002/mainloop-remove-deprecated-methods
MainLoop: Remove deprecated methods
2020-11-02 14:26:49 +01:00
Lyuma
37b6a36cc4 Avoid reentrant OBJTYPE_RLOCK in ClassDB
Fixes #43020 when a thread uses ClassDB while main thread calls is_parent_class().
2020-11-01 03:40:06 -08:00
HaSa1002
f8ac4c4d75 MainLoop: Remove deprecated methods 2020-11-01 12:38:30 +01:00
Marcel Admiraal
f9bb8de3fc Remove unneeded filter on joy_axis() 2020-10-31 09:13:17 +00:00
Rémi Verschelde
f98db723b9
Merge pull request #43184 from Chaosus/fix_randi_range_biased
Fix biased output of randi_range
2020-10-30 15:00:44 +01:00
reduz
0e6664539d Refactor pixel snapping.
-Rename pixel_snap to snap_2d_to_vertices
-Added snap_2d_to_transforms which is more useful

Fixes #41814
Solves proposal https://github.com/godotengine/godot-proposals/issues/1666
Supersedes #35606, supersedes #41535, supersedes #41534
2020-10-30 08:57:32 -03:00
Yuri Roubinsky
31faa1f226 Fix biased output of randi_range 2020-10-29 15:41:00 +03:00
Rémi Verschelde
54e6338c9b
Vulkan: Make validation layers optional
They're now disabled by default, and can be enabled with the command line
argument `--vk-layers`.

When enabled, the errors about them being missing are now warnings, as
users were confused and thought this meant Vulkan is broken for them.

Fix crash in `~VulkanContext` when validation layers are disabled (exposed by
this PR since before they could not be disabled without source modification).

Also moved VulkanContext member initializations to header.

Fixes #37102.
2020-10-27 16:19:15 +01:00
Rémi Verschelde
fddbfdba91
Merge pull request #43100 from madmiraal/apply-upstream-391
Apply upstream gamecontrollerdb patch 391.
2020-10-27 08:56:13 +01:00
Andrii Doroshenko (Xrayez)
1923f0d302 Make randbase member protected in RandomNumberGenerator
Allows to extend `RandomNumberGenerator` via C++ modules.
2020-10-27 01:52:15 +02:00
Marcel Admiraal
afc9e5923e Apply upstream gamecontrollerdb patch 391.
Co-authored-by: SalvoB <salvob41@users.noreply.github.com>
2020-10-26 16:47:48 +00:00
Marcel Admiraal
0c0c36be44 Provide support for buttons and D-pads mapped to half axes, and
fix axes mapped to buttons and D-pads.
2020-10-26 07:52:24 +00:00
Yuri Roubinsky
4c65dc975c Shows ColorRect in Color constants autocompletion 2020-10-23 19:03:50 +03:00
Rafał Mikrut
742251e90a Fix invalid method names 2020-10-22 19:50:25 +02:00
George Marques
c8716734eb
Merge pull request #43000 from vnen/variant-internal-method-name
Add name and base type to Variant::InternalMethod (on debug)
2020-10-22 09:55:18 -03:00
George Marques
8b3271563f
Add name and base type to Variant::InternalMethod (on debug)
This is useful to showing error messages when a pointer to an
InternalMethod is the only information available.
2020-10-22 09:07:25 -03:00
Tomasz Chabora
37d515e99c Favor project.binary over project.godot 2020-10-22 00:12:18 +02:00
Hugo Locurcio
0209e3790e
Add Image.load_bmp_from_buffer() for run-time BMP image loading
This partially addresses
https://github.com/godotengine/godot-proposals/issues/676.
2020-10-20 23:52:45 +02:00
reduz
ee06a70ea6 Refactor MethodBind to use variadic templates
Removed make_binders and the old style generated binders.
2020-10-18 12:28:44 +02:00
Rémi Verschelde
88a3db5bff
Merge pull request #42315 from lyuma/command_queue_fix
core/command_queue_mt.h: Fix crash/hang when buffer fills up
2020-10-15 22:35:44 +02:00
reduz
b8c64184c6 Refactored binding system for core types
Moved to a system using variadic templates, shared with CallableBind.

New code is cleaner, faster and allows for much better optimization of core
type functions from GDScript and GDNative.

Added Variant::InternalMethod function for direct call access.
2020-10-14 15:24:30 +02:00
Lyuma
9f654b441f core/command_queue_mt: Fix crash/hang when buffer fills up
This patch fixes two related issues. One is the race condition in issue #42107..
The other is a crash which happens when the reader is lapped near the end of the buffer.
2020-10-12 08:41:13 -07:00
Lyuma
48e8da4aac core/command_queue_mt: Customizable size and tests
Adds unit tests for command_queue_mt.h/cpp
In this revision, some unit tests will fail due to issue #42107.
2020-10-12 08:24:08 -07:00
Fabio Alessandrelli
ab0907c1ba
Merge pull request #42684 from timothyqiu/conn-self-assign
Fix HTTPClient::poll crash after connection is self-assigned
2020-10-12 12:40:22 +02:00
Haoyu Qiu
8226cee8d8 Fixes HTTPClient::poll crash after connection is self-assigned 2020-10-10 10:10:30 +08:00
reduz
351a122029 Add ability to bind an unbind arguments to Callable. 2020-10-09 19:43:22 -03:00
Rémi Verschelde
7c4d1e9c65
Merge pull request #42660 from Chaosus/remove_get_uv84_normal_bit
Removed unused method Geometry3D.get_uv84_normal_bit
2020-10-09 19:31:24 +02:00
reduz
26f5bd245c Implement GPU Particle Collisions
-Sphere Attractor
-Box Attractor
-Vector Field
-Sphere Collider
-Box Collider
-Baked SDF Collider
-Heightmap Collider
2020-10-09 13:25:47 -03:00
Yuri Roubinsky
66c2aaf749 Removed unused method Geometry.get_uv84_normal_bit 2020-10-09 10:22:26 +03:00
Tomasz Chabora
bb2684f4a7 Cancel rename if file does not exist 2020-10-08 13:00:23 +02:00
Rémi Verschelde
0d8bd93e40
Fix build after merge of #40097
CI had passed back then but this would have needed a rebase to
take into account recent changes to String.
2020-10-07 14:23:44 +02:00
Rémi Verschelde
cb77e8d6cf
Merge pull request #40097 from mrushyendra/file_sort_master
Fix natural sort comparison for strings with large numbers
2020-10-07 13:59:14 +02:00
Aaron Franke
1ca501d7d4
Check for global script class information before clearing it 2020-10-05 15:45:54 -04:00