Commit graph

490 commits

Author SHA1 Message Date
Karroffel 6c49fe9c62 [DLScript] added variant constructor and a function to get userdata of a script
The godot_dlinstance_get_userdata() function can be used to get the DLScript userdata pointer of any object that has a DLScript attached to it.
This is particularly useful and even required for language bindings to work properly.

This also fixes non-tool builds.
2017-04-04 23:02:46 +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
Saggi Mizrahi c464609bda Add '$' to token names
It was missing from this array and would cause godot to crash or report
bad errors.

Signed-off-by: Saggi Mizrahi <saggi@mizrahi.cc>
2017-04-01 03:20:23 +03:00
Rémi Verschelde d8f32637be SCons: Add option to toggle warnings (on by default)
All the warnings are factored out of the platform-specific files and moved to
SConstruct. Will have to check that it does not introduce regressions on some
platforms/compilers.

(cherry picked from commit 31107daa1a)
2017-03-26 21:58:37 +02:00
Rémi Verschelde 495710c3d6 Merge pull request #8123 from bojidar-bg/gdscript-inline-block-indent
Make inline blocks in GDScript more (or less) pythonic
2017-03-24 22:52:09 +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
Fabio Alessandrelli 0450e6539e ENet code cleanup and changes from review. 2017-03-24 02:30:11 +01:00
Fabio Alessandrelli 38d457170a Update ENet module to support custom ENet lib
Keep compatibility with upstream enet libraries
2017-03-24 02:30:05 +01:00
Bojidar Marinov 18ab88b3f1
Make inline blocks in GDScript more pythonic
Fixes #8001
2017-03-23 20:07:02 +02:00
Rémi Verschelde 33a2c5def0 Merge pull request #8095 from RandomShaper/fix-yield-crash
Fix random crashes when using yield()
2017-03-21 11:07:07 +01:00
Pedro J. Estébanez 0664a9ef8e Fix random crashes when using yield() 2017-03-21 02:53:06 +01:00
Rémi Verschelde 26c6c2b01a Fix linking order for builtin freetype
Before this change the libfreetype_builtin.a lib would be appended
at the very end of the linking flags, after system libs such as -lX11
or -lkernel32.
2017-03-19 15:19:31 +01:00
Rémi Verschelde 00c4782910 Merge pull request #8051 from RayKoopa/resizable_new_node_dialog
Make Create New Node dialog resizable and burninate old dialog
2017-03-18 14:52:34 +01:00
Ray Koopa c0c4ba4e94 Make Create New Node dialog resizable and burninate old dialog 2017-03-18 11:21:50 +01:00
mbalint12 edaf77abd6 Fixed typo in gdscript autocompletion.
There was a missing '!' sign, but autocompletion shows parent script members too.
2017-03-17 23:27:44 +01:00
Pedro J. Estébanez 31af5a31fb Skip asserts on non-debug builds at compiler level 2017-03-13 00:25:29 +01:00
Rémi Verschelde 6163343118 Make that Whole New World great again
Fix regression from 5dbf180 that broke Windows build.
2017-03-05 19:12:22 +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 e1c1d7d1d7 Add a bunch of missing Godot headers in own files 2017-03-05 15:47:28 +01:00
Rémi Verschelde 49c065d29c Refactoring: rename tools/editor/ to editor/
The other subfolders of tools/ had already been moved to either
editor/, misc/ or thirdparty/, so the hiding the editor code that
deep was no longer meaningful.
2017-03-05 14:21:25 +01:00
Ferenc Arn 790611ef26 Added missing FIXMEs in PR #7878 2017-03-02 16:13:01 -06: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 1ec8b9fb7d Merge pull request #7851 from shlomif/fix-some-compilation-warnings
Get rid of some compilation warnings.
2017-02-26 20:22:48 +01:00
Rémi Verschelde 0f12d0a924 Merge pull request #7827 from volzhs/libwebp-0.6.0
Update libwebp to 0.6.0
2017-02-26 20:13:31 +01:00
Rémi Verschelde a78c314b0e Merge pull request #7809 from hpvb/fix-6798
Allow preload to accept a const string.
2017-02-26 20:12:36 +01:00
Shlomi Fish 0a2c387d5c Fix some compilation warnings.
Redone the commit based on the input in
https://github.com/godotengine/godot/pull/7851 . Not all warnings were
fixed but it's a start.
2017-02-21 11:59:19 +02: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 6de3defe72 Update libwebp to 0.6.0 2017-02-17 23:49:40 +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
Hein-Pieter van Braam 3e5743ca36 Allow preload to accept a const string.
In preload() parsing this code will lookup the identifier in the local
constant database. If the identifier corresponds to a string constant
it is used as the path for preload().

Currently this does not work for global constants, only constants
declared in the same class as the preload is happening. We can implement
a full fix too. Maybe we can use this PR to discuss the possibilities.

This (partially) fixes #6798
2017-02-16 14:29:18 +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
Hein-Pieter van Braam e8611966de Remove bounds check when resuming from yield.
The code would get a pointer to the beginning of the call_args by using
operator[] at the stack Vector. This does bound checking. When there are
no call_args this bound check fails and the error mentioned in #7796
gets triggered.

This bound check is actually not necessary as call_args just gets set to
NULL and never dereferenced. This new code will just unconditionally set
the pointer to the place where the call_args are if there are any. There
is no NULL check for call_args anywhere so this is safe.

Fixes #7796
2017-02-13 21:59:05 +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 530de920d4 Merge pull request #7723 from lonesurvivor/gdscript-range-fix
Fix parsing bug which causes range(variable) to crash the engine
2017-02-12 23:13:08 +01:00
Juan Linietsky 6f2e16306a Several bugfixes, improving the import workflow 2017-02-06 00:38:39 -03:00
lonesurvivor c71a6c6d71 Fix parsing bug which causes range(variable) to crash the engine
problem was a segmentation fault caused by trying to access Vector constants[0] which isn't there if op->arguments.size() is not bigger than one.

- the changed OR condition didn't make sense (always true), should be AND
- changes the "constant" variable to be false per default and gets set to true when there is actually something pushed to "constants"
2017-02-04 20:57:39 +01:00
Juan Linietsky d2b2d6801f Changed OGG Vorbis type to be imported, so it's possible to specify loop 2017-02-03 08:55:29 -03:00
Juan Linietsky 96de0141cc Removed import/export system, will start new one from scratch. 2017-01-25 21:57:08 -03:00
Rémi Verschelde 5027799c13 Merge pull request #7583 from karroffel/wildcard
made _ a special token in GDScript
2017-01-23 07:55:11 +01:00
Juan Linietsky 0aa7242624 WIP new AudioServer, with buses, effects, etc. 2017-01-21 19:01:00 -03:00
karroffel c24c739da5 made _ a special token in GDScript 2017-01-20 09:26:55 +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 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
Rémi Verschelde 2a0ddc1e89 Style: Various fixes to play nice with clang-format 2017-01-16 08:49:52 +01:00