Commit graph

4109 commits

Author SHA1 Message Date
Rémi Verschelde 1620669f4e
Merge pull request #39051 from Xrayez/geometry-split
Split `Geometry` singleton into `Geometry2D` and `Geometry3D`
2020-05-29 12:10:37 +02:00
Rémi Verschelde a16031beb6 Use translated docs in PropertySelector
And do the dedent and stripping for both translated and
non-translated strings for consistency, and so that we
don't need to do it at the call site.
2020-05-28 12:02:12 +02:00
Andrii Doroshenko (Xrayez) 69d5de632e Split Geometry singleton into Geometry2D and Geometry3D
Extra `_2d` suffixes are removed from 2D methods accoringly.
2020-05-27 14:28:34 +03:00
Rémi Verschelde bd14c6406a
Merge pull request #39064 from bruvzg/gdn_packed_array_ptr
GDNative: Add bindings for the Packed*Array ptr() and ptrw() functions.
2020-05-27 12:55:17 +02:00
Rémi Verschelde ab460e7a6f
Merge pull request #39074 from vnen/gdscript-assert-message
Fix assert message when no custom message is set
2020-05-27 08:23:17 +02:00
George Marques f29a2e2606
GDScript: Fix assert message when no custom message is set 2020-05-26 20:40:59 -03:00
bruvzg 9fbc424d4c
GDNative: Add bindings for the Packed*Array ptr() and ptrw() functions. 2020-05-26 17:02:02 +03:00
Maganty Rushyendra 3d03be7a56 Update Mono C# warning to reflect latest list of platforms supported
Simple fix for #38627. iOS (#20268) and HTML5 (#20270) removed from list of exceptions
for platforms supported in warning message.
2020-05-26 09:19:45 +08:00
Rémi Verschelde bfac9b3538
Merge pull request #39015 from ThakeeNathees/dict-key-autocomplete-regression-fix
regression: dictionary key no autocomplete fix
2020-05-25 15:58:08 +02:00
Andrii Doroshenko (Xrayez) a96f0e98d7 Add custom_modules build option to compile external user modules
This patch adds ability to include external, user-defined C++ modules
to be compiled as part of Godot via `custom_modules` build option
which can be passed to `scons`.

```
scons platform=x11 tools=yes custom_modules="../project/modules"
```

Features:

- detects all available modules under `custom_modules` directory the
same way as it does for built-in modules (not recursive);
- works with both relative and absolute paths on the filesystem;
- multiple search paths can be specified as a comma-separated list.

Module custom documentation and editor icons collection and generation
process is adapted to work with absolute paths needed by such modules.

Also fixed doctool bug mixing absolute and relative paths respectively.

Implementation details:

- `env.module_list` is a dictionary now, which holds both module name as
  key and either a relative or absolute path to a module as a value.
- `methods.detect_modules` is run twice: once for built-in modules, and
  second for external modules, all combined later.
- `methods.detect_modules` was not doing what it says on the tin. It is
  split into `detect_modules` which collects a list of available modules
  and `write_modules` which generates `register_types` sources for each.
- whether a module is built-in or external is distinguished by relative
  or absolute paths respectively. `custom_modules` scons converter
  ensures that the path is absolute even if relative path is supplied,
  including expanding user paths and symbolic links.
- treats the parent directory as if it was Godot's base directory, so
  that there's no need to change include paths in cases where custom
  modules are included as dependencies in other modules.
2020-05-25 15:33:32 +03:00
Thakee Nathees 13c372b522 regression: dictionary key no autocomplete fix
Fix: #38998
2020-05-24 16:52:44 +05:30
Rémi Verschelde 2a3f650bf6
Merge pull request #38962 from neikeq/4.0-scons-option-build-cil
Add SCons option to not build C# solutions
2020-05-22 18:29:13 +02:00
Ignacio Etcheverry e3a54152e4 Add SCons option to not build C# solutions 2020-05-22 17:44:33 +02:00
Rémi Verschelde 90f46a19a4
Merge pull request #38366 from akien-mga/xatlas-470576d
xatlas: Sync with upstream 470576d
2020-05-22 10:17:14 +02:00
Rémi Verschelde 07ada02cb4
Merge pull request #38943 from neikeq/yakamashi
Mono/C#: Don't try to load project assembly in project manager
2020-05-22 09:16:26 +02:00
Ignacio Etcheverry d7e21ecd63 Mono/C#: Don't try to load project assembly in project manager
This was causing an error message when launching the manager,
because there is no project assembly to load.
2020-05-22 02:17:59 +02:00
Ignacio Etcheverry 51e1614d28 Mono/C#: Fix values not updated in remote inspector 2020-05-22 00:58:38 +02:00
Rémi Verschelde 78e223569b
Merge pull request #33689 from jbuck3/signal-error
Trigger an error when trying to define a preexisting signal in GDScript
2020-05-21 11:01:23 +02:00
Rémi Verschelde af366c7adf
Merge pull request #35900 from yamgent/unreachable
Fix false positive "Unreachable code" warning for loops
2020-05-21 10:59:59 +02:00
Rémi Verschelde 59780fd046 xatlas: Sync with upstream 470576d 2020-05-20 13:51:15 +02:00
Rémi Verschelde cba1f492cc
Merge pull request #38863 from neikeq/csharp-no-false-error-objtype-reload
Mono/C#: Remove script load error about not a Godot.Object
2020-05-19 20:48:59 +02:00
Ignacio Etcheverry 38cd2152e6 Mono/C#: Remove script load error about not a Godot.Object
Any C# file can be loaded as script and at load
time we don't yet know if it's actually meant to
be used as a script. As such, such an check can
result in a lot of false errors.

If the file is really meant to be used as a
script, an error would be printed later when
attempting to instantiate it any way.
2020-05-19 17:51:56 +02:00
Pedro J. Estébanez 1f0548efd4 Fix too eager GDScriptFunctionState stack cleanup 2020-05-19 16:41:14 +02:00
Rémi Verschelde ca3192d18a Style: Fix unnecessary semicolons that confused clang-format 2020-05-19 11:24:58 +02:00
Rémi Verschelde 38250ef54e
Merge pull request #38826 from bruvzg/gdnative_core_types
Add new (and rename changed) core types to GDNative API.
2020-05-18 16:39:40 +02:00
Rémi Verschelde 56343e13b0
Merge pull request #38723 from neikeq/initial-classdb-test
Added tests for ClassDB
2020-05-18 16:34:36 +02:00
bruvzg 74eecd1d6b
GDNative add new core types. 2020-05-18 15:52:20 +03:00
Rémi Verschelde c74d65cec8 GLSL: Change shader type specifier from [vertex] to #[vertex]
The added `#` prevents clang-format from misinterpreting the meaning
of this statement and thus messing up the formatting of the next
lines up until the first `layout` statement.

Similarly, a semicolon is now enforced on `versions` defines to
prevent clang-format from messing up formatting and putting them
all on a single line. Note: In its current state the code will
ignore chained statements on a single line separated by a semicolon.

Also removed some extraneous lines missed in previous style changes
or added by mistake with said changes (e.g. after uniform definitions
that clang-format messes up somewhat too, but we live with it).
2020-05-18 10:58:14 +02:00
Ignacio Etcheverry 9fa4b402a7 Added tests for ClassDB 2020-05-16 17:32:58 +02:00
Tan Wang Leng 7b1423a61e gdscript_parser: Fix "unreachable code" false positive for loops
Depending on the conditional statements of the 'for' and 'while' loops,
their body may not even execute once. For example:

    func a():
        var arr = []
        for i in arr:
            return i
        # can be reached, but analysis says cannot
        return -1

    func b():
        var should_loop = false
        while should_loop:
           return 1
        # can be reached, but analysis says cannot
        return 0

The parser will complain that the statements after the comment cannot
be reached, but it is clearly possible for our scenario. This is
because the parser falsely assumes that the loop body will always
execute at least once.

Fix the code to remove this assumption for both of those loops.
2020-05-16 20:02:55 +08:00
bruvzg 48d133a5fd
Fix GDNative wrapper type sizes (RID, Variant, Packed*Array), add size checking static asserts. 2020-05-16 13:58:42 +03:00
Ignacio Etcheverry 18332a0094 websocket: Fix crash at exit when not running the editor
EditorDebuggerServer::register_protocol_handler must not be called before
editor initialization. Otherwise, if the editor is never initialized,
the added StringName will not be released until static destructors are
called (instead of being release during editor deinitialization).
2020-05-16 04:30:12 +02:00
Oliver Frank 6815bf42b3 Fix incorrect capabilities notification in LSP
(cherry picked from commit 2173d041af)
2020-05-15 23:55:49 +02:00
Oliver Frank 3d09edeaef Improve jsonrpc error reporting
(cherry picked from commit dac8b7b6f4)
2020-05-15 23:55:41 +02:00
Thakee Nathees c076a2b7e9 break, continue outside of a loop, match statement handled 2020-05-15 03:16:50 +05:30
Rémi Verschelde 00949f0c5f
Merge pull request #38738 from akien-mga/cause-we-never-go-out-of-style
Style: Remove new line at block start, enforce line between functions, enforce braces in if and loop blocks
2020-05-14 23:09:03 +02:00
Rémi Verschelde 0ee0fa42e6 Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14 21:57:34 +02:00
Rémi Verschelde 5046f666a1
Merge pull request #38610 from ThakeeNathees/infer-type-null-error
set parser error when infer type is null
2020-05-14 21:50:48 +02:00
Rémi Verschelde 07bc4e2f96 Style: Enforce separation line between function definitions
I couldn't find a tool that enforces it, so I went the manual route:
```
find -name "thirdparty" -prune \
  -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \
  -o -name "*.glsl" > files
perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files)
misc/scripts/fix_style.sh -c
```

This adds a newline after all `}` on the first column, unless they
are followed by `#` (typically `#endif`). This leads to having lots
of places with two lines between function/class definitions, but
clang-format then fixes it as we enforce max one line of separation.

This doesn't fix potential occurrences of function definitions which
are indented (e.g. for a helper class defined in a .cpp), but it's
better than nothing. Also can't be made to run easily on CI/hooks so
we'll have to be careful with new code.

Part of #33027.
2020-05-14 16:54:55 +02:00
Rémi Verschelde 0be6d925dc Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to
will now be changed automatically to remove the first empty line.

This makes us lean closer to 1TBS (the one true brace style) instead
of hybridating it with some Allman-inspired spacing.

There's still the case of braces around single-statement blocks that
needs to be addressed (but clang-format can't help with that, but
clang-tidy may if we agree about it).

Part of #33027.
2020-05-14 16:54:55 +02:00
Rémi Verschelde 710b34b702 Style: Fix missing/invalid copyright headers 2020-05-14 16:54:54 +02:00
Rémi Verschelde 963a27f8a2
Merge pull request #38611 from ThakeeNathees/shadow-var-warning-bug-fix
shadowed var warning in nested block bug fix
2020-05-14 16:48:56 +02:00
Rémi Verschelde a1aaed5a84 Remove redundant void argument lists
Using clang-tidy's `modernize-redundant-void-arg`.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-redundant-void-arg.html
2020-05-14 13:51:45 +02:00
Rémi Verschelde dcd1151d77 Enforce use of bool literals instead of integers
Using clang-tidy's `modernize-use-bool-literals`.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-bool-literals.html
2020-05-14 13:45:01 +02:00
Rémi Verschelde 1a8167867b Modernize remaining uses of 0/NULL instead of nullptr (C++11)
Using clang-tidy's `modernize-use-nullptr`.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
2020-05-14 13:45:01 +02:00
Rémi Verschelde 1f6f364a56 Port member initialization from constructor to declaration (C++11)
Using `clang-tidy`'s `modernize-use-default-member-init` check and
manual review of the changes, and some extra manual changes that
`clang-tidy` failed to do.

Also went manually through all of `core` to find occurrences that
`clang-tidy` couldn't handle, especially all initializations done
in a constructor without using initializer lists.
2020-05-14 10:01:56 +02:00
Thakee Nathees 687b1941b4 set parser error when infer type is null 2020-05-13 22:12:23 +05:30
Rémi Verschelde e7c9d81876
Merge pull request #38609 from ThakeeNathees/range-crash-with-non-numeric-const-fix
range() with non-numeric const argument crash fix
2020-05-13 15:42:29 +02:00
Rémi Verschelde dc649684be
Merge pull request #38708 from ThakeeNathees/init-assign-type-parser-bug-fix
regression: var declaration type info parser bug fix
2020-05-13 15:41:28 +02:00
Thakee Nathees e7f056dfac regression: static func can't access const fix 2020-05-13 06:07:22 +05:30