Commit graph

5131 commits

Author SHA1 Message Date
K. S. Ernest (iFire) Lee d840165a32
Add etcpak library for faster ETC/ETC2/S3TC imports.
- `etc` module was renamed to `etcpak` and modified to use the new library.
- PKM importer is removed in the process, it's obsolete.
- Old library `etc2comp` is removed.
- S3TC compression no longer done via `squish` (but decompression still is).
- Slight modifications to etcpak sources for MinGW compatibility,
  to fix LLVM `-Wc++11-narrowing` errors, and to allow using vendored or
  system libpng.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2021-04-13 00:12:12 +02:00
Julien Nguyen 9936abb3d5 Fix type argument in is_builtin which was treated as an address 2021-04-11 20:34:48 +02:00
George Marques cf4079cb5f
Reduce number of addressing modes in GDScript VM
There's now only 3 addressing modes: stack, constant, and member.

Self, class, and nil are now present respectively in the first 3 stack
slots. Global and class constants are moved to local constants when
compiling. Named globals is only present on editor to use on tool
singletons, so its use now emits a new instruction to copy the global to
the stack.

This allow us to further optimize the VM later by embedding the
addressing modes in the instructions themselves, which is better done
with less permutations.
2021-04-08 14:29:55 -03:00
George Marques 5f77f38573
Add runner for GDScript testing
This is meant for testing the GDScript implementation, not for testing
user scripts nor testing the engine using scripts.

Tests consists in a GDScript file and a .out file with the expected
output. The .out file format is: expected status (based on the enum
GDScriptTest::TestStatus) on the first line, followed by either an error
message or the resulting output. Warnings are added after the first
line, before the output (or compiler errors) if the parser pass without
any error.

The test script must have a function called `test()` which takes no
argument. Such function will be called by the test runner. The test
should not have any dependency unless it's part of the test too. Global
classes (using `class_name`) are registered before the runner starts, so
those should work if needed.

Use the command `godot --gdscript-generate-tests
godot-source/modules/gdscript/tests/scripts` to update the .out files
with the current output (make sure the output are the expected values
before committing).

The tests themselves are part of the doctest suite so those can be
executed with `godot --test`.

Co-authored-by: Andrii Doroshenko (Xrayez) <xrayez@gmail.com>
2021-04-08 09:34:59 -03:00
Lyuma 7d8e981262 Fix crash on importing empty .fbx file 2021-04-08 02:50:01 -07:00
Fabio Alessandrelli f7ae5442a6
Merge pull request #47708 from Calinou/doc-websocketclient-secure
Document secure wss:// caveats for WebSocketClient
2021-04-08 00:47:04 +02:00
Rémi Verschelde 40dff7117a
Merge pull request #47648 from Blackiris/fix-gdscript-editor-hangs
Fix infinite loop when guessing argument type from parent class
2021-04-07 23:19:29 +02:00
Rémi Verschelde 73a1253095
Merge pull request #47672 from Blackiris/fix-setter-stackoverflow
Fix stack overflow in setter
2021-04-07 23:17:30 +02:00
Hugo Locurcio a56e37545b
Document secure wss:// caveats for WebSocketClient
See https://github.com/godotengine/godot/issues/37739.
2021-04-07 21:32:17 +02:00
Rémi Verschelde e261c2dd9d
Merge pull request #46877 from W4RH4WK/always-dynamically-allocate-property-table
Always dynamically allocate PropertyTable
2021-04-07 11:25:38 +02:00
Marcel Admiraal ff9a6c4e39 Check for the use of an empty shape in Bullet Kinematic collisions 2021-04-06 18:40:13 +01:00
Julien Nguyen 43c1c680f0 Fix stack overflow in setter 2021-04-06 19:00:08 +02:00
Bastiaan Olij 81131bd844 Only cleanup meta data if GDNative library is reloadable and we're about to unload it 2021-04-06 11:55:15 +10:00
Julien Nguyen 20f18f1621 Fix infinite loop when guessing argument type from parent class 2021-04-05 16:39:41 +02:00
Rémi Verschelde 5b2c4ad91c
Merge pull request #47569 from vnen/gdscript-typed-return
GDScript: Properly validate return type
2021-04-05 15:16:43 +02:00
George Marques 35682d3079
GDScript: Properly validate return type
When the type cannot be validated at compile time, the runtime must do a
check to ensure type safety is kept, as the code might be assuming the
return type is correct in another place, leading to crashes if the
contract is broken.
2021-04-05 09:52:05 -03:00
Rémi Verschelde d83761ba80
Style: Apply clang-tidy's readability-braces-around-statements 2021-04-05 14:09:59 +02:00
Rémi Verschelde 9bbe51dc27
Style: Apply clang-tidy's modernize-use-nullptr 2021-04-05 14:05:07 +02:00
Rémi Verschelde 65a2888057
Style: Apply clang-tidy's modernize-use-default-member-init 2021-04-05 13:37:27 +02:00
Rémi Verschelde 0f0c0e5933
Style: Apply clang-tidy's modernize-use-bool-literals 2021-04-05 13:16:35 +02:00
Rémi Verschelde 33b8f1448e
Merge pull request #47592 from jmb462/fix-VisualScriptFunctionState-connect-to-null-signal-crash
Fix VisualScriptFunctionState connect to null object crash (Fix #47572)
2021-04-05 12:15:58 +02:00
Rémi Verschelde e0b24467f7
Merge pull request #47627 from Blackiris/fix-gdscript-var-address
Fix GDScript variables addresses getting mixed
2021-04-05 11:55:47 +02:00
Rémi Verschelde 77dc4c3cb6
Merge pull request #47636 from qarmin/input
Fix crashes in *_input functions
2021-04-05 11:54:08 +02:00
Rafał Mikrut 504bc5cc67 Fix crashes in *_input functions 2021-04-05 08:52:21 +02:00
Julien Nguyen 3168c2a513 Fix GDScript variables addresses getting mixed 2021-04-04 19:03:15 +02:00
Jan Haller 0fe851da23 Fixes #47607 (forgotten statement in GDNative cleanup)
Co-authored-by: geekrelief <geekrelief@gmail.com>
2021-04-04 16:11:16 +02:00
jmb462 3a0a71fa6a Fix VisualScriptFunctionState connect to null object crash 2021-04-03 12:13:26 +02:00
Rémi Verschelde ed2f51b15f
Merge pull request #47452 from BastiaanOlij/xr_positional_tracker_ref
Change XRPositionalTracker to a reference (master)
2021-04-03 10:13:23 +02:00
Rémi Verschelde 4b6e9f3157
Merge pull request #46991 from madmiraal/rename-invert-reverse
Rename Array.invert() to Array.reverse()
2021-04-01 13:32:22 +02:00
Kyle 618dd892f5 Fix gdnative config file set as null
Fixes #

Setting a GDNativeLibrary config file as null or any other object but a ConfigFile will now cause an error.
2021-03-31 15:00:31 -04:00
Rémi Verschelde 9cd1e50969
Merge pull request #47250 from BastiaanOlij/check_vulkan_version
Obtain supported Vulkan API
2021-03-31 13:45:43 +02:00
Bastiaan Olij e93c9fc4ed As GLSLang seems to be all or nothing, added our own defines 2021-03-31 21:47:25 +11:00
bruvzg 0d3fa2a125
[Complex Text Layouts] Provide access to glyph contour points. 2021-03-31 09:32:14 +03:00
Rémi Verschelde 737f09895d
Merge pull request #47131 from vnen/gdscript-export-fix
Fix a few issues with @export in GDScript
2021-03-30 15:12:04 +02:00
Rémi Verschelde 7c14e987b4
Merge pull request #47492 from vnen/gdscript-typed-arrays
GDScript: Fix array type check on constants
2021-03-30 14:37:42 +02:00
George Marques 5d9585d83b
GDScript: Fix array type check on constants
They mistakenly pointing to the wrong union member (variable instead of
constant).
2021-03-30 09:09:13 -03:00
George Marques 2b9be53243
GDScript: Implement export of typed arrays 2021-03-30 08:29:38 -03:00
George Marques 160c260495
GDScript: Allow export of enum variables
Also fix the enum type in variables to be integer.
2021-03-30 08:29:38 -03:00
George Marques 3e4ecd9669
GDScript: Show error on invalid initializer expression 2021-03-30 08:29:38 -03:00
George Marques 577a17980d
Move GDSript annotation application after type-checking
This ensures that annotations that rely on the datatype (such as
@export) can validated it timely, allowing compound expressions instead
of only literal values.
2021-03-30 08:29:36 -03:00
Rémi Verschelde d71eed2865
FBX: Fix first bone getting unnecessary '_1' suffix
Fixes #43820.

Co-authored-by: Gordon MacPherson <gordon@gordonite.tech>
2021-03-29 17:25:12 +02:00
Rémi Verschelde aba03110ba
Merge pull request #46830 from vnen/gdscript-typed-arrays
GDScript typed arrays
2021-03-29 16:47:38 +02:00
Rémi Verschelde 58d302dd5f
Merge pull request #46844 from geekrelief/gdnative_unregister_script_fix
fixes #46839, ensure library_classes is cleared and free funcs are ca…
2021-03-29 16:11:11 +02:00
George Marques 85e316a5d5
Add typed arrays to GDScript
- Use `Array[type]` for type-hints. e.g.:
  `var array: Array[int] = [1, 2, 3]`
- Array literals are typed if their storage is typed (variable
  asssignment of as argument in function all). Otherwise they are
  untyped.
2021-03-29 10:45:48 -03:00
Bastiaan Olij 454c889e61 Change XRPositionalTracker to a reference and better expose it to GDNative 2021-03-29 23:01:47 +11:00
Marcel Admiraal fd30c36985 Rename Texture.get_data() to get_image() 2021-03-28 13:00:46 +01:00
Emmanuel Leblond 9761bab753
Add support for _to_string virtual function overwrite in Pluginscript 2021-03-27 21:13:51 +01:00
Bastiaan Olij a6c989bc1b Obtain supported Vulkan API 2021-03-26 12:06:57 +11:00
PouleyKetchoupp c8dd3c7d80 Heightmap collision shape support in Godot Physics 2021-03-25 16:52:41 -07:00
Rémi Verschelde 3a5929abf3
doc: Sync classref with current source 2021-03-25 12:19:51 +01:00
K. S. Ernest (iFire) Lee 60eb3dd6ad Always have a name for gltf2 mesh, material and skins.
Co-authored-by: Lcbx <luc.courbariaux@gmail.com>
2021-03-24 00:30:22 -07:00
Aaron Franke a5324787c8
Rename some more global enums (Key, Joy, MIDI) 2021-03-23 07:13:23 -04:00
Aaron Franke 10d7fccb54
Rename ButtonList enum and members to MouseButton 2021-03-23 07:13:23 -04:00
Rémi Verschelde eeba8d63f8
Merge pull request #44398 from RevoluPowered/unit-tests-for-export-templates
Add unit tests for export templates
2021-03-23 00:42:29 +01:00
Rémi Verschelde 11718dbef9 Merge pull request #45562 from aaronfranke/core-modules-real_t
Use real_t in GridMap and VariantParser
2021-03-23 00:10:04 +01:00
Gordon MacPherson 6b4ff3b44b Add unit tests for export templates 2021-03-22 18:57:08 +00:00
Juan Linietsky 97a3a66220 Improved 3D Scene Importer
* Added option for importers to show an Advanced settings dialog
* Created advanced settings dialog for Scene Importer
* Cleaned up importers (remove many old/unused options)
* Added the ability to customize every node, material, mesh and animation individually
* Saving to animations and meshes to files is now a manual process, making it more predictable
* Added the ability for materials to be replaced by external files (or to be made external, up to you).
* When doubleclicking an impoted scene in the filesystem dock, it automatically shows the import settings instead of asking to open it.

WARNING: Lightmap UV unwrap is not working, it needs to be re-made.
2021-03-22 12:16:40 -03:00
Marcel Admiraal 755c70b871 Rename Array.invert() to Array.reverse()
Does the same internally for List and Vector<>, which includes all
PackedArray types.
2021-03-21 10:20:08 +00:00
Rémi Verschelde 07f076fa4f
Merge pull request #47194 from W4RH4WK/fbx-normalize-rotations
FBX Import: Normalize rotation quaternions
2021-03-21 08:48:53 +01:00
Rémi Verschelde fa681d04b7
Merge pull request #46937 from nekomatata/soft-body-support
SoftBody support in GodotPhysics 3D
2021-03-20 21:45:20 +01:00
Rémi Verschelde 793000c6a9
Merge pull request #47139 from nekomatata/concave-backface-collision
Disable backface collision with ConcavePolygonShape by default
2021-03-20 21:43:57 +01:00
Alex Hirsch d03f4cefea FBX Import: Check bone map access for valid cluster target node id
fix #47184
2021-03-20 18:07:51 +01:00
Alex Hirsch 72d3bfc88c FBX Import: Normalize rotation quaternions
fix #47174
2021-03-20 17:46:25 +01:00
Aaron Franke affe3c817a
Use real_t in GridMap and VariantParser 2021-03-19 00:56:34 -04:00
Alex Hirsch d7ac5ba1c6 Fix missing quote in multiline GDScript string
fix #47117
2021-03-19 01:24:18 +01:00
Rémi Verschelde 47cf9985eb
Merge pull request #47128 from ArdaE/master
GLTF importer: Prevent quick accumulation of significant numerical errors in keyframe times
2021-03-19 00:14:51 +01:00
ArdaE 6770a9413b GLTF import: Prevent significant numerical errors in keyframe times
Keyframe times shift slowly in imported animations, starting with a zero shift
at the beginning and increasing and becoming erratic slowly farther into an
animation, reaching significant levels at times after about 3 minutes into an
animation. This commit fixes the issue by increasing the precision of the
floating point numbers used for keyframe time calculations. Only the most
significant cases that cause fast accumulation of errors over a short animation
duration are fixed. Other cases that would have a marginal benefit from
switching to double precision numbers are left for another PR/further analysis.
Note that this change has no impact on the runtime performance of games/apps
created using Godot. It only affects the GLTF importer.

Fixes #47127.
2021-03-18 15:55:31 -07:00
PouleyKetchoupp 7bbd545432 Disable backface collision with ConcavePolygonShape by default
Helps a lot with soft bodies and generally useful to avoid shapes to go
through the ground in certain cases.

Added an option in ConcavePolygonShape to re-enable backface collision
on specific bodies if needed.
2021-03-18 11:30:22 -07:00
Rémi Verschelde 2274d4eebc
Mono: Fix Android build after #46900 2021-03-18 17:58:21 +01:00
PouleyKetchoupp d5ea4acd2d SoftBody support in GodotPhysics 3D
- Fixed SoftBody surface update with new rendering system
- Added GodotPhysics implementation for SoftBody
- Added support to get SoftBody rid to interact with the physics server
- Added support to get SoftBody bounds from the physics server
- Removed support for unused get_vertex_position and get_point_offset
from the physics server
- Removed SoftBody properties that are unused in both Bullet and
GodotPhysics (angular and volume stiffness, pose matching)
- Added RenderingServerHandler interface to PhysicsServer3D so the physics servers don't need to reference the class from SoftBody node directly
2021-03-18 09:04:17 -07:00
Rémi Verschelde 4ca1e73ff9
doc: Sync classref with current source
And move GLTF docs to its module folder.
2021-03-18 16:37:43 +01:00
George Marques ec806c5c5b
Added static method information the generated builtin API JSON 2021-03-17 08:33:08 -03:00
George Marques 8fddab9209
Further changes in GDNative API
- Added new_copy to all types, since trivial copy won't work for all
  types.
- Added functions to convert from String to char array types, which is
  not provided by the methods bound in Variant.
- Added operator index to String.
- Added missing cstring version of some Variant functions. They existed
  in the header but didn't have the implementation and were missing from
  the gdnative_api.json file.
- Added support for static calls on Variant types.
2021-03-17 08:26:10 -03:00
Rémi Verschelde 08ca4184f4
Merge pull request #47024 from groud/navigation
Allow Navigation to be more flexible
2021-03-17 09:18:54 +01:00
K. S. Ernest (iFire) Lee c203fbfa8c Expand bone name possibilities. 2021-03-16 15:07:30 -07:00
bruvzg b79e8c22f0
HarfBuzz: Update to version 2.8.0 2021-03-16 19:56:52 +02:00
Rémi Verschelde 69486b1059
miniupnpc: Update to version 2.2.2 2021-03-16 10:54:38 +01:00
Fabio Alessandrelli 163fc125cd [Net] Fix miniupnpc when no interface is specified
This is a tricky one, it used to work, but it was wrong, because in such
a scenario instead of passing NULL as required by the API, it would pass
a buffer containing the `\0` terminator.
This stopped working on a specific miniupnpc version, when they fixed
some network endianess issue on Windows, to which we made a workaround,
which in turn would probably result in failures when the interface is
specified.

This commit address the issue properly, by checking the specified
interface string size, and correctly passing NULL instead of the empty
string when necessary.

Also reverts the commit that introduced the bogus workaround:
e85330231c

One of those PR when the explaination is much longer then code changes
:).
2021-03-15 17:33:26 +01:00
Gilles Roudière ac7073f586 Allow Navigation to be more flexible 2021-03-15 15:58:59 +01:00
Ignacio Etcheverry 5b3b9cd63b C#: Fix disconnecting event signals twice
`disconnect_event_signals` can be called twice (when managed instance
is disposed and from the ScriptInstance destructor).
2021-03-15 07:08:10 +01:00
Rémi Verschelde 6edb0a75ab
Merge pull request #46936 from DavidSichma/match_temp_header
Fixed match test expression for temporaries
2021-03-14 15:46:53 +01:00
Rémi Verschelde 1066dbcecc
Merge pull request #46968 from sboronczyk/fix-editor-plugin-mono
Fix create c# script from editor after partial class type is necessary
2021-03-14 00:27:34 +01:00
Rémi Verschelde 7015027cbf
Merge pull request #46900 from Ev1lbl0w/bugfix-malloc_calls
Replace malloc's with Godot's memalloc macro
2021-03-13 21:55:52 +01:00
sboronczyk 094981b277 Fix create c# script after partial class type 2021-03-13 17:31:47 +01:00
Rémi Verschelde 942f5f0cb2
Merge pull request #46929 from Anshul7sp1/typosAndGrammar
Fixes small typos and grammar correction
2021-03-13 14:55:05 +01:00
Ev1lbl0w 838e7d0a8d
Replace malloc's with Godot's memalloc macro 2021-03-13 11:51:45 +00:00
Rémi Verschelde 8368f53941
Merge pull request #46954 from neikeq/reggr-46307
C#: Fix StringName leak warnings after generating bindings
2021-03-13 09:13:34 +01:00
Ignacio Etcheverry d9603b2d73 C#: Fix StringName leak warnings after generating bindings
`Main::cleanup()` prints warnings if it finds `StringName`s still alive.
We need the `BindingsGenerator` to be destructed before calling cleanup.
2021-03-13 01:16:31 +01:00
Ignacio Etcheverry ee8e5146a4 C#: Fix ScriptPathAttribute generator with none or nested namespaces
The following two bugs were fixed:
- For classes without namespace we were still generating `namespace {`
without a namespace identifier, causing a syntax error.
- For classes with nested namespaces we were generating only the innermost
part of the namespace was being generated, e.g.: for `Foo.Bar` we were
generating `namespace Bar {` instead of `namespace Foo.Bar {`.
This wasn't causing any build error, but because of the wrong namespace
Godot wasn't able to find the class associated with the script.
2021-03-13 01:04:59 +01:00
David Sichma 762bb5843b
Fixed match test expression for temporaries
Fixed that a potentially popped temporary was used for the value in
match statements.
2021-03-12 15:04:45 +01:00
Anshul7sp1 91181c2086 Fixes small typos and grammar correction 2021-03-12 19:05:16 +05:30
jfons 809d88b925 Fix visibility toggle for baked GridMaps 2021-03-12 12:57:04 +01:00
Rémi Verschelde fec979b850
Merge pull request #44671 from o01eg/fix-gcc-visibility
GDNative: Fix symbols visibility for GCC
2021-03-12 09:41:56 +01:00
Alex Hirsch 09bda3f140 Always dynamically allocate PropertyTable
- `Texture::~Texture` expects `props` to be dynamically allocated.

- `GetPropertyTable` returned a pointer to an existing `PropertyTable`
  but is expected to return a newly, dynamically allocated one.

- `PropertyTable::PropertyTable()` suggests that an empty `element`
  property is valid.

fix #46876
fix #45573
2021-03-10 19:12:23 +01:00
Gilles Roudière ba1344408f Implement Navigation layers 2021-03-10 11:23:06 +01:00
Gilles Roudière a9dc53d152 Remove Navigation2D/3D nodes, and move the navigation map to the world resource 2021-03-10 11:23:06 +01:00
geekrelief 58fa4973f6 fixes #46839, ensure library_classes is cleared and free funcs are called
Co-authored-by: toasteater <48371905+toasteater@users.noreply.github.com>
Co-authored-by: Jan Haller <bromeon@gmail.com>
2021-03-09 14:32:46 -08:00
Rémi Verschelde 83b1acdc60
Merge pull request #45545 from abaire/relaxes_gltf_name_sanitization
Relaxes node name sanitization in gltf documents.
2021-03-09 14:54:33 +01:00
Rémi Verschelde 26d1b30d35
Merge pull request #46174 from xill47/mono-appdomain-unhandled-exception-event
Added mono_unhandled_exception call to unhandled_exception hook
2021-03-08 13:26:47 +01:00
Ilya Kuznetsov 6061ff7ba1 Added mono_unhandled_exception call to unhandled_exception hook 2021-03-08 12:57:50 +01:00