Commit graph

116 commits

Author SHA1 Message Date
Aaron Franke 4e6efd1b07
Use C++ iterators for Lists in many situations 2021-07-23 17:38:28 -04:00
reduz 6631f66c2a Optimize StringName usage
* Added a new macro SNAME() that constructs and caches a local stringname.
* Subsequent usages use the cached version.
* Since these use a global static variable, a second refcounter of static usages need to be kept for cleanup time.
* Replaced all theme usages by this new macro.
* Replace all signal emission usages by this new macro.
* Replace all call_deferred usages by this new macro.

This is part of ongoing work to optimize GUI and the editor.
2021-07-18 21:20:02 -03:00
Lightning_A e28fd07b2b Rename instance()->instantiate() when it's a verb 2021-06-19 20:49:18 -06:00
Lyuma 6c94b2cb9e Remove thread-unsafe and unused late_added_files.
_reimport_file is called from multiple threads as part of the threaded importer.
Inserting to this set from a thread could hit a race condition leading to memory corruption or hangs.
It seems to be unused, intentionally or unintentionally
2021-06-17 05:30:24 -07:00
Rémi Verschelde 1074017f04
Refactor editor paths validation in EditorPaths and EditorSettings
- EditorSettings: Ensure that `create()` makes a valid singleton.
  Fixes #49179, fixes #49450.
- EditorPaths: Cleanup code, properly set `paths_valid`.
- EditorPaths: Move more paths validation (check, mkdir) from
  EditorSettings for a better separation of concerns.
- EditorPaths: Move EditorFileSystem creation of `.godot/imported`
  next to other paths.
2021-06-14 19:56:20 +02:00
Rémi Verschelde 9e328bb5b7
Core: Move DirAccess and FileAccess to core/io
File handling APIs are typically considered part of I/O, and we did have most
`FileAccess` implementations in `core/io` already.
2021-06-11 14:52:39 +02:00
Georgi Genkov a8c83a7b35 Change EditorFileSystem and ScriptEditor file sorting order to improve consistency.
Fixes #37721.
2021-05-18 10:42:06 +02:00
Mateo Kuruk Miccino dc76938679 FileSystem: Force update when we delete a folder from the editor and searching changes only if we change the directory successfully in the scan_fs_changes 2021-05-01 22:12:02 -03:00
Juan Linietsky 2b730cad90 Use multiple threads to import.
- For now everything imports multithreaded by default (should work I guess, let's test).
- Controllable per importer

Early test benchmark. 64 large textures (importing as lossless, _not_ as vram) on a mobile i7, 12 threads:
Importing goes down from 46 to 7 seconds.

For VRAM I will change the logic to use a compressing thread in a subsequent PR, as well as implementing Betsy.
2021-04-19 14:12:22 -03:00
Juan Linietsky 8d64f3bd76 Add a "keep" import mode to keep files as-is and export them. 2021-03-22 17:19:19 -03:00
Juan Linietsky 97a3a66220 Improved 3D Scene Importer
* Added option for importers to show an Advanced settings dialog
* Created advanced settings dialog for Scene Importer
* Cleaned up importers (remove many old/unused options)
* Added the ability to customize every node, material, mesh and animation individually
* Saving to animations and meshes to files is now a manual process, making it more predictable
* Added the ability for materials to be replaced by external files (or to be made external, up to you).
* When doubleclicking an impoted scene in the filesystem dock, it automatically shows the import settings instead of asking to open it.

WARNING: Lightmap UV unwrap is not working, it needs to be re-made.
2021-03-22 12:16:40 -03:00
Fredia Huya-Kouadio eda18fcc1f Update the filtering logic to properly handle directories with .gdignore files. 2021-02-24 18:40:36 -08:00
Rémi Verschelde 310496a89f
Merge pull request #45617 from RandomShaper/modernize_atomics
Modernize atomics (and fix `volatile`)
2021-02-18 19:40:31 +01:00
Pedro J. Estébanez 8e128726f0 Modernize atomics
- Based on C++11's `atomic`
- Reworked `SafeRefCount` (based on the rewrite by @hpvb)
- Replaced free atomic functions by the new `SafeNumeric<T>`
- Replaced wrong cases of `volatile bool` by the new `SafeFlag`
- Platform-specific implementations no longer needed

Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
2021-02-18 17:12:46 +01:00
reduz 64140eaf42 Reorganize Project Settings
-Advanced Settings toggle also hides advanced properties when disabled
-Simplified Advanced Bar (errors were just plain redundant)
-Reorganized rendering quality settings.
-Reorganized miscelaneous settings for clean up.
2021-02-18 11:23:34 -03:00
Pedro J. Estébanez 99fe462452 Modernize Thread
- Based on C++11's `thread` and `thread_local`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed (except for the few cases of non-portable functions)
- Simpler for `NO_THREADS`
- Thread ids are now the same across platforms (main is 1; others follow)
2021-01-29 12:02:13 +01:00
Filip b05ff60f6e Fix file name comparison when new file is added to file system 2021-01-10 12:28:15 +01:00
Rémi Verschelde b5334d14f7
Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆
2021-01-01 20:19:21 +01:00
reduz bf77016c8a Reimplement skeletons and blend shapes
Uses compute shaders, which only once, on demand, and all in parallel.
2020-12-16 14:32:04 -03:00
Tomasz Chabora 2c048ea164 Cleanup unused engine code 2020-12-09 12:12:36 +01:00
reduz 70f5972905 Refactored Mesh internals and formats.
-Changed how mesh data is organized, hoping to make it more efficient on Vulkan and GLES.
-Removed compression, it now always uses the most efficient format.
-Added support for custom arrays (up to 8 custom formats)
-Added support for 8 weights in skeleton data.
-Added a simple optional versioning system for imported assets, to reimport if binary is newer
-Fixes #43979 (I needed to test)

WARNING:

-NOT backwards compatible with previous 4.x-devel, will most likely never be, but it will force reimport scenes due to version change.
-NOT backwards compatible with 3.x scenes, this will be eventually re-added.
-Skeletons not working any longer, will fix in next PR.
2020-12-02 13:07:59 -03:00
Thakee Nathees 42bfa16996 Refactor DocData into core and editor (DocTools) parts 2020-12-02 00:48:39 +05:30
Thakee Nathees d0e7d9b62f Documentation generation for GDScript
- ClassDoc added to GDScript and property reflection data were extracted
from parse tree

- GDScript comments are collected from tokenizer for documentation and
applied to the ClassDoc by the GDScript compiler

- private docs were excluded (name with underscore prefix and doesn't
have any doc comments)

- default values (of non exported vars), arguments are extraced from the
parser

- Integrated with GDScript 2.0 and new enums were added.

- merge conflicts fixed
2020-11-29 19:45:36 +05:30
reduz 127458ed17 Reorganized core/ directory, it was too fatty already
-Removed FuncRef, since Callable makes it obsolete
-Removed int_types.h as its obsolete in c++11+
-Changed color names code
2020-11-07 20:17:12 -03:00
Gilles Roudière 6f696a5927 Improve file sorting 2020-10-26 09:22:35 +01:00
Aaron Franke 5fbcd8f9df
Rename the ".import" folder to ".godot/imported" 2020-09-28 05:23:45 -04:00
Rémi Verschelde 0f6a8f57ee
Merge pull request #40229 from ChristopheLY/atlas-auto-reimport
auto re-import atlas, fixes #40047
2020-07-10 10:57:13 +02:00
Chistpohe LY f34f00bccc auto re-import atlas, fixes #40047 2020-07-10 09:26:53 +02:00
PouleyKetchoupp 759fef5401 Fix crash on project files import in EditorFileSystem
Fixes #40017
2020-07-04 16:08:09 +02:00
Aaron Franke bb8aa107fd
Remove 32-bit String to_int method 2020-06-03 00:03:34 -04: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 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
lupoDharkael 95a1400a2a Replace NULL with nullptr 2020-04-02 13:38:00 +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
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
Pedro J. Estébanez 3017bdb7ce Make file system scan more robust
Previously, a change was missed if it happened while the scan was in progress and already past the affected location.

Also:
- Consider the scan changes thread on termination, in addition to the full scan one
- Add FS-reported hidden to the check for hidden by the editor file system
2020-02-10 09:32:17 +01:00
Marcel Admiraal f0db13502a Remove duplicate WARN_PRINT macro. 2020-02-05 11:13:24 +01:00
Marcel Admiraal 5af3b4ca27 Remove duplicate ERR_PRINT macro. 2020-02-05 11:13:24 +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
Rémi Verschelde 565f7183aa Prevent crash when we can't write to editor cache or config path
This can happen if users somehow got wrong user permissions assigned to
their Godot cache, config or data paths (e.g. `~/.config/godot`).

The error messages should give them a hint as to what the issue may be.

Fixes #33199.

There may be other situations that still lead to a crash, we need to
review all uses of `FileAccess::open` with `FileAccess::WRITE` mode to
ensure that proper pointer validation is done.
2019-10-31 15:16:02 +01:00
Rémi Verschelde c287f220ce
Revert "Fix plugin script classes defined even if inactive." 2019-10-02 19:17:59 +02:00
Rémi Verschelde 680bcb1ef4
Merge pull request #32434 from willnationsdev/script-class-no-plugins
Fix plugin script classes defined even if inactive.
2019-09-30 11:03:29 +02:00
willnationsdev 168f6cd975 Fix plugin script classes defined even if inactive. 2019-09-30 00:40:27 -05:00
qarmin 17732fe698 Added some obvious errors explanations 2019-09-25 10:28:50 +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 43238bb59a DirAccess: Drop compat get_next(bool *is_dir) which was hidden
Fixes this warning:
```
./core/os/dir_access.h:74:17: warning: 'virtual String DirAccess::get_next(bool*)' was hidden [-Woverloaded-virtual]
```

Part of #30790.
2019-07-25 11:09:57 +02:00
Rémi Verschelde d17eac735c
Merge pull request #29815 from NilsIrl/plus_file_1
Replace ` + "/" + ` with `String::file_add()`
2019-07-01 12:06:35 +02:00
qarmin 4e5310cc60 Some code changed with Clang-Tidy 2019-06-26 15:08:25 +02:00
Nils ANDRÉ-CHANG d2833d4f4d Replace + "/" + with String::file_add() 2019-06-23 13:33:50 +01:00