Commit Graph

877 Commits

Author SHA1 Message Date
Rémi Verschelde c1f54e1a45 Style: Apply clang-format on all files
Thus fixing some invalid changes that had still made it to the 2.1 branch.
2017-07-30 23:00:25 +02:00
Andreas Haas 992b415702 Bindings: Fix Object::get_meta return type.
The method was shown as void in the docs.

(cherry picked from commit 2b7b67b7b1)
2017-07-30 21:12:08 +02:00
Pedro J. Estébanez 94fdbf67a9 Fix misplaced quote in error messsage
(cherry picked from commit 748240b090)
2017-07-27 01:29:37 +02:00
Marcelo Fernandez a3a01332b8 Fix cvs files freezing the editor when a double quote is not closed 2017-07-25 22:00:47 -03:00
Poommetee Ketson 61ff58403d Ignore fuzzy translations
(cherry picked from commit fdd2a87b8f)
2017-07-14 22:15:05 +02:00
Poommetee Ketson 7603d77d1d AStar: add bool has_point(id)
(cherry picked from commit 2c9f6312e2)
2017-07-14 22:14:37 +02:00
geequlim da2bcda7be Enhanced debugger. ake 2.1 more productive!
Allow access more informations from remote debugger.
Refector more debugger related code to allow full access to variables.
Array Property Editor now can edit with more objects including remote objects.
Implements `GDInstance::debug_get_globals` to query all gloabl constants avaliable in GDScriptLanguage.
Show globals in debug stack variable panel.
Disabe capitalize property name for  remote object.
Add DictionaryPropertyEdit to edit with Dictionaries.
The serialization/unserialization workflow use binary data instead of dictionary to avoid send too large data.
Do not stop debugger if curent break point stack has error fix #9034.
Don't send all content of strings but first 80 characters from remote debugger.
Add constants into the break point stack tree and remote object instance edit inspector.
Remote GDScript resource object instance list constants in the property inspector.
Add `self` to the local in the break point stack as a remote object.
Move some functions for GDScript related to thier base classes so debugger don't rely on the gdscript module any more.
The slef in the debugger tree now expanded as the instance of script instead of the script resource.
2017-07-11 17:44:28 +08:00
Rémi Verschelde f99481e0c2 Merge pull request #8944 from RandomShaper/fix-error-handling-2.1
Make error handling more convenient (2.1)
2017-07-05 10:15:36 +02:00
Pedro J. Estébanez e9b7640f84 Make error handling more convenient
By adding some PRAY_* macros that encapsulate both the check and the returning of a null reference (UB).
Plus transient avoidance of the flood of warnings emitted by Clang when checking 'this' for NULL.
Plus explanation about the do-while(0) loop in some error macros.
2017-07-05 09:31:37 +02:00
Juan Linietsky 026c580399 Changed Vector3.snap from fmod to stepify, which makes more sense, fixes #6399
(cherry picked from commit 23ababdcd5)
2017-06-30 23:32:13 +02:00
Rémi Verschelde 1a1b97e059 Revert "Dictionary keys are now sorted by insertion order"
This reverts commit b8a16fbd0e.

Too cutting edge for the stable branch, it also makes Dictionary
twice slower.
2017-06-28 08:05:30 +02:00
Rémi Verschelde e3f9653353 Merge pull request #9410 from williamd1k0/advanced-string-format
Advanced string format (2.1)
2017-06-27 20:52:27 +02:00
Juan Linietsky b8a16fbd0e Dictionary keys are now sorted by insertion order
- Cherry-pick from 0a59c3c3a6
2017-06-26 20:29:17 -03:00
geequlim 9d49491afd Fix crash with String copy from with NULL string parameter
(cherry picked from commit 4b2a44054a)
2017-06-25 16:18:05 +02:00
Poommetee Ketson 4a0dc529ce BuildSystem: generated files have .gen.ext 2017-06-25 20:31:56 +07:00
dumitru-stama e9e39dd6dc Added 'blit_rect_mask' method 2017-06-24 08:16:35 -07:00
d 48f8931d48 Added two new methods 'blend_rect_mask' and 'fill' 2017-06-18 10:27:50 -07:00
Rémi Verschelde e17966ca01 Merge pull request #9167 from dumitru-stama/blitalpha
Added new "blend_rect" method as an alpha-aware blit_rect
2017-06-17 12:54:15 +02:00
dumitru.stama e99d13c6bc Fixed a blit_rect crash with out-of-bounds coords 2017-06-17 12:53:32 +02:00
Martin Capitanio 3213ddd060 Don't append standard ports to the request header.
Breaks the SSL communication with some servers,
do the same that the other curl, wget, firefox & co clients do.

Fixes #9146

(cherry picked from commit 5cabe5f0fc)
2017-06-17 12:16:45 +02:00
toger5 e1f4abe062 added grow functions to Rect2
- grow_individual
 - grow_margin

(cherry picked from commit 66b308925c)
2017-06-17 12:04:49 +02:00
William Tumeo a82bf83ea2 Add advanced string format
Cherry-pick from #7010
2017-06-16 00:41:51 -03:00
dumitru.stama 95dcd22b46 Added a new 'blend_rect' method acting as 'blit_rect' with alpha-blending 2017-06-14 00:55:52 -07:00
Rémi Verschelde dc420b3b0a Doc: Sync classref with current source 2017-06-14 09:26:43 +02:00
George Marques 1d759f02e6
Fix root path resolution on PCK file 2017-06-07 11:36:00 -03:00
Pedro J. Estébanez bf4a25c272 Use builtin BC decompression when libsquish not available
Builtin code is revived and fixed.
2017-05-28 03:45:38 +02:00
Ferenc Arn aef3c4a804 Use libsquish to decompress DXT textures.
Also ensure that save_png doesn't modify the image.

Removed the broken decompressor in the process.
2017-05-26 18:56:10 -05:00
Bojidar Marinov 831cb5b119 Fix weigth scale of A* being applied to the whole path and estimation
Attempt to fix #8584

(cherry picked from commit bd91730347)
2017-05-27 00:42:59 +02:00
Ferenc Arn 89703435a1 Avoid overestimating the cost in AStar heuristics.
This is a necessary condition for finding optimal solutions.
This is achieved by simply requiring/ensuring that no weights are smaller than 1.

Fixes #8584.

(cherry picked from commit e4eb093c62)
2017-05-27 00:42:59 +02:00
Fabian Mathews f0beb36652 Added bool to allow astar points to be connected in one direction only
(cherry picked from commit 2262a59ab3)
2017-05-27 00:42:59 +02:00
Marcelo Fernandez 645636e27c Fixed the IP resolver code blocking the main thread, it uses a Mutex now to lock its own thread.
(cherry picked from commit bba8f1db30)
2017-05-26 23:56:31 +02:00
Rémi Verschelde 6cf507f004 Move other lone thirdparty files to thirdparty/misc
Also move Box2D ConvexDecomposition contrib code to
thirdparty/b2d_convexdecomp.

(cherry picked from commit d4029aa51a)
2017-05-26 23:39:47 +02:00
Rémi Verschelde 86724ba1c6 Split thirdparty smaz.c out of compressed_translation.cpp
Code comes from 150e125cba/smaz.c

With a small modification to match Godot expectations:
```
diff --git a/thirdparty/core/smaz.c b/thirdparty/core/smaz.c
index 9b1ebc2..555dfea 100644
--- a/thirdparty/core/smaz.c
+++ b/thirdparty/core/smaz.c
@@ -14,7 +14,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 #include <string.h>

 /* Our compression codebook, used for compression */
-static char *Smaz_cb[241] = {
+static const char *Smaz_cb[241] = {
 "\002s,\266", "\003had\232\002leW", "\003on \216", "", "\001yS",
 "\002ma\255\002li\227", "\003or \260", "", "\002ll\230\003s t\277",
 "\004fromg\002mel", "", "\003its\332", "\001z\333", "\003ingF", "\001>\336",
@@ -89,7 +89,7 @@ static char *Smaz_rcb[254] = {
 "e, ", " it", "whi", " ma", "ge", "x", "e c", "men", ".com"
 };

-int smaz_compress(char *in, int inlen, char *out, int outlen) {
+int smaz_compress(const char *in, int inlen, char *out, int outlen) {
     unsigned int h1,h2,h3=0;
     int verblen = 0, _outlen = outlen;
     char verb[256], *_out = out;
@@ -167,7 +167,7 @@ out:
     return out-_out;
 }

-int smaz_decompress(char *in, int inlen, char *out, int outlen) {
+int smaz_decompress(const char *in, int inlen, char *out, int outlen) {
     unsigned char *c = (unsigned char*) in;
     char *_out = out;
     int _outlen = outlen;
@@ -192,7 +192,7 @@ int smaz_decompress(char *in, int inlen, char *out, int outlen) {
             inlen -= 2+len;
         } else {
             /* Codebook entry */
-            char *s = Smaz_rcb[*c];
+            const char *s = Smaz_rcb[*c];
             int len = strlen(s);

             if (outlen < len) return _outlen+1;
diff --git a/thirdparty/core/smaz.h b/thirdparty/core/smaz.h
index a547d89..a9d8a33 100644
--- a/thirdparty/core/smaz.h
+++ b/thirdparty/core/smaz.h
@@ -14,7 +14,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 #ifndef _SMAZ_H
 #define _SMAZ_H

-int smaz_compress(char *in, int inlen, char *out, int outlen);
-int smaz_decompress(char *in, int inlen, char *out, int outlen);
+int smaz_compress(const char *in, int inlen, char *out, int outlen);
+int smaz_decompress(const char *in, int inlen, char *out, int outlen);

 #endif
```

(cherry picked from commit c5f830d6b9)
2017-05-26 23:35:15 +02:00
Rémi Verschelde 8312d421c6 Move core thirdparty files to thirdparty/{minizip,misc}
(cherry picked from commit 2398eb6ed4)
2017-05-26 23:29:26 +02:00
Marco Melorio b0d2b46efb Update snake_case splitting
(cherry picked from commit 4677c0fbb8)
2017-05-26 18:47:23 +02:00
Andreas Haas a46dcfe12f Core: fix possible memory leaks.
(cherry picked from commit a2734df7ed)
2017-05-26 17:38:05 +02:00
Pedro J. Estébanez fa4b09f63d Make MessageQueue::flush() reentrant 2017-05-18 13:01:12 +02:00
Rémi Verschelde aa046a85dc Merge pull request #8740 from pixelpicosean/scrollingWithFactor
Implemented scrolling factor for precision trackpads for 2.1
2017-05-15 07:57:05 +02:00
Sean Bohan ee670f3724 Implemented scrolling factor for smooth trackpad scrolling
Working platforms platform: OSX, Windows.
Support for almost all ui elements, including project list.

Ported from 304a1f5b5a (#7864).
Fixes #492 and #3913.
2017-05-15 06:44:00 +08:00
Fabio Alessandrelli 3044d0aed3 Compression::compress properly returns compressed size
selective pick from cbbcf72703
2017-05-12 20:01:53 +02:00
Fabio Alessandrelli 5521325068 Better explain out of memory error in message queue
Also effectively saves one unnecessary call when everything is fine.

(cherry picked from commit 1a7aafa90d)
2017-05-12 20:01:53 +02:00
Fabio Alessandrelli bd26eacc59 Allow non blocking UDP put_packet in C++.
- Add blocking mode option to PacketPeerUDP.
- put_packet returns ERR_UNAVAILABLE when operation would block.
- ENet module uses non-blocking UDP.

(cherry picked from commit 5f681d0b0f)
2017-05-12 20:01:53 +02:00
Pedro J. Estébanez 0469782d3c Fix infinite loop in DirAccessPack::get_current_dir() 2017-05-04 02:18:39 +02:00
volzhs cfa943a0eb Fix wrong fallback for locale 2017-04-26 04:45:52 +09:00
Rémi Verschelde 3b687c5474 Move VERSION_MKSTRING logic to version.h
Fixes a bug where the VERSION_PATCH define is not yet in scope if
typedefs.h is included before version.h at compilation time.
2017-04-10 23:08:28 +02:00
Rémi Verschelde e9b045d9e5 Add "Godot Engine contributors" copyright line 2017-04-08 00:45:24 +02:00
Fabian Mathews 1a1e25bfca Added ability to change A-star cost function
(cherry picked from commit b541402417)
2017-04-05 08:18:38 +02:00
Ferenc Arn f263274a25 Use atan2 rather than acos in Vector3.angle_to.
Fixes #8111.

(cherry picked from commit 3730e0533c)
2017-03-24 23:19:30 +01:00
Bojidar Marinov 0afb9b579f Suppress error messages when using ConfigFile::get_value and a default is given
Fixes #8097

(cherry picked from commit 927d15b815)
2017-03-24 23:17:08 +01:00
Rémi Verschelde a9d63bcf6f Merge pull request #8107 from RandomShaper/warped-panning-2.1
Implement warped mouse panning for 2D & 3D editors (2.1)
2017-03-24 22:50:34 +01:00
Pedro J. Estébanez 2c2c48ffb3 Implement warped mouse panning for 2D & 3D editors
Enabled by default as in Blender, but can be disabled separately for 2D & 3D;
the core functionality is in Input so this could be reused or even exposed to scripts in the future
2017-03-22 21:18:47 +01:00
Fabio Alessandrelli d9525082fe Remove set_ip_type from network classes (no longer needed)
- TCP:
  - `listen` bind to wildcard "*" -> dual stack socket
  - `listen` bind to address -> socket from address type
  - `connect` -> resolve using best protocol (UNSPEC), socket from address type

- UDP:
  - `listen` bind to wildcard "*" -> dual stack socket
  - `listen` bind to address -> socket from address type
  - `put_packet`/`put_var` -> resolve using TYPE_ANY (UNSPEC), socket from address type
    (to change socket type you must first call `close` it)

(cherry picked from commit 88a56ba783)
2017-03-22 21:00:23 +01:00
Fabio Alessandrelli 0b9684a085 Implement UDP listen bind address
(cherry picked from commit 2fe4ef6699)
2017-03-22 20:25:56 +01:00
Fabio Alessandrelli 43d992fc34 Implement TCP Server bind address
(cherry picked from commit b2839343ca)
2017-03-22 20:25:52 +01:00
Fabio Alessandrelli 90a747a52d IP_Address can now be a wildcard (not a valid IP, used for binding)
(cherry picked from commit 4198291cd4)
2017-03-22 20:01:41 +01:00
Fabio Alessandrelli 603105df18 Convert validity checks of IP_Address to is_valid method.
(cherry picked from commit 98a7e2b4e0)
2017-03-22 20:01:41 +01:00
Andreas Haas 2f1a0448a7
Input: bind parse_input_event()
When using get_tree().input_event(ev), the engine will JUST send the event down the SceneTree.
However, you won't get any of the benefits of the Input singleton:
- No InputMap actions will be emitted
- The internal input state won't be modified, so methods like `Input.get_mouse_pos()` or `Input.is_joy_button_pressed` won't return the expected output after sending the event.

This is fixed by using `Input.parse_input_event(ev)` instead.
I guess we'll also have to update the docs to reflect that this is the preferred method of sending custom InputEvents.
2017-03-19 08:33:07 +01:00
Rémi Verschelde f8db8a3faa Bring that Whole New World to the Old Continent too
Applies the clang-format style to the 2.1 branch as done for master in
5dbf1809c6.
2017-03-19 00:36:26 +01:00
Rémi Verschelde 1d418afe86 Prevent cyclical dependency issue after clang-format includes reorder 2017-03-19 00:33:35 +01:00
Rémi Verschelde d4e0be7632 Add missing map.h include in color defs
(cherry picked from commit 5e13a762ec)
2017-03-19 00:32:58 +01:00
Rémi Verschelde 16b78da941 Style: Various fixes to play nice with clang-format
(cherry picked from commit 2a0ddc1e89)
2017-03-18 23:13:47 +01:00
Rémi Verschelde dbf0137576 Style: Fix statements ending with ';;'
(cherry picked from commit f44ee891be)
2017-03-18 21:14:33 +01:00
Rémi Verschelde 75bf6a9978 Style: Keep long lines for now
clang-format does not play well with tab-aligned multiline statements...
Some more research will be needed if we want to set a column limit.

(cherry picked from commit e2a3f06f3d)
2017-03-18 21:06:07 +01:00
Rémi Verschelde 4bfecab813 Style: No break before list brace
clang-format does not handle that well *at all*.

For the reference, found the relevant pieces of code with:
`ag "=[ "$'\t'"]?"$'\n'"[ "$'\t'"]?{" --ignore=thirdparty`

(cherry picked from commit 40323407df)
2017-03-18 21:05:58 +01:00
Andreas Haas 8015ab0db3 Add ClassDB binding for File.get_modified_time
Closes #7613

(cherry picked from commit 5ec0610c60)
2017-03-18 19:46:36 +01:00
Pedro J. Estébanez 6289997724 Fix ambiguity in StringName (null data vs. data with empty string) 2017-03-15 04:26:23 +01:00
BastiaanOlij 8436a34305 Core motion for Godot 2.x (based on PR 7127) 2017-03-09 21:46:38 +11:00
Rémi Verschelde cc265d5506 Merge pull request #7910 from RandomShaper/single-field-prop-edit-2.1
Implement single-field property change for multinode edit (2.1)
2017-03-05 13:43:35 +01:00
Pedro J. Estébanez e0170625ef Expose uncapped versions of closest-point-to-segment utilities 2017-03-04 22:57:53 +01:00
Pedro J. Estébanez 25aedb896a Expose Geometry::get_closest_point_to_segment_2d() 2017-03-04 01:49:16 +01:00
Pedro J. Estébanez e46e12906a Implement single-field property change for multinode edit 2017-03-02 10:48:24 +01:00
Juan Linietsky d5c2a6b76b Godot 2.1 to 3.0 conversion should be more or less final 2017-02-15 08:29:11 -03:00
Juan Linietsky ebb7d2cdb7 -WIP Exporter to Godot 3.0, only text scenes (no .scn) and still kind of buggy 2017-02-12 23:13:14 -03:00
Rémi Verschelde 6abe141579 Merge pull request #7756 from volzhs/str-format
Fix zero padding formatting
2017-02-12 23:20:13 +01:00
Rémi Verschelde 11b95cda45 Merge pull request #7750 from Faless/2.1.x_fix_7697
HTTPClient properly handle partial data in non-blocking mode
2017-02-12 23:19:10 +01:00
Rémi Verschelde 331ff9db77 Merge pull request #7742 from karroffel/json_parsing
JSON::parse reports errors on open-ended objects
2017-02-12 23:17:11 +01:00
Nuno Donato 7496b2f862 Added "Scots" locale name, fixing #7630
(cherry picked from commit 6b5c595e40)
2017-02-08 16:18:59 +01:00
volzhs 7ebb356a31 Fix zero padding formatting 2017-02-08 10:40:35 +09:00
Fabio Alessandrelli 1f08d17a98 HTTPClient properly handle partial data in non-blocking mode
Use block to send DVector::Write out of scope in
HTTPClient::read_response_body_chunk()

(cherry picked from commit 833994b294)
2017-02-07 11:05:14 +01:00
Karroffel 85793ccc4a JSON::parse reports errors on open-ended objects 2017-02-06 19:22:42 +00:00
Pedro J. Estébanez 888f8b31e7 Improve .tscn VCS
Serialize dictionaries adding newlines between key-value pairs
Serialize group lists also with newlines in between
Serialize string properties escaping only " and \ (needed for a good diff experience with built-in scripts and shaders)

Bonus:
Make AnimationPlayer serialize its blend times always sorted so their order is predictable in the .tscn file.

This PR is back-compat; won't break the load of existing files.

Cherry-picked from 7dbb1c0571
2017-01-25 20:11:10 +01:00
Rémi Verschelde 349e62835b i18n: Add support for Scots (sco) language
Fixes #6931.

(cherry picked from commit ede36aca8d)
2017-01-12 19:15:30 +01:00
karroffel b1fc41a301 exposed OS.set_exit_code and OS.get_exit_code to ObjectTypeDB
(cherry picked from commit fbfcc981d9)
2017-01-12 19:15:30 +01:00
Rémi Verschelde d8223ffa75 Welcome in 2017, dear changelog reader!
That year should bring the long-awaited OpenGL ES 3.0 compatible renderer
with state-of-the-art rendering techniques tuned to work as low as middle
end handheld devices - without compromising with the possibilities given
for higher end desktop games of course. Great times ahead for the Godot
community and the gamers that will play our games!

(cherry picked from commit c7bc44d5ad)
2017-01-12 19:15:30 +01:00
Fabio Alessandrelli 6940830627 Properly localize absolute path.
Calling localize_path will return a localized path in res:// if the
path starts with the resource file-system/folder, and will return
the unchanged absolute path otherwise.

Closes #6979 and #7161.

(cherry picked from commit cdc97ca453)
2017-01-12 19:15:28 +01:00
Bojidar Marinov 71b35c527f Remove extraneous line in .po reader, which caused it to disregard first line
Fixes #7337

(cherry picked from commit 474eafbbf6)
2017-01-12 19:15:28 +01:00
Bojidar Marinov 85585c7fc5 Add named colors to GDScript/core.
Names and values taken from https://en.wikipedia.org/wiki/X11_color_names

(cherry picked from commit 23381a530b)
2017-01-12 19:15:27 +01:00
Kazuo256 b56c00cc56 Add Array.front() and Array.back()
(cherry picked from commit bf4fda64fd)
2017-01-12 19:15:26 +01:00
Fabio Alessandrelli 7a77fd1cd5 Expose HTTP classes' set_ip_type to scripting
(cherry picked from commit d194e1c48e)
2017-01-04 00:46:33 +01:00
Fabio Alessandrelli 3bb1709fd7 Separate hostname resolve cache based on ip_type
(cherry picked from commit c1c1ec690e)
2017-01-04 00:46:33 +01:00
Fabio Alessandrelli 00fdcf3cd0 IP_Address now handle IPv4 and IPv6 transparently
IP_Address changes:
- Converts to and from String transparently while handling IPv4 as IPv6
  mapped (::ffff:[IP]) address internally.
- Completely remove AddrType enum.
- Setting/Getting of ip array is now only possible through dedicated functions
  (ie. set_ipv4, get_ipv4, set_ipv6, get_ipv6)
- Add function to know if the address is a valid IPv4 (for IP implementation and enet)

(cherry picked from commit 1aff508dd9)
2017-01-04 00:46:33 +01:00
Fabio Alessandrelli 7ef71b9013 Allow setting ip_type for TCP/UDP and HTTP classes
(cherry picked from commit a77a0118f6)
2017-01-04 00:46:33 +01:00
Fabio Alessandrelli e8a6cbc897 Migrate int.IP_TYPE_ constants to IP.TYPE_
(cherry picked from commit c18c5013f8)
2017-01-04 00:46:32 +01:00
Fabio Alessandrelli a46a643f90 Use an instance variable for ip_type in raw sockets
PacketPeerUDP/StreamPeerTCP/TCP_Server now uses an instance variable
to store the selected ip_type (IPv4/IPv6/ANY, where ANY = dual stack).
All calls to resolve addresses, sending/receving data, connecting/listening
will use that socket type.

(cherry picked from commit 95bdd97768)
2017-01-04 00:46:32 +01:00
Fabio Alessandrelli 2fff8e8cde Set proper ip_type default for listen() and resolve_hostname()
(cherry picked from commit 7eef15b734)
2016-12-11 18:12:46 +01:00
Fabio Alessandrelli a2048efd72 Add optional IP type param in TCP/UDP connect/set_send_address
(cherry picked from commit 2f1c859272)
2016-12-11 18:12:45 +01:00
Fabio Alessandrelli 6e0de0cce8 TCPServer listen now default to IP type ANY (v6 socket with v4 support)
(cherry picked from commit ee69bd81cf)
2016-12-11 18:12:45 +01:00
Ariel Manzur 5546929712 added implementation of is_valid_ip_address()
(cherry picked from commit a3131a6b5b)
2016-12-11 12:35:06 +01:00
Ariel Manzur d8b0070b8c added windows support for ipv6, cleaned up unix code
(cherry picked from commit 672225b710)
2016-12-11 12:35:06 +01:00
Ariel Manzur 904285f4b4 address type for http client
(cherry picked from commit 1c2ac490cf)
2016-12-11 12:35:06 +01:00