Commit Graph

245 Commits

Author SHA1 Message Date
Bojidar Marinov 0c650c2511 Make inline blocks in GDScript more pythonic
Fixes #8001

(cherry picked from commit 18ab88b3f1)
2017-03-24 23:19:14 +01:00
Pedro J. Estébanez 48da11372e Fix random crashes when using yield() 2017-03-21 02:54:46 +01:00
mbalint12 82ad45024f Fixed typo in gdscript autocompletion.
There was a missing '!' sign, but autocompletion shows parent script members too.

(cherry picked from commit edaf77abd6)
2017-03-19 00:43:07 +01:00
Rémi Verschelde f8db8a3faa Bring that Whole New World to the Old Continent too
Applies the clang-format style to the 2.1 branch as done for master in
5dbf1809c6.
2017-03-19 00:36:26 +01:00
Rémi Verschelde 1b0e2b0c39 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.

(Manual redo of 49c065d29c)
2017-03-18 23:45:45 +01:00
Rémi Verschelde 16b78da941 Style: Various fixes to play nice with clang-format
(cherry picked from commit 2a0ddc1e89)
2017-03-18 23:13:47 +01:00
Rémi Verschelde dbf0137576 Style: Fix statements ending with ';;'
(cherry picked from commit f44ee891be)
2017-03-18 21:14:33 +01:00
Hein-Pieter van Braam 4cf49bb6f4 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

(cherry picked from commit 3e5743ca36)
2017-03-18 20:10:36 +01:00
Hein-Pieter van Braam 38e86c8c24 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

(cherry picked from commit e8611966de)
2017-03-18 20:09:45 +01:00
Pedro J. Estébanez 204a7481e0 Skip asserts on non-debug builds at compiler level 2017-03-13 00:23:42 +01:00
Rémi Verschelde d8223ffa75 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!

(cherry picked from commit c7bc44d5ad)
2017-01-12 19:15:30 +01:00
Bojidar Marinov 4c9c43735a Disallow assignment to expressions
Fixes #6824

(cherry picked from commits 0b077162a3
and dcc4ee21c1)
2017-01-12 19:15:28 +01:00
Bojidar Marinov 85585c7fc5 Add named colors to GDScript/core.
Names and values taken from https://en.wikipedia.org/wiki/X11_color_names

(cherry picked from commit 23381a530b)
2017-01-12 19:15:27 +01:00
Bojidar Marinov 6ad84850ab Ternary operator in GDScript (a if x else b)
Fixes #1961
2017-01-10 17:09:26 +01:00
Bojidar Marinov c0743f898a Allow for linebreaks in function calls and definitions and yeild/signal.
(Plus maybe a few other things)
2017-01-10 17:08:50 +01:00
Rémi Verschelde a7389217f8 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-02 22:29:36 +01:00
Rémi Verschelde 561c1f17a1 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-02 22:26:55 +01:00
yg2f caf42f77d2 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

(cherry picked from commit 217e09c79d)
2016-10-31 00:00:46 +01:00
Rémi Verschelde 5a49e45d21 SCsub: Add python shebang as a hint for syntax highlighting
Also switch existing shebangs to "better" /usr/bin/env python.

(cherry picked from commit fc8ccd5b8c)
2016-10-30 14:51:34 +01:00
Rémi Verschelde bfea3f1d9a 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.

(cherry picked from commit da09c6131b)

Obviously removed the parts about enet and visual_script.
2016-10-30 14:51:32 +01:00
Pedro J. Estébanez 2261c65f19 Adapt overlooked instances of zero-based column numbers
(cherry picked from commit 1b3dcac281)
2016-10-17 20:49:28 +02:00
Fabio Alessandrelli d5ee98bb2c Revert "Add warning when (pre)loading paths with leading / (#4280 - #3106)"
Also closes: #6801

This reverts commit e59820ac94.

(cherry picked from commit 11349a786b)
2016-10-17 20:48:52 +02:00
Pedro J. Estébanez 99d82f3033 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

(cherry picked from commit 2f80965845)
2016-10-17 20:44:47 +02:00
Rémi Verschelde b3bf3c392a i18n: Fix string that broke msgmerge
(cherry picked from commit 2fb5a00305)
2016-10-09 18:21:59 +02:00
Fabio Alessandrelli e51cd3d454 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

(cherry picked from commit ee7df2c89a)
2016-10-09 17:40:19 +02:00
Fabio Alessandrelli ba095b8dcc Add warning when (pre)loading paths with leading / (#4280 - #3106)
(cherry picked from commit e59820ac94)
2016-10-09 17:34:23 +02:00
Juan Linietsky a72945f4e3 Added constants from types in code completion, somehow this was never added.
Stuff like Label.ALIGN_CENTER or Mesh.PRIMITIVE_TRIANGLES did not complete..

(cherry picked from commit b83350f4b2)
2016-09-18 23:19:04 +02:00
Răzvan Cosmin Rădulescu c4f79716d3 Clean up GDScript template
(cherry picked from commit 00e743b76a)
2016-09-18 23:05:45 +02:00
Bojidar Marinov f25e9a08e1 Fix #5891 by not expecting the script instance to be a GDInstance
It could be a placeholder instance as well

(cherry picked from commit 76ea995228)
2016-08-08 18:14:44 +02: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