Commit graph

59 commits

Author SHA1 Message Date
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
Rémi Verschelde
bd282ff43f Use HTTPS URL for Godot's website in the headers 2017-08-27 14:16:55 +02: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
Wilson E. Alvarez
738d2ab969 Removed unnecessary assignments 2017-08-21 15:15:55 -04: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
Rémi Verschelde
df61dc4b2b Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02: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
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
f44ee891be Style: Fix statements ending with ';;' 2017-01-16 08:49:52 +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
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
6dd7d2c1f7 Implicit inheritance now defaults to Resource, will error for node scripts if extends not used. 2017-01-12 16:00:57 -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
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
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
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
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
Bojidar Marinov
9f66f59477
Ternary operator in GDScript (a if x else b)
Fixes #1961
2016-08-25 21:23:03 +03:00
Juan Linietsky
1add52b55e Brand new networked multiplayer 2016-08-19 16:48:41 -03:00
Juan Linietsky
5218f35b7f Forgot to clear signals on recompile, closes #5729 2016-07-17 13:49: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
565bb3afcc Fix extends issue, closes #4026 2016-06-28 10:44:38 -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
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
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
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
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
Saracen
d643a40f95 Subclasses can now extend from other subclasses contained in scripts derived from relative paths. 2016-04-09 03:23:33 +01:00
Hubert Jarosz
4a4f247914
remove trailing whitespace 2016-03-09 00:00:52 +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
Juan Linietsky
cb39db0b02 Fixed bug with default arguments in gdscript, closes #2024 2016-01-03 21:11:11 -03:00
George Marques
5be9ff7b67 Update copyright to 2016 in headers 2016-01-01 11:50:53 -02:00
Zher Huei Lee
61a1f596cc added missing null check
for p_func inside _parse_function
2015-12-30 01:02:31 +00:00
reduz
7d2d1442f8 -add breakpoint statement to ease with debugging, closes #3165 2015-12-29 12:11:21 -03:00
reduz
30c12297dc - added 'onready' keyword to gdscript. Defers initialization of member variables until _ready() is run. 2015-12-28 19:32:51 -03:00
Juan Linietsky
48f1d02da4 added ability to define signals in script
closes #2175
2015-06-24 13:29:45 -03:00
Juan Linietsky
701335e845 -Throw error if setter and getter reference their member variable with self. , fixes #1685 2015-04-18 17:55:04 -03:00
Juan Linietsky
4661a6e126 -try to avoid errors when path using ".." is present in script include, fixes #1703 2015-04-18 16:17:33 -03:00
Juan Linietsky
fdaa2920eb Updated copyright year in all headers 2015-04-18 14:38:54 -03:00
Juan Linietsky
bd03562076 -Resolved bug that made yield() not work in some situations, fixes #884 2015-01-06 00:39:35 -03:00
Juan Linietsky
60afd79a6e -added a check for setget while running the game , closes #1009
-fixed issues in tilemap editor (swap arrows not showing/hiding properly)
2015-01-03 00:57:02 -03:00
Juan Linietsky
bcf27feb98 New Code Completion
-=-=-=-=-=-=-=-=-=-

-Massive improvement to code completion
-Argument hinting for functions

If you manage to out-smart the code-completion in a situation where completion
should be possible to guess, let me know.

 Please enter the commit message for your changes. Lines starting
2014-12-16 22:31:57 -03:00
Juan Linietsky
d85b67be53 Bug Fixes
-=-=-=-=-

-Fixed problem with scaling shapes (#827), related to not taking scale in consideration for calculating the moment of inertia
-Added support for multiline strings (or comments) using """
-Save subscene bug, properties not being saved in root node (#806)
-Fix Crash in CollisionPolygon2DEditor (#814)
-Restored Ability to compile without 3D (#795)
-Fix InterpolatedCamera (#803)
-Fix UV Import for OBJ Meshes (#771)
-Fixed issue with modifier gizmos (#794)
-Fixed CapsuleShape gizmo handle (#50)
-Fixed Import Button (not properly working in 3D) (#733)
-Many misc fixes (though no new features)
2014-11-02 11:31:01 -03:00
Juan Linietsky
e82dc40205 -Much improvement to baked light baker
-Fixed many bugs in stretch mode
-Fixes to camera project and unproject as consequence of the above
-added setget to script (documented in script doc)
-more fixes to collada exporter for blender
2014-10-27 22:54:32 -03:00