Commit graph

95 commits

Author SHA1 Message Date
Pedro J. Estébanez 18fbdbb456 Reimplement Mutex with C++'s <mutex>
Main:
- It's now implemented thanks to `<mutex>`. No more platform-specific implementations.
- `BinaryMutex` (non-recursive) is added, as an alternative for special cases.
- Doesn't need allocation/deallocation anymore. It can live in the stack and be part of other classes.
- Because of that, it's methods are now `const` and the inner mutex is `mutable` so it can be easily used in `const` contexts.
- A no-op implementation is provided if `NO_THREADS` is defined. No more need to add `#ifdef NO_THREADS` just for this.
- `MutexLock` now takes a reference. At this point the cases of null `Mutex`es are rare. If you ever need that, just don't use `MutexLock`.
- Thread-safe utilities are therefore simpler now.

Misc.:
- `ScopedMutexLock` is dropped and replaced by `MutexLock`, because they were pretty much the same.
- Every case of lock, do-something, unlock is replaced by `MutexLock` (complex cases where it's not straightfoward are kept as as explicit lock and unlock).
- `ShaderRD` contained an `std::mutex`, which has been replaced by `Mutex`.
2020-02-26 20:40:10 +01:00
Fabio Alessandrelli cbc450c0e5 Huge Debugger/EditorDebugger refactor. 2020-02-21 11:12:03 +01:00
Erik 8b0546d93b Implement game camera override
Implemented uniform API in Viewport class to override 2D and/or
3D camera.

Added buttons in 2D and 3D editor viewport toolbars that override
the running game camera transform with the editor viewport camera
transform. Implemented via remote debugger protocol and camera
override API.

Removed LiveEditFuncs function pointers from ScriptDebugger class.
Since the debugger got access to the SceneTree instance (if one
exists), there is no need to store the function pointers. The live
edit functions in SceneTree are used directly instead. Also removed
the static version of live edit functions in SceneTree for the same
reason. This reduced the SceneTree -> Debugger coupling too since
the function pointers don't need to be set from SceneTree anymore.

Moved script_debugger_remote.h/cpp from 'core/' to 'scene/debugger/'.
This is because the remote debugger is now using SceneTree directly
and 'core/' classes should not depend on 'scene/' classes.
2019-10-23 02:51:32 +01:00
Fabio Alessandrelli 768d637a1b
Merge pull request #31870 from JFonS/add_network_profiler
Add network profiler
2019-09-05 16:34:36 +02:00
jfons 8244f535cd Add network profiler 2019-09-05 09:48:36 +02:00
iwek7 617797c47c Adds skip-breakpoints feature 2019-09-03 20:49:09 +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
miwanczuk 98a3b2e5f4 Fixes issue when inspecting nodes that are not in the tree 2019-08-12 17:06:44 +02:00
Hugo Locurcio 47c615caf3
Cap the number of warnings/errors per second rather than per frame
This reproduces the behavior used for printing when using the remote
debugger. The default limit is 100 errors and 100 warnings per second,
which makes it possible to display much more GDScript warnings
before overflowing.

This also adds a "Too many warnings" message, so that warnings
don't look like errors when overflowing anymore.

This closes #21896.
2019-07-31 17:29:26 +02:00
Pedro J. Estébanez 9c3ddf05cb Revert accidental commits
This reverts commit fb37284c02.
This reverts commit 4db0f51b9a.
2019-03-20 21:43:55 +01:00
Pedro J. Estébanez 4db0f51b9a Create live view dock [wip] 2019-03-20 20:44:43 +01:00
Juan Linietsky ae886a6f32 Ability to keep pumping messages while being debugged, may be a solution for #21431 2019-03-03 17:12:19 -03:00
Rémi Verschelde 0ba75c195e Fix GCC 5 build after #26331 and cleanup style
Also cleanup after 01a3dd3.
2019-02-27 09:01:24 +01:00
Juan Linietsky 9d78274e06 Make allowed pid for window takeover happen immediately, fixes #21431 2019-02-23 12:09:35 -03: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
Juan Linietsky a2a606794c Ensure array and dict editors show edited object IDs, fixes #20225 2018-11-21 22:10:58 -03:00
Rémi Verschelde 1169196f04
Merge pull request #22779 from Superwaitsum/LimitSettings
Limit several project settings
2018-10-25 11:38:06 +02:00
Superwaitsum e5041ad0f5 Add some limits on the Editor Settings 2018-10-24 19:46:33 -05:00
DualMatrix c4ac2707dc Cleaned up/Fixed some bugs in the remote inspector code.
Cleaned up/Fixed some bugs in the remote inspector code.

This makes some of my previous code cleaner while resolving a bunch of bugs.
2018-10-04 15:13:44 +02:00
Rémi Verschelde 62ecb44035 Fix warning about functions defined but not used [-Wunused-function]
Fixes the following GCC 5 warnings:
```
core/io/zip_io.h:128:26: warning: 'zlib_filefunc_def zipio_create_io_from_file(FileAccess**)' defined but not used [-Wunused-function]
core/script_debugger_remote.cpp:110:17: warning: 'ObjectID safe_get_instance_id(const Variant&)' defined but not used [-Wunused-function]
drivers/unix/socket_helpers.h:103:12: warning: 'int _socket_create(IP::Type&, int, int)' defined but not used [-Wunused-function]
drivers/unix/socket_helpers.h:45:15: warning: 'size_t _set_sockaddr(sockaddr_storage*, const IP_Address&, int, IP::Type)' defined but not used [-Wunused-function]
drivers/unix/socket_helpers.h:76:15: warning: 'size_t _set_listen_sockaddr(sockaddr_storage*, int, IP::Type, IP_Address)' defined but not used [-Wunused-function]
editor/editor_fonts.cpp:40:24: warning: 'Ref<BitmapFont> make_font(int, int, int, int, const int*, const Ref<Texture>&)' defined but not used [-Wunused-function]
editor/editor_themes.cpp:85:26: warning: 'Ref<StyleBoxFlat> change_border_color(Ref<StyleBoxFlat>, Color)' defined but not used [-Wunused-function]
editor/import/editor_import_collada.cpp:493:13: warning: 'void _generate_normals(const PoolVector<int>&, const PoolVector<Vector3>&, PoolVector<Vector3>&)' defined but not used [-Wunused-function]
editor/import/editor_import_collada.cpp:524:13: warning: 'void _generate_tangents_and_binormals(const PoolVector<int>&, const PoolVector<Vector3>&, const PoolVector<Vector3>&, const PoolVector<Vector3>&, PoolVector<float>&)' defined but not used [-Wunused-function]
editor/pvrtc_compress.cpp:118:13: warning: 'void _compress_etc(Image*)' defined but not used [-Wunused-function]
modules/etc/image_etc.cpp:89:13: warning: 'void _decompress_etc1(Image*)' defined but not used [-Wunused-function]
modules/etc/image_etc.cpp:93:13: warning: 'void _decompress_etc2(Image*)' defined but not used [-Wunused-function]
modules/gdscript/editor/gdscript_highlighter.cpp:46:13: warning: 'bool _is_whitespace(CharType)' defined but not used [-Wunused-function]
scene/2d/cpu_particles_2d.cpp:510:14: warning: 'float rand_from_seed_m1_p1(uint32_t&)' defined but not used [-Wunused-function]
scene/3d/cpu_particles.cpp:474:14: warning: 'float rand_from_seed_m1_p1(uint32_t&)' defined but not used [-Wunused-function]
scene/resources/default_theme/default_theme.cpp:123:20: warning: 'Ref<Shader> make_shader(const char*, const char*, const char*)' defined but not used [-Wunused-function]
scene/resources/default_theme/default_theme.cpp:130:24: warning: 'Ref<BitmapFont> make_font(int, int, int, int, const int*, const Ref<Texture>&)' defined but not used [-Wunused-function]
```

Had to split `core/io/zip_io.h` into header and .cpp file without 'static' keyword.

Not fixed yet (static definition in header used in some files but not all):
```
modules/websocket/lws_helper.h:111:13: warning: 'void _lws_make_protocols(void*, int (*)(lws*, lws_callback_reasons, void*, void*, size_t), PoolVector<String>, _LWSRef**)' defined but not used [-Wunused-function]
```

Also fixed a couple other warnings missed in previous commits.
2018-09-29 22:26:12 +02:00
Rémi Verschelde 2091f20443 Fix warnings about wrong member initialization order [-Wreorder]
Fixes the following GCC 5 warnings:
```
core/object.h:193:11: warning: 'MethodInfo::flags' will be initialized after [-Wreorder]
core/object.h:192:15: warning:   'PropertyInfo MethodInfo::return_val' [-Wreorder]
core/object.cpp:278:1: warning:   when initialized here [-Wreorder]
core/script_debugger_remote.h:97:6: warning: 'ScriptDebuggerRemote::max_cps' will be initialized after [-Wreorder]
core/script_debugger_remote.h:91:6: warning:   'int ScriptDebuggerRemote::max_messages_per_frame' [-Wreorder]
core/script_debugger_remote.cpp:1086:1: warning:   when initialized here [-Wreorder]
core/script_debugger_remote.h:98:6: warning: 'ScriptDebuggerRemote::char_count' will be initialized after [-Wreorder]
core/script_debugger_remote.h:92:6: warning:   'int ScriptDebuggerRemote::n_messages_dropped' [-Wreorder]
core/script_debugger_remote.cpp:1086:1: warning:   when initialized here [-Wreorder]
modules/bullet/area_bullet.h:102:7: warning: 'AreaBullet::isScratched' will be initialized after [-Wreorder]
modules/bullet/area_bullet.h:92:39: warning:   'PhysicsServer::AreaSpaceOverrideMode AreaBullet::spOv_mode' [-Wreorder]
modules/bullet/area_bullet.cpp:46:1: warning:   when initialized here [-Wreorder]
modules/bullet/collision_object_bullet.h:127:15: warning: 'CollisionObjectBullet::space' will be initialized after [-Wreorder]
modules/bullet/collision_object_bullet.h:117:7: warning:   'CollisionObjectBullet::Type CollisionObjectBullet::type' [-Wreorder]
modules/bullet/collision_object_bullet.cpp:67:1: warning:   when initialized here [-Wreorder]
modules/bullet/godot_ray_world_algorithm.h:48:7: warning: 'GodotRayWorldAlgorithm::m_ownManifol1d' will be initialized after [-Wreorder]
modules/bullet/godot_ray_world_algorithm.h:46:33: warning:   'const btDiscreteDynamicsWorld* GodotRayWorldAlgorithm::m_world' [-Wreorder]
modules/bullet/godot_ray_world_algorithm.cpp:50:1: warning:   when initialized here [-Wreorder]
modules/bullet/godot_result_callbacks.h:91:18: warning: 'GodotAllConvexResultCallback::m_exclude' will be initialized after [-Wreorder]
modules/bullet/godot_result_callbacks.h:89:6: warning:   'int GodotAllConvexResultCallback::m_resultMax' [-Wreorder]
modules/bullet/godot_result_callbacks.h:93:2: warning:   when initialized here [-Wreorder]
modules/bullet/godot_result_callbacks.h:142:18: warning: 'GodotAllContactResultCallback::m_exclude' will be initialized after [-Wreorder]
modules/bullet/godot_result_callbacks.h:140:6: warning:   'int GodotAllContactResultCallback::m_resultMax' [-Wreorder]
modules/bullet/godot_result_callbacks.h:147:2: warning:   when initialized here [-Wreorder]
modules/bullet/godot_result_callbacks.h:168:18: warning: 'GodotContactPairContactResultCallback::m_exclude' will be initialized after [-Wreorder]
modules/bullet/godot_result_callbacks.h:166:6: warning:   'int GodotContactPairContactResultCallback::m_resultMax' [-Wreorder]
modules/bullet/godot_result_callbacks.h:173:2: warning:   when initialized here [-Wreorder]
modules/bullet/godot_result_callbacks.h:195:18: warning: 'GodotRestInfoContactResultCallback::m_exclude' will be initialized after [-Wreorder]
modules/bullet/godot_result_callbacks.h:191:7: warning:   'bool GodotRestInfoContactResultCallback::m_collided' [-Wreorder]
modules/bullet/godot_result_callbacks.h:199:2: warning:   when initialized here [-Wreorder]
modules/bullet/rigid_body_bullet.h:200:9: warning: 'RigidBodyBullet::gravity_scale' will be initialized after [-Wreorder]
modules/bullet/rigid_body_bullet.h:199:9: warning:   'real_t RigidBodyBullet::mass' [-Wreorder]
modules/bullet/rigid_body_bullet.cpp:258:1: warning:   when initialized here [-Wreorder]
modules/bullet/rigid_body_bullet.h:222:28: warning: 'RigidBodyBullet::force_integration_callback' will be initialized after [-Wreorder]
modules/bullet/rigid_body_bullet.h:219:7: warning:   'bool RigidBodyBullet::isTransformChanged' [-Wreorder]
modules/bullet/rigid_body_bullet.cpp:258:1: warning:   when initialized here [-Wreorder]
modules/bullet/rigid_body_bullet.h:220:7: warning: 'RigidBodyBullet::previousActiveState' will be initialized after [-Wreorder]
modules/bullet/rigid_body_bullet.h:208:6: warning:   'int RigidBodyBullet::maxCollisionsDetection' [-Wreorder]
modules/bullet/rigid_body_bullet.cpp:258:1: warning:   when initialized here [-Wreorder]
modules/bullet/soft_body_bullet.h:69:9: warning: 'SoftBodyBullet::total_mass' will be initialized after [-Wreorder]
modules/bullet/soft_body_bullet.h:68:6: warning:   'int SoftBodyBullet::simulation_precision' [-Wreorder]
modules/bullet/soft_body_bullet.cpp:38:1: warning:   when initialized here [-Wreorder]
modules/bullet/soft_body_bullet.h:76:9: warning: 'SoftBodyBullet::drag_coefficient' will be initialized after [-Wreorder]
modules/bullet/soft_body_bullet.h:61:14: warning:   'btSoftBody* SoftBodyBullet::bt_soft_body' [-Wreorder]
modules/bullet/soft_body_bullet.cpp:38:1: warning:   when initialized here [-Wreorder]
modules/bullet/space_bullet.h:97:22: warning: 'SpaceBullet::solver' will be initialized after [-Wreorder]
modules/bullet/space_bullet.h:95:35: warning:   'btDefaultCollisionConfiguration* SpaceBullet::collisionConfiguration' [-Wreorder]
modules/bullet/space_bullet.cpp:333:1: warning:   when initialized here [-Wreorder]
modules/bullet/space_bullet.h:101:23: warning: 'SpaceBullet::soft_body_world_info' will be initialized after [-Wreorder]
modules/bullet/space_bullet.h:99:23: warning:   'btGhostPairCallback* SpaceBullet::ghostPairCallback' [-Wreorder]
modules/bullet/space_bullet.cpp:333:1: warning:   when initialized here [-Wreorder]
modules/gdnative/nativescript/nativescript.h:79:13: warning: 'NativeScriptDesc::base_native_type' will be initialized after [-Wreorder]
modules/gdnative/nativescript/nativescript.h:73:9: warning:   'String NativeScriptDesc::documentation' [-Wreorder]
modules/gdnative/nativescript/nativescript.h:88:9: warning:   when initialized here [-Wreorder]
modules/gdscript/gdscript.h:296:6: warning: 'GDScriptWarning::line' will be initialized after [-Wreorder]
modules/gdscript/gdscript.h:294:4: warning:   'GDScriptWarning::Code GDScriptWarning::code' [-Wreorder]
modules/gdscript/gdscript.h:303:2: warning:   when initialized here [-Wreorder]
scene/3d/physics_body.h:544:7: warning: 'PhysicalBone::simulate_physics' will be initialized after [-Wreorder]
scene/3d/physics_body.h:543:7: warning:   'bool PhysicalBone::_internal_static_body' [-Wreorder]
scene/3d/physics_body.cpp:2502:1: warning:   when initialized here [-Wreorder]
scene/3d/physics_body.h:546:6: warning: 'PhysicalBone::bone_id' will be initialized after [-Wreorder]
scene/3d/physics_body.h:539:12: warning:   'Skeleton* PhysicalBone::parent_skeleton' [-Wreorder]
scene/3d/physics_body.cpp:2502:1: warning:   when initialized here [-Wreorder]
scene/3d/spring_arm.h:44:11: warning: 'SpringArm::mask' will be initialized after [-Wreorder]
scene/3d/spring_arm.h:43:8: warning:   'float SpringArm::current_spring_length' [-Wreorder]
scene/3d/spring_arm.cpp:37:1: warning:   when initialized here [-Wreorder]
scene/animation/skeleton_ik.h:159:11: warning: 'SkeletonIK::target_node_override' will be initialized after [-Wreorder]
scene/animation/skeleton_ik.h:152:7: warning:   'bool SkeletonIK::use_magnet' [-Wreorder]
scene/animation/skeleton_ik.cpp:418:1: warning:   when initialized here [-Wreorder]
scene/resources/tile_set.h:84:9: warning: 'TileSet::AutotileData::size' will be initialized after [-Wreorder]
scene/resources/tile_set.h:83:7: warning:   'int TileSet::AutotileData::spacing' [-Wreorder]
scene/resources/tile_set.h:92:12: warning:   when initialized here [-Wreorder]
scene/resources/tile_set.h:115:12: warning: 'TileSet::TileData::tile_mode' will be initialized after [-Wreorder]
scene/resources/tile_set.h:114:9: warning:   'Color TileSet::TileData::modulate' [-Wreorder]
scene/resources/tile_set.h:120:12: warning:   when initialized here [-Wreorder]
servers/physics/body_sw.h:84:19: warning: 'BodySW::direct_state_query_list' will be initialized after [-Wreorder]
servers/physics/body_sw.h:57:11: warning:   'uint16_t BodySW::locked_axis' [-Wreorder]
servers/physics/body_sw.cpp:756:1: warning:   when initialized here [-Wreorder]
```

Nothing really relevant for us, but it's not a bad consistency
improvement anyway so worth taking.
2018-09-28 17:30:28 +02:00
DualMatrix 54286e1711 Fixed error spam in remote debugger
Fixed error spam in remote debugger.
2018-09-19 11:32:11 +02:00
Fabio Alessandrelli 634d057a52 Less verbose ScriptDebugger, message on connect.
Short diff, long explaination:

This will hopefully clarify whether or not issues are about the dubgger
like the case of the never ending thread about MacOS "Remote debugger
fails", which started as a real issue, and ended up being referenced for
every strange OSX issue where the window was not visible or the engine
crashed without appearing on screen.
2018-09-13 01:57:58 +02:00
Fabio Alessandrelli 30327872e0 Unify StreamPeerTCP/TCP_Server with NetSocket API 2018-09-12 15:56:20 +02:00
Rémi Verschelde 277b24dfb7 Make core/ includes absolute, remove subfolders from include path
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-12 09:52:22 +02:00
DualMatrix 35248a03be Fixed error spam when inspecting remote tree
Fixed error spam when inspecting remote tree, fixes #20365
2018-09-08 00:48:39 +02:00
Rémi Verschelde 52466d57e9 Make some debug prints verbose-only, remove others 2018-08-24 14:59:01 +02:00
Hein-Pieter van Braam 0e29f7974b Reduce unnecessary COW on Vector by make writing explicit
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-26 00:54:16 +02:00
Max Hilbrunner dc2d8d4dee
Merge pull request #19229 from RandomShaper/fix-focus-steal
Fix debugger focus stealing
2018-07-05 00:27:08 +02:00
Pedro J. Estébanez 2fcbf9dd81 Fix debugger focus stealing
At least on Windows, the authorization must be given every time, not only at startup.
2018-05-28 21:49:48 +02:00
Juan Linietsky 5bb412f389
Revert "Make the performance reporting update frequency customizable" 2018-05-28 08:47:09 -03:00
Rémi Verschelde bce002f5c3
Merge pull request #18410 from GodotExplorer/debugger-inherited-variables
Add inherited variables support for script debugger
2018-05-28 11:59:18 +02:00
Hugo Locurcio 228ae60a63
Make the performance reporting update frequency customizable
The default update frequency has been changed from 1000ms to 250ms.
2018-05-18 11:49:21 +02:00
Juan Linietsky 80b9edf0f6
Merge pull request #16893 from GodotExplorer/debugger-improvement-3
Save runtime node as scene from remote scene tree.
2018-05-07 16:41:34 -03:00
Geequlim 7e499683a2 Send inherited variables and constants from remote debugger 2018-04-29 20:27:20 +08:00
geequlim 24e6361cba Save runtime node as scene from the remote scene tree. 2018-02-22 10:00:13 +08:00
luz.paz 612ab4bbc6 Fix typos with codespell
Found via `codespell -q 3 --skip="./thirdparty,./editor/translations" -I ../godot-word-whitelist.txt`
Whitelist consists of:
```
ang
doubleclick
lod
nd
que
te
unselect
```
2018-02-21 19:46:06 +01:00
Geequlim 10f0451cc2 Remote debugger send the real instance of WeakRef referenced to 2018-01-23 17:17:35 +08:00
Ignacio Etcheverry 5be356b72f Mono: Implement stack info for errors and exceptions 2018-01-09 17:19:03 +01:00
Rémi Verschelde 42ee9541fd
Merge pull request #15297 from poke1024/runner-limit-errs
Limit number of errors and messages sent by runner
2018-01-07 12:38:08 +01:00
Rémi Verschelde e4213e66b2 Add missing copyright headers and fix formatting
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-05 01:22:23 +01:00
Bernhard Liebl c7c764220c Limit number of errors and messages sent by runner 2018-01-03 17:23:09 +01:00
Geequlim 6c8ec5a930 Fix crash while the debugger encode a freed object. 2018-01-03 13:58:27 +08:00
Rémi Verschelde 4973b7a513
Merge pull request #14916 from poke1024/reduce-startup-time
Ramp up remote debugger wait time
2018-01-02 11:33:30 +01:00
Rémi Verschelde b50a9114b1 Update copyright statements to 2018
Happy new year to the wonderful Godot community!
2018-01-01 14:40:47 +01:00
poke1024 e6d83a766a Ramp up remote debugger wait time 2017-12-22 07:17:31 +01:00
Rémi Verschelde 13c2ff9320 Style: Apply new clang-format 5.0 style to all files 2017-12-07 08:02:00 +01:00
Juan Linietsky bc2e8d99e5 Made Vector::ptrw explicit for writing, compiler was sometimes using the wrong function,
leading to unnecesary copy on writes and reduced performance.
2017-11-25 00:09:40 -03:00
Rémi Verschelde 6065b2d177
Merge pull request #11940 from GodotExplorer/debugger
Enhanced debugger for godot 3.0
2017-11-20 22:55:49 +01:00
Geequlim fab66af7e9 Move the remote scene tree to the scene tree dock.
Ignore all script constants in the global section of the breakpoint stack.
Check property size before send to avoid too large of data be sent.
Fix crash while clear the remote objects from the debugger.
2017-11-17 12:01:54 +08:00