summaryrefslogtreecommitdiff
path: root/core/class_db.cpp
AgeCommit message (Collapse)Author
2020-06-12Object: Add usage hint to instantiate Object properties in editorRémi Verschelde
Fixes #36372 as Path2D/Path3D's `curve` property no longer uses a Curve instance as default value, but instead it gets a (unique) default Curve instance when created through the editor (CreateDialog). ClassDB gets a sanity check to ensure that we don't do the same mistake for other properties in the future, but instead use the dedicated property usage hint. Fixes #36372. Fixes #36650. Supersedes #36644 and #36656. Co-authored-by: Thakee Nathees <thakeenathees@gmail.com> Co-authored-by: simpuid <utkarsh.email@yahoo.com>
2020-05-14Style: Enforce braces around if blocks and loopsRémi Verschelde
Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14Style: Enforce separation line between function definitionsRémi Verschelde
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-14Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocksRémi Verschelde
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-14Port member initialization from constructor to declaration (C++11)Rémi Verschelde
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-10Style: clang-format: Disable AllowShortIfStatementsOnASingleLineRémi Verschelde
Part of #33027, also discussed in #29848. Enforcing the use of brackets even on single line statements would be preferred, but `clang-format` doesn't have this functionality yet.
2020-04-08Refactored shadowmapping.Juan Linietsky
- Made shadow bias size independent, so it will remain when changing light or camera size. - Implemented normal offset bias, which greatly enhances quality. - Added transmission to subsurface scattering - Reimplemented shadow filter modes Closes #17260
2020-04-02Replace NULL with nullptrlupoDharkael
2020-04-01Fix out of bound array access caused by unassigned variableRafał Mikrut
2020-03-17Style: Set clang-format Standard to Cpp11Rémi Verschelde
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-02-20Reworked signal connection system, added support for Callable and Signal ↵Juan Linietsky
objects and made them default.
2020-02-19Revert "ClassDB: Workaround double-free for GDScript"George Marques
This reverts commit 8312ead0d99cfc308f2f7635bae3da6bf0ff5489.
2020-02-17ClassDB: Workaround double-free for GDScriptRémi Verschelde
This is a temporary hack until vnen and reduz can work on a proper fix. The changes in 867d073b98344b848c96012418912a7e72841a31 exposed a GDScript issue, which apparently triggers an automatic unreferencing. This hack only makes it possible to use the editor again, but GDScript is still broken.
2020-02-11GIProbes working.Juan Linietsky
2020-02-05Remove duplicate ERR_PRINT macro.Marcel Admiraal
2020-01-07ClassDB: Exclude method binds starting with '_' from API hashIgnacio Etcheverry
These methods are not meant to be part of the scripting API. These are not the same as virtual methods starting with '_', e.g.: '_process'.
2020-01-01Update copyright statements to 2020Rémi Verschelde
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.
2019-09-25Added some obvious errors explanationsqarmin
2019-08-17Replace 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG' in 'core/' and 'editor/'Braden Bodily
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-07-23Fix some code found by Coverity Scan and PVS Studioqarmin
2019-07-10Use reference to constant in functionsqarmin
2019-07-01Merge pull request #30126 from qarmin/remove_unnecessary_codeRémi Verschelde
Remove unnecessary code and add some error explanations
2019-07-01Remove unnecessary code and add some error explanationsqarmin
2019-06-29Remove bogus nulls from generated default valuesBojidar Marinov
Also, fix crash in PluginScript destructor.
2019-06-27Add default values to the editor help, docs, and generated RSTBojidar Marinov
Also, make spacing of "=" in the editor help a bit more consistent. Closes #16086
2019-06-26Some code changed with Clang-Tidyqarmin
2019-06-20Fix always true/false valuesqarmin
2019-04-08Add ability to edit editor feature profilesJuan Linietsky
Allows enabling/disabling parts of the editor and storing/loading profiles for that.
2019-04-06Fix wrong method binds and registered classIgnacio Etcheverry
2019-01-01Update copyright statements to 2019Rémi Verschelde
Happy new year to the wonderful Godot community!
2018-11-20Make add_property error more explicit on duplicatesRémi Verschelde
Would have helped solve #23800 faster.
2018-11-08-Moved EditorDefaultValue to ClassDB, made it coreJuan Linietsky
-Removed one and zero hints for properties, replaced by default value
2018-10-03Fix warnings on release builds (not DEBUG_ENABLED)Rémi Verschelde
Fixes the following Clang 5 warnings: ``` modules/bmp/image_loader_bmp.cpp:46:60: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare] modules/bmp/image_loader_bmp.cpp:48:61: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare] drivers/png/image_loader_png.cpp:231:20: warning: comparison of unsigned expression >= 0 is always true [-Wtautological-compare] scene/gui/graph_edit.cpp:1045:8: warning: comparison of constant 0 with expression of type 'bool' is always false [-Wtautological-constant-out-of-range-compare] core/class_db.cpp:812:13: warning: unused variable 'check' [-Wunused-variable] core/io/file_access_pack.cpp:172:11: warning: unused variable 'ver_rev' [-Wunused-variable] core/math/bsp_tree.cpp:195:13: warning: unused variable 'plane' [-Wunused-variable] core/math/bsp_tree.cpp:168:6: warning: unused variable 'plane_count' [-Wunused-variable] modules/gdscript/gdscript_function.cpp:685:10: warning: unused variable 'ok' [-Wunused-variable] modules/gdscript/gdscript_function.cpp:706:10: warning: unused variable 'ok' [-Wunused-variable] modules/gdscript/gdscript_function.cpp:755:19: warning: unused variable 'var_type' [-Wunused-variable] modules/gdscript/gdscript_function.cpp:1306:12: warning: unused variable 'err' [-Wunused-variable] modules/gdscript/gdscript_function.cpp:158:15: warning: unused function '_get_var_type' [-Wunused-function] modules/gdscript/gdscript_parser.cpp:750:20: warning: unused variable 'lv' [-Wunused-variable] modules/gdscript/gdscript_parser.cpp:59:15: warning: unused function '_find_function_name' [-Wunused-function] scene/main/node.cpp:2489:13: warning: unused function '_Node_debug_sn' [-Wunused-function] ```
2018-09-12Make core/ includes absolute, remove subfolders from include pathRémi Verschelde
This allows more consistency in the manner we include core headers, where previously there would be a mix of absolute, relative and include path-dependent includes.
2018-09-06Print an error if you try to instantiate an editor class outside the editor, ↵Juan Linietsky
fixes #17624
2018-07-26Reduce unnecessary COW on Vector by make writing explicitHein-Pieter van Braam
This commit makes operator[] on Vector const and adds a write proxy to it. From now on writes to Vectors need to happen through the .write proxy. So for instance: Vector<int> vec; vec.push_back(10); std::cout << vec[0] << std::endl; vec.write[0] = 20; Failing to use the .write proxy will cause a compilation error. In addition COWable datatypes can now embed a CowData pointer to their data. This means that String, CharString, and VMap no longer use or derive from Vector. _ALWAYS_INLINE_ and _FORCE_INLINE_ are now equivalent for debug and non-debug builds. This is a lot faster for Vector in the editor and while running tests. The reason why this difference used to exist is because force-inlined methods used to give a bad debugging experience. After extensive testing with modern compilers this is no longer the case.
2018-07-02-Fixes to how hashing happened, now StringName and NodePath use default ↵Juan Linietsky
hasher, this was leading to some severe slowdown in scenarios -Fixes to some duplication scenarios for instanced scenes
2018-05-03Merge pull request #18514 from neikeq/api-hash-fixesRémi Verschelde
API hash fixes
2018-04-29ClassDB API hash now only includes exposed classesIgnacio Etcheverry
2018-04-19Fix Coverity reports of uninitialized scalar variableRémi Verschelde
Fixes most current reports on Coverity Scan of uninitialized scalar variable (CWE-457): https://cwe.mitre.org/data/definitions/457.html These happen most of the time (in our code) when instanciating structs without a constructor (or with an incomplete one), and later returning the instance. This is sometimes intended though, as some parameters are only used in some situations and should not be double-initialized for performance reasons (e.g. `constant` in ShaderLanguage::Token).
2018-04-03Ctrl+Clicking a enum now scrolls down to it in the docs.Felix Yang
2018-03-20Add RWLockDummy for NO_THREADS buildsLeon Krause
2018-02-23Refactor version macros and fix related bugsRémi Verschelde
The previous logic with VERSION_MKSTRING was a bit unwieldy, so there were several places hardcoding their own variant of the version string, potentially with bugs (e.g. forgetting the patch number when defined). The new logic defines: - VERSION_BRANCH, the main 'major.minor' version (e.g. 3.1) - VERSION_NUMBER, which can be 'major.minor' or 'major.minor.patch', depending on whether the latter is defined (e.g. 3.1.4) - VERSION_FULL_CONFIG, which contains the version status (e.g. stable) and the module-specific suffix (e.g. mono) - VERSION_FULL_BUILD, same as above but with build/reference name (e.g. official, custom_build, mageia, etc.) Note: Slight change here, as the previous format had the build name *before* the module-specific suffix; now it's after - VERSION_FULL_NAME, same as before, so VERSION_FULL_BUILD prefixed with "Godot v" for readability Bugs fixed thanks to that: - Export templates version matching now properly takes VERSION_PATCH into account by relying on VERSION_FULL_CONFIG. - ClassDB hash no longer takes the build name into account, but limits itself to VERSION_FULL_CONFIG (build name is cosmetic, not relevant for the API hash). - Docs XML no longer hardcode the VERSION_STATUS, this was annoying. - Small cleanup in Windows .rc file thanks to new macros.
2018-01-20Added all missing VisualServer bindingsMarc Gilleron
- Added bindings for multimesh, immediate, skeleton, light, reflection probe, gi probe, lightmap, particles, camera, environment, scenario, instance - Removed draw and sync, were duplicates of force_* equivalents - Bumped binders max arguments from 11 to 13 - Wrote some wrappers as not all methods were variant-friendly
2018-01-05Add missing copyright headers and fix formattingRémi Verschelde
Using `misc/scripts/fix_headers.py` on all Godot files. Some missing header guards were added, and the header inclusion order was fixed in the Bullet module.
2018-01-01Update copyright statements to 2018Rémi Verschelde
Happy new year to the wonderful Godot community!
2017-12-16Faster ClassDB::get_api_hash()Bernhard Liebl
2017-12-09PropertyEditor: Fix display of property doc in tooltipRémi Verschelde
2017-10-20Bind some VisualServer functionsLeon Krause
2017-10-09Adds 'exposed' field to ClassInfoIgnacio Etcheverry
This field represents if the class is exposed to the scripting API. The value is 'true' if the class was registered manually ('ClassDB::register_*class()'), otherwise it's false (registered on '_post_initialize'). - Added missing registration of classes that are meant to be exposed.