Commit graph

110 commits

Author SHA1 Message Date
Juan Linietsky 2d6b994e47 Massive speed up on deleting nodes, fixes #18673
Also makes the editor exit faster
2018-11-18 11:48:21 -03:00
Juan Linietsky 0b1e93ccd4 -Make sure monitorable cant be flipped while flushing queries, fixes #17330
-Also added set_deferred, this was missing.
2018-11-16 08:49:26 -03:00
Juan Linietsky f2e54057ae -Moved EditorDefaultValue to ClassDB, made it core
-Removed one and zero hints for properties, replaced by default value
2018-11-08 11:30:59 -03:00
Juan Linietsky e647342140 Moved folding outside the resource files, now saved outside the project. 2018-10-29 16:37:09 -03:00
Rémi Verschelde 8cabd31577
Merge pull request #22297 from DualMatrix/no_more_method_not_found_error
Fixed method not found error when connecting with signal that fires in editor
2018-10-02 09:38:57 +02:00
Marc Gilleron a392d553c2 Fix dirty read of ObjectID counter when threads are involved 2018-09-29 15:45:09 +01: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 992a5892f1 Fixed method not found error when connecting with signal that fires in editor
Fixed method not found error when connecting with signal that fires in editor.

This is a  better solution to the problem than #22033. As discussed on IRC

This properly fixes #13070 then.
2018-09-21 00:05:39 +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
Juan Linietsky 8c435a343e
Merge pull request #16927 from neikeq/rework-refcount-notify
Notify instance binding data api of refcount increment/decrement
2018-08-25 11:01:55 -03:00
Rémi Verschelde de59fe04e7 Add print_verbose to print to stdout only in verbose mode
Equivalent of the cumbersome:
if (OS::get_singleton()->is_stdout_verbose())
	print_line(msg);
2018-08-24 09:23:20 +02:00
Ignacio Etcheverry 908a30964a Notify instance binding data api of refcount increment/decrement 2018-08-23 01:38:48 +02:00
Juan Linietsky 031f763d4f Crash fixes for material and animtree 2018-08-20 16:35:36 -03:00
Juan Linietsky c7e4527a88 Massive rewrite to AnimationTree. Many APIs changed in order to:
-Reuse resources
-Expose properties in AnimationTree
2018-08-20 13:39:16 -03:00
Rémi Verschelde b4f579b5ba
Merge pull request #20583 from neikeq/issue-15371
Fix case where exported properties value is lost
2018-08-14 21:08:56 +02:00
Juan Linietsky ac52eb444f Ensure one shot signals are not disconnected while edited, closes #7776 2018-07-29 21:05:31 -03:00
Ignacio Etcheverry f3c7527225 Fix case where exported properties value is lost
Fixes exported property modified values lost when creating a placeholder script instance with a failed script compilation

- Object set/get will call PlaceHolderScriptInstance's new fallback set/get methods as a last resort. This way, placeholder script instances can keep the values for storage or until the script is compiled successfuly.
- Script::can_instance() will only return true if a real script instance can be created. Otherwise, in the case of placeholder script instances, it will return false.
- Object::set_script(script) is now in charge of requesting the creation of placeholder script instances. It's no longer Script::instance_create(owner)'s duty.
- PlaceHolderScriptInstance has a new method set_build_failed(bool) to determine whether it should call into its script methods or not.
- Fixed a few problems during reloading of C# scripts.
2018-07-29 22:40:12 +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
Juan Linietsky 43dc050947 Several improvements to editor inspector usability and style 2018-07-18 19:37:41 -03:00
George Marques 34e2ccc593
Fix return type of _get() virtual method 2018-05-29 23:30:01 -03:00
Juan Linietsky ff1e7cfbf4 Add is_instance_valid() method to GDScript, ending more than a decade of pain. 2018-05-07 17:30:03 -03:00
Bojidar Marinov 9b8e8b2220
Bind many more properties to scripts
Notable potentially breaking changes:
- PROPERTY_USAGE_NOEDITOR is now PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_NETWORK, without PROPERTY_USAGE_INTERNAL
- Some properties were renamed, and sometimes even shadowed by new ones
- New getter methods (some virtual) were added
2018-01-12 00:58:14 +02: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
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
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
Bojidar Marinov 0b63e84566
Fix a crash in get_static_property_type_indexed
Fixes #13243
2017-11-24 15:26:32 +02:00
Bojidar Marinov 0cf9597758
Allow for getting/setting indexed properties of objects using get/set_indexed
Performance is around the same as using pure set() through GDScript.
2017-11-21 20:58:21 +02:00
Ross Hadden 1a97d6455d Fixed a bunch of typos, including an error code. 2017-09-21 23:58:29 -04:00
Wilson E. Alvarez 0f4643a4f6 Moved class_name and return_val to initializer list 2017-09-14 12:54:37 -04:00
Ignacio Etcheverry c16d00591b DocData and type hints fixes
- Makes vararg methods automatically use PROPERTY_USAGE_NIL_IS_VARIANT on return types
- Completely removes the ":type" suffix for method names. Virtual methods must use the MethodInfo constructors that takes Variant::Type or PropertyHint as the first parameter for the return type (with CLASS_INFO as a helper to get the PropertyInfo). Parameters must use PROPERTY_HINT_RESOURCE_TYPE and hint string.
- PROPERTY_USAGE_NIL_IS_VARIANT is no longer needed for parameters, because parameters cannot be void.
- Adds missing PROPERTY_USAGE_NIL_IS_VARIANT to virtual and built-in methods that return Variant.
2017-08-29 19:40:21 +02:00
Rémi Verschelde 7ad14e7a3e Dead code tells no tales 2017-08-27 22:13:45 +02:00
Rémi Verschelde bd282ff43f Use HTTPS URL for Godot's website in the headers 2017-08-27 14:16:55 +02:00
Poommetee Ketson 4950ef7478 Fix double single quotes in connect error print 2017-08-27 00:46:33 +07:00
Hein-Pieter van Braam cacced7e50 Convert Object::cast_to() to the static version
Currently we rely on some undefined behavior when Object->cast_to() gets
called with a Null pointer. This used to work fine with GCC < 6 but
newer versions of GCC remove all codepaths in which the this pointer is
Null. However, the non-static cast_to() was supposed to be null safe.

This patch makes cast_to() Null safe and removes the now redundant Null
checks where they existed.

It is explained in this article: https://www.viva64.com/en/b/0226/
2017-08-24 23:08:24 +02:00
Juan Linietsky 3d1c031871 Changed MethodBind API to request information from methods. It's much claner now.
Also changed PropertyInfo to include informatino about class names.
2017-08-23 19:11:11 -03:00
Ignacio Etcheverry 32dd9a9f66 ClassDB: Provide the enum name of integer constants 2017-08-20 22:07:43 +02:00
Rémi Verschelde 18a7315381 Rename localization method to tr again
Partial revert of #10380 based on contributor ~~bullying~~ feedback.
2017-08-18 22:38:38 +02:00
Rémi Verschelde c72529baf0 Rename XL_MESSAGE aka tr to localize
Also renames `set_message_translation` to `set_message_localization`
for consistency.
2017-08-17 18:10:22 +02:00
Rémi Verschelde 306c0471f7 Merge pull request #9987 from Rubonnek/move-members-to-initilization-list
Moved member variables from constructor to initialization list
2017-08-11 10:31:04 +02:00
Ignacio Etcheverry 78619a5866 Fixes method definitions with extra number of arguments 2017-08-10 07:17:51 +02:00
Ignacio Etcheverry b8420cda9c Removes type information from vararg method binds 2017-08-10 07:17:51 +02:00
Ignacio Etcheverry 2f290038d6 Removes type information from method binds 2017-08-10 07:17:50 +02:00
Ignacio Etcheverry 1e74f27f8f Adds missing type information to virtual method binds 2017-08-10 07:17:50 +02:00
Wilson E. Alvarez 6d112a68b6 Moved member variables from constructor to initialization list 2017-08-08 21:43:19 -04:00
Indah Sylvia 5ae78fdf6a Makes all Godot API's methods Lower Case 2017-08-07 18:24:35 +07:00
Ruslan Mustakov 789815466a Fix is_class check typo in ObjectDB::cleanup 2017-08-06 16:04:35 +07:00
Juan Linietsky a3a7fb83e6 Made bool constructor explicit in Variant to avoid bugs, fixes #7843 2017-08-05 19:50:53 -03:00
Juan Linietsky 3b2dfae5af function to add script and instance at once, as needed by neikeq 2017-07-22 16:57:56 -03:00
Ramesh Ravone 826c51c70e
_get return type fix 2017-07-18 21:09:46 +05:30