Commit graph

4695 commits

Author SHA1 Message Date
George Marques cf7a6be1db
Merge pull request #43226 from mateosss/unreachable-prop-crash
Fix crash due to unreachable code in properties
2020-11-27 11:03:20 -03:00
Thakee Nathees f0613a91be GDScript range function typecheck bug fixed
Fix: #43586
2020-11-27 18:23:35 +05:30
Jon Bonazza d5925fd522 feat: HMAC support in Crypto APIs 2020-11-26 18:39:56 -08:00
George Marques fbb806fd68
Unregister GDScriptFunctionState class
This is not user accessible anymore so it does not need to be show in
documentation.
2020-11-26 21:39:54 -03:00
Rémi Verschelde ed2f84735b
Merge pull request #43895 from vnen/gdscript-operators-fix
GDScript: Improve handling of operators
2020-11-26 21:19:31 +01:00
Pedro J. Estébanez 4eb3286230 Put misc. 3D tool visible instances on their own layer
This makes that visible stuff invisible to ReflectionProbes, whose preview in the editor shouldn't involve them.
2020-11-26 20:11:00 +01:00
Rémi Verschelde e5ff2d0ffd
Merge pull request #43894 from vnen/gdscript-some-fixes
Some GDScript fixes
2020-11-26 18:56:42 +01:00
George Marques 0cb185927c
GDScript: Improve handling of operators
- Use the new functions in Variant to determine the validity and resulting
  type of operators.
- Split the operator function in codegen between binary and unary, since
  the unary ones have now a special requirement of having the second
  argument to be the NIL type when requesting info.
2020-11-26 14:41:55 -03:00
George Marques 627ca7f30e
GDScript: Don't clear depended parsers too soon
It can wait until the analyzer itself is destructed, otherwise other
phases might be using freed parsers.
2020-11-26 14:14:29 -03:00
George Marques 817fb3d702
GDScript: Give an error if dependency can't be parsed
Otherwise this may lead to a crash when the dependency is not present.
2020-11-26 12:27:48 -03:00
bruvzg 99666de00f
[Complex Text Layouts] Refactor Font class, default themes and controls to use Text Server interface.
Implement interface mirroring.
Add TextLine and TextParagraph classes.
Handle UTF-16 input on macOS and Windows.
2020-11-26 14:25:48 +02:00
bruvzg 07d14f5bb8
[Complex Text Layouts] Implement GDNative interface for TextServer. 2020-11-26 13:55:29 +02:00
bruvzg 200828276e
[Complex Text Layouts] Implement ICU / HarfBuzz based TextServer module. 2020-11-26 13:55:28 +02:00
bruvzg b9f441e81e
[Complex Text Layouts] Add third-party TextServer dependencies (ICU, HarfBuzz, Graphite). 2020-11-26 13:55:27 +02:00
bruvzg 493da99269
[Complex Text Layouts] Implement TextServer interface. Implement Fallback TextServer. 2020-11-26 13:55:26 +02:00
Jordan Schidlowsky afa15c5f15 fixes crash for OPCODE_CAST_TO_NATIVE opcode in gdscript disassemlber 2020-11-25 16:26:32 -06:00
PouleyKetchoupp faca8b77aa Fixed ccd enabled by default on Bullet bodies
It was due to main_shape_changed being called two times for each
added body. The first time it disables ccd, which sets the internal ccd
threshold to be 10000. The second time, it enables ccd again because
the internal threshold is > 0.

Bodies are now consistently set with a ccd threshold of 0 when ccd is
disabled.

This was causing crashing asserts in Bullet when adding bodies in some
scenarios, in btVector3::normalize():
btAssert(!fuzzyZero());

These crashes will still happen with ccd enabled.
2020-11-25 15:02:33 -07:00
Rémi Verschelde fc28de64c4
Merge pull request #43856 from vnen/gdscript-some-fixes
A couple of GDScript fixes
2020-11-25 17:13:41 +01:00
Rémi Verschelde a5ee8d881f
Merge pull request #43775 from vnen/gdscript-fix-stack
GDScript: Fix mishandling of stack pointers
2020-11-25 16:25:51 +01:00
George Marques ed3d8f31df
GDScript: Fix return of cast expression on compilation
It was mistakenly returning the source instead of the result.
2020-11-25 11:37:51 -03:00
George Marques fb3dc2670a
GDScript: Fix range() being treated as array when optimized out
The call of range() in a for loop is optimized to use int or vectors, to
avoid allocating an array, however the type was set as array still. With
the new typed VM this is an issue as the type mismatch the actual value,
resulting in wrong instructions to be selected.
2020-11-25 11:35:07 -03:00
George Marques 2e528ef382
GDScript: Fix mishandling of stack pointers
- Replace the for loop temporaries by locals. They cause conflicts with
  the stack when being popped, while locals are properly handled in the
  scope.
- Change the interface for the codegen so the for loop list doesn't live
  through the whole block if it's a temporary.
- Keep track of the actual amount of local variables in the stack. Using
  the size of the map is misleading in cases where multiple locals have
  the same name (which is allowed when there's no shadowing).
- Added a few debug checks for temporaries, to avoid them being wrongly
  manipulated in the future. They should not live more than a line of
  code.
- Rearrange some of compiler code to make sure the temporaries don't
  live across blocks.
2020-11-25 11:24:13 -03:00
Rémi Verschelde d76806d322
Core: Always enable ptrcall, remove PTRCALL_ENABLED define
ptrcall is now also used to optimize calls in GDScript, on top of the existing
use by the GDNative and Mono modules.

It no longer makes sense to make it optional.
2020-11-25 14:08:17 +01:00
Marcel Admiraal 4f654dad13 Fix useless assignement in webrtc/library_godot_webrtc.js 2020-11-25 10:09:53 +00:00
Rémi Verschelde 50db0e66ac
Merge pull request #43747 from Faless/js/4.0_lint
[HTML5] Linting, fixes.
2020-11-23 12:38:17 +01:00
Fabio Alessandrelli 4617a7fa9c [HTML5] Run eslint --fix.
Should I write a poem about this whole new world? ;)
2020-11-23 12:15:18 +01:00
Eric M efe5c250d5 Implement new shortcuts system.
unhandled_key_input changed to unhandled_button_input. Controls can set a 'shortcut_context' which they can then use to determine if their shortcuts should be triggered or not, based on if the viewport's focused GUI control is a child of their 'shortcut context'.
2020-11-23 21:14:26 +10:00
Rémi Verschelde a248e6f8c3
Merge pull request #43781 from MaxMutantMayer/regex_unit_tests
Move and add new RegEx test cases
2020-11-23 10:07:07 +01:00
Rémi Verschelde 4ed42bfc29
Merge pull request #43725 from vnen/gdscript-typed-vm-2
GDScript: Typed VM Take 2
2020-11-23 09:59:20 +01:00
Maximilian Mayer 7edb50a31c Move and add new RegEx test cases
Test cases for 'RegEx' are moved from 'test_string.h' to own test suite
in 'test_regex.h'. Additionally, new tests are introduced and '_init' is
removed as it isn't implemented/used anywhere.
2020-11-22 22:48:03 +01:00
Hugo Locurcio 1a616726cf
Document that WebM videos don't support the alpha channel 2020-11-22 17:43:07 +01:00
George Marques 5518e2a68e
GDScript: Add faster instruction for validated constructor
Only for built-in types.
2020-11-21 13:30:17 -03:00
George Marques e0dca3c6b6
GDScript: Add typed iterate instructions 2020-11-21 13:24:50 -03:00
George Marques 52ab64db69
GDScript: Add faster call instructions for builtin methods
Methods from builtin types can be called by using the function pointer
when the argument and base types are known at compile time.
2020-11-21 13:24:50 -03:00
George Marques d8b22097f2
GDScript: Add faster call instructions for native methods 2020-11-21 13:24:50 -03:00
George Marques 5aeb390cd7
GDScript: Add speficic set/get instructions
When the base type is known at compile-time, we can get a direct
function pointer that is faster than the regular set/get paths.
2020-11-21 13:24:49 -03:00
George Marques 1ad5c926dc
GDScript: Add faster operator for known types
It now uses the direct operator function pointer, which increases
performance in evaluation.
2020-11-21 13:24:49 -03:00
George Marques c707d6fe71
GDScript: Gather instructions arguments beforehand
Almost all instructions need variant arguments. With this change they
are loaded in an array before each instruction call. This makes the
addressing code be localized to less places, improving compilation
overhead and binary size by a small margin.

This should not affect performance.
2020-11-21 13:24:49 -03:00
George Marques b6519d0d03
GDScript: Split Function code into multiple files
To improve organization and reduce the size of compilation units.
2020-11-21 13:24:49 -03:00
Fabio Alessandrelli a82f70ea9f [HTML5] Libraries refactor for linting.
Initial work to make liniting easier.

This includes:
- Rename http_request.js to library_godot_http_request.js.
- Rename externs.js to engine.externs.js.
- New library_godot_runtime.js (GodotRuntime) wraps around emscripten
  functions.
- Refactor of XMLHttpRequest handler in engine/preloader.js.
- Few fixes to bugs spotted by early stage linting.
2020-11-21 14:22:40 +01:00
Rémi Verschelde a655de89e3
doc: Warn about using Node internal processing
See #43689.

Also 'fixed' some spelling for behavior in publicly visible strings.
(Sorry en_GB, en_CA, en_AU, and more... Silicon Valley won the tech spelling
war.)
2020-11-20 09:52:37 +01:00
Marcel Admiraal 112e2fdfc3 Fix godot_js_websocket_send function unused assignment. 2020-11-17 18:28:39 +00:00
Aaron Franke 02161aad5a
Remove empty lines around braces with the formatting script 2020-11-16 23:38:11 -05:00
Rémi Verschelde d7176e9040
Merge pull request #42167 from madmiraal/fix-42108
Remove the unnecessary sync() and the restrictions it imposes on 3D Physics.
2020-11-16 09:32:48 +01:00
Rémi Verschelde f763a2a3db
Merge pull request #43250 from aaronfranke/strext-lstrip
Add LStrip, RStrip, and HexEncode to C#
2020-11-16 09:15:45 +01:00
Aaron Franke 4b272b18ea
Improve comments in Color documentation 2020-11-13 23:31:19 -05:00
Andrea Catania 98daa0af6b Fixes crash when returns . 2020-11-13 15:09:52 +01:00
George Marques 8bcd345782
GDScript: Fix native class not set with inheritance 2020-11-13 10:35:24 -03:00
Grzegorz Puławski c49810046e Removing unneeded FuncRef code in C# 2020-11-11 21:57:42 +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
Rémi Verschelde 10fd107599
Merge pull request #43443 from Faless/js/4.0_audio_worklet
[HTML5] Port inline JS code to libraries, AudioWorklet support.
2020-11-11 10:07:28 +01:00
Aaron Franke ee79fc627c
Minor clamp and float fixes 2020-11-10 14:30:07 -05:00
Sergey Minakov 30783d57cc iOS Modules: separate main platform code from modules
Moved previously builtin modules 'GameCenter', 'AppStore', 'iCloud' to separate modules to be represented as plugin.
Modified 'ARKit' and 'Camera' to not be builtin into engine and work as plugin.
Changed platform code so it's not affected by the move.
Modified Xcode project file to remove parameters that doesn't make any effect.
Added basic '.gdip' plugin config file.
2020-11-10 16:28:29 +03:00
Gustav 0ddd4097a6 Fix completion for built-in load function 2020-11-10 12:00:08 +01:00
Rémi Verschelde 263f731924
Merge pull request #43434 from sneik15/patch-1
Updated gd_glue.cpp to work in the variant refactoring (Mono enabled)
2020-11-10 11:56:18 +01:00
Fabio Alessandrelli e2083871eb [HTML5] Port JavaScript inline code to libraries.
The API is implemented in javascript, and generates C functions that can
be called from godot.
This allows much cleaner code replacing all `EM_ASM` calls in our C++
code with plain C function calls.
This also gets rid of few hacks and comes with few optimizations (e.g.
custom cursor shapes should be much faster now).
2020-11-10 11:42:51 +01:00
Fabio Alessandrelli 05261cceaf Fix gdnative build when WebRTC module is disabled. 2020-11-10 11:42:51 +01:00
Rémi Verschelde 68067b8d97
Merge pull request #43423 from Calinou/doc-assert-avoid-side-effects
Clarify that code in `assert()` should avoid side effects
2020-11-10 11:31:28 +01:00
Adrian Adeva 74f98de223
Updated gd_glue.cpp to work with the latest changes in the variant refactoring
Without this change the engine dont compile with the mono module enabled.
2020-11-10 11:13:54 +01:00
Rémi Verschelde b51dca64a6
Merge pull request #43383 from vnen/gdnative-string-header
GDNative: Define special char types in string.h
2020-11-10 09:40:26 +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
Hugo Locurcio d6c7073bd7
Clarify that code in assert() should avoid side effects 2020-11-09 21:48:24 +01: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
reduz 221a2a1742 Refactored variant constructor logic 2020-11-09 08:54:43 -03:00
Aaron Franke 6b54d7dde1
Add HexEncode to C# 2020-11-09 03:25:51 -05:00
Aaron Franke c89af1d433
Add LStrip and RStrip to C# strings 2020-11-09 03:24:46 -05: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
George Marques 82576371ef
GDNative: Define special char types in string.h
Those are standard types in C++ but not in C.

This also removes the wchar header which is not needed anymore and use
stddef.h instead (which is needed for size_t).
2020-11-07 16:09:14 -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 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
Yuri Roubinsky 156e4043b4 [Mono] Added Shuffle method to Array 2020-11-07 11:26:54 +03: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
Rémi Verschelde c35517f07e
Merge pull request #42724 from theoway/error_message_fix_call_recursive
Fixes the misleading message when a non-existing function name is passed to TreeItem.call_recursive()
2020-11-05 00:46:28 +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
Rémi Verschelde bd13e82080
Merge pull request #41516 from Lunatoid/allow-object-new
Fixed ParseError when calling Object.new()
2020-11-03 13:08:48 +01: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
Mateo de Mayo 531958b2f0 Fix crash due to unreachable code in properties 2020-10-30 22:21:50 -03:00
Rémi Verschelde c11992ed48
Merge pull request #43029 from neikeq/offline-nuget-fallback
C#: Make editor create NuGet fallback folder for Godot packages
2020-10-27 08:07:58 +01:00
Rémi Verschelde f594f31823
Merge pull request #43088 from neikeq/fix-custom-event-signal-hot-reload
C#: Fix custom event signals crash on hot-reload
2020-10-27 08:07:33 +01:00
bruvzg b506f9b5aa
Fix uninitialized GridMapEditor::node and InputMapEditor::setting variables. 2020-10-26 22:57:11 +02:00
Rémi Verschelde 825ab3b784
Merge pull request #42817 from akien-mga/vulkan-sdk-1.2.154.0
vulkan: Sync loader, headers and glslang to sdk-1.2.154.0
2020-10-26 15:15:19 +01:00
Ignacio Etcheverry 34960cb936 C#: Fix custom event signals crash on hot-reload
Cleanup and re-initialization of event signals before
and after hot-reload should be working correctly now.
2020-10-26 07:00:51 +01:00
Hugo Locurcio a1d9c67f43
Optimize SVG using svgcleaner --multipass
This decreases the editor binary size by about 8 KB.
2020-10-25 10:02:37 +01:00
Rémi Verschelde d3dd8fb0f3
Merge pull request #42848 from Tadaboody/bugfix/gridmap_visibility
Setting visibility on GridMaps parent now works. Closes #41374.
2020-10-25 00:33:55 +02:00
Andrii Doroshenko (Xrayez) 650ae413ce GDNative XR: remove redundant config.py
It's not an engine module. This is handled by GDNative's
`SCsub` instead, as done for other subdirectories already.
2020-10-24 23:04:07 +03:00
Yuri Roubinsky b09e60ef1a
Merge pull request #43026 from Chaosus/color_autocompletion
Shows ColorRect in Color constants autocompletion
2020-10-23 19:18:20 +03:00
Yuri Roubinsky 4c65dc975c Shows ColorRect in Color constants autocompletion 2020-10-23 19:03:50 +03:00
Ignacio Etcheverry 64b5ee7010 C#: Make editor create NuGet fallback folder for Godot packages
Main benefits:
- Projects can be built offline. Previously you needed internet
  access the first time building to download the packages.
- Changes to packages like Godot.NET.Sdk can be easily tested
  before publishing. This was already possible but required
  too many manual steps.
- First time builds are a bit faster, as the Sdk package doesn't
  need to be downloaded. In practice, the package is very small
  so it makes little difference.

Bumped Godot.NET.Sdk to 4.0.0-dev3 in order to enable the
recent changes regarding '.mono/' -> '.godot/mono/'.
2020-10-23 10:54:49 +02:00
Ignacio Etcheverry f06f91281c C#: Re-work solution build output panel
- Removed item list that displayed multiple build
  configurations launched. Now we only display
  the last build that was launched.
- Display build output next to the issues list.
  Its visibility can be toggled off/on.
  This build output is obtained from the MSBuild
  process rather than the MSBuild logger. As such
  it displays some MSBuild fatal errors that
  previously couldn't be displayed.
- Added a context menu to the issues list with
  the option to copy the issue text.
- Replaced the 'Build Project' button in the panel
  with a popup menu with the options:
  - Build Solution
  - Rebuild Solution
  - Clean Solution
- The bottom panel button was renamed from 'Mono'
  to 'MSBuild' and now display an error/warning icon
  if the last build had issues.
2020-10-23 07:49:39 +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
Rémi Verschelde ef62e93677
Merge pull request #42943 from vnen/gdscript-local-scope-fix
Fix handling of scope for local GDScript variables
2020-10-20 21:00:57 +02:00
George Marques 96884ef41e
Merge pull request #41983 from ThakeeNathees/array-const-folding-bug-fix
Array/Dictionary Nodes no more reduced to array/dictionary variant
2020-10-20 15:43:07 -03:00
George Marques 11c05642fe
GDScript: Fix handling of scope for local variables 2020-10-20 14:57:31 -03:00
George Marques 48b91b900d
GDScript: Add initialization for the language before debug tests
This ensures that the tests will use a full environment with correct
settings so global classes and autoloads can be properly found.
2020-10-20 10:07:03 -03:00
Yuri Roubinsky 4f4287243c Removed underscore from GraphEdit begin/end_node_move signals 2020-10-20 09:22:40 +03:00
George Marques 5ddfc657ab
Merge pull request #42067 from ThakeeNathees/for-loop-stack-overriden-fix
GDScript: for loop override stack variable bug fix
2020-10-19 20:21:14 -03: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