Commit Graph

2429 Commits

Author SHA1 Message Date
marxin e5f665c718 Fix -Wsign-compare warnings.
I decided to modify code in a defensive way. Ideally functions
like size() or length() should return an unsigned type.
2019-02-27 07:45:57 +01:00
marxin aff84ec55d Fix -Wsuggest-attribute=format warnings. 2019-02-27 06:56:50 +01:00
Juan Linietsky f669ebeeaf -Properly handle missing ETC support on export
-Added ability for resource importers to save metadata
-Added ability for resource importers to validate depending on project settings
2019-02-26 18:45:06 -03:00
Juan Linietsky 5eeb06ffd1 -Remove harcoded opengl extension testing from OS, ask rasterizer instead.
-Fixed a bug where etc textures were imported broken
2019-02-26 11:58:47 -03:00
Juan Linietsky 3299045988 Remove setting that caused is_inside_tree() errors on doppler tracking enabled. 2019-02-26 09:16:23 -03:00
Juan Linietsky a32b26dfa2 Several fixes to make GLES2 on HTML5 work much better.
Changed math class error reporting to be a bit less paranoid.
2019-02-25 21:47:29 -03:00
Michael Alexsander Silva Dias dcf6c4a368 Revert "Fix 'UndoRedo's 'MERGE_ALL' mode repeating instructions when quickly commiting actions"
This reverts commit 79f1d8b4fb.
2019-02-25 14:09:33 -03:00
Chaosus bc4d781277 Fix wrapi to use int64_t instead int 2019-02-25 10:51:04 +03:00
Juan Linietsky 61b41d6001 Ensure all properties are refreshed when setting a script, fixes #24845 2019-02-24 10:50:43 -03:00
Juan Linietsky 3ea04c1366 Prevent circular references to scene being saved, fixes #24384 2019-02-24 10:48:38 -03:00
Rémi Verschelde 4ebb544ffa
Merge pull request #26171 from Calinou/fix-wrapi-crash
Fix crash when using `wrapi()` with a range of zero
2019-02-24 02:37:04 +01:00
Hugo Locurcio 18b90508a1
Fix crash when using `wrapi()` with a range of zero
`wrapi()` and `wrapf()` will now return the value of
the `min` parameter if the range is equal to zero.
2019-02-23 16:16:32 +01:00
Juan Linietsky 9d78274e06 Make allowed pid for window takeover happen immediately, fixes #21431 2019-02-23 12:09:35 -03:00
Hein-Pieter van Braam 4f49d09272 Don't crash when parse_utf8 receives a NULL pointer
This can happen when chaining calls to various string methods when the
string is empty.
2019-02-22 19:28:19 +01:00
Rémi Verschelde 7e69c160a4
Merge pull request #26129 from YeldhamDev/undoredo_merge_all_fix
Fix 'UndoRedo's 'MERGE_ALL' mode repeating instructions when quickly commiting actions
2019-02-22 09:57:23 +01:00
Rémi Verschelde 726f31e992
Merge pull request #26132 from marxin/fix-Wignored-qualifiers
Fix warnings seen with -Wignored-qualifiers.
2019-02-22 09:55:27 +01:00
Rémi Verschelde 60fe9321ac
Merge pull request #26099 from marxin/fix-Wtype-limits-warnings
Fix all -Wtype-limits warnings.
2019-02-22 09:44:59 +01:00
Juan Linietsky 8b231b96e3 Implement a cleaner (and better) way to save imagedata from ImageTexture, fixes #18801 2019-02-21 20:49:42 -03:00
marxin c11e7ffd0e Fix warnings seen with -Wignored-qualifiers. 2019-02-21 20:24:29 +01:00
Michael Alexsander Silva Dias 79f1d8b4fb Fix 'UndoRedo's 'MERGE_ALL' mode repeating instructions when quickly commiting actions
It seems that the merge operation validation is only useful to the 'MERGE_ENDS' mode, causing problems when in 'MERGE_ALL'.

Fixes #26118.
2019-02-21 15:36:45 -03:00
marxin 7de7f0ef17 Fix all -Wtype-limits warnings. 2019-02-21 19:34:35 +01:00
Rémi Verschelde b970c4187d
Merge pull request #26115 from WindyDarian/fix_dictionary_erase_returing_null
Fix return value for Dictionary.erase(key) in script
2019-02-21 13:54:34 +01:00
Windy Darian 7d4a653223 Fix return value for Dictionary.erase() 2019-02-21 18:52:29 +08:00
Rémi Verschelde b39e1df704 Fix VariantWriter overflow on 64-bit int
Integers in Godot are signed 64-bit ints (int64_t), but var2str used
int behind the scenes and would thus overflow after 2^31.

Also properly documented the actual bounds of int and the behaviour
when overflowing them.
2019-02-21 11:24:00 +01:00
marxin 8d51618949 Add -Wshadow=local to warnings and fix reported issues.
Fixes #25316.
2019-02-20 19:44:12 +01:00
Rémi Verschelde 132e2f458d
Merge pull request #26015 from hedin-hiervard/master
fixed AStar improper point deletion (leads to crash)
2019-02-20 18:20:23 +01:00
Rémi Verschelde 5023cc111b
Merge pull request #26095 from lupoDharkael/right-left
Fix wrong bounds check in String::right
2019-02-20 17:48:53 +01:00
hedin c496781bf6 fixed AStar improper point deletion (leads to crash) 2019-02-20 17:24:58 +01:00
lupoDharkael 597aac382b Fix wrong bounds check in String::right 2019-02-20 16:47:25 +01:00
Rémi Verschelde 75c89aaaef
Merge pull request #26069 from hpvb/align-variant
Align the Variant data member
2019-02-20 13:27:05 +01:00
Hein-Pieter van Braam b6b113cc2b Align the Variant data member
This should avoid potential alignment issues when _mem holds real
values and speed up some floating point operations in some cases.
2019-02-20 11:14:22 +00:00
Fabio Alessandrelli 0e5655694c Fix HTTPClient keep alive with chunked encoding.
We need to consume the trailer part and final CRLF after last chunk
as per RFC 7230 section 4.1:

```
chunked-body   = *chunk
                 last-chunk
                 trailer-part
                 CRLF
```

We do not return the trailer part, just consume it allowing following
requests to work as expected when using keep alive.
2019-02-20 05:13:51 +01:00
Fabio Alessandrelli 10e4821260 HTTPClient read until EOF fixes 2019-02-20 03:06:02 +01:00
marxin 155cbe0b37 Fix warnings seen with warnings=all and recent GCC 8.2. 2019-02-18 21:54:31 +01:00
IronicallySerious 4121df235e Fix parameterised macros in core. Addresses #25488
This adds the saves the programmer of doing something like SWAP(x++, y--)
and getting the wrong result unless the parameters are evaluated
before use.
2019-02-18 22:08:42 +05:30
Rémi Verschelde 2e6501d879 Add hex-encoded version number to Engine singleton for easy comparisons 2019-02-17 13:38:52 +01:00
Rémi Verschelde f6fcbcfe9e
Merge pull request #25680 from Chaosus/random_fix
Fix random generation, to not always retrieve 0 after seed()
2019-02-16 23:24:02 +01:00
Rémi Verschelde 44d24e8b78
Merge pull request #25952 from pbrunet/fix/rand
Fix typo for randd and randf
2019-02-16 22:05:23 +01:00
Juan Linietsky 1f9c54bd55 Make resource loader cycle checker work on a per-thread basis.
This removes editor errors saying cycles existed when the thumbnailer was running.
2019-02-16 17:39:06 -03:00
Pierrick Brunet 3b6d05db3e Fix typo for randd and randf
* And improve documentation according to issue #25938
2019-02-16 21:05:18 +01:00
Rémi Verschelde ca5ec803fc
Merge pull request #25944 from Faless/net/http_editor_fixes
Fix keep-alive without header in HTTP client
2019-02-16 17:58:48 +01:00
Fabio Alessandrelli 673caa5f46 Fix keep-alive without header in HTTP client 2019-02-16 17:05:13 +01:00
Rémi Verschelde 7a79eee523 Expose OS::get_current_video_driver to scripting languages 2019-02-16 14:41:07 +01:00
Rémi Verschelde 29359c169b
Merge pull request #25924 from Calinou/add-gamepad-button-shortcut
Make Button shortcuts triggerable by gamepads
2019-02-16 14:17:26 +01:00
MrCdK 3441e2a96f Added PoolIntArray, PoolRealArray and PoolColorArray interpolate 2019-02-16 12:20:01 +01:00
Hein-Pieter van Braam 24e7a54cd0 Fix alignment and locking issues with CommandQueueMT
The allocations of commands in CommandQueueMT weren't aligned. This
commit aligns all accesses on 64bit boundaries regardless of target
platform. This ensures that all types are aligned.

Lock-wise the semaphores were maked as usable when the command had ran
but not when the synchronous stub had finished with it. This lead to a
race condition where sometimes the semaphore got reused before it was
waited on. We now mark the semaphore as free only once we're done
waiting on it.
2019-02-16 04:00:19 +01:00
Hugo Locurcio b54910eb05
Make Button shortcuts triggerable by gamepads
This closes #25741.
2019-02-16 00:29:23 +01:00
Juan Linietsky 4a24ba6e77 -Fixes to undo redo to avoid crash, closes #24251
-Changed Animation to have a special signal when tracks are changed, to avoid unnecesary track cache rebuilds in AnimationPlayer
-Added missing emit_changed whe modifying keys to Animation
-Changed AnimationPlayer to use the new refcounted connections instead of the previous hacky way to keep references
-Changed AnimationEditor to update the current track when keys are edited
-Fixed bug where undo/redo did not work with AnimationKeyEdit (was not being updated)
-Made sure UndoRedo does not mind deleted objects in undo/redo history, this would corrupt the history or clear it without need.
2019-02-14 10:22:34 -03:00
Rémi Verschelde 5fc86026ca Fix typos with codespell
Using codespell 1.14.0.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
doubleclick
lod
nd
numer
que
te
unselect
EOF
$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2019-02-13 09:23:29 +01:00
Rémi Verschelde 55ca2a7c88
Merge pull request #25821 from akien-mga/sync-class-and-filenames
Ensure classes match their header filename
2019-02-13 08:49:39 +01:00
Aaron Franke 06df7b0963 [Core] Transform2D add set_scale and fix set_rotation
Note: These are still not exposed to GDScript
2019-02-12 17:59:29 -05:00
Rémi Verschelde c4835c4345
Merge pull request #25721 from neikeq/ww
Use script instance binding for objects constructed from C#
2019-02-12 15:29:25 +01:00
Rémi Verschelde b7cc2bb1e2 Core: Ensure classes match their header filename
Also drop some unused files.

Renamed:
- `core/dvector.h` -> `pool_vector.h`
- `core/io/resource_import.h` -> `resource_importer.h`
- `core/sort.h` -> `sort_array.h`
- `core/string_db.h` -> `string_name.h`

Dropped:
- `core/allocators.h`
- `core/os/shell.h`
- `core/variant_construct_string.cpp`
2019-02-12 13:34:25 +01:00
Rémi Verschelde 13c50e8aa5
Merge pull request #25481 from hpvb/fix-ubsan-asan-reports
Fix many asan and ubsan reported issues
2019-02-12 12:21:01 +01:00
Rémi Verschelde b6e03d927e
Merge pull request #25727 from aaronfranke/matrix3-basis
[Core] Rename Matrix3 file to Basis
2019-02-10 12:32:32 +01:00
Chaosus f946b28f75 Fix random generation, to not retrieve 0 after seed() 2019-02-10 14:16:02 +03:00
Rémi Verschelde 034cd62a77 Warn when using GPU particles with GLES2
Closes #25733.
2019-02-09 20:49:58 +01:00
Aaron Franke 3f837d5cc5 [Core] Rename Matrix3 file to Basis
The code already referred to "Basis", it's just the file name that was different for some reason.
2019-02-09 14:42:23 -05:00
Ignacio Etcheverry 9df44c2d2c Use script instance binding for objects constructed from C#
Only possible if the object class is a "native type". If the object class is a user class (that derives a "native type") then a script is needed.
Since CSharpLanguage does cleanup of script instance bindings when finished, cases like #25621 will no longer cause problems.

Fixed ~Object() trying to free script instance bindings after the language has already been removed, which would result in a NULL dereference.
2019-02-09 00:32:18 +01:00
Rémi Verschelde 1772d6fa23 Image: Fix decompressing ETC2
Thanks to @Rriik for finding the bug and its cause.

Fixes #25595.
2019-02-08 17:26:47 +01:00
Ignacio Etcheverry 3233083f63 Mono: Lifetime fixes for CSharpInstance and instance binding data
Avoid CSharpInstance from accessing its state after self destructing (by deleting the Reference owner).
It's now safe to replace the script instance without leaking or crashing.

Also fixed godot_icall_Object_weakref return reference being freed before returning.
2019-02-03 06:47:25 +01:00
Ignacio Etcheverry 4e4e889c75
Merge pull request #25478 from neikeq/rr
Mono: Fix MonoPosixHelper not being found
2019-02-03 06:31:52 +01:00
Ignacio Etcheverry 41873ffa88 Added set_environment to OS class 2019-02-03 05:38:47 +01:00
Rémi Verschelde 463123a661
Merge pull request #25494 from RandomShaper/fix-21677
Let memory stat functions return uint64_t
2019-01-31 10:33:18 +01:00
Bojidar Marinov e34a4c63a7
Fix AStar crashing with large (>1e30) estimated values
Fixes #21601
2019-01-30 20:22:08 +02:00
Pedro J. Estébanez 496d8f19fc Let memory stat functions return uint64_t 2019-01-30 19:07:46 +01:00
Hein-Pieter van Braam d308eb091a Fix many asan and ubsan reported issues
This allows most demos to run without any ubsan or asan errors. There
are still some things in thirdpart/ and some things in AudioServer that
needs a look but this fixes a lot of issues. This should help debug less
obvious issues, hopefully.

This fixes #25217 and fixes #25218
2019-01-30 06:43:56 +01:00
Rémi Verschelde cc0842f9a6 Prevent upscaled SVG from exceeding Image bounds
Also expose Image MAX_WIDTH and MAX_HEIGHT.

Fixes #24455.
2019-01-28 16:00:15 +01:00
Juan Linietsky 11642b92d1 Avoid cyclic resource loading of any type, fixes #22673 2019-01-27 19:24:55 -03:00
Rémi Verschelde c3b0ee5941 Fix code style issues 2019-01-26 22:35:31 +01:00
Juan Linietsky c2f59de212 Warn of invalid pointer when converting object to RID, closes #19023 2019-01-26 15:41:26 -03:00
Marcelo Fernandez fd59732298 Expose InputEventMIDI to scripts 2019-01-23 09:09:03 -03:00
Rémi Verschelde a0581cca1f Revert "Revert "Update random_pcg.h""
This reverts commit 6f704c338a.

Sorry about this, this was a test and not meant to be pushed to master. :/
2019-01-23 10:36:36 +01:00
Rémi Verschelde 6f704c338a Revert "Update random_pcg.h"
This reverts commit 64e584a97e.
2019-01-23 10:30:18 +01:00
Ivan Ponomarev 8edfc3b5ac Fixed possible crash in pck_packer.cpp due to wrong memory freeing. 2019-01-22 20:02:19 +03:00
Juan Linietsky 6fa632b821 Add function to obtain filesystem type from DirAccess.
Change EditorFileSystem to not use directory modification times on FAT32, fixes #20946
2019-01-21 18:06:14 -03:00
Leon Krause 35466475fe Fix HTML5 build warning 2019-01-20 00:12:50 +01:00
Fabio Alessandrelli 60d235622d Don't reset MultiplayerAPI when setting same peer.
A GDScript call to:
`multiplayer.network_peer.some_prop = true`
seems to transalte to:
```
var temp = multiplayer.network_peer
temp.some_prop = true
multiplayer.network_peer = temp
```
Which caused the MultiplayerAPI to be resetted.
The call to set_network_peer is now ignored if the peer that's beeing
set is the same as the currently set one.
2019-01-15 11:14:51 +01:00
Fabio Alessandrelli 1f7846abf8 Fix MultiplayerAPI initialization, clear.
rpc_sender_id is now correctly initialized to 0 so get_rpc_sender_id()
work reliably even if called before receiving any RPC.
root_node is initialized to NULL (fix crashes when incorrectly using the
MultiplayerAPI).
clear function now resets the packet cache size to free more memory when
not running.
2019-01-15 10:35:26 +01:00
Rémi Verschelde 7346afb0ee
Merge pull request #24987 from akien-mga/gles2-nvidia-rect-hack-opt-in
GLES2: Make Nvidia flicker workaround opt-in
2019-01-14 20:20:56 +01:00
Juan Linietsky 91290f0ded Added a flag to specify an exported node path must be supplied from scene root, fixes #24412 2019-01-14 15:46:56 -03:00
Rémi Verschelde 02ffc59270 GLES2: Make Nvidia flicker workaround opt-in
It has a big impact on 2D and text rendering performance (cf. #24466)
so the solution seems worse than the bug it aims to work around.

It's now opt-in via "rendering/quality/2d/gles2_use_nvidia_rect_flicker_workaround"
for those who need it and have a simple enough game for the performance
drop not to be an issue.

Fixes #24466.
2019-01-14 19:02:07 +01:00
Juan Linietsky 6d8083ea65 Do not use the workaround for desktop nvidia on mobile and html5. 2019-01-14 11:24:00 -03:00
Juan Linietsky ae99530a8d Do not allow flushing while already flushing the message queue. Added to help track bugs in ProgressDialog in editor. 2019-01-14 11:04:25 -03:00
Juan Linietsky 4bb0080b3d Do not allow adding tasks while in the middle of flushing a message queue 2019-01-14 11:00:05 -03:00
Rémi Verschelde 9ddf1115bc
Revert "fixed invalid implementation of Plane::intersects_segment and Plane::intersects_ray" 2019-01-13 11:06:34 +01:00
Rémi Verschelde 3652442a92
Merge pull request #24897 from GlaDos28/master
fixed invalid implementation of Plane::intersects_segment and Plane::intersects_ray
2019-01-11 22:56:03 +01:00
Evgeny Savelyev 2c36078be4 fixed invalid implementations of Plane::intersects_segment and Plane::intersects_ray 2019-01-12 00:38:16 +03:00
Poommetee Ketson 2caaa7c97d
Fix error explanation in core_bind Thread::_start_func 2019-01-11 10:12:13 +07:00
Rémi Verschelde 658296856c
Merge pull request #24877 from neikeq/issue-24280
Fix properties being lost when reloading placeholder GDScript instance
2019-01-10 18:02:57 +01:00
Rémi Verschelde e5f1d19352 Consistency in resource format saver/loader de-registration
Some used 'is_valid()' checks, others not. Validity is already checked in 'unref()',
and 'remove_resource_format_*()' has an ERR_FAIL condition on 'is_null()' already
(which shouldn't happen since we're only unregistering things that we previously
registered.

Also add missing GDCLASS statement in ResourceFormatLoaderVideoStreamGDNative,
missed in #20552 which was last amended before #19501 was merged.
2019-01-10 12:45:57 +01:00
Ignacio Etcheverry ea85ff0dc2 Fix properties being lost when reloading placeholder GDScript instance
During reloading in `GDScriptLanguage::reload_all_scripts` a placeholder instance that must remain so is replaced with a new placeholder instance. The state is then restored by calling `ScriptInstance::set` for each property. This does not work if the script is missing the properties due to build/parse failing.
The fix for such cases is to call `placeholder_set_fallback` instead of `set` on the script instance.

I took this chance to move the `build_failed` flag from `PlaceHolderScriptInstance` to `Script`. That improves the code a lot. I also renamed it to `placeholder_fallback_enabled` which is a much better name (`build_failed` could lead to misunderstandings).
2019-01-10 01:58:50 +01:00
Juan Linietsky e46f28e02d Removed splits in Polygon editor, replace by internal vertices and polygon support. 2019-01-08 19:11:08 -03:00
Calamander 64e584a97e
Update random_pcg.h
little fix to function types
2019-01-07 23:13:16 +01:00
Ibrahn Sahir cbb396c006 Repair String lstrip and rstrip.
Background: lstrip and rstrip were broken by changes to String in:
0e29f7974b
which removed it's access to Vector::find(CharType).

Moved Vector's find up into CowData so it can be shared by Vector and String.
Added String::find_char using CowData::find.
Implemented rstrip and lstrip using find_char.
Added a few tests for String rstrip and lstrip.
2019-01-07 17:34:44 +00:00
Hein-Pieter van Braam 5e6c6f3bb7
Merge pull request #21708 from hpvb/fix-21242v2
String[size()] should return a default constructed CharType
2019-01-04 20:57:22 +01:00
Hein-Pieter van Braam ac99ed3cda String[size()] should return a default constructed CharType
As per the C++ standard 21.3.4.1 for std::string:
Returns: If pos < size(), returns data()[pos]. Otherwise, if pos ==
size(), the const version returns charT(). Otherwise, the behavior is
undefined.

Since the behavior is undefined Godot now does the same thing for const
and non-const versions of operator[].

This fixes #21242 and fixes #22221.
2019-01-04 17:48:03 +00:00
Rémi Verschelde 70de8ca9a9
Merge pull request #24585 from Xrayez/fix-crash-hex-number
Fix crash when checking empty string for valid hex number
2019-01-04 16:19:29 +01:00
Rémi Verschelde 578c6316c8
Merge pull request #24732 from hpvb/vector-pod-optimization
Optimizations for trivial types
2019-01-04 15:09:05 +01:00
Guilherme Felipe e64391f47b Update zstd to 1.3.8 2019-01-03 22:35:20 -02:00