Commit graph

1240 commits

Author SHA1 Message Date
Rémi Verschelde bee81d5214 Merge pull request #8981 from toger5/addedGrowFunction
implemented grow(left,top,right,bottom) function
2017-06-08 07:41:54 +02:00
Rémi Verschelde 71ada5bc2c Merge pull request #9015 from mcanders/mcanders/ParseObjectVariantFix
Fix Variant::OBJECT token parsing
2017-06-07 07:51:32 +02:00
toger5 66b308925c added grow functions to Rect2
- grow_individual
 - grow_margin
2017-06-05 01:11:00 -07:00
Carter Anderson 0a8de39bb1 Fix Variant::OBJECT token parsing 2017-06-04 21:33:09 -07:00
alexholly a3c90b0293 renamed all Rect2.pos to Rect2.position 2017-06-04 02:09:17 +02:00
Andreas Haas 9bc5348961
InputEvent: Renamed "pos" property to "position"
Make the naming consistent with other classes.
2017-06-03 11:26:39 +02:00
Rémi Verschelde 5a6d4971e1 Merge pull request #8973 from thomas-goerlich/8957_rand_range_bugfix
Fixed rand_range not returning correct random values on windows
2017-06-03 08:44:07 +02:00
Rémi Verschelde 59322d4cc4 Merge pull request #9011 from karroffel/ptrcall-nightmare-fix
fixed PowerState enum cast
2017-06-01 09:42:05 +02:00
Ferenc Arn 6a9c990da7 Add ETC1/ETC2 compression support though etc2comp.
Remove rg-etc1 code. Also updated travis to use ubuntu 14.04.

Fixes #8457.
2017-05-31 18:59:00 -05:00
Juan Linietsky a134f58fb3 rewritten PBR implementation to make it friendlier with Blender 2017-05-31 20:29:56 -03:00
Karroffel 6bda2876f1 fixed PowerState enum cast
Quite a while ago I made a commit (131631b) where I did a weird
thing to fix compilation with PTRCALL_ENABLED. And I couldn't
sleep because of this after all these months. So here is the
proper version.
2017-06-01 00:16:33 +02:00
Ferenc Arn a1c8896d9d Fix PathFollow rotations.
Used parallel transport to move the object along the curve. Also introduced a few more math checks useful for debugging.
2017-05-31 13:58:31 -05:00
Andreas Haas c218390864
InputEvent: Restore old behaviour for matching key events to actions.
Original code in 9100db7
2017-05-30 22:27:55 +02:00
Juan Linietsky 5567e898d1 Several fixes related to PBR and Environment 2017-05-30 08:56:19 -03:00
Thomas Görlich 2c6449c4fc Changed enum to const because enum with uint64 size does not work on VSC++ Compiler 2017-05-29 23:56:21 +02:00
Poommetee Ketson ff03d846eb NaturalSort: strings start with . treated differently 2017-05-29 09:59:02 +07:00
Juan Linietsky bb20f230ad -Added .hdr format support
-Added default environment editor setting
-Added environment created by default in new projects
-Removed default light and ambient from spatial editor, to make the editor more PBR compliant
2017-05-28 21:48:05 -03:00
Rémi Verschelde 378ebffb23 Merge pull request #8936 from Hinsbart/fix_action
Fix InputEvent actions.
2017-05-27 11:29:05 +02:00
Andreas Haas 3204befd1e
Fix InputEvent actions.
The `InputEvent::is_action(pressed|released)` methods weren't implemented yet.
Also fixed a typo in `InputDefault` that prevented `Input.is_action(pressed|released)` from working.
2017-05-27 10:52:57 +02:00
Juan Linietsky f89641907f -Added EXR supprot for HDR (no BC6 compression yet though)
-Improvements to texture importer
-Proper detection of S3TC compression modes, and added all modes to Image
-Fixes to non-power of 2 compressed textures, which should all be supported by GLES3
2017-05-26 22:31:32 -03:00
Andreas Haas 3744d9fd55
Fix virtual methods in InputEventKey.
This fixes a lot of problems with key input in the engine.
2017-05-25 21:56:54 +02:00
Juan Linietsky 7c89e00d46 Merge pull request #8590 from tagcup/s3tc_stuff
Use libsquish to decompress DXT textures.
2017-05-25 16:29:04 -03:00
Rémi Verschelde 7592c2380d Merge pull request #8898 from vnen/screentouch-struct-class
Change InputEventScreenTouch from struct to class
2017-05-25 08:40:27 +02:00
George Marques 452caf3f80
Change InputEventScreenTouch from struct to class 2017-05-24 16:06:07 -03:00
Martin Capitanio 29c5b4c7e6 Fix 2D-editor mouse wheel zoom (x11).
Fixes #8888
2017-05-24 10:02:43 +02:00
Juan Linietsky afcce9eb12 -Fix the "set_val" call deferred, it was the only one.. closes #8742
-Removed redundant bind in input_event
2017-05-23 09:06:22 -03:00
Juan Linietsky 6161e731d0 fixed crash on code that checks InputEvent 2017-05-23 08:13:11 -03:00
Rémi Verschelde ce51138b38 Merge pull request #8786 from bojidar-bg/fix-astar-weight-scale
Fix weigth scale of A* being applied to the whole estimation
2017-05-22 15:16:20 +02:00
Bojidar Marinov bd91730347
Fix weigth scale of A* being applied to the whole path and estimation
Attempt to fix #8584
2017-05-22 15:55:49 +03:00
Ferenc Arn e4eb093c62 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.
2017-05-21 15:13:09 -05:00
Juan Linietsky 5b3709d309 Removal of InputEvent as built-in Variant type..
this might cause bugs I haven't found yet..
2017-05-20 17:05:38 -03:00
Rémi Verschelde c7650c363b Merge pull request #8829 from supagu/astar-bidirectional
Added bool to allow astar points to be connected in one direction only
2017-05-20 09:49:28 +02:00
Emmanuel Leblond abcb044bf3
Finish implementation of GDnative builtins bindings 2017-05-19 23:28:15 +02:00
Fabian Mathews 2262a59ab3 Added bool to allow astar points to be connected in one direction only 2017-05-19 20:46:45 +09:30
Ferenc Arn 3c175115eb Use libsquish to decompress DXT textures. 2017-05-18 16:57:53 -05:00
Rémi Verschelde 1f62c33141 Merge pull request #8807 from RandomShaper/mq-flush-reentrant
Make MessageQueue::flush() reentrant
2017-05-18 18:52:55 +02:00
Rémi Verschelde c2854381b3 Merge pull request #8649 from neikeq/pr-ringbuffer-find
RingBuffer: Adds find() method
2017-05-18 13:42:56 +02:00
Pedro J. Estébanez 983fd3a7bb Make MessageQueue::flush() reentrant 2017-05-18 13:02:49 +02:00
Rémi Verschelde c3baf5eb3c Fix two typos from previous commit
Also cleanup comments on variant types.
2017-05-17 18:45:56 +02:00
Juan Linietsky 98a3296702 Removal of Image from Variant, converted to a Resource. 2017-05-17 07:37:45 -03:00
Damian Day f2564ca97f Fix natural sorting order in EditorFileDialog, FileDialog and EditorFileSystemDirectory
Make EditorFileDialog, FileDialog and EditorFileSystemDirectory alphanumerical sorting more natural

Added a new method 'naturalnocasecmp_to' and comparator 'NaturalNoCaseComparator' to String.

Fixes #8712.
2017-05-12 13:02:25 +01:00
Marcelo Fernandez bba8f1db30 Fixed the IP resolver code blocking the main thread, it uses a Mutex now to lock its own thread. 2017-05-08 21:30:48 +02:00
toger5 304a1f5b5a Implemented scrolling factor for smooth trackpad scrolling
Working platforms platform: OSX, Windows.
Support for almost all ui elements, including project list.
2017-05-07 14:23:56 +02:00
Rémi Verschelde 18df047f0b Merge pull request #8658 from Faless/explain_out_of_mem_msg_queue_master
Better explain out of memory error in message queue
2017-05-05 23:09:30 +02:00
Rémi Verschelde e58519eb31 Merge pull request #8642 from RandomShaper/fix-pack-get-curr-dir
Fix infinite loop in DirAccessPack::get_current_dir()
2017-05-05 23:02:07 +02:00
Fabio Alessandrelli 1a7aafa90d Better explain out of memory error in message queue
Also effectively saves one unnecessary call when everything is fine.
2017-05-05 19:56:54 +02:00
Ignacio Etcheverry 803a54d93c RingBuffer: Adds find() method 2017-05-05 02:09:43 +02:00
Pedro J. Estébanez 5c0188b5c3 Fix infinite loop in DirAccessPack::get_current_dir() 2017-05-04 02:20:53 +02:00
Rémi Verschelde 7ce8342ac5 Rename project file to "project.godot"
Slimmed down variant from the reverted #8375.
The rationale behind the name change is to give Godot's project file a unique
extension (".godot") that can be registered on the OS to be associated with
the Godot binary (OS registration not implemented here).

This PR also adds the possibility to start the game or editor if launched
with the project.godot passed as argument, which paves the way for allowing
a similar behaviour on a double-click in the OS file manager (code originally
by @Hinsbart).

Closes #6915.
2017-05-01 17:50:19 +02:00
Rémi Verschelde de7eba887e Merge pull request #8572 from akien-mga/thirdparty
Moving more thirdparty stuff (minizip, some single-file external libs) to the thirdparty directory
2017-04-29 22:57:49 +02:00
Juan Linietsky 6d2f985db4 Revert "Use .godot as file extension for project files." 2017-04-29 17:56:51 +02:00
Rémi Verschelde d4029aa51a Move other lone thirdparty files to thirdparty/misc
Also move Box2D ConvexDecomposition contrib code to
thirdparty/b2d_convexdecomp.
2017-04-28 21:19:25 +02:00
Rémi Verschelde c5f830d6b9 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
```
2017-04-28 21:19:24 +02:00
Rémi Verschelde 2398eb6ed4 Move core thirdparty files to thirdparty/{minizip,misc} 2017-04-28 21:19:23 +02:00
Andreas Haas c530d8f43c
Fix recognition of resource extensions.
Also removes a related debug print.
2017-04-26 23:07:23 +02:00
volzhs ec1c7ce6c3 Fix wrong fallback for locale 2017-04-26 04:48:03 +09:00
Rémi Verschelde 1dc689b513 Merge pull request #8506 from iam13islucky/patch-1
[3.0] Fix bug in Image::_get_pixelb
2017-04-24 12:02:10 +02:00
Rémi Verschelde bd885ed704 Merge pull request #8469 from Melix19/patch-2
Update snake_case splitting
2017-04-24 11:38:36 +02:00
Rémi Verschelde 68870af214 Merge pull request #8420 from magyar123/pr-script-files-as-base
Added the ability to select files as base when creating scripts
2017-04-24 11:28:36 +02:00
Rémi Verschelde 5ae1e172da Merge pull request #8277 from tagcup/math_checks
Added various functions basic math classes. Also enabled math checks …
2017-04-24 11:16:20 +02:00
iam13islucky 73a9a85bc9 [3.0] Fix bug in Image::_get_pixelb
Fixes issue:
 https://github.com/godotengine/godot/issues/8158
2017-04-23 22:51:35 -06:00
Marco Melorio 4677c0fbb8 Update snake_case splitting 2017-04-23 23:03:16 +02:00
Rémi Verschelde 515f92d03b Fix property warnings and hide some debug prints
"ALL IS GOOD" was a lie.

In particular, removes verbose "path not recognized" false positive.

The actual logic is to (somewhat naively) check all ResourceFormatLoaders
and to pick the first good match, so no need to warn about the formats
that do not match the type hint.
2017-04-23 11:17:32 +02:00
Rémi Verschelde 99529fb80d 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.

(cherry picked from commit 3b687c5474)
2017-04-20 12:14:34 +02:00
Rémi Verschelde 22b9c0207b Merge pull request #8417 from neikeq/hello-there
External editor improvements and fixes
2017-04-20 02:20:04 +02:00
Marco Melorio 1ac38846e8 Fixed that playing the project opens the project manager
Fixes #8445
2017-04-18 15:46:37 +02:00
Rémi Verschelde 7088d9e30f Merge pull request #8441 from tagcup/seed_fix
Fix PRNG randomization.
2017-04-18 00:06:41 +02:00
Rémi Verschelde 474f18512a Merge pull request #8375 from Hinsbart/project_extension
Use .godot as file extension for project files.
2017-04-17 23:28:15 +02:00
Ferenc Arn ceb699f5ec Fix PRNG randomization.
PCG32 doesn't like small seeds, which leads to zero random values (prior to #7532, zero values were handled as special cases).

Use a large default seed, and also add a shift in Math::randomize.

Fixes #8423.
2017-04-17 14:05:02 -05:00
Ignacio Etcheverry 4b8568006d External editor improvements and fixes
Notable changes:

- Now ScriptLanguages have the option to override the global external editor setting.
If `ScriptLanguage::open_in_external_editor()` returns `ERR_UNAVAILABLE` (which it does by default), then the global external editor option will be used.
- Added formatting to the external editor execution arguments. Now it's possible to write something like this: `{project} -g {file}:{line}:{col}`.
- `VisualScript::get_member_line()` now can return the line of functions (well, it returns the id of the _Function_ node of the function). I guess there is nothing else we can get a "line" from.

Fixes:

- Fixes a bug where `ScriptEditor::script_goto_method()` would not work if the script is not already open in the built-in editor.
- Fixes wrong DEFVAL for `cursor_set_column` and `cursor_set_line` in TextEdit.
- `Script::get_member_line()` now returns -1 ("found nothing") by default.
2017-04-17 01:51:30 +02:00
Andreas Haas c06a2db63a
Use .godot as file extension for project files.
Now project files don't have to be named "godot.cfg" anymore, they can have any name so as long as it ends with *.godot.
Also godot will automatically start the editor now if launched with a project file as an argument.
This allows for double-clicking of projects to open them :)

Code-wise this should be complete, but there's still work to do:

- Make a nice icon for godot projects.
- Work on installers/packaging -> register the extension and icon with godot.
- Update the 2.1 to 3.0 exporter.

Tested on linux and windows so far.
2017-04-16 10:19:07 +02:00
mbalint12 a3afec588c Added the ability to select files as base when creating scripts 2017-04-15 23:29:09 +02:00
Hein-Pieter van Braam 8ff6e53833 Correct Variant::hash_compare()
There was a logic error in #7815 which made
Variant.hash_compare() == Variant.hash_compare() always true.
In an attempt to short-circuit the NaN check I made an (in hindsight) obvious
error: 10 == 12 || is_nan(10) == is_nan(12)

This will be true for all inputs, except for the NaN, not-NaN case. The macro
has been updated to now generate:

(10 == 12) || (is_nan(10) && is_nan(10))

so:

(10 == 12)   || (is_nan(10)  && is_nan(12))  = false
   False  or (False and False) is False
(10 == 10)   || (is_nan(10)  && is_nan(10))  = true
   True or (False and False) is True
(Nan == 10)  || (is_nan(NaN) && is_nan(10))  = false
   False or (True and False) is False
(Nan == Nan) || (is_nan(NaN) && is_nan(NaN)) = true
   False or (True and True) is True

Which is correct for all cases.

This bug was triggered because the hash function for floating point numbers
can very easily generate collisions for the tested Vector3(). I've also added
an extra hashing step to the float hash function to make this less likely to
occur.

This fixes #8081 and probably many more random weirdness.
2017-04-14 11:31:18 +02:00
Bojidar Marinov c37840c69f
Fix a pesky bug in marshalls.cpp/encode_variant
Fixes #7556 running game from editor on LLVM builds.
2017-04-11 20:17:56 +03:00
Sergey Pusnei 8589ca3903 Rename [gs]et_pos to [gs]et_position for Controls
Control set_pos -> set_position
Control set_global_pos -> set_global_position
[gs]et_mouse_pos -> [gs]et_mouse_position
[gs]et_global_mouse_pos -> [gs]et_global_mouse_position
fixes #8005
2017-04-10 08:27:34 +02:00
Rémi Verschelde f29dc079dc Merge pull request #8333 from touilleMan/classdb-class_sget_property-binding
Add _ClassDB.class_[g|s]et_property to ClassDB exposed methods
2017-04-09 17:46:35 +02:00
Emmanuel Leblond 42eba57bad
Add return value in ClassDB.class_[g|s]et_property bindings 2017-04-09 14:04:01 +02:00
Emmanuel Leblond 23c310be7b
Add _ClassDB.class_[g|s]et_property to ClassDB exposed methods 2017-04-09 13:27:07 +02:00
Juan Linietsky 4286aef693 Particle system is complete. Rejoice! 2017-04-08 22:40:06 -03:00
Rémi Verschelde df61dc4b2b Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
Juan Linietsky 74808ac4d9 New particle system, mostly working, some small features missing. 2017-04-06 23:49:27 -03:00
Ferenc Arn 9a37ff1e34 Added various functions basic math classes. Also enabled math checks only for debug builds.
Added set_scale, set_rotation_euler, set_rotation_axis_angle. Addresses #2565 directly.
Added an euler angle constructor for Basis in GDScript and also exposed is_normalized for vectors and quaternions.
Various other changes mostly cosmetic in nature.
2017-04-06 13:03:56 -05:00
Rémi Verschelde 1a33d5e06f Merge pull request #8286 from Hinsbart/memleaks
Core: fix possible memory leaks.
2017-04-06 14:34:21 +02:00
Andreas Haas a2734df7ed
Core: fix possible memory leaks. 2017-04-06 13:43:13 +02:00
Rémi Verschelde 2c4e4432af Merge pull request #8214 from tagcup/bounce_reflect_slide
Made slide and reflect active verbs acting on itself in Vector2 and V…
2017-04-05 01:23:09 +02:00
Rémi Verschelde 46bc14e66f Merge pull request #8246 from GodotNativeTools/dlscript-module
DLScript module
2017-04-04 00:25:03 +02:00
Karroffel fd55308786 added dlscript module
This module was written by bojidar-bg and me, with the help of ClikCode and touilleMan.

This adds a module to Godot that enables the use of dynamic libraries as a source for scripts.
That also allows third party libraries to be linked to Godot more easily and without creating modules.

For a readme see https://github.com/GodotNativeTools/godot_headers/blob/master/README.md
2017-04-03 17:20:11 +02:00
Ferenc Arn 1a620bd5fa Made slide and reflect active verbs acting on itself in Vector2 and Vector3.
This is in alignment with other functions in vector classes.
Also added checks for normalization, fixed the sign of reflect (which now corresponds to reflection along a plane mathematically), added bounce method and updated docs.

Fixes #8201.
2017-04-03 10:02:12 -05:00
Karroffel 67f59bc2d9 increased maximum number of scripting languages 2017-04-03 16:10:26 +02:00
Rémi Verschelde 5b09dde3fe Merge pull request #8146 from supagu/astar
Added ability to change A-star cost function
2017-04-03 13:52:59 +02:00
Fabian Mathews b541402417 Added ability to change A-star cost function 2017-04-01 16:36:22 +10:30
Karroffel 2281942fb3 Added methods for opening dynamic libraries to OS 2017-03-29 23:05:15 +02:00
Ferenc Arn 97d510531a Fix polar decomposition in 2D.
When performing polar decomposition in 2D as B = R.S, where R is rotation (with determinant +1) and S is scaling, use the convention that reflections are absorbed into S through a reflection around y axis.
In 3D, this is done by using a reflection along all three axes, but since the dimensionality is even in 2D, one axis needs to be chosen.

Fixes Matrix32::get_rotation and Matrix32::get_scale (which weren't properly fixed in #7445).
2017-03-29 12:04:49 -05:00
Rémi Verschelde 5cad9147f9 Merge pull request #8133 from Hinsbart/joy_constants
Input: Refactor JOY_* constants.
2017-03-24 22:53:16 +01:00
Rémi Verschelde 60a9debb99 Merge pull request #8132 from tagcup/vector3_angle_to
Use atan2 rather than acos in Vector3.angle_to.
2017-03-24 22:52:46 +01:00
Rémi Verschelde beba97c0c3 Merge pull request #8122 from tagcup/axis_check_normalization
Explicitly documented that Transform.basis is not necessarily an orth…
2017-03-24 22:51:27 +01:00
Rémi Verschelde 98baec6880 Merge pull request #8109 from RandomShaper/warped-panning
Implement warped mouse panning for 2D & 3D editors
2017-03-24 22:50:39 +01:00
Rémi Verschelde ca3596b043 Merge pull request #8098 from bojidar-bg/configfile-get-value-suppress
Suppress error messages when using ConfigFile::get_value and a default is given
2017-03-24 22:49:50 +01:00
Rémi Verschelde 296ece2c6a Merge pull request #7985 from Faless/enet_godot_sock_squash
Update ENet to use Godot sockets.
2017-03-24 22:47:18 +01:00
Rémi Verschelde debeee56f7 Fix typos in source code using codespell
From https://github.com/lucasdemarchi/codespell
2017-03-24 21:45:31 +01:00
Andreas Haas 0d8f5660f6
Input: Refactor JOY_* constants.
**Breaking change**

Removed the `JOY_SNES_*` and `JOY_SEGA_*` constants. Imho there's no reason for a modern game engine to provide button aliases for decades-old hardware.
Also renamed `JOY_ANALOG_{0,1}_{X,Y}` to `JOY_ANALOG_{L,R}{X,Y}` and removed `JOY_ANALOG_2_*`.
2017-03-24 18:04:36 +01:00
Ferenc Arn 3730e0533c Use atan2 rather than acos in Vector3.angle_to.
Fixes #8111.
2017-03-24 12:03:33 -05:00
Fabio Alessandrelli 5f681d0b0f 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.
2017-03-24 02:30:11 +01:00
Ferenc Arn 6bb9b58b09 Explicitly documented that Transform.basis is not necessarily an orthogonal matrix.
Also added a check that in axis-angle rotations, axis is a normalized vector, and modified the docs accordingly.

Fixes #8113.
2017-03-23 12:27:00 -05:00
Pedro J. Estébanez f5004b78d0 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:36:52 +01:00
Bojidar Marinov 927d15b815
Suppress error messages when using ConfigFile::get_value and a default is given
Fixes #8097
2017-03-21 19:56:54 +02:00
Andreas Haas a69e449782
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 09:20:44 +01:00
Karroffel 6ab3213a55 fixed ClassDB inconsistencies
fixes #7960
2017-03-13 21:17:31 +01:00
Rémi Verschelde 5dbf1809c6 A Whole New World (clang-format edition)
I can show you the code
Pretty, with proper whitespace
Tell me, coder, now when did
You last write readable code?

I can open your eyes
Make you see your bad indent
Force you to respect the style
The core devs agreed upon

A whole new world
A new fantastic code format
A de facto standard
With some sugar
Enforced with clang-format

A whole new world
A dazzling style we all dreamed of
And when we read it through
It's crystal clear
That now we're in a whole new world of code
2017-03-05 16:44:50 +01:00
Rémi Verschelde 45438e9918 Style: prevent bogus macro formatting by clang-format
Also prevent formatting of thirdparty snippet
2017-03-05 16:29:53 +01:00
Karroffel 1531f6fe01 really fixed PTRCALL now 2017-03-05 16:20:20 +01:00
Rémi Verschelde f4fb19d11a Merge pull request #7958 from karroffel/powerstate-ptrcall-fix
Added PowerState casting operator to Variant
2017-03-05 15:48:06 +01:00
Rémi Verschelde e1c1d7d1d7 Add a bunch of missing Godot headers in own files 2017-03-05 15:47:28 +01:00
Karroffel 15838f3702 Added PowerState casting operator to Variant
Without it Godot does not build with PTRCALL_ENABLED
2017-03-05 15:32:16 +01:00
Rémi Verschelde e6952cad3a Merge pull request #7950 from RandomShaper/expose-more-geom
Expose uncapped versions of closest-point-to-segment utilities
2017-03-05 12:04:23 +01:00
Pedro J. Estébanez 0e0b6ec443 Expose uncapped versions of closest-point-to-segment utilities 2017-03-04 23:02:27 +01:00
Julian Murgia 94103c0c02 Add API to access battery power state
Done:
- X11, server (tested)
- Windows (developed, would be nice to retest)
- OSX (not tested)
Prepared (not developed):
- Android (code is here, but may not compile)
- iphone
- winrt
- bb10
- haiku
- javascript
2017-03-04 18:04:29 +01:00
Rémi Verschelde de530c1b23 Merge pull request #7940 from RandomShaper/expose-geometry
Expose Geometry::get_closest_point_to_segment_2d()
2017-03-04 17:00:34 +01:00
Pedro J. Estébanez eaa6433b3b Expose Geometry::get_closest_point_to_segment_2d() 2017-03-04 01:55:12 +01:00
Rémi Verschelde 74eace2b14 Merge pull request #7911 from RandomShaper/single-field-prop-edit
Implement single-field property change for multinode edit
2017-03-02 11:47:11 +01:00
Pedro J. Estébanez 1e867cb9d4 Implement single-field property change for multinode edit 2017-03-02 10:42:05 +01:00
Rémi Verschelde ee53f85bea Merge pull request #7882 from AlexHolly/PoolStringArray-join
added join to PoolStringArray
2017-03-02 08:00:28 +01:00
Leandro Motta Barros 0e5863c86a Fix RANDOM_MAX, which is 2^32-1 with PCG32. 2017-03-01 14:33:45 -03:00
AlexHolly 9f7ce79ea3 added join to PoolStringArray 2017-03-01 16:30:34 +01:00
Rémi Verschelde a1cbe8e22b Merge pull request #7878 from RebelliousX/else
Bunch of missing `else` statements and general logic
2017-02-28 23:03:10 +01:00
Saracen 5e938f0001 Inf and NaN support added to GDScript. 2017-02-28 21:52:33 +00:00
Thaer Razeq f50488a361 Various fixes detected using PVS-Studio static analyzer.
- Add FIXME tags comments to some unfixed potential bugs
- Remove some checks (always false: unsigned never < 0)
- Fix some if statements based on reviews.
- Bunch of missing `else` statements
2017-02-28 07:52:02 -06:00
Rémi Verschelde 9c2542cf26 Merge pull request #7830 from volzhs/str-format-3
Fix zero padding formatting
2017-02-26 20:15:10 +01:00
Juan Linietsky de0045cf1b -renamed globals.h to global_config.cpp (this seems to have caused a few modified files)
-.pck and .zip exporting redone, seems to be working..
2017-02-21 00:06:30 -03:00
volzhs b8e58b2b7b Fix zero padding formatting 2017-02-18 00:20:05 +09:00
Hein-Pieter van Braam b696beea65 Correct hash behavior for floating point numbers
This fixes HashMap where a key or part of a key is a floating point
number. To fix this the following has been done:

* HashMap now takes an extra template argument Comparator. This class
gets used to compare keys. The default Comperator now works correctly
for common types and floating point numbets.

* Variant implements ::hash_compare() now. This function implements
nan-safe comparison for all types with components that contain floating
point numbers.

* Variant now has a VariantComparator which uses Variant::hash_compare()
safely compare floating point components of variant's types.

* The hash functions for floating point numbers will now normalize NaN
values so that all floating point numbers that are NaN hash to the same
value.

C++ module writers that want to use HashMap internally in their modules
can now also safeguard against this crash by defining their on
Comperator class that safely compares their types.

GDScript users, or writers of modules that don't use HashMap internally
in their modules don't need to do anything.

This fixes #7354 and fixes #6947.
2017-02-16 18:44:29 +01:00
Juan Linietsky da11d6d9e8 Many fixes to make exported scenes work better, still buggy. 2017-02-15 08:34:02 -03:00
Juan Linietsky d7fd86d51a -begin of export work, not done yet
-fixes to make scenes exported from godot 2.x work
2017-02-15 08:30:32 -03:00
Juan Linietsky 04a6d2789e Revert "Make nan==nan true for GDScript" 2017-02-14 17:05:16 -03:00
Hein-Pieter van Braam adcc211feb Make nan==nan true for GDScript
After discussing this with Reduz this seemed like the best way to
fix #7354. This will make composite values that contain NaN in the same
places as well as the same other values compare as the same.

Additionally non-composite values now also compare equal if they are
both NaN. This breaks IEEE specifications but this is probably what most
users expect. There is a GDScript function check for NaN if the user
needs this information.

This fixes #7354 and probably also fixes #6947
2017-02-14 13:32:23 +01:00
Hein-Pieter van Braam 411ee71b4d Rename the _MD macro to D_METHOD
This new name also makes its purpose a little clearer

This is a step towards fixing #56
2017-02-13 12:50:02 +01:00
Hein-Pieter van Braam 0f687f0ccb Remove use of _SCS from ADD_METHOD
This saves typing and is a step towards fixing #56
2017-02-13 10:37:47 +01:00
Rémi Verschelde 70b9aa379d Merge pull request #7581 from Faless/v6_wild_bind
TCP/UDP listen bind to address and bugfixes
2017-02-12 23:31:40 +01:00
Rémi Verschelde 70fff42df5 Merge pull request #7749 from Faless/fix_7697
HTTPClient properly handle partial data in non-blocking mode
2017-02-12 23:18:59 +01:00
Rémi Verschelde 5ce18cbdb9 Merge pull request #7743 from karroffel/json_parsing-3.0
JSON::parse reports errors on open-ended objects (master)
2017-02-12 23:17:08 +01:00
Nuno Donato 6b5c595e40 Added "Scots" locale name, fixing #7630 2017-02-08 14:54:28 +00:00
Fabio Alessandrelli 833994b294 HTTPClient properly handle partial data in non-blocking mode
Use block to send DVector::Write out of scope in
HTTPClient::read_response_body_chunk()
2017-02-07 11:01:53 +01:00
Juan Linietsky 6bfaa0f12c shadows were not working in-editor for nvidia, fixed now 2017-02-06 20:18:35 -03:00
Karroffel d5071a940d JSON::parse reports errors on open-ended objects 2017-02-06 19:34:34 +00:00
Juan Linietsky 6f2e16306a Several bugfixes, improving the import workflow 2017-02-06 00:38:39 -03:00
Juan Linietsky af3fabeb77 Ensure proper config version when reading the new configuration file. 2017-02-04 21:02:52 -03:00
Juan Linietsky 102b5fce85 Renamed engine.cfg to godot.cfg, to forcefully break compatibility with 2.x 2017-02-04 20:53:55 -03:00
volzhs e3cf472651 Match ERROR_QUERY_FAILED enum with others 2017-02-02 21:15:47 +09:00
Rémi Verschelde 40e4c1f6ab Merge pull request #7689 from eska014/webgl2
Enable WebGL2 in web export, start fixing build
2017-02-02 08:18:42 +01:00
Rémi Verschelde a506898137 Merge pull request #7681 from karroffel/classdb_type
corrected ClassDB::instance() return type
2017-02-02 08:15:43 +01:00
Rémi Verschelde af6d59eed6 Merge pull request #7649 from Faless/fix_input_master
Keyboard Input modifiers do not block actions.
2017-02-02 08:07:47 +01:00
Juan Linietsky b3aebcf6df CSV translation import plugin 2017-02-01 20:41:05 -03:00
Juan Linietsky 2cd2ca7bbc Lot of work in new importer, importing textures now works. 2017-02-01 09:46:36 -03:00
eska e06edc67c0 Enable WebGL2 in web export, start fixing build
Will not yet compile
2017-02-01 10:21:04 +01:00
Karroffel a7b1f9ee5a corrected ClassDB::insatnce() return type 2017-01-30 14:13:13 +01:00
Juan Linietsky 96de0141cc Removed import/export system, will start new one from scratch. 2017-01-25 21:57:08 -03:00
Fabio Alessandrelli 9100db7b94 Keyboard Input modifiers do not block actions.
This means, if you press "F" while holding "shift" and there is and
action registered for "F" that action should be pressed.
This commit restore this behaviour, lost when implementing
is_action_just_pressed.
If you want "blocking modifiers" you should code it via script.

Fixes 6826
2017-01-25 21:21:19 +01:00
Rémi Verschelde 831d9b925a Merge pull request #7563 from RayKoopa/extended_list_dir_begin
Add parameters to Directory.list_dir_begin() to skip navigational or hidden entries
2017-01-25 20:22:34 +01:00
Ilija Boshkov 1005a56e5a Added focus tracking in X11 and Windows classes, added new confined mouse mode (#7162) 2017-01-25 19:21:41 +01:00
Juan Linietsky 4c28f35b2c Merge pull request #7002 from RandomShaper/vcs-friendliness
Greater VCS friendliness
2017-01-25 14:52:40 -03:00
Juan Linietsky 7e1afeafd4 Audio bus editing is COMPLETE! 2017-01-25 14:31:52 -03:00
Ray Koopa 1ce9bbc8ed Added parameters to skip hidden and/or navigational file system entries 2017-01-24 21:07:02 +01:00
Juan Linietsky 87bb6cdc6f Ability to drag and drop around audio effects! 2017-01-24 00:19:31 -03:00
Juan Linietsky 3b019bf644 Ability to delete, drag and drop audio buses! 2017-01-23 23:12:41 -03:00
Juan Linietsky 2527566ca8 Merge pull request #7621 from Hinsbart/modified_time
Add ClassDB binding for File.get_modified_time
2017-01-23 22:07:02 -03:00
Andreas Haas 5ec0610c60
Add ClassDB binding for File.get_modified_time
Closes #7613
2017-01-23 22:33:58 +01:00
Fabio Alessandrelli 88a56ba783 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)
2017-01-23 20:18:22 +01:00
Fabio Alessandrelli 2fe4ef6699 Implement UDP listen bind address 2017-01-23 20:18:18 +01:00
Fabio Alessandrelli b2839343ca Implement TCP Server bind address 2017-01-23 20:15:20 +01:00
Fabio Alessandrelli 4198291cd4 IP_Address can now be a wildcard (not a valid IP, used for binding) 2017-01-23 20:15:20 +01:00
Fabio Alessandrelli 98a7e2b4e0 Convert validity checks of IP_Address to is_valid method. 2017-01-23 20:15:20 +01:00
Juan Linietsky 0aa7242624 WIP new AudioServer, with buses, effects, etc. 2017-01-21 19:01:00 -03:00
Juan Linietsky ee0f53df52 Merge pull request #7528 from tagcup/real_t_float_fixes
Use real_t rather than float or double in generic functions (core/mat…
2017-01-20 19:24:49 -03:00
BastiaanOlij d11a4c1120 Some changes in the header so Godot3 compiles again on Windows. 2017-01-18 21:55:47 +11:00
karroffel fb16f09b15 updated method_ptrcall.h to use 3.0 naming 2017-01-17 11:36:17 +01:00
Ferenc Arn 6f4f9aa6de Overloaded basic math funcs (double and float variants). Use real_t rather than float or double in generic functions (core/math) whenever possible.
Also inlined some more math functions.
2017-01-16 13:36:33 -06:00
Rémi Verschelde d13f2f9e25 Merge pull request #7560 from volzhs/issue-7555
Fix crash when creating new project
2017-01-16 20:10:34 +01:00
Rémi Verschelde bf05dab74f Merge pull request #7532 from tagcup/pcg_prng
Replace the existing PRNG (Xorshift31) with (minimal) PCG-32.
2017-01-16 20:06:54 +01:00
volzhs 57350faee4 Fix crash when creating new project 2017-01-17 03:50:42 +09:00
Pedro J. Estébanez 7dbb1c0571 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.
2017-01-16 18:03:51 +01:00
BastiaanOlij cef0ae5d5d Fix compile errors related to audio on OSX 2017-01-16 20:32:44 +11:00
Rémi Verschelde 2a0ddc1e89 Style: Various fixes to play nice with clang-format 2017-01-16 08:49:52 +01:00
Rémi Verschelde f44ee891be Style: Fix statements ending with ';;' 2017-01-16 08:49:52 +01:00
Rémi Verschelde e2a3f06f3d 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.
2017-01-16 08:48:24 +01:00
Rémi Verschelde 40323407df 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`
2017-01-16 08:48:24 +01:00
Rémi Verschelde 3890256fc5 Style: Cleanups, added headers, renamed files
Made sure files in core/ and tools/ have a proper Godot license header
when written by us. Also renamed aabb.{cpp,h} and object_type_db.{cpp,h}
to rect3.{cpp,h} and class_db.{cpp,h} respectively.

Also added a proper header to core/io/base64.{c,h} after clarifying
the licensing with the original author (public domain).
2017-01-16 08:04:23 +01:00
Ferenc Arn 4c9004671a Replace the existing PRNG (Xorshift31) with (minimal) PCG (XSH-RR variant with 32-bit output, 64-bit state).
PCG is better than many alternatives by many metrics (see www.pcg-random.org) including statistical quality with good speed.
2017-01-15 19:15:16 -06:00
Juan Linietsky b400c69cd4 Oops! Audio engine has vanished :D 2017-01-15 16:07:51 -03:00
Rémi Verschelde e0faf8a51b Style: Cosmetic fixes to play nice with clang-format 2017-01-15 16:42:17 +01:00
Rémi Verschelde 5e13a762ec Add missing map.h include in color defs 2017-01-15 12:51:47 +01:00
Geequlim c8e9937e21 Fix error while JSON::parse with empty string 2017-01-15 16:59:02 +08:00
Juan Linietsky 5dde810aa5 no more errors related to missing GlobalConfig::Get (or so I hope) 2017-01-14 21:57:22 -03:00
Rémi Verschelde d4eb8ec884 Merge pull request #7127 from BastiaanOlij/ios_meters
Core motion implementation for iPhone (Accelerometer/Gyro/Magnetometer support)
2017-01-15 00:08:46 +01:00
Rémi Verschelde 8d3aedeefd MethodBind: Make sure header order is kept
When clang-format sorts includes alphabetically, MethodBind breaks.
Trying to move the object.h include upward in method_bind.h does
not seem to fix the problem, this needs investigation.
2017-01-14 22:07:28 +01:00
Rémi Verschelde 52666b88b3 Merge pull request #7525 from neikeq/pr-plus_file
String: plus_file(String) no longer adds a root
2017-01-14 19:53:35 +01:00
Wilhem Barbier 54b20874b6 Fix _Directory::get_current_drive error condition 2017-01-14 18:47:06 +01:00
Ignacio Etcheverry 95396067b7 String: plus_file(String) no longer adds a root 2017-01-14 18:18:44 +01:00
Rémi Verschelde ce99286362 Merge pull request #7524 from neikeq/pr-dir-getcurdrive
Directory: Bind get_current_drive() method
2017-01-14 17:22:06 +01:00
Ignacio Etcheverry 0b2ae7313b Directory: Bind get_current_drive() method 2017-01-14 17:20:16 +01:00
Juan Linietsky 7c4167de64 Merge pull request #7010 from AlexHolly/format-string2
advanced string format
2017-01-14 11:56:24 -03:00