Commit Graph

3896 Commits

Author SHA1 Message Date
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
Danil Alexeev 01d0addf56 Unified named colors in RichTextLabel
Now the BB tag `[color]` uses the color names from the `Color` class.
Also, the use of the `#` symbol in an HTML color code has become optional.
2020-11-17 02:55:36 +03: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
Andrii Doroshenko (Xrayez) 1e6b684d44 Expose `PROPERTY_HINT_TYPE_STRING` to scripting 2020-11-09 18:12:04 +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
Michael Alexsander 4f08174413 Make translation change notification when setting the locale of a Translation resource only happen when loaded in the server 2020-11-08 11:48:50 -03: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
Rémi Verschelde e35bb04c53
Improve format version mismatch error in binary loader 2020-10-05 14:49:41 +02:00
Aaron Franke 3163611f0c
Don't write global script class information if there is none 2020-10-03 04:36:07 -04:00
Serhat 9f2cdfea82 Fixed padding bug of sprintf function 2020-10-02 00:25:42 +03:00
Wilson E. Alvarez b4e7edabf3
Make "function" a property of FuncRef 2020-09-30 06:57:59 -04:00
Craig-Stoneham 46519ba52c Removed unnecessary keyword, fix comment style
The privacy here is already private
2020-09-29 10:30:02 +02:00
Rémi Verschelde b07f020c99
Merge pull request #42133 from vnen/variant-op-consistency
Allow commutative multiplication in Variant
2020-09-28 15:56:29 +02:00
Aaron Franke 5fbcd8f9df
Rename the ".import" folder to ".godot/imported" 2020-09-28 05:23:45 -04:00
Rémi Verschelde 1a8dfcd97b
Merge pull request #42304 from akien-mga/os-drop-get_splash_tick_msec
OS: Remove unused get_splash_tick_msec
2020-09-28 10:13:37 +02:00
Rémi Verschelde 545da82427
Merge pull request #42340 from Rubonnek/get-funcref-function
Allow retrieval of FuncRef function string
2020-09-27 10:08:25 +02:00
Rémi Verschelde fc481db1c3
Merge pull request #37403 from aaronfranke/basis_equal_approx
Change Basis is_equal_approx to use instance method
2020-09-27 08:46:37 +02:00
Wilson E. Alvarez 75154e64a9
Allow retrieval of FuncRef function string 2020-09-25 11:54:51 -04:00
Rémi Verschelde 819c3524a5
OS: Remove unused get_splash_tick_msec
It was added in 3e20391bf6 but it doesn't seem
particularly useful, and it was only implemented for the custom splash branch
and not the default one, so it could return an uninitialized int.
2020-09-24 15:40:30 +02:00
Rémi Verschelde 9c9f3365b2
Merge pull request #42296 from akien-mga/messagequeue-default-size-4096-kb
MessageQueue: Change default queue size to 4096 KB
2020-09-24 15:11:17 +02:00
Tomasz Chabora 7b1ad6fbe0 Remove unnecessary empty line from Dictionaries 2020-09-24 13:23:06 +02:00
Rémi Verschelde 5009ba54b2
MessageQueue: Change default queue size to 4096 KB
1024 KB was low enough that many users seem to hit it, which can lead to the
editor freezing.

The proper fixed as described in #35653 would be to implement a page allocator
to prevent this overflow, but as a stop-gap measure, we can increase the
default value to a more lenient 4096 KB which should be high enough for the
vast majority of use cases.

The default size can be brought down again if/when #35653 is properly fixed,
and if it's actually relevant from a memory point of view.
2020-09-24 09:05:12 +02:00
Tomasz Chabora f4e34ac353 Check for null in InputMap::_find_event 2020-09-23 15:39:06 +02:00
Aaron Franke 9394c057b8
Remove redundant is_equal_approx_ratio method
is_equal_approx is able to handle values of any size, and is_equal_approx_ratio is no longer used in any exposed APIs, so we don't need is_equal_approx_ratio anymore. Also, add #ifdef MATH_CHECKS for a method that is only used when MATH_CHECKS is defined.
2020-09-23 00:28:49 -04:00
Aaron Franke 23dabcd2d0
Change Basis is_equal_approx to use instance method 2020-09-23 00:28:49 -04:00
Hugo Locurcio 0b65342fd2
Fix crash when opening a ZIP data pack
Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>
2020-09-19 15:45:00 +02:00
Rémi Verschelde 914591c9ae
zstd: Update to upstream version 1.4.5 2020-09-18 21:47:12 +02:00
Rémi Verschelde 3e78963bb9
Fix typos with codespell
Using codespell 1.17.1.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
dof
doubleclick
fave
findn
leapyear
lod
merchantibility
nd
numer
ois
ony
que
seeked
synching
te
uint
unselect
webp
EOF

$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2020-09-18 13:44:25 +02:00
Rémi Verschelde 5f4d64f4f3
Linux/BSD: Fix support for NetBSD
Add __NetBSD__ to `platform_config.h` so that it can find `alloca`
and use the proper `pthread_setname_np` format.

Rename RANDOM_MAX to avoid conflict with NetBSD stdlib.

Fixes #42145.
2020-09-18 10:27:55 +02:00
George Marques e4942e4a96
Allow commutative multiplication in Variant
Also allow quaternions to be multiplied by integers.
2020-09-17 09:02:53 -03:00
Rémi Verschelde 6ac7b90097
Merge pull request #42013 from Xrayez/fix-list-swap
Fix `List` swap behavior on front, back and adjacent elements
2020-09-16 17:39:43 +02:00
Andrii Doroshenko (Xrayez) cfead57d1d Make `Object::to_string` virtual
Allows to override printing via C++, not only via script.
2020-09-15 18:14:45 +03:00
Andrii Doroshenko (Xrayez) ac69f092fc Fix `List` swap behavior on front, back and adjacent elements
- immediately return if A == B;
- first and last elements (front, back) are updated upon relinking;
- handles a special case of forward and backward adjacent elements.
2020-09-12 23:58:56 +03:00
George Marques 49e0cadcca
Fix Vector{2,3}i casting on Variant multiplication with numbers 2020-09-12 17:23:34 -03:00
Marcel Admiraal 4feba93630 Add missing reference to const T Vector::get(). 2020-09-11 11:58:47 +01:00
Marcel Admiraal e3d698dae9 Remove unused Python imports. 2020-09-10 11:38:52 +01:00
reduz a674da4eec Implement 3D textures as import and resource format. 2020-09-09 13:50:21 -03:00
Aaron Franke d0a1399a1b
Change inequality comparison operators to use exact equality 2020-09-08 18:10:58 -04:00
Marcel Admiraal 9149fb760c Initialise Basis elements with a default Basis in the declaration.
Ensures a valid Basis is created with all constructors.
2020-09-08 12:15:08 +01:00
Rémi Verschelde 3c42d5789f
Merge pull request #38308 from bruvzg/sad_security_circus
Adds PCK encryption support (using script encryption key for export).
2020-09-07 17:12:01 +02:00
Fabio Alessandrelli 2cb6b2ac6f
Merge pull request #38944 from Wavesonics/http-gzip
HttpRequest now handles gzipping response bodies
2020-09-07 17:03:19 +02:00
bruvzg f043eabdd8
Adds PCK encryption support (using script encryption key for export).
Change default encryption mode from ECB to CFB.
2020-09-05 14:53:39 +03:00
Adam Brown 8f1a6d7489 Fixed PackedByteArray GDScript functions
p_self._data.packed_array needs to be used instead of p_self._data._mem

printline
2020-09-04 12:43:00 -07:00
Marcel Admiraal ce263c4ff6 Ensure assignment operators return by reference to avoid unnecessary copies. 2020-09-04 09:18:19 +01:00
bruvzg 80b8eff6aa
[Complex Test Layouts] Change `String` to use UTF-32 encoding on all platforms. 2020-09-03 19:56:24 +03:00
Marcel Admiraal f6ad1954f7 Ensure header guards enclose entire header. 2020-09-03 11:29:42 +01:00
Rémi Verschelde f57ade8f80
Merge pull request #41460 from Calinou/improve-resource-load-fail-message
Improve the resource loading error message to mention the need to import
2020-09-03 11:31:27 +02:00
Rémi Verschelde 4a5138bb99
Merge pull request #40400 from Arivval/load-resourcepack-with-offset
Added PCK file loading with offset feature
2020-09-03 07:33:19 +02:00
Yilin Ma c524d50444 added load resource pack with offset feature
updated variables to use size_t

removed line break to make code style more consistent

added conditional check to return an error if offset field is used when loading a ZIP package

fixed typo

formatted file

added commit regarding self contained exe files

handled error loging for load zip file with offset

spelling tweak

updated conditional statement for magic check

udpated error message when load Zip file with offset is called

fix CI

Trying to fix CI

fix CI done

Added error message for loading self-contained exe with offset.

Updated documentation.

Fix indent

final fix indent

Updated documentation.

fix indents

Updated doc based on suggestion

Final fix

fixed format
2020-09-02 17:57:01 -05:00
Adam Brown 6584db1538 HTTPRequest now accepts gzip
Added request_raw to HttpRequest
Added decompress_dynamic to Compression class
Added decompress_dynamic to BytePoolArray

Merge doc fix

revert
2020-09-02 12:59:59 -07:00
George Marques 1a29e94c52
Add VariantInternal class
This is used to get a direct pointer for the data inside a Variant.
Added as another class instead of in Variant directly because this
should only be used in special cases, so use must be explicit.
2020-09-02 16:23:57 -03:00
Andrii Doroshenko (Xrayez) 0cc05c5a31 Register GDScript test tools as test commands to run via command-line 2020-09-02 01:43:26 +03:00
Rémi Verschelde 1e49a86884
Fix invalid CSV in SDL2 controller mappings DB
Follow-up to a61cae1469.
2020-09-01 20:53:51 +02:00
Rémi Verschelde 8ce02caf40
Merge pull request #41669 from strank/hardcoded-op-max
Fix hard-coded OP_MAX in variant_op.cpp
2020-09-01 19:51:23 +02:00
Rémi Verschelde eac32f082a
Merge pull request #40868 from aaronfranke/color-html-rgba
Change Color HTML conversion from ARGB to RGBA
2020-09-01 10:44:36 +02:00
Rémi Verschelde a61cae1469
Sync controller mappings DB with SDL2 community repo
Synced with gabomdq/SDL_GameControllerDB@d148c6ce49.
2020-09-01 10:23:16 +02:00
strank 447b140671 Fix hard-coded OP_MAX in variant_op.cpp 2020-09-01 03:17:42 -04:00
Aaron Franke a6ff389a55
Simplify html_is_valid and allow it to work with 3 and 4 hex digits 2020-09-01 02:07:35 -04:00
Aaron Franke ecd6a893b4
Change Color HTML conversion from ARGB to RGBA
Also add support for 3 and 4 digit values in C#. Now it actually matches the HTML/CSS spec.
2020-09-01 02:07:35 -04:00
Rémi Verschelde 37443bf04d
Merge pull request #41635 from jkb0o/master
Clear missed remaps on deinitialization
2020-08-31 15:29:17 +02:00
Yakov Borevich 604bd75438 [funexpected] clear missed remaps on deinitialization, fixes godotengine/godot#34221 2020-08-31 16:04:46 +03:00
Rémi Verschelde a276e6fc36
Merge pull request #40955 from Calinou/test-add-expression
Add a test suite for Expression
2020-08-31 11:12:34 +02:00
Hugo Locurcio d5ffa42cd2
Add a test suite for Expression
This also makes the first parameter of `Expression::execute()` optional
from C++. Previously, it was only optional in the scripting API.
2020-08-27 15:16:09 +02:00
simpu ea2eaf8c27 Added debugger plugin support
Changes:
* EngineDebugger is exposed to gdscript. Game side of communication can be implemented through it.
* EditorDebuggerPlugin is added which handles the editor side of communication.
2020-08-26 11:24:51 +05:30
Rémi Verschelde f13207254c
Revert "Check if global class file still exists before registering it"
And revert follow-up regression fix "Remap script path when registering class."

After the regression fix, the original issue is valid again so it's better
to go back to the previous state.

This reverts commits e264ae20d2 and
fceb64827e.
2020-08-25 13:02:03 +02:00
Rémi Verschelde 9d8f3496e8
Merge pull request #40443 from SkyLucilfer/PluralsSupport
Added plurals and context support to Translation
2020-08-25 12:11:56 +02:00
Hugo Locurcio 58ed3037c0
Improve the resource loading error message to mention the need to import
This is a common pitfall when setting up projects in a headless
environment.
2020-08-22 22:19:08 +02:00
Marcel Admiraal 5f092cf7bb Fix new black style check failures in various files. 2020-08-21 16:51:30 +01:00
Rémi Verschelde 989a4deb2f Fix warning using ERR_FAIL_INDEX on unsigned int
This method starting being used in 079ca220e1,
which now triggers this warning from GCC 10:
```
./core/error_macros.h:151:25: error: comparison of unsigned expression in '< 0' is always false [-Werror=type-limits]
```
2020-08-19 14:41:46 +02:00
SkyJJ ce3461dc88 Update GDScriptTranslationParserPlugin to use GDSriptParser instead of RegEx. 2020-08-19 03:10:51 +02:00
SkyJJ 0ef758eaee Updated Translation architecture to have TranslationPO, did some commit fixes and updated class Reference. 2020-08-19 03:01:53 +02:00
SkyJJ c0d837a2ea Added plurals and context support to Translation 2020-08-19 03:01:51 +02:00
Eric M 8f54e8bfb5 Fixed issues with adding custom project settings and added confirmation dialog when deleting settings. 2020-08-18 09:12:02 +10:00
Rémi Verschelde d2d4c1c957 Update AUTHORS and DONORS list
New contributors added to AUTHORS:
@hinlopen, @naithar, @rrcore, @SkyLucilfer, @TwistedTwigleg

Thanks to all contributors and donors for making Godot possible!

---

Also changes to relevant code that parses the DONORS.md to match
the new tiers.
2020-08-14 00:06:51 +02:00
Juan Linietsky 079ca220e1 Added volumetric fog effect. 2020-08-13 11:28:45 -03:00
Rémi Verschelde d3b5c0948c
Merge pull request #41025 from Faless/gdscript/fix_class_name
Remap script path when registering class.
2020-08-11 20:02:35 +02:00
Rémi Verschelde a32b427f99
Merge pull request #41043 from ShivamMukherjee/fix-variant-call
Fix Vector3i and Vector2i AXIS_* constants
2020-08-10 19:30:39 +02:00
Stijn Hinlopen 5563722628 Rewrite ProjectSettings editor advanced options
- New layout: advanced options hidden by default, error labels added.
 - Disallow adding invalid new settings, or overwriting built-in settings.
2020-08-10 17:32:01 +02:00
Vivraan 8629cfdb08 Fix Vector3i and Vector2i AXIS_* constants 2020-08-05 14:15:28 +05:30
Fabio Alessandrelli fceb64827e Remap script path when registering class.
Was causing `class_name`-defined scripts to not being loaded in exported
games due to the remap from `*.gd` to `*.gdc`/`*.gde`.
2020-08-04 15:46:40 +02:00
Andrea Catania 9fb587b702
Fixes issue with LocalVector remove function 2020-07-31 13:49:15 +02:00
Wilson E. Alvarez e264ae20d2
Check if global class file still exists before registering it 2020-07-28 09:25:34 -04:00
Aaron Franke 56e2c6c704
Make all String float conversion methods be 64-bit 2020-07-27 18:38:53 -04:00
Andrii Doroshenko (Xrayez) d86de6c98e SCons: Refactor running commands through builders
A new `env.Run` method is added which allows to control the verbosity
of builders output automatically depending on whether the "verbose"
option is set. It also allows to optionally run any SCons commands in a
subprocess using the existing `run_in_subprocess` method, unifying
the interface. `Action` objects wrap all builder functions to include a
short build message associated with any action.

Notably, this removes quite verbose output generated by `make_doc_header`
and `make_editor_icons_action` builders.
2020-07-28 00:09:21 +03:00
Pedro J. Estébanez f38949a44d Improve/fix packed data API
- Enhance directory API
- Fix `FileAccess::exists()` not checking for PackedData being disabled
- Fix moving to the parent directory (`..`)
- Allow absolute paths in existence checks
2020-07-27 12:06:40 +02:00
Rémi Verschelde 33d423e240
Merge pull request #39898 from Meriipu/master_gdscript
GDScript: Clarified/fixed inaccuracies in the built-in function docs.
2020-07-26 17:12:13 +02:00
Rémi Verschelde b2096ba53e
Merge pull request #40670 from vnen/remove-multilevel-call
Remove multilevel calls
2020-07-26 17:09:41 +02:00
Sergey Minakov 7ee268c2c7 Core Variant: switch from 'real' to 'float' to allow building with NEED_LONG_INT 2020-07-25 21:55:10 +02:00
Sergey Minakov 8e9a07c401 Core Callable: fixed variant call caster
Use same call to VariantCaster in release build as used in VariantCasterAndValidate::call method
2020-07-25 21:55:08 +02:00
Meriipu 7f9bfee0ac GDScript: Clarified/fixed inaccuracies in the built-in function docs.
The input to smoothstep is not actually a weight, and the decscription
of smoothstep was pretty hard to understand and easy to misinterpret.

Clarified what it means to be approximately equal.

nearest_po2 does not do what the descriptions says it does. For one,
it returns the same power if the input is a power of 2. Second, it
returns 0 if the input is negative or 0, while the smallest possible
integral power of 2 actually is 1 (2^0 = 1). Due to the implementation
and how it is used in a lot of places, it does not seem wise to change
such a core function however, and I decided it is better to alter the
description of the built-in.

Added a few examples/clarifications/edge-cases.
2020-07-25 20:26:02 +02:00
Rémi Verschelde 6f292f906e
Merge pull request #38900 from bruvzg/docs_ignore_os_spec_def_vals
Docs: Ignore OS specific values (constants, project settings, properties)
2020-07-25 18:54:25 +02:00
Wilson E. Alvarez 1cd02ef600
Show errors on Object.call_deferred 2020-07-24 21:47:01 -04:00
George Marques 2b9d9bc364
Remove multilevel calls
In general they are more confusing to users because they expect
inheritance to fully override parent methods. This behavior can be
enabled by script writers using a simple super() call.
2020-07-24 14:13:58 -03:00
RevoluPowered 579342810f t Add unit testing to Godot using DocTest and added to GitHub Actions CI
Implements exit codes into the engine so tests can return their statuses.
Ideally we don't do this, and we use FIXUP logic to 'begin' and 'end' the engine execution for tests specifically.

Since realistically we're initialising the engine here we don't want to do that, since String should not require an engine startup to test a single header.

This lowers the complexity of running the unit tests and even for
physics should be possible to implement such a fix.
2020-07-24 13:05:33 +01:00
Rémi Verschelde 3811fb919e
Merge pull request #40598 from vnen/gdscript-2.0
GDScript 2.0 (again)
2020-07-24 01:04:57 +02:00
Adam Bates 8f84dfa91d issue-40396 - Added missing error strings to JSON parsing when array or object is never closed. 2020-07-22 15:06:57 -04:00
Rémi Verschelde a5fb445121
Merge pull request #40450 from asmaloney/spelling
Fix spelling & grammar in comments, docs, and messages
2020-07-21 22:14:04 +02:00
Andy Maloney 4dda62f591 Fix spelling & grammar in comments, docs, and messages 2020-07-21 15:17:23 -04:00
Aaron Franke 83e324d670
Update core documentation to match recent C# changes
Also a few minor API changes like adding AABB.abs()

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2020-07-21 14:44:53 -04:00
George Marques 95c0909290
Add warning checks in GDScript analyzer
Reenable checking those when validating code.
2020-07-20 11:38:40 -03:00
Rémi Verschelde 818bfbc5b5
Merge pull request #40161 from vnen/classdb-info-methods
Add methods in ClassDB to get property/method/constant/enum info
2020-07-20 16:29:33 +02:00
Rémi Verschelde 0e1c235d95
Merge pull request #40468 from asmaloney/spelling-code
Fix spelling of a var, a struct, and some message output
2020-07-20 15:51:05 +02:00
Nathan Franke 210ccb3a75
Fix Directory make_dir and make_dir_recursive 2020-07-20 06:38:10 -05:00
Andy Maloney 8b949918b1 Fix spelling of a var, a struct, and message output 2020-07-17 12:02:06 -04:00
bruvzg 0181c3dde1
Docs: Ignore OS specific values (constants, project settings, properties). 2020-07-15 12:24:59 +03:00
Rémi Verschelde 9bdcfc4e87
Merge pull request #40374 from Faless/udp/server_abstraction
UDPServer uses single socket, abstract clients.
2020-07-14 16:31:19 +02:00
Fabio Alessandrelli 147bbe2155 UDPServer handles PacketPeerUDP-client association
UDPServer now uses a single socket which is shared with the
PacketPeerUDP it creates and has a new `poll` function to read incoming
packets on that socket and delivers them to the appropriate peer.
PacketPeerUDP created this way never reads from the socket, but are
allowed to write on it using sendto.

This is needed because Windows (unlike Linux/BSD) does not support
packet routing when multiple sockets are bound on the same address/port.
2020-07-14 14:10:18 +02:00
Rémi Verschelde 47cc202972 PO loader: Fix unclosed files and error messages
Trying to get `f->get_path()` after deleting `f` was not super clever :)

Fixes #40324.
2020-07-14 13:39:46 +02:00
Rémi Verschelde ca5958d180
Merge pull request #38440 from Paulb23/syntax_highlighter_refactor
Syntax highlighter refactor
2020-07-14 09:49:02 +02:00
Aaron Franke 9986439352
Commit other files changed by file_format.sh 2020-07-13 14:14:11 -04:00
Andrii Doroshenko (Xrayez) 1f73469b50 Fix overriding compression related settings 2020-07-13 14:38:35 +03: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 be119c5c47 Add core types to ScriptLanguage 2020-07-11 15:19:02 +01:00
Marcel Admiraal 26fcf2b04c Add override keywords. 2020-07-10 13:56:54 +01:00
Rémi Verschelde aeccd1e287
Merge pull request #40121 from Calinou/enable-file-logging
Enable file logging by default on desktops to help with troubleshooting
2020-07-10 11:02:57 +02:00
Nathan Franke 6952458538
Follow-Up Fix Directory Open 2020-07-10 02:56:37 -05:00
PouleyKetchoupp b2d27214aa Keep debug & verbose options after loading project from project manager 2020-07-09 09:51:32 +02:00
Hugo Locurcio 20af28ec06
Enable file logging by default on desktops to help with troubleshooting
- Use the `.log` file extension (recognized on Windows out of the box)
  to better hint that generated files are logs. Some editors provide
  dedicated syntax highlighting for those files.
- Use an underscore to separate the basename from the date and
  the date from the time in log filenames. This makes the filename
  easier to read.
- Keep only 5 log files by default to decrease disk usage in case
  messages are spammed.
2020-07-08 18:57:25 +02:00
Aaron Franke af80bcd2f8
Add sort and has methods to PackedArrays 2020-07-06 22:16:39 -04:00
Rémi Verschelde 141ce4d1f9
Merge pull request #40151 from nathanfranke/fix-directory-open-check
Fix Directory Open Check
2020-07-07 01:28:11 +02:00
George Marques 14e85b762e
Add methods in ClassDB to get property/method/constant/enum info
Without the need to iterate the whole list.
2020-07-06 19:27:05 -03:00
Nathan Franke 09aeb7706b
Fix Directory Open Check 2020-07-06 11:32:05 -05: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
Rémi Verschelde 7e38e8fdb0
Merge pull request #40138 from neikeq/error-macros-use-bool-literals
Fix 'modernize-use-bool-literals' clang-tidy warnings in error macros
2020-07-05 22:33:13 +02:00
Ignacio Etcheverry ea632a5007 Fix 'modernize-use-bool-literals' clang-tidy warnings in error macros 2020-07-05 19:22:26 +02:00
Jummit d4c4d2db4c add root_node as property of MultiplayerAPI 2020-07-05 16:15:04 +02:00
Maganty Rushyendra de46c92711 Fix natural sort comparison for strings with large numbers
Fix errors when comparing strings with large numbers (> INT64_MAX).
Comparisons now occur by comparing individual digits, instead of
converting to int64_t first.
2020-07-04 07:42:02 +08:00
Rémi Verschelde c020eea184
Merge pull request #40092 from hinlopen/remove-find-last
Remove String::find_last (same as rfind)
2020-07-04 01:38:01 +02:00
Stijn Hinlopen 929b98d24b Remove String::find_last (same as rfind) 2020-07-03 15:26:22 +02:00
Rémi Verschelde b5488def47 Image: Improve error messages for invalid creation size 2020-07-03 12:57:23 +02:00
Rémi Verschelde fd5b6e1db2
Merge pull request #40009 from mrushyendra/ustring_overflow_master
Fix overflow and underflow checks for string conversion to int
2020-07-02 16:32:27 +02:00
Rémi Verschelde c069f5f5ca
Merge pull request #34028 from nekomatata/list-erase-not-found
Removed errors when List::erase() can't find the value
2020-07-02 13:32:57 +02:00
Maganty Rushyendra 687b127fc5 Fix overflow and underflow checks for string conversion to int
Current error checks for to_int and to_int64 do not issue overflow error
messages for INT64_MAX + 1, INT64_MAX + 2, and other numbers close to the
integer limits. Likewise, error checks for hex_to_int, hex_to_int64 and
bin_to_int64 issue false positive error messages for INT64_MIN or INT32_MIN.
This commit fixes these error checks.
2020-07-02 09:58:23 +08:00
Rémi Verschelde 6cf416dafc
Merge pull request #33061 from madmiraal/nullpointerdereference
Call CRASH_COND_MSG if key not found in HashMap get(key) functions.
2020-07-01 18:20:23 +02:00
Rémi Verschelde a8a2769bb6
Merge pull request #38713 from aaronfranke/string-64bit
Make all String integer conversion methods be 64-bit
2020-07-01 16:01:05 +02:00
Marcel Admiraal 1b05f449f0 Call CRASH_COND_MSG if key not found in HashMap get function. 2020-07-01 10:50:13 +01:00
PouleyKetchoupp 45445e1b31 Removed errors when List::erase() can't find the value
This change makes the behavior consistent when the value
is not found between erasing from an empty list
(no error, just returning false) and erasing from a non-empty list
(previously displaying triggering an error and returning false).

Error message previously triggered:
ERROR: erase: Condition ' !p_I ' is true. returned: false
   At: ./core/list.h:157.
2020-07-01 10:17:27 +02:00
Fabio Alessandrelli 1b6e3458b2 Move frame delaying functions from Main to OS.
Will allow specific platforms to override it and avoid blocking on the
main/GUI thread.
2020-06-30 19:39:09 +02:00
Rémi Verschelde 5f2295f2df
Merge pull request #39986 from reduz/app-inout-notification
Add a separate application focus/in notification
2020-06-30 16:58:46 +02:00
Rémi Verschelde f3c5f12e39
Merge pull request #38920 from paulherman/tga
Expose loading TGA images in Image.
2020-06-30 16:40:28 +02:00
Juan Linietsky 438c380458 Add a separate application focus/in notification out from Window focus notification. 2020-06-30 10:40:06 -03:00
simpu bfadb882b1 Added Custom Performance Monitor and feature to read intermediate values of Monitor
Custom monitors can be added/removed/checked using `Performance.add_custom_monitor`/`Performance.remove_custom_monitor`/`Performance.has_custom_monitor`

The value can be viewed in the `Monitor` tab of Debugger.

Text before `/` is used to categorize the custom monitor.

`EditorPerformanceProfiler` class is created to separate logic from `ScriptEditorDebugger`

User can click on the graph of monitors to read the value at that point.

Graph includes intermediate base lines.
2020-06-29 17:20:29 +05:30
Maganty Rushyendra aae5f246ff Fix weekday calculation in get_datetime_from_unix_time for negative times
Fix calculation for negative times to ensure Sundays are wrapped around to '0'
instead of '7', making it consistent with the output for positive times.
2020-06-29 14:27:10 +08:00
Juan Linietsky 201d606b3d Addition of SDFGI for open world global illumination
Move GI to a deferred pass
2020-06-26 11:06:48 -03:00
Rémi Verschelde 23f7f86914 Style: Fix copyright headers 2020-06-25 16:33:44 +02:00
Rémi Verschelde 850134aff9
Merge pull request #39617 from mrushyendra/bilinear_interpolation
Fix upscaling image with bilinear interpolation option specified
2020-06-24 21:58:43 +02:00
Rémi Verschelde 42c4a701dd
Merge pull request #39755 from Faless/crypto/encryption_pr_4.0
Crypto enhancements, AESContext, RSA public key, signature, verification.
2020-06-22 23:31:58 +02:00
Rémi Verschelde 35414f1dec
Merge pull request #39053 from timoschwarzer/static-assert-variant-arg-max
Add static_assert checks where code assumes VARIANT_ARG_MAX == 5
2020-06-19 23:51:22 +02:00
Andy Maloney 37a2a5a997 Ensure FileAccessBuffered structs are properly initialized 2020-06-19 11:36:28 -04:00
Maganty Rushyendra f24ec3878e Fix upscaling image with bilinear interpolation option specified
Fix error in calculation of 4 nearest points in source image when
resizing image with bilinear interpolation.
2020-06-19 09:38:42 +08:00
Fabio Alessandrelli 8e3f9aa681 Implement RSA encryption/decryption. 2020-06-18 15:29:39 +02:00
Fabio Alessandrelli dfcc11fa52 Implement sign and verify in crypto. 2020-06-18 15:29:39 +02:00
Fabio Alessandrelli 788f18086e CryptoKey supports public keys. 2020-06-18 15:29:39 +02:00
Fabio Alessandrelli 9a462e07a4 Add AESContext.
GDScript interface to CryptoCore::AESContext.
Also add CBC mode in CryptoCore::AESContext and expose it.
2020-06-18 15:26:24 +02:00
Aaron Franke 0fa478a050
Simplify Transform2D get_rotation 2020-06-17 01:00:42 -04:00
Rémi Verschelde 309adb93cd
Merge pull request #39484 from hbina/use_nullptr_in_macros
Check pointers against nullptr.
2020-06-16 10:42:56 +02:00
Rémi Verschelde 4b5b60de85
Merge pull request #39189 from touilleMan/issue-38925
Unify OS.get_system_time_* and OS.get_unix_time
2020-06-15 23:57:16 +02:00
Hanif Bin Ariffin 4fea536517 Check pointers against nullptr. 2020-06-15 16:20:36 -04:00
Rémi Verschelde 6f938c761e
Merge pull request #39483 from AndreaCatania/euler
Added more euler rotation orders support.
2020-06-15 20:38:11 +02:00
Rémi Verschelde f61e4216b7
Merge pull request #39439 from Lefl1/rename_get_action_list
Renamed InputMap.get_action_list to InputMap.action_get_events
2020-06-15 19:59:07 +02:00
Lennard f515071edc Renamed InputMap.get_action_list to InputMap.get_action_events 2020-06-15 14:01:53 +02:00
Andrea Catania 2331300989 - Added more euler rotation orders support.
- Fixed floating point issue on the old one.
- Fixed the equation on the get_euler_yxz function.
- Added unit tests.

This work has been kindly sponsored by IMVU.
2020-06-12 20:03:27 +02:00
Rémi Verschelde b3bc5aafc5 Object: Add usage hint to instantiate Object properties in editor
Fixes #36372 as Path2D/Path3D's `curve` property no longer uses a Curve
instance as default value, but instead it gets a (unique) default Curve
instance when created through the editor (CreateDialog).

ClassDB gets a sanity check to ensure that we don't do the same mistake
for other properties in the future, but instead use the dedicated
property usage hint.

Fixes #36372.
Fixes #36650.

Supersedes #36644 and #36656.

Co-authored-by: Thakee Nathees <thakeenathees@gmail.com>
Co-authored-by: simpuid <utkarsh.email@yahoo.com>
2020-06-12 14:30:18 +02:00
Rémi Verschelde cbcc0eacd5 String: Use ABS macro in padding code
Follow-up to #39261.
2020-06-11 11:39:21 +02:00
Rémi Verschelde 7217a7edbd
Merge pull request #39230 from ntfshard/expression_string_singlequote
Fix for Expression class: string inside an expression can't be single quoted
2020-06-11 09:37:35 +02:00
Rémi Verschelde 786fc63faa
Merge pull request #39261 from mrushyendra/string_padding
Enable zero padding with float specifier for format strings
2020-06-11 09:37:16 +02:00
Pedro J. Estébanez 4e4b1d7568 Fix potential crash when listing leaked objects
Note:
Casting to the C++ classes and calling the methods there would work as well,
but would require including he header files for the specific object types handled
here, which wouldn't be OK either.
2020-06-10 20:44:11 +02:00
Rémi Verschelde 47f1faf512
Merge pull request #39409 from akien-mga/astar-get_closest_point-deterministic
AStar: Make get_closest_point() deterministic for equidistant points
2020-06-10 10:46:35 +02:00
Rémi Verschelde 187ba4c5a8 AStar: Make get_closest_point() deterministic for equidistant points
Closes godotengine/godot-docs#3667.
Supersedes #39405.
2020-06-09 11:04:12 +02:00
Rémi Verschelde 2b5545270a Core: Add hints to run with --verbose when leaking nodes/resources at exit 2020-06-08 16:48:21 +02:00
Rémi Verschelde e7ebda975a VariantParser: Fix crash on malformed vectors
Each time `r_err_str` is set, we should return a parse error.

Removed redundant `return OK;` which were already handled after the big
`if`/`else if`/`else` for `TK_IDENTIFIER`.

Part of #17372.
2020-06-08 11:38:13 +02:00
Rémi Verschelde ec1bf96e41
Merge pull request #39200 from azagaya/fix-blend-2
Fixing wrong blending rect methods
2020-06-07 15:52:22 +02:00
Fabio Alessandrelli 87cc283b8b Crypto as a custom instance class. 2020-06-06 17:33:44 +02:00
Fabio Alessandrelli 054f52364f Fix editor crash when mbedtls is disabled. 2020-06-06 17:33:43 +02:00
Rémi Verschelde 50cb781b1b
Merge pull request #39316 from Anutrix/remove-hashmap-reduntant-func
Remove unused function get_key_value_ptr_array from hash_map.h and another tiny fix.
2020-06-05 11:53:54 +02:00
unknown c9edc82b3b Remove unused function get_key_value_ptr_array from hash_map.h and also fix parameter name in function get_key_list. 2020-06-05 13:13:42 +05:30
Rémi Verschelde 938334cc9e Sync controller mappings DB with SDL2 community repo
Synced with gabomdq/SDL_GameControllerDB@6191f6333b.
2020-06-04 15:52:27 +02:00
Maganty Rushyendra b7d835d9ca Enable zero padding with float specifier for format strings
Godot currently supports zero padding for integers, octals and
hexadecimals when using format strings, but not for floats.

This commit adds support for zero padding for floats, thus ensuring
consistent behavior for all types, and making Godot's format specifiers'
behavior closer to c's `printf()`.

Before: `print("<%07.2f>" % -0.2345)` prints `<  -0.23>`.
Now: `print("<%07.2f>" % -0.2345)` prints `<-000.23>`.
     `print("<%7.2f>" % -0.2345)` prints `<  -0.23>`.
2020-06-03 21:21:27 +08:00
Yuri Roubinsky d7cf1b5c73 Fix docs generation for Vector2i/Vector3i/Rect2i 2020-06-03 15:22:26 +03:00
Aaron Franke 25c978730b
Rename String bin_to_int64 to bin_to_int
And also change String static to_int(const char *) to return int64_t
2020-06-03 00:04:15 -04:00
Aaron Franke e5ae89775a
Remove 32-bit String hex_to_int method 2020-06-03 00:03:34 -04:00
Aaron Franke bb8aa107fd
Remove 32-bit String to_int method 2020-06-03 00:03:34 -04:00
ntfs.hard ec164b2301 Fix for Expression class: inner string can be single quoted 2020-06-02 13:44:53 +03:00
Hugo Locurcio 9c0d214776
Print errors when calling MIDI input methods on unsupported platforms
This partially addresses #32065.
2020-05-31 19:10:27 +02:00
azagaya b211a86ebe Fixing wrong blending rect methods
Using Color.blend function instead of custom code

Fixed clang_format

Removed unnecessary help
2020-05-31 14:06:53 -03:00
Emmanuel Leblond c6de3872f9
Remove OS.get_system_time_secs/get_system_time_msecs and change OS.get_unix_time return type to double 2020-05-31 14:19:31 +02:00
Rémi Verschelde 1620669f4e
Merge pull request #39051 from Xrayez/geometry-split
Split `Geometry` singleton into `Geometry2D` and `Geometry3D`
2020-05-29 12:10:37 +02:00
Rémi Verschelde a16031beb6 Use translated docs in PropertySelector
And do the dedent and stripping for both translated and
non-translated strings for consistency, and so that we
don't need to do it at the call site.
2020-05-28 12:02:12 +02:00
Maganty Rushyendra 4ef246f804 Fix unsigned integer bug in LocalVector::erase
`erase()` calls `find()` to get the index of the element to remove, if
any.

c2151e1813/core/local_vector.h (L77-L81)

`find()` returns a signed integer. In particular, it returns -1 if
no element is found. Since `erase()` converts this to an unsigned type, the
wrong element may be erroneously removed from the vector.

Other ways to fix this would involve changing function signatures, so
this seemed to be the least disruptive change.

Fixes #38884
2020-05-27 21:53:34 +08:00
Andrii Doroshenko (Xrayez) 69d5de632e Split `Geometry` singleton into `Geometry2D` and `Geometry3D`
Extra `_2d` suffixes are removed from 2D methods accoringly.
2020-05-27 14:28:34 +03:00
Timo Schwarzer 05b32fc01d
Add static_assert checks where code assumes VARIANT_ARG_MAX == 5 2020-05-25 21:55:03 +02:00
Rémi Verschelde 0183bfbb0f Improve documentation of ProjectSettings::setup
Subsequent PRs adding and fixing support for bundled PCKs
did not update the documentation /o\
2020-05-25 17:50:36 +02:00
Rémi Verschelde a55a97119b
Merge pull request #38887 from AndreaCatania/oahash_imp
OAHashMap crash fix and copy feature.
2020-05-25 11:55:06 +02:00
Andrea Catania 094a05d44e - Make sure it's impossible to initialize an OAHashMap with 0 capacity (would cause division by 0)
- Added possibility to copy an OAHashMap
- Added unit tests

This code is generously donated by IMVU.
2020-05-25 11:18:02 +02:00
Rémi Verschelde 57d21ebeda
Merge pull request #38396 from nekomatata/unexpose-sort-children
Fix Container sorting not working when overriding _sort_children in gdscript
2020-05-23 20:22:44 +02:00
Rémi Verschelde a891c71426
Merge pull request #38886 from Xrayez/save-png-to-buffer-bind
Expose `Image.save_png_to_buffer` method
2020-05-22 09:48:23 +02:00
Paul Herman 7d4b3e6587 Expose loading TGA images in Image. 2020-05-21 16:02:53 +02:00
bruvzg 409562558a
Docs: Fix order of variant constants. 2020-05-20 16:45:42 +03:00
Andrii Doroshenko (Xrayez) d4d4229d9d Expose `Image.save_png_to_buffer` method 2020-05-20 14:43:24 +03:00
bruvzg d0b5174b6a
[Windows] Add tablet driver selection. 2020-05-20 09:37:32 +03:00
Rémi Verschelde 85220fec01 Style: Remove unnecessary semicolons from `core`
Semicolons are not necessary after function definitions or control flow
blocks, and having some code use them makes things inconsistent (and
occasionally can mess up `clang-format`'s formatting).

Removing them is tedious work though, I had to do this manually (regex
+ manual review) as I couldn't find a tool for that. All other code
folders would need to get the same treatment.
2020-05-19 15:57:56 +02:00
Rémi Verschelde ca3192d18a Style: Fix unnecessary semicolons that confused clang-format 2020-05-19 11:24:58 +02:00
Rémi Verschelde 36ba9fabde
Merge pull request #38567 from AndreaCatania/AndreaCatania-patch-3
Removed const from OAHashMap iterator value
2020-05-19 10:26:05 +02:00
Hanif Ariffin 0fa9ea7095
Avoid copying vector in constructor of PathMD5
Copying the vector is unnecessary here.
2020-05-18 18:52:04 -04:00
Pedro J. Estébanez b720a01849 Fix leaks and crashes in OAHashMap
This changes the way the lifespan of items is managed to be consistent.

Bonus: Simplify cases of destroy-then-emplace.
2020-05-18 14:02:52 +02:00
PouleyKetchoupp 3ad694018f Fix Container sorting not working when overriding _sort_children in gdscript
Remove _sort_children from script bindings:
_sort_children is an internal method which shouldn't be exposed to scripts.

Added support for non-bound methods in MessageQueue:
So we can use deferred calls without exposing internal methods to scripts.

Added debug checks in CallableCustomMethodPointer:
Adding method pointer callables to the message queue was causing crashes
in case an object was destroyed and the same memory was allocated for
another one. The new object had a valid object id but the call was erroneous.
Release will be fixed later, along with Variant which has the same problem and
is also fixed for debug only.
2020-05-16 18:13:25 +02:00
Hugo Locurcio d935a4348d
Remove HQ2X and the `Image.expand_2x_hq2x()` method
As of Godot 3.0, HQ2X is no longer used to upscale the editor theme
and icons on hiDPI displays, which limited its effective uses.
HQ2X was also used to upscale the project theme when the "Use Hidpi"
project setting was enabled, but results were often less than ideal.
The new StyleBoxFlat and SVG support also make HQ2X less important
to have as a core feature.

This decreases binary sizes slightly (-150 KB on most platforms,
-212 KB on WebAssembly release).

This partially addresses #12419.
2020-05-16 16:10:50 +02:00
Rémi Verschelde 5b53f22774
Merge pull request #38760 from akien-mga/error-macros-style
Error macros: Improve style of error messages
2020-05-15 22:04:52 +02:00
Rémi Verschelde 0ed7d3a40a Error macros: Improve style of error messages
Document why the `if (1) {} else ((void)0)` construct is used.
2020-05-15 18:21:14 +02:00
Rémi Verschelde f06c44a02c
Merge pull request #38717 from madmiraal/fix-image-uninitialized-warning
Silence 'w' may be used uninitialized in image.cpp warning.
2020-05-15 18:05:53 +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 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 710b34b702 Style: Fix missing/invalid copyright headers 2020-05-14 16:54:54 +02:00
Marcel Admiraal 6c4c1bf53d Silence 'w' may be used uninitialized in image.cpp warning.
Rename `w` to the more meaningful `data_write`
2020-05-14 15:24:17 +01:00
Rémi Verschelde dcd1151d77 Enforce use of bool literals instead of integers
Using clang-tidy's `modernize-use-bool-literals`.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-bool-literals.html
2020-05-14 13:45:01 +02:00
Rémi Verschelde 1a8167867b Modernize remaining uses of 0/NULL instead of nullptr (C++11)
Using clang-tidy's `modernize-use-nullptr`.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
2020-05-14 13:45:01 +02:00
Rémi Verschelde 1f6f364a56 Port member initialization from constructor to declaration (C++11)
Using `clang-tidy`'s `modernize-use-default-member-init` check and
manual review of the changes, and some extra manual changes that
`clang-tidy` failed to do.

Also went manually through all of `core` to find occurrences that
`clang-tidy` couldn't handle, especially all initializations done
in a constructor without using initializer lists.
2020-05-14 10:01:56 +02:00
Marcel Admiraal e0d4e840b4 Implement half axis and inverted axis mapping. 2020-05-13 10:33:32 +01:00
Marcel Admiraal e7fee711b3 Update game controller enums. 2020-05-13 10:33:32 +01:00
Marcel Admiraal 1176e078b9 Parse SDL game controller half axis and inverted axis entries. 2020-05-13 10:33:19 +01:00
Fabio Alessandrelli ed225faf31 Add support for multiple RemoteDebuggerPeer(s).
It is now possible to register protocol handlers (default tcp://) to
support additional debugging communication layers (e.g. websocket).
2020-05-12 15:09:13 +02:00
Hugo Locurcio c6fbbdf15d Rename SSL certificate bundle setting to clarify the "overriding" aspect
This closes https://github.com/godotengine/godot-docs/issues/2531.
2020-05-12 10:13:27 +02:00
Rémi Verschelde 83b630b8c2 thirdparty: Cleanup after #38386, document provenance and copyright
Also renamed `delaunay.h` to `delaunay_2d.h` to match the class name.
2020-05-11 14:50:06 +02:00
Rémi Verschelde 32133a11b5
Merge pull request #38386 from reduz/new-lightmapper
New GPU lightmapper
2020-05-11 13:45:48 +02:00
Rémi Verschelde 1c61b31109 Input: Readd 'Default Android Gamepad' magic binding
Removed by mistake in #38292 like the Windows `__XINPUT_DEVICE__`,
this magic binding is referenced directly in our code.
2020-05-11 11:07:04 +02:00
Juan Linietsky 1bea8e1eac New lightmapper
-Added LocalVector (needed it)
-Added stb_rect_pack (It's pretty cool, we could probably use it for other stuff too)
-Fixes and changes all around the place
-Added library for 128 bits fixed point (required for Delaunay3D)
2020-05-10 15:59:09 -03:00
Rémi Verschelde 6a0473bcc2
Merge pull request #38548 from kuruk-mm/add_string_join_to_gdscript
GDScript: Add join method on String
2020-05-10 16:54:45 +02:00
Rémi Verschelde 94721f5ab8 Revert "Renamed plane's d to distance"
This reverts commit ec7b481170.

This was wrong, `d` is not a distance but the `d` constant in the
parametric equation `ax + by + cz = d` describing the plane.
2020-05-10 16:47:11 +02:00
Rémi Verschelde 69de7ce38c Style: clang-format: Disable AllowShortCaseLabelsOnASingleLine
Part of #33027.
2020-05-10 13:13:54 +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 03b13e0c69 Style: Add missing copyright headers 2020-05-10 13:12:16 +02:00
Rémi Verschelde a128dd97d6
Merge pull request #37020 from aaronfranke/range
Allow using integer vectors for iteration and make range() use them
2020-05-10 13:11:07 +02:00
Marcus Elg ec7b481170 Renamed plane's d to distance 2020-05-10 12:12:51 +02:00
Rémi Verschelde a4b829410c
Merge pull request #38481 from RandomShaper/improve_yield
Fix object leaks caused by unfulfilled yields
2020-05-09 22:02:52 +02:00
Aaron Franke 38a0ff2249
Allow Vector2/Vector3 iterators to have non-integer values 2020-05-09 13:43:35 -04:00
Aaron Franke f7b50992b5
Allow using integer vectors for iteration and make range() use them 2020-05-09 13:43:35 -04:00
Mateo Kuruk Miccino 8c2dc177b6 GDScript: Add join method on String
Docs: Add join on String.xml
2020-05-09 12:16:21 -03:00
Andrea Catania 97f9bbcfa3
Removed const from OAHashMap iterator value
to allows to mutate the value while iterating over it.
2020-05-08 14:21:46 +02:00
hoontee 9aa29b85a8
Re-add __XINPUT_DEVICE__
Required for `JoypadWindows::probe_joypads`.
Partially reverts 510e83498e. Fixes #38554.
2020-05-07 22:19:42 -05:00
Rémi Verschelde ae33cf5f45
Merge pull request #36379 from aaronfranke/color-constructors
Add a Color constructor for Color with alpha
2020-05-07 21:16:51 +02:00
Rémi Verschelde bd75e2538b
Merge pull request #38536 from ThakeeNathees/trnasform-2-transform2d-convert-fix
Fix: can't convert Transform -> Transform2D
2020-05-07 20:56:50 +02:00
Thakee Nathees e32cdbe568 Fix: can't convert Transform -> Transform2D
Fix: #38528
2020-05-07 21:40:53 +05:30
Rémi Verschelde 77e19d116e
Merge pull request #38522 from ThakeeNathees/printing-empty-string-fix
Fix: printing empty string does nothing in editor output pannel
2020-05-07 18:05:36 +02:00
Thakee Nathees 5640cad1e1 Fix: printing empty string does nothing in editor output pannel
Fix: #38490
2020-05-07 05:56:29 +05:30
Rémi Verschelde 33d0b9e169
Merge pull request #38393 from nekomatata/printerr-remote-debugger-4.0
Format remote printerr properly in script debugger output
2020-05-06 07:31:57 +02:00
Pedro J. Estébanez 46bfe4452f Fix object leaks caused by unfulfilled yields
Now the stack saved in a `GDScriptFunctionState` is cleared as soon as the `yield()` operation is known not to be resumed because either the script, the instance or both are deleted.

This clears problems like leaked objects by eliminating cases of circular references between `GDScriptFunctionState`s preventing them and the objects they refer to in their saved stacks from being released. As an example, this makes using `SceneTreeTimer` safer.

Furthermore, with this change it's now possible to print early warnings about `yield()`s to released script/instances, as now we know they won't be successfully resumed as the condition for that happens. However, this PR doesn't add such messages, to keep the observed behavior the same for the time being.

Also, now a backup of the function name in `GDScriptFunctionState` is used, since the script may not be valid by the time the function name is needed for the resume-after-yield error messages.
2020-05-05 17:54:15 +02:00
Rémi Verschelde 8227947d41
Merge pull request #38415 from madmiraal/fix-array-slicing
Fix array slicing.
2020-05-05 16:44:52 +02:00
bruvzg d978658f81
[Windows] Add support for the WinTab API for pen input. 2020-05-05 14:16:02 +03:00
Marcel Admiraal 54c36adbec Check for empty vectors before trying to access a pointer to the first
element in Octree<T, use_pairs, AL>::cull_convex().
2020-05-04 21:02:58 +01:00
Rémi Verschelde 97c787b84d
Merge pull request #37937 from HaSa1002/fix-pck
Priorize Embedded PCKs on loading
2020-05-04 16:14:39 +02:00
HaSa1002 fba98950c7 Priorize Embedded PCKs on loading
If existing, embedded PCKs are loaded before the pcks the engine might
find next to it.

Fixes #37568
2020-05-04 15:24:25 +02:00
Rémi Verschelde ec542db782
Merge pull request #38394 from reduz/implement-skew
Implement Skew in Node2D
2020-05-03 18:17:08 +02:00
Hugo Locurcio 596d426151
Remove some C++11 polyfill defines that are no longer needed 2020-05-03 00:42:04 +02:00
Marcel Admiraal 4409f3cc68 Fix array slicing. 2020-05-02 14:42:16 +01:00
Juan Linietsky efb1f7d76b Implement Skew in Node2D
Skew is x-axis only, because it must be bidirectionally convertible to a 2x3 matrix, but you can subtract it  to the rotation to get the effect on y-axis
2020-05-01 13:38:04 -03:00
PouleyKetchoupp aacf69bad2 Format remote printerr properly in script debugger output 2020-05-01 18:23:51 +02:00
Kiri Jolly 87ba4daf4b Fixed false positives in the culling system.
This fixes numerous false positives coming out of the culling system.

AABB checks are now a full separating-axis check against the frustum, with the points of the frustum being compared to the planes of the box just as the points of the box were being compared to the planes of the frustum. This fixes large objects behind the camera not being culled correctly.

Some systems that used frustums that were (sometimes mistakenly?) unbounded on one or more side have been modified to be fully enclosed.
2020-04-29 19:33:42 -07:00
Aaron Franke 90df1d67cb
Color with alpha constructor 2020-04-29 14:41:12 -04:00
Rémi Verschelde b99b212855
Merge pull request #38307 from Calinou/shell-open-res-user-warning
Warn when trying to open `res://` or `user://` with `OS.shell_open()`
2020-04-29 16:07:34 +02:00
Aaron Franke 540156b387
[Core] Rename linear_interpolate to lerp 2020-04-29 04:02:49 -04:00
Rémi Verschelde 10273e9de6
Merge pull request #38034 from punto-/punto-/vibration_info_protected
makes VibrationInfo protected
2020-04-29 09:57:17 +02:00
Rémi Verschelde 5cae0f3402
Merge pull request #37580 from aaronfranke/xform
Print errors when passing an invalid type to xform
2020-04-29 09:32:51 +02:00
punto- 41a7d07095 Input: make VibrationInfo protected to allow implementors to use it 2020-04-29 09:11:14 +02:00
Rémi Verschelde e445be6944
Merge pull request #38064 from aaronfranke/rotated
Improve the Vector2 rotated code
2020-04-28 20:49:22 +02:00
Aaron Franke 72ecd36cb3
Print errors when passing an invalid type to xform 2020-04-28 14:24:16 -04:00
Hugo Locurcio d46e411b44
Warn when trying to open `res://` or `user://` with `OS.shell_open()`
`OS.shell_open()` will pass on the path directly to the OS' shell
handler (which can handle file paths or URLs). It can't handle
Godot-specific paths, so these need to be converted with
`ProjectSettings.globalize_path()` first.
2020-04-28 19:37:09 +02:00
Rémi Verschelde d44c5cfcf7
Merge pull request #38295 from akien-mga/input-is-back
Rename InputFilter back to Input
2020-04-28 16:20:20 +02: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
Rémi Verschelde 510e83498e Input: Drop obsolete versions of SDL gamecontrollerdb
The 204 and 205 are the older, SDL 2.0.4 and 2.0.5 compatible mappings,
but since all new mappings have only been added to the main
gamecontrollerdb.txt which overrides the older entries, it doesn't make
much sense for us to keep the old databases.

We do not support the SDL2 half axes and inverted axes features from
gamecontrollerdb.txt, but this only impacts the specific controllers
which can use those features, the rest are parsed and used properly.

As for godotcontrollerdb.txt, it doesn't make sense for us to maintain
our own custom mappings instead of submitting them upstream. The only
exception is the Javascript and UWP platforms for which no bindings are
available upstream, so we keep those entries.
2020-04-28 14:51:44 +02:00
Tobias Mansfield-Williams 982efb1864 Add const to InputEventMouseButton::get_factor 2020-04-25 13:25:00 +02:00
Aaron Franke 23a349c427
Improve the Vector2 rotated code 2020-04-21 14:06:41 -04:00
Juan Linietsky f8ef38efed Add proper type to most public API uses of Array 2020-04-21 12:16:45 -03:00
Juan Linietsky 5d4dc2d45c 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
Juan Linietsky ae09b55a19 Exposed RenderingDevice to script API
Also added an easier way to load native GLSL shaders.

Extras:

Had to fix no-cache for subresources in resource loader, it was not properly working, making shaders not properly reload.

Note:

The precommit hooks are broken because they don't seem to support enums from one class being used in another.
Feel free to fix this after merging this PR.
2020-04-20 21:21:58 -03:00
Rémi Verschelde 114ffb19e6
Merge pull request #37982 from DrMoriarty/fix_square_resize
Fix square image resize
2020-04-20 23:56:23 +02:00
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
Rémi Verschelde 9cf48b3e99
Merge pull request #38039 from akien-mga/docdata-skip-unexposed
DocData: Skip unexposed classes
2020-04-20 15:21:49 +02:00
Rémi Verschelde 0ef8bcac4d DocData: Skip unexposed classes
Properly expose classes that we actually want accessible.
2020-04-20 12:51:10 +02:00
Rémi Verschelde 515fe0f29b Revert "Made possible to specify where to dump the contents when loading a ".pck" file"
This reverts commit 3c261e0dfa.

This was not so useful as is due to the way dependency paths are stored
in scenes and resources.
2020-04-20 10:57:05 +02:00
Vasiliy Makarov d45e8734d1 Fix square image resize
Fixes #37980
2020-04-18 13:29:01 +03:00
Michael Alexsander 3c261e0dfa Made possible to specify where to dump the contents when loading a ".pck" file 2020-04-16 22:52:26 -03:00
qarmin 943ec79859 Fixes leaks in ResourceCache, Vulkan and X11 2020-04-15 10:27:57 +02:00
Marcel Admiraal 8e6e91f2cd Remove unnecessary check for zero determinant in Basis::orthonormalize(). 2020-04-14 17:20:45 +01:00
Juan Linietsky 5944eb6e7f Implement decals
Also implemented decal atlas, so projectors and other stuff can be added.
Sidenote: Had to make RID hashable, so some unrelated includes changed
in order to include it in hashfuncs.h
2020-04-14 11:13:34 -03:00
Rémi Verschelde 0826b63c7e
Merge pull request #37450 from SkyLucilfer/profilerBug
Fix profiler frame number stops updating when window is minimized
2020-04-10 17:56:28 +02:00
Rémi Verschelde d41444b0d8
Merge pull request #37693 from lupoDharkael/remove-hint
Remove obsolete enums
2020-04-10 11:47:44 +02:00
Rémi Verschelde 95db658672
Merge pull request #37699 from lupoDharkael/committing-typo
Replace is_commiting_action with is_committing_action
2020-04-10 11:47:19 +02:00
Marcel Admiraal 0b9e95cac5 Fix Engine get_target_fps() returning float instead of int. 2020-04-10 06:48:22 +01:00
lupoDharkael 5021dcfcd6 Remove obsolete enums 2020-04-08 20:44:01 +02:00
lupoDharkael 406c2790e3 Replace is_commiting_action with is_committing_action 2020-04-08 18:52:04 +02:00
Juan Linietsky 4ffc0d6b3f Refactored shadowmapping.
- Made shadow bias size independent, so it will remain when changing light or camera size.
- Implemented normal offset bias, which greatly enhances quality.
- Added transmission to subsurface scattering
- Reimplemented shadow filter modes

Closes #17260
2020-04-08 11:19:43 -03:00
Rémi Verschelde 8c8e3ba918
Merge pull request #37579 from Calinou/improve-shader-error-output
Improve the shader error console output
2020-04-07 09:17:37 +02:00
Bastiaan Olij 94fab21348 Fix aspect ratio on hmd projection matrix
(cherry picked from commit a7438f0e61)
2020-04-05 12:41:29 +02:00
Hugo Locurcio 5fae0c454a
Improve the shader error console output
This makes the line gutter look more like an actual line gutter,
which makes it less confusing.
2020-04-04 14:27:44 +02:00
Ignacio Etcheverry 27ddb27da8 Fix C# bindings after recent breaking changes 2020-04-03 01:38:48 +02:00
Rémi Verschelde ea7b497065 Replace more occurrences of NULL with nullptr 2020-04-02 14:56:01 +02:00
lupoDharkael 95a1400a2a Replace NULL with nullptr 2020-04-02 13:38:00 +02:00
Rémi Verschelde 5f11e15571
Merge pull request #37504 from qarmin/out_of_bound_cursor
Fix array out of bounds access caused by uninitialised variables
2020-04-02 13:07:55 +02:00
Zak Grumbles d648f77119
Make dict erase node sequenced godotengine#37477
* Updated macro call to make the visual Dictionary Erase node sequenced.
2020-04-01 22:10:12 -05:00
Rafał Mikrut 359bebd8c0 Fix out of bound array access caused by unassigned variable 2020-04-01 19:29:35 +02:00
Thakee Nathees cb53b1d88e some typo in method binds fixed 2020-04-01 14:01:18 +05:30
SkyJJ c1ee20a05d Fix profiler frame number stops updating when window is minimized 2020-03-31 03:49:29 +02:00
Rémi Verschelde cd4e46ee65 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
Juan Linietsky 0c24a844ec Ensure COWData does not reallocate on push back, fixes #22561 2020-03-27 21:52:42 -03: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
Rémi Verschelde f725bd99f4 Fix some -Wmaybe-uninitialized warnings
Namely:
```
modules/basis_universal/register_types.cpp: In function 'Ref<Image> basis_universal_unpacker(const Vector<unsigned char>&)':
modules/basis_universal/register_types.cpp:266:15: warning: 'imgfmt' may be used uninitialized in this function [-Wmaybe-uninitialized]
  266 |  image->create(info.m_width, info.m_height, info.m_total_levels > 1, imgfmt, gpudata);
      |  ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
modules/basis_universal/register_types.cpp:255:39: warning: 'format' may be used uninitialized in this function [-Wmaybe-uninitialized]
  255 |    bool ret = tr.transcode_image_level(ptr, size, 0, i, dst + ofs, level.m_total_blocks - i, format);
      |               ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

```
servers/visual_server.cpp: In member function 'Error VisualServer::_surface_set_data(Array, uint32_t, uint32_t*, uint32_t, Vector<unsigned char>&, int, Vector<unsigned char>&, int, AABB&, Vector<AABB>&)':
servers/visual_server.cpp:636:15: warning: 'iw' may be used uninitialized in this function [-Wmaybe-uninitialized]
  636 |       copymem(&iw[i * 2], &v, 2);
      |               ^
```

```
core/image.cpp: In member function 'Error Image::generate_mipmap_roughness(Image::RoughnessChannel, const Ref<Image>&)':
core/image.cpp:1683:11: warning: 'roughness' may be used uninitialized in this function [-Wmaybe-uninitialized]
 1683 |     float roughness;
      |           ^~~~~~~~~
```
2020-03-27 14:33:06 +01:00
bruvzg 15a9f94346 Add macOS DisplayServer implementation.
Change global menu to use Callable, add support for check items and submenus.
2020-03-26 16:24:05 +01:00