Commit graph

178 commits

Author SHA1 Message Date
Rémi Verschelde 35fbbeb99b
Merge pull request #20627 from malcolmhoward/core-dictionary-get-key
#20488 core dictionary get key
2018-11-19 21:11:55 +01:00
m bf1867aaab Added Python-like .get() method to Dictionary in GDScript #20488
Added .get() method to Dictionary class in GDScript to return the value if the key exists, or return Null if the key does not exist.
2018-11-19 14:03:13 -05:00
Fabio Alessandrelli c449512318 Always initialize VariantCall return_type.
The return_type is used by the GDScript parser (and possibly other
scripting languages), so it MUST be initialized at least.
It could be initialized to Variant::NIL in release, but I see no reason
for not setting the actual value.
See similar issue in 95dfa5b .
2018-11-17 19:06:18 +01:00
Kelly Thomas 215db9ff71 add ONE constants to Vector2 and Vector3 2018-10-07 21:33:18 +08:00
Rémi Verschelde 277b24dfb7 Make core/ includes absolute, remove subfolders from include path
This allows more consistency in the manner we include core headers,
where previously there would be a mix of absolute, relative and
include path-dependent includes.
2018-09-12 09:52:22 +02:00
Juan Linietsky adc0188d9f Added max() and min() functions to array to return greater or lesser element (or null if data is not of compatible type or empty array). Closes #15697 2018-08-23 15:32:02 -03:00
Rémi Verschelde a319d72071
Merge pull request #21253 from aaronfranke/plane-constants
Rename Plane constants, add to Mono
2018-08-21 21:16:41 +02:00
Aaron Franke a986686ac4 Rename Plane constants, add to Mono
But I'm not tagging PR as [Core] or [Mono] due to it being a minor change anyway.
2018-08-21 01:35:07 -04:00
Rémi Verschelde f0b914fa68 Remove circle/diamond and NodePath String constants
They were introduced in #14704 but need more discussion IMO,
they don't strike me as core features that would have to be
registered in Variant directly.

Moreover, they currently break the documentation XML as string
constants end up encoded as e.g. `value=""..""`.
2018-08-21 00:23:35 +02:00
Thomas Herzog 037f4638ab add project method to Vector2/3 2018-08-16 12:52:38 +02:00
Rémi Verschelde 4548ec4a49
Merge pull request #20945 from neikeq/dict-erase-retbool
Dictionary: remove erase_checked(key), make erase(key) return bool
2018-08-15 01:08:23 +02:00
Ignacio Etcheverry 21d285e30f Dictionary: remove erase_checked(key), make erase(key) return bool 2018-08-14 19:19:05 +02:00
Chaosus 3b10bd1fa2 Fix int(String) != int(int) conversion 2018-08-14 10:56:10 +03:00
Bernhard Liebl ba974b8d1e Allow some non-integer built-in constants in gdscript 2018-07-31 17:56:48 +02:00
Rémi Verschelde 47a7dc7b3c
Merge pull request #18282 from aaronfranke/better-mathf
[Core] [Mono] Fix Color missing int export methods, added 64-bit
2018-07-26 10:48:47 +02:00
Hein-Pieter van Braam 0e29f7974b Reduce unnecessary COW on Vector by make writing explicit
This commit makes operator[] on Vector const and adds a write proxy to it.  From
now on writes to Vectors need to happen through the .write proxy. So for
instance:

Vector<int> vec;
vec.push_back(10);
std::cout << vec[0] << std::endl;
vec.write[0] = 20;

Failing to use the .write proxy will cause a compilation error.

In addition COWable datatypes can now embed a CowData pointer to their data.
This means that String, CharString, and VMap no longer use or derive from
Vector.

_ALWAYS_INLINE_ and _FORCE_INLINE_ are now equivalent for debug and non-debug
builds. This is a lot faster for Vector in the editor and while running tests.
The reason why this difference used to exist is because force-inlined methods
used to give a bad debugging experience. After extensive testing with modern
compilers this is no longer the case.
2018-07-26 00:54:16 +02:00
Aaron Franke 55d976467d Expose 64-bit Color methods to GDScript and fix/update Color XML doc 2018-07-25 15:35:29 -05:00
Rémi Verschelde 4c5dd51eb9 Sync classref with current source
Also fix binding of Basis.slerp
2018-05-28 14:53:15 +02:00
Max Hilbrunner acf6c326fb
Merge pull request #14715 from Krakean/string_add_rsplit2
Added rsplit() method to String class
2018-05-23 17:19:35 +02:00
tagcup ed7aadcd87 Add SLERP to Vector{2,3}, optimize Quat's Vector3 rotation.
Also even out Basis and Quat APIs a little.
2018-05-12 13:05:04 -04:00
Alexander Alekseev 26963473a9 Vector3::round, Vector2::round & Vector2::ceil methods were added.
Now both structs (Vector2 & Vector3) have round, floor & ceil methods.
(see #18603)
2018-05-04 12:43:50 +03:00
Rémi Verschelde 85c8953c9f
Merge pull request #16649 from ibrahn/visual-script-release-crash
fix for segfault when using CallBasic in visual script on release build
2018-05-01 17:48:27 +02:00
bosak 79ecdee496
add string trim_prefix trim_suffix lstrip and rstrip methods 2018-04-17 14:15:43 +03:00
Bojidar Marinov 9f6c0c6eae
Duplicate Arrays and Dictionaries when instancing scene in editor
Also, add deep (=false) parameter to Array.duplicate and Dictionary.duplicate

Fixes #13971
2018-03-13 17:18:08 +02:00
Bernhard Liebl 9d7856620c Bring back Vector2.cross() 2018-03-07 21:10:31 +01:00
Rémi Verschelde 37a6ce5a42
Merge pull request #15563 from poke1024/gdscript-shuffle
Add shuffle() method to Array
2018-02-19 21:53:08 +01:00
Rémi Verschelde 7455244866
Merge pull request #15852 from poke1024/color_hsv
Add Color.from_hsv()
2018-02-19 21:51:04 +01:00
Ibrahn Sahir 95dfa5b96d fix for segfault when using CallBasic in visual script on release build 2018-02-12 17:09:00 +00:00
Timur Celik c16f61190c Fix broken variant call of Vector3.snapped 2018-02-03 19:57:12 +01:00
Poommetee Ketson ebe2337515 Fix wrong return type of xform functions 2018-01-30 18:45:54 +07:00
Bernhard Liebl be55171231 Add Color.from_hsv() 2018-01-18 22:13:00 +01:00
poke1024 75d69fb4ec Add shuffle() method to Array 2018-01-10 19:36:53 +01:00
Rémi Verschelde e4213e66b2 Add missing copyright headers and fix formatting
Using `misc/scripts/fix_headers.py` on all Godot files.
Some missing header guards were added, and the header inclusion order
was fixed in the Bullet module.
2018-01-05 01:22:23 +01:00
Rémi Verschelde 6b6f60defc
Merge pull request #15220 from ibrahn/variantcall-defargs-fix
fix VariantCall default parameter ordering
2018-01-03 12:50:04 +01:00
Rémi Verschelde b50a9114b1 Update copyright statements to 2018
Happy new year to the wonderful Godot community!
2018-01-01 14:40:47 +01:00
Ibrahn Sahir 96706168d0 fix VariantCall default parameter ordering 2017-12-31 14:58:45 +00:00
Will Nations f19fc83546 Dictionary::copy -> ::duplicate 2017-12-17 16:07:15 -06:00
Dmitry Koteroff 6fe415ca7f Added rsplit() for String class
Docs updated
2017-12-15 22:23:58 +03:00
Dmitry Koteroff 5302fd125b Added third argument for String.split() function (see issue #14349)
Remove negative limit, leave only positive and make it reflect behaviour like in Python
Also limit renamed to maxsplit to match Python one.
Also docs updated.

Fix indent
2017-12-15 21:51:13 +03:00
Rémi Verschelde 41e3592041
Merge pull request #13347 from Noshyaar/hang_in_there
Rect2: add function returning same rect with positive w and h
2017-12-09 18:08:09 +01:00
Rémi Verschelde 13c2ff9320 Style: Apply new clang-format 5.0 style to all files 2017-12-07 08:02:00 +01:00
Poommetee Ketson 5c9be411eb Rect2: add function returning same rect with positive w and h 2017-11-28 00:41:29 +07:00
Juan Linietsky bc2e8d99e5 Made Vector::ptrw explicit for writing, compiler was sometimes using the wrong function,
leading to unnecesary copy on writes and reduced performance.
2017-11-25 00:09:40 -03:00
Bojidar Marinov bfe44de2b6
Make tween able to be used as before (without the need for ":...")
Fixes #13174
2017-11-22 14:13:56 +02:00
Rémi Verschelde 9638c9cb5d
Merge pull request #12371 from donkeybonks/color-lighten-darken
Add Color.lighten and Color.darken (like LESS.css or SASS) #2
2017-11-22 01:27:01 +01:00
Rémi Verschelde 3b7e9df255
Merge pull request #13151 from akien-mga/basis-vector3-constructor
Properly implement Basis constructor using Vector3 of Euler angles
2017-11-22 01:20:14 +01:00
Rémi Verschelde 613d374bc5
Merge pull request #12284 from bojidar-bg/allow-subproperty-set
Allow for getting/setting "dotted" properties of objects
2017-11-21 22:44:14 +01:00
Rémi Verschelde a3f8dde502 Properly implement Basis constructor using Vector3 of Euler angles
Fixes #13104.
2017-11-21 20:52:07 +01:00
Bojidar Marinov 0cf9597758
Allow for getting/setting indexed properties of objects using get/set_indexed
Performance is around the same as using pure set() through GDScript.
2017-11-21 20:58:21 +02:00
Kyle Van Berendonck 8e4336a729
Add Color.lightened and Color.darkened (like LESS.css or SASS) 2017-11-21 21:48:11 +11:00