Commit graph

119 commits

Author SHA1 Message Date
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 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 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 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
Fabio Alessandrelli d79e28c302 Support multiple debug protocols. 2020-05-12 15:09:13 +02:00
lupoDharkael 95a1400a2a Replace NULL with nullptr 2020-04-02 13:38:00 +02:00
Ignacio Etcheverry 77dd061345 Mono/C#: Add iOS support
Right now, games only work on devices when exported with FullAOT+Interpreter.
There are some issues left that need to addressed for FullAOT alone. Right now,
it's giving issues with the Godot.NativeCalls static constructor.
2020-03-31 09:37:16 +02:00
Rémi Verschelde cb282c6ef0 Style: Set clang-format Standard to Cpp11
For us, it practically only changes the fact that `A<A<int>>` is now
used instead of the C++03 compatible `A<A<int> >`.

Note: clang-format 10+ changed the `Standard` arguments to fully
specified `c++11`, `c++14`, etc. versions, but we can't use `c++17`
now if we want to preserve compatibility with clang-format 8 and 9.
`Cpp11` is still supported as deprecated alias for `Latest`.
2020-03-17 07:36:24 +01:00
Rémi Verschelde 01afc442c7 Signals: Port connect calls to use callable_mp
Remove now unnecessary bindings of signal callbacks in the public API.
There might be some false positives that need rebinding if they were
meant to be public.

No regular expressions were harmed in the making of this commit.
(Nah, just kidding.)
2020-02-28 14:24:09 +01:00
Juan Linietsky 69c95f4b4c Reworked signal connection system, added support for Callable and Signal objects and made them default. 2020-02-20 08:24:50 +01:00
Juan Linietsky 3205a92ad8 PoolVector is gone, replaced by Vector
Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are
sugar for `Vector<Type>`.
2020-02-18 10:10:36 +01:00
Rémi Verschelde 386968ea97 Remove obsolete GLES3 backend
Due to the port to Vulkan and complete redesign of the rendering backend,
the `drivers/gles3` code is no longer usable in this state and is not
planned to be ported to the new architecture.

The GLES2 backend is kept (while still disabled and non-working) as it
will eventually be ported to serve as the low-end renderer for Godot 4.0.

Some GLES3 features might be selectively ported to the updated GLES2
backend if there's a need for them, and extensions we can use for that.

So long, OpenGL driver bugs!
2020-02-13 10:36:44 +01:00
Juan Linietsky 3f335ce3d4 Texture refactor
-Texture renamed to Texture2D
-TextureLayered as base now inherits 2Darray, cubemap and cubemap array
-Removed all references to flags in textures (they will go in the shader)
-Texture3D gone for now (will come back later done properly)
-Create base rasterizer for RenderDevice, RasterizerRD
2020-02-11 11:53:26 +01:00
Marcel Admiraal 5af3b4ca27 Remove duplicate ERR_PRINT macro. 2020-02-05 11:13:24 +01:00
Rémi Verschelde 5011afcb6a Export: Improve usability of command line interface
I'm barely scratching the surface of the changes needed to make the
--export command line interface easy to use, but this should already
improve things somewhat.

- Streamline `can_export()` templates check in all platforms, checking
  first for the presence of official templates, then of any defined
  custom template, and reporting on the absence of any.
  Shouldn't change the actual return value much which is still true if
  either release or debug is usable - we might want to change that
  eventually and better validate against the requested target.

- Fix discrepancy between platforms using `custom_package/debug` and
  `custom_template/debug` (resp. `release`).
  All now use `custom_template`, which will break compatibility for
  `export_presets.cfg` with earlier projects (but is easy to fix).

- Use `can_export()` when attempting a command line export and report
  the same errors that would be shown in the editor.

- Improve error reporting after a failed export attempt, handling
  missing template and invalid path more gracefully.

- Cleanup of unused stuff in EditorNode around the export workflow.

- Improve --export documentation in --help a bit.

Fixes #16949 (at least many of the misunderstandings listed there).
Fixes #18470.
2020-01-07 14:25:56 +01:00
Joost Heitbrink dc61323b2c PCK: Set VERSION_PATCH in header, factor out header magic
Unify pack file version and magic to avoid hardcoded literals.

`version.py` now always includes `patch` even for the first release in
a new stable branch (e.g. 3.2). The public name stays without the patch
number, but `Engine.get_version_info()` already included `patch == 0`,
and we can remove some extra handling of undefined `VERSION_PATCH` this
way.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2020-01-06 13:13:17 +01:00
Rémi Verschelde a7f49ac9a1 Update copyright statements to 2020
Happy new year to the wonderful Godot community!

We're starting a new decade with a well-established, non-profit, free
and open source game engine, and tons of further improvements in the
pipeline from hundreds of contributors.

Godot will keep getting better, and we're looking forward to all the
games that the community will keep developing and releasing with it.
2020-01-01 11:16:22 +01:00
Fabio Alessandrelli 53637e4b1c Improve EditorExportPlatform interface.
Convert all get_device* methods to get_option* and normalize their usage
as icon, label, tooltip.
2019-10-23 10:59:03 +02:00
bruvzg 1c592e5f1f
Add code signing support for Windows exports (using "signtool" on Windows and "osslsigncode" on the other platforms) 2019-10-04 22:33:03 +03:00
qarmin 17732fe698 Added some obvious errors explanations 2019-09-25 10:28:50 +02:00
Rémi Verschelde 73f1f9b44f
Merge pull request #31586 from SonerSound/issue_31533
Export path is the only path to be saved as a relative path
2019-08-23 08:34:03 +02:00
SonerSound 326f856006 Export path is the only path to be saved as a relative path
Also reverts 90b2415343
2019-08-22 22:20:15 +01:00
Fabio Alessandrelli c19871af6d Move CryptoCore to it's own folder.
Crypto classes will be placed in core/crypto.
2019-08-19 16:31:05 +02:00
Braden Bodily 71d71d55b5 Replace 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG' in 'core/' and 'editor/'
Condensed some if and ERR statements. Added dots to end of error messages

Couldn't figure out EXPLAINC. These files gave me trouble: core/error_macros.h, core/io/file_access_buffered_fa.h (where is it?),
core/os/memory.cpp,
drivers/png/png_driver_common.cpp,
drivers/xaudio2/audio_driver_xaudio2.cpp (where is it?)
2019-08-17 12:33:15 +02:00
Rémi Verschelde 37a16fee05 Export: Remove temp files from cache after export
So far we left most temporary files lying around, so this attempts to
fix that.

I added a helper method to DirAccess to factor out the boilerplate of
creating a DirAccess, checking if the file exists, remove it or print
an error on failure.
2019-08-12 13:31:59 +02:00
Rémi Verschelde a149e412f7
Merge pull request #24086 from RandomShaper/bundle-pck-to-executable
Enhance game export
2019-07-05 10:28:29 +02:00
Pedro J. Estébanez 40f4d3cf0f Add embedded PCK option to PC platforms
The basic point is as in 2.1 (appending the PCK into the executable), but this implementation also patches a dedicated section in the ELF/PE executable so that it matches the appended data perfectly.

The usage of integer types is simplified in existing code; namely, using plain `int` for small quantities.
2019-07-03 21:58:12 +02:00
Fabio Alessandrelli 564d93ff10 CryptoCore class to access to base crypto utils.
Godot core needs MD5/SHA256/AES/Base64 which used to be provided by
separate libraries.
Since we bundle mbedtls in most cases, and we can easily only include
the needed sources if we so desire, let's use it.

To simplify library changes in the future, and better isolate header
dependencies all functions have been wrapped around inside a class in
`core/math/crypto_base.h`.

If the mbedtls module is disabled, we only bundle the needed source
files independently of the `builtin_mbedtls` option.
If the module is enabled, the `builtin_mbedtls` option works as usual.

Also remove some unused headers from StreamPeerMbedTLS which were
causing build issues.
2019-07-02 12:36:27 +02:00
qarmin 4e5310cc60 Some code changed with Clang-Tidy 2019-06-26 15:08:25 +02:00
Rémi Verschelde 6d16f2f053 Fix error macro calls not ending with semicolon
It's not necessary, but the vast majority of calls of error macros
do have an ending semicolon, so it's best to be consistent.
Most WARN_DEPRECATED calls did *not* have a semicolon, but there's
no reason for them to be treated differently.
2019-06-11 14:49:34 +02:00
Rémi Verschelde e8fbb28e20
Merge pull request #29119 from bruvzg/native_icon_support
Add native window/taskbar icon support for Windows and macOS.
2019-05-27 12:09:42 +02:00
bruvzg 2b9ed68d6a
Add native window/taskbar icon support for Windows and macOS.
Co-authored-by: Markus Törnqvist <mjt@nysv.org>
2019-05-24 14:23:57 +03:00
WiggleWizard aebca30c43 Fixed virtual method not showing up in autocomplete and docs 2019-05-23 22:31:02 +01:00
George Marques c121d8871d
Allow project export to be canceled 2019-05-18 15:33:57 -03:00
volzhs 8920bb8c1b Fix directory check when exporting project
Fix #26702
2019-03-06 21:20:18 +09:00
Rémi Verschelde b4d5c1ab5b
Merge pull request #26633 from akien-mga/driver-fallback-etc
Disable driver fallback to GLES2 by default
2019-03-06 00:57:49 +01:00
Ricardo Lüders 3fdbdd8380 Fixes misleading error message when trying to export
This patch fixes the misleading error message when users
try to "export all" into an invalid destination path.

Closes #26539
2019-03-05 21:32:52 +01:00
Rémi Verschelde b0f782a0e3 Disable driver fallback to GLES2 by default
GLES2 is not designed to be a drop-in replacement for the GLES3 backend,
so the fallback mode has to be used knowingly. It *can* make sense for
simple projects which make sure to handle the differences between both
rendering backends, but most users should stick to one supported backend.

By making it opt-in, we can now use this parameter to define whether to
export ETC textures to Android and iOS when using GLES3 + Fallback.

When using GLES3 without Fallback on Android, set the proper min GLES
version in the AndroidManifest.

Also made the option boolean and renamed it for clarity and to avoid
conflict with the previous String option (which would always evaluate as
"true" otherwise).

Fixes #26569.
2019-03-05 16:36:46 +01:00
Rémi Verschelde 9d002442b2 Improve VRAM texture compression checks for mobile/web
For HTML5, we need to support S3TC if running on desktop,
and ETC or ETC2 for mobile, so make this explicit.

Add logic to check for ETC2 support on GLES3,
and remove incorrect ETC feature for GLES3 on Android.

Fix ETC check invalidating templates on HTML5.
Fixes #26476.
2019-03-03 13:24:08 +01:00
Juan Linietsky dce1e6b5fe Clarify that ETC is required for GLES2. 2019-02-26 19:31:10 -03:00
Juan Linietsky f669ebeeaf -Properly handle missing ETC support on export
-Added ability for resource importers to save metadata
-Added ability for resource importers to validate depending on project settings
2019-02-26 18:45:06 -03:00
Alexander Holland c28da89879 Fix Android jarsigner error duplicate file
Exports same file only once.
2019-02-16 21:58:52 +01:00
Rémi Verschelde c5dcbeb160 Scene: Ensure classes match their header filename
Also drop some unused files.

Renamed:
- `scene/2d/navigation2d.h` -> `navigation_2d.h`
- `scene/2d/screen_button.h` -> `touch_screen_button.h`
- `scene/3d/scenario_fx.h` -> `world_environment.h`
- `scene/audio/audio_player.h` -> `audio_stream_player.h`
- `scene/resources/bit_mask.h` -> `bit_map.h`
- `scene/resources/color_ramp.h` -> `gradient.h`
- `scene/resources/shape_line_2d.h` -> `line_shape_2d.h`
- `scene/resources/scene_format_text.h` -> `resource_format_text.h`
- `scene/resources/sky_box.h` -> `sky.h`

Dropped:
- `scene/resources/bounds.h`
2019-02-12 17:21:48 +01:00
Rémi Verschelde 2323464f5e ExportDialog: Make error messages translatable
Also fix missing newlines that caused #24202.
2019-01-21 18:34:53 +01:00
Rémi Verschelde 5809be9641
Merge pull request #24582 from Xrayez/script-encrypt
Bring back script encryption in export preset
2019-01-04 16:34:38 +01:00
Rémi Verschelde b16c309f82 Update copyright statements to 2019
Happy new year to the wonderful Godot community!
2019-01-01 12:58:10 +01:00
Andrii Doroshenko (Xrayez) ba13a2bc05 Bring back script encryption in export preset
Retrieved working implementation from 2.1 branch and adapted to
existing export preset system.

Added Script tab in export preset to export script as raw text,
compiled, or encrypted (same as in 2.1). The script encryption key is
visually validated. The script export mode and the key is saved per
per preset in `export_presets.cfg`, so it makes sense to ignore this
file in version control system.

Each custom exporting procedure can retrieve an export preset set
during project exporting. Refactored project export dialog a bit to
allow easier code comprehension.
2018-12-24 17:16:14 +02:00
Wilson E. Alvarez 08f22f1cf0
Moved member variables to initializer list 2018-12-11 18:33:01 -05:00
Marcelo Fernandez 087401b33f Fix custom features missing when _export_begin is called 2018-12-07 16:29:47 -03:00