Commit graph

592 commits

Author SHA1 Message Date
Rémi Verschelde
490aef9369 Merge pull request #10581 from hpvb/fix-gcc6+
Make cast_to a static member of Object.
2017-08-25 08:37:38 +02:00
Juan Linietsky
b1c0e45b03 Implemented, The Amazing Zylann Hack (tm), fixes #10603 2017-08-25 00:34:32 -03:00
Hein-Pieter van Braam
cacced7e50 Convert Object::cast_to() to the static version
Currently we rely on some undefined behavior when Object->cast_to() gets
called with a Null pointer. This used to work fine with GCC < 6 but
newer versions of GCC remove all codepaths in which the this pointer is
Null. However, the non-static cast_to() was supposed to be null safe.

This patch makes cast_to() Null safe and removes the now redundant Null
checks where they existed.

It is explained in this article: https://www.viva64.com/en/b/0226/
2017-08-24 23:08:24 +02:00
Andreas Haas
f61e8695c9
GDScript: More reliable check if loading a template.
Prevents showing some useless parse errors in the console.
2017-08-24 22:08:23 +02:00
Rémi Verschelde
3ea0943f64 Fix mismatched signatures for GDScriptLanguage::complete_code 2017-08-24 12:44:51 +02:00
Juan Linietsky
36e0a72c77 -Code completion for enumerations
-Disabled GDNative and GDNativeScript so build compiles again
2017-08-24 00:06:56 -03:00
Juan Linietsky
3d1c031871 Changed MethodBind API to request information from methods. It's much claner now.
Also changed PropertyInfo to include informatino about class names.
2017-08-23 19:11:11 -03:00
Rémi Verschelde
1ad68c946e Merge pull request #10542 from karroffel/gdscript-match-index
support enums and nested constants in match statement
2017-08-23 08:05:52 +02:00
Wilson E. Alvarez
baa94a3758 Removed unnecessary returns and break statements 2017-08-22 13:01:57 -04:00
Karroffel
57654d4b95 support enums and nested constants in match statement
The initial version of the pattern matcher in GDScript does not
allow matching on nested identifiers, only one identifiers available
in the current scope.

With the introduction of enums to GDScript that's a huge missing
feature. This commit makes the parser accept indexed constants and
variables to properly support enums.
2017-08-22 17:45:05 +02:00
Rémi Verschelde
df590fc2d3 Merge pull request #10340 from Rubonnek/remove-unnecessary-assignments
Removed unnecessary assignments
2017-08-22 00:58:12 +02:00
Rémi Verschelde
135027a2f6 Merge pull request #10225 from Noshyaar/map
GDScript Built-in: add inverse_lerp & range_lerp
2017-08-22 00:31:46 +02:00
Wilson E. Alvarez
738d2ab969 Removed unnecessary assignments 2017-08-21 15:15:55 -04:00
Juan Linietsky
541fdffc0a Merge pull request #10319 from neikeq/pr-engine-editor-hint
Adds Engine::is_editor_hint() method
2017-08-20 12:55:46 -03:00
Ignacio Etcheverry
90b8a5b71e Removes editor_hint from SceneTree 2017-08-19 01:29:45 +02:00
Poommetee Ketson
d28da86f9f GDScript Built-in: add inverse_lerp & range_lerp 2017-08-18 21:49:03 +07:00
Marcelo Fernandez
eab850524e Add closest_power_of_2 func and implement mix_rate/latency on OS X 2017-08-17 19:51:13 -03:00
Rémi Verschelde
b1ecaaa22b Merge pull request #10307 from Rubonnek/update-argument-names
Updated function argument names
2017-08-16 17:17:56 +02:00
Pedro J. Estébanez
ae2d449047 Revive inspector property evaluation
GDScript was restricted to parse only scripts beginning with __res://__ or __user://__ to avoid templates from being parsed. I've made that a bit less inclusive by allowing scripts with an empty path to be parsed too, which doesn't conflict and is needed for this to work.

Also I've removed the `this` variable of the generated script and made the relevant object to be the one the script instance refers to, so you can use `self` instead.

Now, with the shorter 3.0-style syntax, you can write things like: `self.position.x + 10`

Closes #9500.
2017-08-16 03:01:41 +02:00
Wilson E. Alvarez
428f03cf06 Updated function argument names 2017-08-12 15:12:49 -04:00
Ignacio Etcheverry
2f290038d6 Removes type information from method binds 2017-08-10 07:17:50 +02:00
Juan Linietsky
95f10c620d push variable later when created, to avoid self-referencing as a valid case, closes #6111 2017-08-08 11:44:49 -03:00
Juan Linietsky
c6120e77a8 Implement len() gdscript built-in function for python users, closes #1960 2017-08-07 18:38:47 -03:00
Indah Sylvia
5ae78fdf6a Makes all Godot API's methods Lower Case 2017-08-07 18:24:35 +07:00
Bojidar Marinov
a5fb82c28c
Fix $a/b being parsed as division 2017-07-26 18:51:03 +03:00
Rémi Verschelde
a931052c79 Merge pull request #9731 from Xrayez/gdscript-completion
Update GDScript completion names for Pool*Arrays
2017-07-25 21:05:42 +02:00
Karroffel
5319098aef fix a regression (GDScript) from e00630b
This removes `not` from the variable safe list of
keywords.
Before that this was a valid expression:
    self.!(some_arg)

The other fix is just a forgotten boolean negation.
2017-07-25 20:01:19 +02:00
Andrii Doroshenko (Xrayez)
72436956dd Update GDScript completion names for Pool*Arrays
Notice: GDScript tokenizer used the old PoolFloatArray name.
Renamed PoolFloatArray to PoolRealArray.

Moved "project_settings.h" down one line to comply with the clang-format rules.

Fixes #9638

Closed pull request #9714 because I messed up with commits, sorry!
2017-07-25 12:14:40 +03:00
Rémi Verschelde
e00630bfca Merge pull request #8217 from bojidar-bg/gdscript-fix-keyword-call
Make GDScript allow some keywords as identifiers
2017-07-25 08:18:10 +02:00
Bojidar Marinov
1936e1d2be
Make GDScript allow some keywords as identifiers
Fixes #8085
Added some comments around the use of is_token_literal, as discussed.
2017-07-23 23:34:31 +03:00
Poommetee Ketson
c7c65ca6ba Clang-formatting *.cpp and *.h (some files excluded) 2017-07-22 18:14:08 +07:00
Juan Linietsky
25678b1876 -Renamed GlobalConfig to ProjectSettings, makes more sense.
-Added system for feature overrides, it's pretty cool :)
2017-07-19 17:06:03 -03:00
Poommetee Ketson
49c7620326 Add object type hint for docs 2017-07-19 02:03:34 +07:00
Juan Linietsky
bbada82f80 -Reorganized all properties of project settings (Sorry, Again).
(Lot's of bloat accumulated, so it was time for clean up.)
-Made EditorSettings and ProjectSettings search more useful (search in sections too)
2017-07-17 22:18:58 -03:00
Rémi Verschelde
a5d500f023 Merge pull request #8573 from neikeq/gdfs-completed
Adds "completed" signal to GDFunctionState
2017-07-11 11:14:22 +02:00
geequlim
6687484958 Better user expirence with external text editors.
Implements open_in_external_editor for subclasses of ScriptLanguage.
Add option 'Debug with external editor' to debug menu to control the behavoir of script opened by editor.
2017-06-27 12:55:16 +08:00
Rémi Verschelde
9c186a754f Merge pull request #8783 from bojidar-bg/fix-range-loop-type
Fix for..in range() resulting in floats instead of ints
2017-06-24 23:39:55 +02:00
Juan Linietsky
00e5ba3143 Remove methods from code completion which are already exposed by properties, makes completion cleaner and more close to the documentation. 2017-06-23 15:10:46 -03:00
Mariano Suligoy
7fe750583e GdScript: Add signal autocompletion to emit_signal function 2017-06-23 07:51:49 -03:00
Ignacio Etcheverry
07fe7d99ea Adds completed signal to GDFunctionState 2017-06-23 02:29:23 +02:00
Bojidar Marinov
26a51c3c0b
Reimplement for..in range() so that it always results in ints
Fixes #8278, fixup of bfef8de1bc
2017-06-22 20:41:52 +03:00
Andreas Haas
8361b1ce07 Add ability to use custom script templates.
Templates will be loaded from .godot/script_templates
For now they're disabled for GDNative.

Ideas for further improvements:

- Add a "Save as Template" option to the script editor, as it can normally only save to res://
- Support more placeholders / custom placeholders
2017-06-13 20:03:08 +00:00
Andreas Haas
015d36d18b
GDScript: Use "is" keyword for type checking.
Replaces the `extends` keyword with `is` in the context of testing for type compatibility.
`extends` is still used for declaring class inheritance.

Example:

```gdscript
extends Node2D

func _input(ev):
	if ev is InputEventKey:
		print("yay, key event")
```
2017-05-27 10:59:59 +02: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
dcc44f05b7 Merge pull request #8798 from RandomShaper/gdfs-ext-check
Add extended check option to GDFunctionState::is_valid()
2017-05-18 12:51:29 +02:00
Pedro J. Estébanez
b69d4ebff4 Add extended check option to GDFunctionState::is_valid() 2017-05-17 14:55:59 +02:00
Juan Linietsky
98a3296702 Removal of Image from Variant, converted to a Resource. 2017-05-17 07:37:45 -03:00
Bojidar Marinov
837a667225
Fix #8674, and rename a few things for clarity 2017-05-08 22:39:27 +03:00
Paulb23
c4ffe89204 Changed indent type settings 2017-04-26 12:14:03 +01:00
Ramesh Ravone
924bccdbd1
Honoring the Indent setting for gdscript 2017-04-25 06:57:49 +05:30
Karroffel
67886bab1e fixed a bug where saving a GDScript file crashed the editor
I changed the loop in #8502, turns out it fixed the error I was facing but introduced a new one. This fixes both
2017-04-24 19:26:32 +02:00
Rémi Verschelde
9acfb0782c Merge pull request #8444 from magyar123/pr-complete-paths
Script editor now automatically completes file paths in GDScript
2017-04-24 11:37:57 +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
Karroffel
885239fb09 re-added MultiScript
The very first Godot version (when it was open sourced) had "MultiScript" which lets you use multiple scripts on one object.
With the addition of mulitple new scripting languages (VisualScript, soon C# and GDNative) it can be of use to combine scripts rather than delegating (with huge maintainance cost) or creating child nodes
which could impact performance.

I used the code from 0b806ee as the base and made it work with the current master.
2017-04-24 01:49:40 +02:00
mbalint12
71978685f9 Added autocomplete for file paths in the script editor 2017-04-18 17:22:01 +02:00
Paulb23
84bca4e72f Added support for space indentation 2017-04-18 12:30:46 +01:00
mbalint12
a3afec588c Added the ability to select files as base when creating scripts 2017-04-15 23:29:09 +02:00
Bojidar Marinov
7cc561fe0e
Fixup #8123, seems like I forgot a few things
Should close #8315
Please test, I'm still unsure I did it correctly...
2017-04-08 19:42:37 +03:00
Rémi Verschelde
df61dc4b2b Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
curtisxk38
d35fab7382 Fix typo in Parser Error message 2017-04-05 23:11:05 -04: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
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
debeee56f7 Fix typos in source code using codespell
From https://github.com/lucasdemarchi/codespell
2017-03-24 21:45:31 +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
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
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
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
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
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
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
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
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
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
Rémi Verschelde
f44ee891be Style: Fix statements ending with ';;' 2017-01-16 08:49:52 +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
Rémi Verschelde
e0faf8a51b Style: Cosmetic fixes to play nice with clang-format 2017-01-15 16:42:17 +01:00
James Mintram
dab73c701a Compile error when duplicate key in dictionery literal #7034 2017-01-14 22:08:49 +01:00
Juan Linietsky
4261880c94 Merge pull request #6845 from karroffel/master
Adds pattern matching to GDScript
2017-01-14 17:08:10 -03:00
Juan Linietsky
7924f08a6a Merge pull request #4918 from jjay/f/error_on_redefine
Redefine var results in an error
2017-01-14 17:07:08 -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
d9d77291bc rename String.extension() -> String.get_extension() / String.basename() -> String.get_basename() 2017-01-14 00:51:09 -03:00
Juan Linietsky
6dd7d2c1f7 Implicit inheritance now defaults to Resource, will error for node scripts if extends not used. 2017-01-12 16:00:57 -03:00
Juan Linietsky
bfef8de1bc More efficient iteration syntax, and range() is converted behind the scenes to it. 2017-01-11 20:10:23 -03:00
Rémi Verschelde
42802ab9dc Merge pull request #6930 from bojidar-bg/gdscript-export-array-hint
Allow typing hints for Array class (in GDScript and Inspector)
2017-01-11 14:46:38 +01:00
Juan Linietsky
e6583117df Both Array and Dictionary are always in shared mode (removed copy on write). 2017-01-11 08:54:17 -03:00
Rémi Verschelde
57166cd292 Merge pull request #7093 from bojidar-bg/named-colors
Add named colors to GDScript/Visual Script/core.
2017-01-11 10:36:15 +01:00
Juan Linietsky
bc26f90581 Type renames:
Matrix32 -> Transform2D
	Matrix3 -> Basis
	AABB -> Rect3
	RawArray -> PoolByteArray
	IntArray -> PoolIntArray
	FloatArray -> PoolFloatArray
	Vector2Array -> PoolVector2Array
	Vector3Array -> PoolVector3Array
	ColorArray -> PoolColorArray
2017-01-11 00:52:51 -03:00
Karroffel
e781a7e07e pattern matcher: Implemented backend
changed comments
2017-01-11 04:40:28 +01:00
Karroffel
d445f0639f pattern matcher: Implemented transformations 2017-01-11 04:40:11 +01:00
Karroffel
f8a7c46273 pattern matching: implemented parser 2017-01-11 04:39:55 +01:00
Juan Linietsky
4338c90163 It is now possible to name layers of different kinds! 2017-01-10 22:20:57 -03:00
Juan Linietsky
80b733a33a uses the global thread to protect the instacnes map in GDScript, closes #4615 2017-01-10 19:02:52 -03:00
Juan Linietsky
62273e51a2 Moved JSON functions to built-in to_json, parse_json, validate_json 2017-01-08 22:40:00 -03:00
Juan Linietsky
13cdccf23b Variant INT and REAL are now 64 bits (other types remain at 32) 2017-01-08 20:58:39 -03:00
Juan Linietsky
547a57777b renamed joystick to joypad everywhere around source code! 2017-01-08 17:06:33 -03:00
Juan Linietsky
8963ca3d17 Fix code completion for new getnode syntax 2017-01-08 03:01:52 -03:00
Juan Linietsky
8b912d1115 -Fix bugs related to PoolVector crashes
-Added ability to request nodes using $Name in GDScript :)
2017-01-08 02:04:53 -03:00
Juan Linietsky
2ab83e1abb Memory pool vectors (DVector) have been enormously simplified in code, and renamed to PoolVector 2017-01-07 18:26:38 -03:00
Juan Linietsky
0f7af4ea51 -Changed most project settings in the engine, so they have major and minor categories.
-Changed SectionedPropertyEditor to support this
-Renamed Globals singleton to GlobalConfig, makes more sense.
-Changed the logic behind persisten global settings, instead of the persist checkbox, a revert button is now available
2017-01-05 09:16:00 -03:00
Juan Linietsky
9e477babb3 -GDScript support for accessing properties directly
-Added code lookup and code completion support for properties too
2017-01-04 17:37:45 -03:00
Juan Linietsky
118eed485e ObjectTypeDB was renamed to ClassDB. Types are meant to be more generic to Variant.
All usages of "type" to refer to classes were renamed to "class"
ClassDB has been exposed to GDScript.
OBJ_TYPE() macro is now GDCLASS()
2017-01-02 23:03:46 -03:00
Rémi Verschelde
dcc4ee21c1 Revert expression reduction from #7390
Fixes #7412.
2017-01-02 20:01:27 +01:00
Rémi Verschelde
caddbbe174 Merge pull request #7390 from bojidar-bg/gdscript-assign-error
Disallow assignment to constants and expressions
2017-01-02 15:54:43 +01:00
Rémi Verschelde
c7bc44d5ad Welcome in 2017, dear changelog reader!
That year should bring the long-awaited OpenGL ES 3.0 compatible renderer
with state-of-the-art rendering techniques tuned to work as low as middle
end handheld devices - without compromising with the possibilities given
for higher end desktop games of course. Great times ahead for the Godot
community and the gamers that will play our games!
2017-01-01 22:03:33 +01:00
Bojidar Marinov
0b077162a3
Disallow assignment to constants and expressions
Fixes #6221, fixes #6824
2016-12-29 12:31:19 +02:00
Bojidar Marinov
23381a530b
Add named colors to GDScript/Visual Script/core.
Names and values taken from https://en.wikipedia.org/wiki/X11_color_names
2016-12-17 11:14:53 +02:00
Rémi Verschelde
7751a933a9 Merge pull request #6802 from henriquelalves/master
Added small modification on gdscript parser to allow users insert '+' before variables
2016-11-11 10:55:26 +01:00
Bojidar Marinov
074bcb2a7b
Make GDScript parser ignore floating strings in class definition
Fixes #1320
2016-11-03 12:26:38 +02:00
Rémi Verschelde
817dd7ccbb style: Fix PEP8 blank lines issues in Python files
Done with `autopep8 --select=E3,W3`, fixes:

- E301 - Add missing blank line.
- E302 - Add missing 2 blank lines.
- E303 - Remove extra blank lines.
- E304 - Remove blank line following function decorator.
- E309 - Add missing blank line.
- W391 - Remove trailing blank lines.
2016-11-01 00:35:16 +01:00
Rémi Verschelde
97c8508f5e style: Start applying PEP8 to Python files, indentation issues
Done with `autopep8 --select=E1`, fixes:

- E101 - Reindent all lines.
- E112 - Fix under-indented comments.
- E113 - Fix over-indented comments.
- E115 - Fix under-indented comments.
- E116 - Fix over-indented comments.
- E121 - Fix a badly indented line.
- E122 - Fix a badly indented line.
- E123 - Fix a badly indented line.
- E124 - Fix a badly indented line.
- E125 - Fix indentation undistinguish from the next logical line.
- E126 - Fix a badly indented line.
- E127 - Fix a badly indented line.
- E128 - Fix a badly indented line.
- E129 - Fix a badly indented line.
2016-11-01 00:33:51 +01:00
Bojidar Marinov
713f1451b9
Allow typing hints for Array class (in GDScript and Inspector/ArrayPropertyEdit)
Closes #3586, by implementing the `1b` variation mentioned there.
2016-10-26 14:38:41 +03:00
Henrique L. Alves
6a4b4c7db4 Added small modification on parser for '+' 2016-10-22 14:26:48 -02:00
Rémi Verschelde
cf3ba3379f Merge pull request #6564 from SuperUserNameMan/gdscript_opcode_line_opcode_breakpoint
fixes #6487, GDscript compiler ignores OPCODE_LINE and OPCODE_BREAKPOINT in Release mode
2016-10-22 12:45:46 +02:00
Rémi Verschelde
e96c49f849 Merge pull request #6850 from akien-mga/pr-scsub-shebang
SCsub: Add python shebang as a hint for syntax highlighting
2016-10-17 20:13:18 +02:00
Rémi Verschelde
fc8ccd5b8c SCsub: Add python shebang as a hint for syntax highlighting
Also switch existing shebangs to "better" /usr/bin/env python.
2016-10-17 20:10:46 +02:00
Rémi Verschelde
31e0e95362 Merge pull request #6692 from bojidar-bg/add-char-to-gd-vs-script
Add `String char(int ascii)` function to GDScript and Visual Script
2016-10-17 09:40:39 +02:00
Rémi Verschelde
da09c6131b modules: Clone env in each module
This allows to pass include paths and flags only to a given thirdparty
library, thus preventing conflicts between their files (e.g. between
opus and openssl which both provide modes.h.

This also has the nice effect of making the compilation command smaller
for each module as it no longer related to all other modules, only the
final linking brings them together.

This however requires adding manually the ogg include path in opus
and vorbis when building against the builtin ogg, since it is no longer
in the global env.

Also simplified template 'thirdparty_<module>_sources' to
'thirdparty_sources'.

"Core" modules like cscript, gdscript, gridmap, ik and virtual_script
still use the main env_modules, but it could be changed if need be.
2016-10-15 11:50:41 +02:00
Rémi Verschelde
5e373c2a69 Merge pull request #6813 from Faless/fix_6801_bis
Re-Allow absolute paths, make them behave correctly
2016-10-14 18:14:05 +02:00
Pedro J. Estébanez
1b3dcac281 Adapt overlooked instances of zero-based column numbers 2016-10-13 12:57:14 +02:00
Fabio Alessandrelli
11349a786b Revert "Add warning when (pre)loading paths with leading / (#4280 - #3106)"
Also closes: #6801

This reverts commit e59820ac94.
2016-10-13 11:49:22 +02:00
Rémi Verschelde
f3106cddb3 Merge pull request #6775 from RandomShaper/one-based-col-numbers
Make text column numbers one-based
2016-10-11 09:09:49 +02:00
Rémi Verschelde
3df507d696 Merge pull request #6694 from bojidar-bg/gdscript-newline-functions
Allow for linebreaks in function calls and definitions and yeild/signal.
2016-10-11 09:06:14 +02:00
Pedro J. Estébanez
2f80965845 Make text column numbers one-based
Make one-based the column number on the code editor

Make one-based the column number for GDScript error messages

Make one-based the column number for shader code error messages
2016-10-10 11:56:45 +02:00
Rémi Verschelde
2fb5a00305 i18n: Fix string that broke msgmerge 2016-10-09 18:11:55 +02:00
Rémi Verschelde
5f7f73c6ae Merge pull request #6730 from Faless/fix_export_crash_error
Throw an error when exporting a resource class
2016-10-09 14:44:10 +02:00
Fabio Alessandrelli
ee7df2c89a Throw an error when exporting a resource class
"export var tex = Texture"
will now throw an error to avoid crashing the editor:
"Exported constant not a type or resource"

Fixes #6719 . Closes #6729
2016-10-06 20:24:32 +02:00
Fabio Alessandrelli
e59820ac94 Add warning when (pre)loading paths with leading / (#4280 - #3106) 2016-10-04 16:07:45 +02:00
Bojidar Marinov
16a0e4b235
Allow for linebreaks in function calls and definitions and yeild/signal.
(Plus maybe a few other things)
2016-10-03 21:40:18 +03:00
Bojidar Marinov
513c0265c4
Add String char(int ascii) function to GDScript and Visual Script
Just hope it doesn't crashes with that much pointer math... 😄
2016-10-03 19:17:54 +03:00
yg2f
217e09c79d Fixes #6487, GDscript compiler ignores OPCODE_LINE and OPCODE_BREAKPOINT in Release mode
When godot is in release mode, GDscript compiler does not generate
bytecodes for OPCODE_LINE and OPCODE_BREAKPOINT anymore.

This optimizes GDscript execution speed when the script contains a lot
of comments in blocs executed in loops.

Fixes #6487
2016-09-20 13:54:17 +02:00
George Marques
5ef64aae58
Fix build for templates 2016-09-12 22:40:46 -03:00
Juan Linietsky
37f1e86108 Do ctrl-click on any code identifier to go to definiton or help page. 2016-09-12 10:53:31 -03:00
Juan Linietsky
78f92dbcb9 Merge pull request #6281 from bojidar-bg/gdscript-ternary-operator
Ternary operator in GDScript (a if x else b)
2016-09-11 18:40:46 -03:00
Juan Linietsky
b83350f4b2 Added constants from types in code completion, somehow this was never added.
Stuff like Label.ALIGN_CENTER or Mesh.PRIMITIVE_TRIANGLES did not complete..
2016-09-11 12:20:28 -03:00
Juan Linietsky
fc61eb37ce Merge pull request #5920 from 29jm/fix-warnings
Fix some more warnings
2016-09-10 12:21:02 -03:00
Juan Linietsky
e6dc95e499 Merge pull request #6292 from bojidar-bg/gdscript-add-enums
Adds enums to GDScript
2016-09-10 11:59:51 -03:00
Juan Linietsky
828e1c092f Renamed the bind_native functions to bind_vararg, should make it show the documentation more clearly and also make it easier to bind to C# 2016-09-07 19:39:57 -03:00
Răzvan Cosmin Rădulescu
00e743b76a Clean up GDScript template 2016-09-05 19:58:04 +02:00
Bojidar Marinov
88430f0962
Add enum naming, by assinging a given enum's values to a Dict 2016-08-27 15:56:51 +03:00
Bojidar Marinov
4ee82a2c38
Adds enums to GDScript
Fixes #2966
2016-08-27 15:27:02 +03:00
Juan Linietsky
9c6175db11 More visual script work
-Block switches to 2d/3d editor if editing visual script
-Added cast node in flow control
-Added ability to do RPC in visual script
-Comment nodes
-Fix bug with inverted cable in connecting backwards
-Copy and paste nodes, including from different scripts
2016-08-25 17:45:20 -03:00
Bojidar Marinov
9f66f59477
Ternary operator in GDScript (a if x else b)
Fixes #1961
2016-08-25 21:23:03 +03:00
Juan Linietsky
ad8f208bdb Proper function/property selection in visual script editing for property.
This one has an ordered list, built-in description, search, etc.
2016-08-23 19:29:07 -03:00
Juan Linietsky
1add52b55e Brand new networked multiplayer 2016-08-19 16:48:41 -03:00
Johan Manuel
a4674bda47 Fix some comparisons between signed and unsigned integers 2016-08-13 13:21:35 +02:00
Johan Manuel
67b29e3b9e Fix some warnings about misleading indentation 2016-08-13 13:21:35 +02:00
Johan Manuel
046f94d3ac Remove some unused variables 2016-08-13 13:21:35 +02:00
Rémi Verschelde
5d9967ef00 Merge pull request #6055 from eska014/native-bind-rettype
Allow documenting unexposed return types in bind_native_method
2016-08-08 18:23:36 +02:00
Rémi Verschelde
38cbf69e24 Merge pull request #6045 from bojidar-bg/extends-on-placeholders
Fix #5891 by not expecting the script instance to be a GDInstance
2016-08-08 10:22:13 +02:00
Juan Linietsky
9865650b43 Added a simpler way to do sub-functions in both visual and gdscript with the subcall node.
With this, visual script is almost done (missing registering custom nodes from addon).
All this is probably pretty broken, too and needs a lot of testing.
2016-08-08 01:21:22 -03:00
Juan Linietsky
6671c6bdc7 Added yield() signal smart autocompletion. 2016-08-06 22:11:03 -03:00
Juan Linietsky
9890c1d2ca Likely with bugs and with some features are missing, as well as profiler support, but VisualScript should be more or less done! 2016-08-06 19:00:54 -03:00
Juan Linietsky
259418f827 VisualScript can now execute visual scripts, but there is no debugger or profiler yet. 2016-08-05 22:48:00 -03:00
eska
4cd246898e Allow documenting unexposed return types in bind_native_method
Document return type of `Object.call` and `GDScript.new`
2016-08-06 02:21:29 +02:00
Bojidar Marinov
76ea995228
Fix #5891 by not expecting the script instance to be a GDInstance
It could be a placeholder instance as well
2016-08-05 13:44:12 +03:00
Juan Linietsky
3d1d190dcd Merge branch 'master' of https://github.com/godotengine/godot 2016-08-02 19:11:47 -03:00
Juan Linietsky
ad313097eb WIP visual scripting, not working yet but you can check out stuff 2016-08-02 19:11:05 -03:00
eska
b80c42ef4e Document FuncRef, GDFunctionState, InstancePlaceholder, RID, World2D 2016-07-30 21:27:58 +02:00
Juan Linietsky
9151eb591d Changed the way the step decimals are computed to a safer way, fixes many issues. 2016-07-26 17:25:10 -03:00
Juan Linietsky
f51a816253 Set proper line into operators when parsing GDScript, fixes #5822 2016-07-22 09:23:26 -03:00
Juan Linietsky
33cc480350 Fixed reloading of tool scripts within editor, they should work much better now, closes #3194 2016-07-20 22:37:48 -03:00
Juan Linietsky
5218f35b7f Forgot to clear signals on recompile, closes #5729 2016-07-17 13:49:59 -03:00
George Marques
8113ba8bef
Allow semicolon after 'pass' keyword 2016-07-10 12:20:53 -03:00
George Marques
4bf31b3f3d
Revert removing of function call in gd_parser
The function call was removed in #5538 because of the unused return value,
but the function itself has side effects and the absence of the call was
causing crashes.
2016-07-08 22:12:59 -03:00
Rémi Verschelde
b6ac91c0e6 Removed unused variables (first pass)
Fixes various gcc 5.4.0 warnings for -Wunused-variable and -Wunused-but-set-variable
2016-07-07 23:15:03 +02:00
Juan Linietsky
48959f0590 Merge pull request #5407 from RandomShaper/opt-self-indexing
Optimize member access with self
2016-07-01 12:25:26 -03:00
Juan Linietsky
e49b73e93a Only check for constants when parsing constants, should close #5497 2016-06-30 10:40:13 -03:00
Juan Linietsky
cf0fbe493f Ability to put constants in constant expressions, closes #5264 2016-06-29 22:17:55 -03:00
Juan Linietsky
36e754457f Warn instad of crashing when class instance is gone after yield. Closes #5247 , probably closes other yield related crashes 2016-06-29 21:06:16 -03:00
Juan Linietsky
3754f6cd75 Properly show the source:line even in inner clases, closes #3766 2016-06-28 11:49:57 -03:00
Juan Linietsky
cf6450043d Fix bug in inner class reference, closes #1411 2016-06-28 11:15:55 -03:00
Juan Linietsky
f4c6640827 Fixed bug related to resolving constants in a class, closes #1110 2016-06-28 11:02:53 -03:00
Juan Linietsky
565bb3afcc Fix extends issue, closes #4026 2016-06-28 10:44:38 -03:00
Juan Linietsky
3813160ea0 -Fix crashes with thread_exit()
-Added draft of C script API (still disabled and unused)
2016-06-26 10:54:45 -03:00
Pedro J. Estébanez
d306b9bea5 Optimize member access with self
Let the compiler take the fast path when a member is superfluously accessed with `self.`.
2016-06-25 15:59:39 +02:00
Andreas Haas
c871cf6801 Add "bool" to GDScript reserverd keywords
Noticed that "bool" wasn't highlighted when used like `export(bool) var is_xy = false`
2016-06-24 17:47:19 +02:00
Juan Linietsky
95e3279d34 Properly report a valid error instead of reporting as a bug, closes #3841 2016-06-24 10:30:36 -03:00
Juan Linietsky
5e816fd8c8 Property reporty base type when a function fails, fixes #4581 probably also closes other issues 2016-06-20 01:15:02 -03:00
Rémi Verschelde
e76f744c36 Merge pull request #5283 from djrm/remove_prints
Removed lots of prints
2016-06-19 13:10:23 +02:00
Rémi Verschelde
1923733ec8 Merge pull request #5268 from brakhane/fix-floating-bug
correctly parse floats in scientific notation (Fix #5267)
2016-06-19 13:05:00 +02:00
Daniel J. Ramirez
422fac5066 Removed lots of prints 2016-06-18 18:01:06 -05:00
Rémi Verschelde
b7dbf9207a Drop empty files that are not used anywhere
Part of #5272
2016-06-18 19:46:30 +02:00
Rémi Verschelde
a7fc04626a Add missing license headers in our source files (#5255)
Also removes a couple wrong Godot headers from third-party source files.
2016-06-18 14:46:12 +02:00
Dennis Brakhane
c246931f03 correctly parse floats in scientific notation
GDScript incorrectly parsed float values in scientific notation
when no decimal point was given. "1e-5" was parsed as "15".

Fix this by not requiring a decimal point when we found an exponent
for the number to be considered a float.

Fixes #5267
2016-06-18 13:20:45 +02:00
Geequlim
71245995a4 Add @GDScript.type_exists 2016-06-18 15:07:51 +08:00
Juan Linietsky
57c67fb0f7 reverted to ==, if a line is missing a statement, we'll have to make sure to add it 2016-06-17 21:57:46 -03:00
Juan Linietsky
dcd50f8838 changed == for >= since some statements may not store a line (if line is empty)
this is added to #5204
2016-06-17 21:19:09 -03:00
Juan Linietsky
3ddce309f4 Merge pull request #5204 from vnen/fix-completion-crash
Fix crash in code completion
2016-06-17 21:09:18 -03:00
Rémi Verschelde
7723579237 Fix type hint for the seed argument
Closes #5260.
2016-06-18 01:18:06 +02:00
George Marques
17b6cebcfe
Fix crash in code completion
Fix #4641
2016-06-13 22:19:39 -03:00
Juan Linietsky
45443a1651 Changed reload logic to auto-hard-reload scripts on save. It's simpler to use and also fixes #4756 2016-06-13 10:58:32 -03:00
Juan Linietsky
ceeb5453a8 gdscript tokenizer will dislike use of case, closes #4991 2016-06-11 21:45:37 -03:00
Juan Linietsky
fea9511bc6 remove unnecesary found bug? print, closes #5028 2016-06-11 20:36:28 -03:00
Juan Linietsky
f860915ae0 Made many built-in gdscript functions return more descriptive errors, closes #5150 2016-06-11 19:43:38 -03:00
Juan Linietsky
9ddc13a5cc -All variables from script are visible through get_property_list(), not just those with export()
-Added PROPERTY_USAGE_SCRIPT_VARIABLE to identify what comes from script
-closes #5146
2016-06-11 18:34:49 -03:00
Juan Linietsky
f8f30662d9 -Ability to reload (and soft reload) tool scripts. Please test! 2016-06-08 20:00:52 -03:00
punto-
86253cbdfe Revert "Fix implicit GDScript Reference inheritance" 2016-06-06 23:40:50 -03:00
eska
3acbf8e71f Fix implicit GDScript Reference inheritance 2016-06-05 19:17:33 +02:00
George Marques
43dad78209
Fix Color8 constructor using wrong value range
Fix #5015
2016-06-03 14:59:40 -03:00
Juan Linietsky
cc0a7b24e7 missed ifdef that broke android build 2016-06-01 20:44:34 -03:00
Juan Linietsky
9e745b920f Ability to reload scripts on running game 2016-06-01 20:31:42 -03:00
Juan Linietsky
df139f57b3 Some cleanup to GDScript
separated GDFunction (VM) from GDScript in two different files
2016-05-31 22:33:43 -03:00
Yakov Borevich
9e86b2714f [GDScript] Redefine var results in an error
Error rised if redefine
- function argument
- for-loop argument
- local-scope var

Affects #3730
2016-05-30 18:22:34 +03:00
Juan Linietsky
3e8eb396d7 Finalized DynamicFont implementation
-DynamicFont uses Freetype by default
-Editor fonts are now scalable thanks to this
-Cleaned up documentation browser and added fonts for this
2016-05-29 11:37:52 -03:00
Ignacio Armenteros
7caabd9398 Fix #4748: proper call to base class function 2016-05-23 11:49:51 +02:00
Juan Linietsky
a75f896338 First version of Profiler
It is now possible to profile GDScript as well as some parts of Godot
internals.
2016-05-21 21:18:16 -03:00
Rémi Verschelde
b58e261d41 GDScript: Fix method info for is_nan and is_inf
As reported on https://godotengine.org/qa/4114/why-isnan-and-isinf-arent-implemented
2016-05-17 14:59:48 +02:00
Juan Linietsky
0c57a58056 ability to drag scenes from filesystem to tree for instancing 2016-05-11 20:57:52 -03:00
Saracen
d643a40f95 Subclasses can now extend from other subclasses contained in scripts derived from relative paths. 2016-04-09 03:23:33 +01:00
Rémi Verschelde
0a5472e697 Remove trailing spaces 2016-04-02 20:26:12 +02:00
Hubert Jarosz
4a4f247914
remove trailing whitespace 2016-03-09 00:00:52 +01:00
Rémi Verschelde
002ff3cc9a Revert "Merge pull request #3814 from est31/iterators_for_for"
This reverts commit adf5056889, reversing
changes made to ee2bc87c0e.
2016-03-01 18:09:48 +01:00
Juan Linietsky
210d332def -wip on addon editor
-fixes instantiable subclasses not working, as reported in #3871
2016-02-29 09:57:38 -03:00
est31
5f66692395 Use xrange for common "for i in range(...)" use case
Make the parser eliminate a wasteful allocation and initialisation
of a possibly large array.
2016-02-28 22:47:48 +01:00
est31
f81153eb69 Add xrange builtin function
Also update classes.xml in order to document xrange
2016-02-28 22:47:48 +01:00
Juan Linietsky
6fc1c3a4d1 Completed the support for plugins! It is not possible to add plugins.
Not all APIs are provided yet, please request whathever you are missing.
Some example plugins are provided in demos/plugins. Just copy them to a folder in your project named addons/ and then enable them from the project settings.
Have fun!
2016-02-27 23:12:27 -03:00
Rémi Verschelde
c8071dfce8 Merge pull request #3812 from est31/master
Fix typo in error
2016-02-24 00:15:53 +01:00
est31
cea8e97c11 Fix typo in error 2016-02-24 00:08:53 +01:00
Juan Linietsky
70cdfa681a -Change link to new documentation
-fixed bug in tilemap collision debug
2016-02-20 10:02:14 -03:00
Rémi Verschelde
285c400288 Merge pull request #3658 from Hinsbart/doc_joyevent
doc: use correct identifiers for InputEventJoystick{Motion, Button}
2016-02-11 07:17:43 +01:00
hondres
6de2b9d864 doc: use correct identifier for InputEventJoystick{Motion, Button} 2016-02-10 23:37:25 +01:00
Juan Linietsky
61f03c98c8 -Added missing functions to the doc, fixes #3583 2016-02-09 16:58:03 -03:00
Rémi Verschelde
6ea0863ed3 Merge pull request #3587 from akien-mga/pr-reserved-keyords
Fix missing comma
2016-02-04 18:57:25 +01:00
Rémi Verschelde
ade7329625 Fix missing comma 2016-02-04 18:56:41 +01:00
George Marques
0f41a18344 Merge pull request #3582 from akien-mga/pr-reserved-keyords
Add preload and PI to GDScript reserved keywords
2016-02-04 14:52:44 -02:00
Rémi Verschelde
99d9188da8 Add preload and PI to GDScript reserved keywords
I've noticed that gd_tokenizer also has keywords for `switch' and `do', but they seem not to be supported actually (only used in commented code for the shader language), so I don't add them.
2016-02-04 10:26:10 +01:00
Rémi Verschelde
8151110002 Reorder reserved words by categories
They were previously kind of sorted with a mix between alphabetical and logical ordering, which made it hard to spot duplicates or missing words.
2016-02-04 10:17:23 +01:00
Juan Linietsky
817fd1ab71 -Added method flags to global constants for script
-Added a new flag METHOD_FLAG_FROM_SCRIPT to get_method_list() flag property. Closes #3489
2016-01-31 15:40:51 -03:00
Rémi Verschelde
7af864f467 Merge pull request #3445 from akien-mga/master
Add missing return for typeof() MethodInfo
2016-01-26 00:03:33 +01:00
Rémi Verschelde
e38b797c97 Add missing return for typeof() MethodInfo 2016-01-25 10:55:50 +01:00
hondres
56ce58d57c can preload constants 2016-01-24 23:45:11 +01:00
Juan Linietsky
de7fe2fced -remove unnecesary error report, fixes #3361 2016-01-23 15:36:03 -03:00