Commit graph

1392 commits

Author SHA1 Message Date
Hein-Pieter van Braam
833c3917b2 Allow booleanization of all types
We now allow booleanization of all types. This means that empty versions
of all types now evaluate to false. So a Vector2(0,0), Dictionary(),
etc.

This allows you to write GDScript like:
if not Dictionary():
  print("Empty dict")

Booleanization can now also no longer fail. There is no more valid flag,
this changes Variant and GDNative API.
2017-09-19 18:55:31 +02:00
Hein-Pieter van Braam
85641c545b Be type-strict checking on equality checks
After a short discussion with @reduz and @karroffel we decided to make
all non number/number comparisons return type errors on comparisons.

Now bool == bool is allowed but Vector2 == Vector3 is a type error and
no longer 'not equal'. The same has been done for the != operators.

In addition I forgot to add some failures to some Object operators
meaning that there was a potential for a crasher.
2017-09-19 16:00:19 +02:00
Rémi Verschelde
33e1716f13 Merge pull request #11402 from hpvb/remove-gdscript-checks-on-release
Various GDScript performance tweaks
2017-09-19 15:48:14 +02:00
Hein-Pieter van Braam
d05965963d Don't call Variant::reference() unnecessarily
operator= does not need to call reference() if the new value is of the
same type as the old. This saves us zeroing the Variant, This speeds
up reuse of a Variant in a loop by roughly 50%.
2017-09-19 15:27:57 +02:00
Rémi Verschelde
ba4439c491 Merge pull request #11386 from kosz78/fix-msvc-compile-errors
Fix MSVC compilation errors
2017-09-19 14:58:19 +02:00
Hein-Pieter van Braam
36e8bee752 Fix accidental cast to Vector3 for Vector2 iter 2017-09-19 14:18:12 +02:00
Indah Sylvia
13b630eb0c Fixed Typo: 'Seperate' to 'Separate' 2017-09-19 15:51:00 +07:00
Konstantin Zaitsev
c386a02654 Fix MSVC compilation errors 2017-09-19 10:33:07 +07:00
Hein-Pieter van Braam
137f8a58a8 Move Variant::evaluate() switch to computed goto
In an effort to make GDScript a little faster replace the double
switch() with a computed goto on compilers that set __GNUC__. For
compilers that don't support computed goto it will fall back to regular
switch/case statements.

In addition disable using boolean values in a mathematical context. Now
boolean values can only be compared with other booleans. Booleans will
also no longer be coerced to integers.

This PR replaces #11308 and fixes #11291
2017-09-17 22:49:23 +02:00
Marcelo Fernandez
3528b1e571 Fix x11 exported executables not getting the +x flag 2017-09-17 14:40:58 -03:00
Thomas Herzog
41715c1e8f Merge pull request #11294 from karroffel/json-object
added JSON singleton
2017-09-17 16:31:27 +02:00
Rémi Verschelde
a1b4e4c607 Merge pull request #11272 from Rubonnek/move-to-initializer-list
Moved class_name and return_val to initializer list
2017-09-17 12:52:46 +02:00
Rémi Verschelde
2db9973ad4 Merge pull request #11176 from bncastle/master
Implement +,-,/, * and negate operators for Color type
2017-09-17 12:43:21 +02:00
Rémi Verschelde
6dd8dd935e Merge pull request #11343 from BastiaanOlij/fix_basename
Fixed naming of pck file
2017-09-17 12:03:39 +02:00
Bastiaan Olij
913e5cabbd Fixed naming of pck file 2017-09-17 11:59:56 +10:00
Poommetee Ketson
a9229d37c8 Merge pull request #11223 from GodotExplorer/pr-undoredo
Expose more methods for UndoRedo
2017-09-17 08:48:38 +07:00
bncastle
9d9cfc6f61 Implement +,-,/, * and negate operators for Color type. 2017-09-16 13:09:49 -04:00
Ignacio Etcheverry
f1f8fd1b68 Adds _OS::PowerState enum 2017-09-16 12:28:23 +02:00
karroffel
308d20aba5 added JSON singleton
There was no way to access JSON functionality in scripting languages
apart from GDScript because the JSON class wasn't exposed to ClassDB.
2017-09-15 15:40:27 +02:00
Thomas Herzog
7dffed485b Merge pull request #11230 from maxim-sheronov/fix_enum_bindings
Fix enums bindings
2017-09-15 08:43:35 +02:00
Wilson E. Alvarez
0f4643a4f6 Moved class_name and return_val to initializer list 2017-09-14 12:54:37 -04:00
Ruslan Mustakov
f08bc0df7c Construct Variants from Reference properly in GDNative
Previously godot_variant_new_object constructed Variant without
accounting for the fact that the Object can be a Reference, so refcount
was not increased and References were destructed prematurely.

Also, Reference::init_ref did not propagate refcount increment to the
script instance, which led to desync of refcount info on the script
side and Godot side.
2017-09-14 19:40:36 +07:00
Rémi Verschelde
ae4cd72e62 Drop unused EventQueue class
Thanks to @Marqin for the notice.
2017-09-13 20:56:23 +02:00
Maxim Sheronov
0fffa45158 Fix enums bindings
Add missed bindings for enums
Move some enums to class to have correct output of api.json
2017-09-13 20:57:07 +03:00
Marcelo Fernandez
83fe937362 Added a crash handler to dump the backtrace on Windows, Linux and OS X 2017-09-13 10:07:23 -03:00
Rémi Verschelde
42504ef0d4 Merge pull request #11062 from BastiaanOlij/osx_datapack
Fixed loading package from resource folder, exporting textures to bun…
2017-09-13 11:11:01 +02:00
Rémi Verschelde
e73e00d369 Style: Apply clang-format to @reduz's changes
[ci skip]
2017-09-13 09:13:34 +02:00
Geequlim
ae18b1f83f Expose more methods for UndoRedo 2017-09-13 12:18:51 +08:00
Juan Linietsky
4f929a0fdf Changed the doc class generation to individual files per class. It is also possible to save module files in module directories and the build system will
recognize them.
2017-09-12 17:45:41 -03:00
Rémi Verschelde
aebf4fb48c Merge pull request #11106 from hpvb/documentation-fix-poolarrays
Correct the Pool*Array documentation
2017-09-12 15:02:22 +02:00
Rémi Verschelde
26017499a5 Merge pull request #11049 from scayze/astar_get_points
Add get_points() method to AStar
2017-09-12 14:07:06 +02:00
Rémi Verschelde
4f51211dfb Merge pull request #11028 from mrawlingst/color-RGBA32
Change Color.to_32() to Color.to_rgba32() and lowercase other functions
2017-09-12 13:44:43 +02:00
Rémi Verschelde
aabbd00284 Merge pull request #10908 from hpvb/fix-unused-variables
Fix unused variable warnings
2017-09-12 12:55:53 +02:00
Rémi Verschelde
cf941fdc35 Merge pull request #11026 from hpvb/fix-assign-in-if
Remove assignment and declarations in if statements
2017-09-12 11:57:49 +02:00
Rémi Verschelde
2b50dc5d4f Merge pull request #11057 from hpvb/fix-various-warnings
Fix various assorted warnings
2017-09-12 11:39:47 +02:00
Rémi Verschelde
8da1732013 Merge pull request #11044 from hpvb/fix-enum-as-bool
Fix using enum as bool value
2017-09-12 11:18:27 +02:00
Rémi Verschelde
dbb28559db Merge pull request #11040 from hpvb/fix-enum-compare
Fix warnings comparing enums of different types
2017-09-12 11:17:28 +02:00
Rémi Verschelde
3941e01a57 Merge pull request #11041 from hpvb/fix-clang-format-error
Fix serveral recent new clang-format errors

[ci skip]
2017-09-12 11:16:36 +02:00
geequlim
20442d0a89 Add user data directory support for ProjectSettings::globalize_path 2017-09-10 16:33:54 +08:00
Hein-Pieter van Braam
daa66cd5c2 Correct the Pool*Array documentation 2017-09-09 16:39:22 +02:00
Hein-Pieter van Braam
b2a38854fd Fix unused variable warnings
The forth in my quest to make Godot 3.x compile with -Werror on GCC7
2017-09-08 15:03:53 +02:00
Hein-Pieter van Braam
8230bf0a2f Remove assignment and declarations in if statements
After discussing with @reduz and @akien-mga it was decided that we do
not allow assignments or declarations in if statements. This PR removes
the instances of this I could find by automated means.
2017-09-08 14:59:15 +02:00
Hein-Pieter van Braam
67a706fc1b Fix various assorted warnings
Fix various warnings that don't have enough instances to merit
individual commits. Also fixes a potential bug in audio_server.cpp.
2017-09-08 14:57:48 +02:00
BastiaanOlij
099546ac00 Fixed loading package from resource folder, exporting textures to bundle and added a bit of feedback for a debug compile 2017-09-08 11:39:32 +10:00
Hein-Pieter van Braam
5e18967d77 Fix serveral recent new clang-format errors 2017-09-08 00:20:16 +02:00
Juan Linietsky
eedb39091a Several fixes to directional shadows, closes #10926
Added option to change directional light range mode, between optimized and stable. For Orthogonal, you might need to use optimized.
2017-09-07 18:00:47 -03:00
mrawlingst
6aa5bc2347 Change Color.to_32() to to_rgba32() and format as RGBA 2017-09-07 16:19:44 -04:00
Scayze
6872cc7b12 Add get_points method to AStar 2017-09-07 19:15:46 +02:00
Hein-Pieter van Braam
6fb86dda8a Fix using enum as bool value
This warning actually hid a bug. The value of ERR_INVALID_DATA is
actually 30, returning this as a bool returns true while false was
required.
2017-09-07 11:39:14 +02:00
Hein-Pieter van Braam
0b23a31b43 Fix warnings comparing enums of different types
This fixes a source of many compiler warnings regarding comparing the
enum VARIANT_TYPE to Variant::Type. This changes the local value to a
static const Variant::Type value rather than an unrelated enum, this
also saves us a cast.
2017-09-07 09:03:11 +02:00