Commit graph

1032 commits

Author SHA1 Message Date
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
Juan Linietsky dcb95ec147 removed duplicated functions in class hierarchy that were bound more than once
added a check to detect this case in the future
2017-01-14 11:10:42 -03:00
Rémi Verschelde 93ab45b6b5 Style: Fix whole-line commented code
They do not play well with clang-format which aligns the `//` part
with the rest of the code block, thus producing badly indented commented code.
2017-01-14 14:52:23 +01:00
Juan Linietsky 78e90ac60b Unexpose the video mode API, will be completely removed when multi-window support is implemented. 2017-01-14 10:06:15 -03:00
Juan Linietsky da4170540c Fixed dir access return value, changed it to Error like all other funcs 2017-01-14 09:17:15 -03:00
Juan Linietsky 6c512b88c2 UDP.set_send_address to UDP.set_dest_address 2017-01-14 00:54:21 -03:00
Juan Linietsky d9d77291bc rename String.extension() -> String.get_extension() / String.basename() -> String.get_basename() 2017-01-14 00:51:09 -03:00
Juan Linietsky 6e88b1096a Vector2.get_aspect() renamed to Vector2.aspect() to keep consistent method naming 2017-01-13 20:00:43 -03:00
Juan Linietsky a97551902e rename Input.get_mouse_speed() to Input.get_last_mouse_speed() 2017-01-13 19:24:28 -03:00