diff options
Diffstat (limited to 'modules')
303 files changed, 1320 insertions, 692 deletions
diff --git a/modules/bullet/area_bullet.cpp b/modules/bullet/area_bullet.cpp index 195d89d0c0..9d46e4fe30 100644 --- a/modules/bullet/area_bullet.cpp +++ b/modules/bullet/area_bullet.cpp @@ -1,10 +1,9 @@ /*************************************************************************/ /* area_bullet.cpp */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -30,13 +29,19 @@ /*************************************************************************/ #include "area_bullet.h" -#include "BulletCollision/CollisionDispatch/btGhostObject.h" -#include "btBulletCollisionCommon.h" + #include "bullet_types_converter.h" #include "bullet_utilities.h" #include "collision_object_bullet.h" #include "space_bullet.h" +#include <BulletCollision/CollisionDispatch/btGhostObject.h> +#include <btBulletCollisionCommon.h> + +/** + @author AndreaCatania +*/ + AreaBullet::AreaBullet() : RigidCollisionObjectBullet(CollisionObjectBullet::TYPE_AREA), monitorable(true), diff --git a/modules/bullet/area_bullet.h b/modules/bullet/area_bullet.h index 3e0913b891..78136d574b 100644 --- a/modules/bullet/area_bullet.h +++ b/modules/bullet/area_bullet.h @@ -1,10 +1,9 @@ /*************************************************************************/ /* area_bullet.h */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -37,6 +36,10 @@ #include "servers/physics_server.h" #include "space_bullet.h" +/** + @author AndreaCatania +*/ + class btGhostObject; class AreaBullet : public RigidCollisionObjectBullet { diff --git a/modules/bullet/btRayShape.cpp b/modules/bullet/btRayShape.cpp index 8f6434b46b..4164450cd2 100644 --- a/modules/bullet/btRayShape.cpp +++ b/modules/bullet/btRayShape.cpp @@ -1,10 +1,9 @@ /*************************************************************************/ -/* btRayShape.h */ -/* Author: AndreaCatania */ +/* btRayShape.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -30,9 +29,15 @@ /*************************************************************************/ #include "btRayShape.h" -#include "LinearMath/btAabbUtil2.h" + #include "math/math_funcs.h" +#include <LinearMath/btAabbUtil2.h> + +/** + @author AndreaCatania +*/ + btRayShape::btRayShape(btScalar length) : btConvexInternalShape(), m_shapeAxis(0, 0, 1) { diff --git a/modules/bullet/btRayShape.h b/modules/bullet/btRayShape.h index be7acaa01f..99a9412dbe 100644 --- a/modules/bullet/btRayShape.h +++ b/modules/bullet/btRayShape.h @@ -1,10 +1,9 @@ /*************************************************************************/ -/* btRayShape.h */ -/* Author: AndreaCatania */ +/* btRayShape.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -29,12 +28,16 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -/// IMPORTANT The class name and filename was created by following Bullet writing rules for an easy (eventually ) porting to bullet +/// IMPORTANT The class name and filename was created by following Bullet writing rules for an easy (eventually) porting to bullet /// This shape is a custom shape that is not present to Bullet physics engine #ifndef BTRAYSHAPE_H #define BTRAYSHAPE_H -#include "BulletCollision/CollisionShapes/btConvexInternalShape.h" +#include <BulletCollision/CollisionShapes/btConvexInternalShape.h> + +/** + @author AndreaCatania +*/ /// Ray shape around z axis ATTRIBUTE_ALIGNED16(class) diff --git a/modules/bullet/bullet_physics_server.cpp b/modules/bullet/bullet_physics_server.cpp index 679e4def82..51de4998fa 100644 --- a/modules/bullet/bullet_physics_server.cpp +++ b/modules/bullet/bullet_physics_server.cpp @@ -1,10 +1,9 @@ /*************************************************************************/ /* bullet_physics_server.cpp */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -30,7 +29,7 @@ /*************************************************************************/ #include "bullet_physics_server.h" -#include "LinearMath/btVector3.h" + #include "bullet_utilities.h" #include "class_db.h" #include "cone_twist_joint_bullet.h" @@ -41,8 +40,15 @@ #include "pin_joint_bullet.h" #include "shape_bullet.h" #include "slider_joint_bullet.h" + +#include <LinearMath/btVector3.h> + #include <assert.h> +/** + @author AndreaCatania +*/ + #define CreateThenReturnRID(owner, ridData) \ RID rid = owner.make_rid(ridData); \ ridData->set_self(rid); \ diff --git a/modules/bullet/bullet_physics_server.h b/modules/bullet/bullet_physics_server.h index 006ad0f821..1c94428a2a 100644 --- a/modules/bullet/bullet_physics_server.h +++ b/modules/bullet/bullet_physics_server.h @@ -1,10 +1,9 @@ /*************************************************************************/ /* bullet_physics_server.h */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -41,6 +40,10 @@ #include "soft_body_bullet.h" #include "space_bullet.h" +/** + @author AndreaCatania +*/ + class BulletPhysicsServer : public PhysicsServer { GDCLASS(BulletPhysicsServer, PhysicsServer) diff --git a/modules/bullet/bullet_types_converter.cpp b/modules/bullet/bullet_types_converter.cpp index 42a6f156a5..a0fe598227 100644 --- a/modules/bullet/bullet_types_converter.cpp +++ b/modules/bullet/bullet_types_converter.cpp @@ -1,10 +1,9 @@ /*************************************************************************/ /* bullet_types_converter.cpp */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -33,6 +32,10 @@ #include "bullet_types_converter.h" +/** + @author AndreaCatania +*/ + // ++ BULLET to GODOT ++++++++++ void B_TO_G(btVector3 const &inVal, Vector3 &outVal) { outVal[0] = inVal[0]; diff --git a/modules/bullet/bullet_types_converter.h b/modules/bullet/bullet_types_converter.h index 349cad65aa..84321fe837 100644 --- a/modules/bullet/bullet_types_converter.h +++ b/modules/bullet/bullet_types_converter.h @@ -1,10 +1,9 @@ /*************************************************************************/ /* bullet_types_converter.h */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -32,14 +31,19 @@ #ifndef BULLET_TYPES_CONVERTER_H #define BULLET_TYPES_CONVERTER_H -#include "LinearMath/btMatrix3x3.h" -#include "LinearMath/btTransform.h" -#include "LinearMath/btVector3.h" #include "core/math/matrix3.h" #include "core/math/transform.h" #include "core/math/vector3.h" #include "core/typedefs.h" +#include <LinearMath/btMatrix3x3.h> +#include <LinearMath/btTransform.h> +#include <LinearMath/btVector3.h> + +/** + @author AndreaCatania +*/ + // Bullet to Godot extern void B_TO_G(btVector3 const &inVal, Vector3 &outVal); extern void INVERT_B_TO_G(btVector3 const &inVal, Vector3 &outVal); diff --git a/modules/bullet/bullet_utilities.h b/modules/bullet/bullet_utilities.h index 1a44f48844..2841dfbe69 100644 --- a/modules/bullet/bullet_utilities.h +++ b/modules/bullet/bullet_utilities.h @@ -1,10 +1,9 @@ /*************************************************************************/ /* bullet_utilities.h */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -32,6 +31,10 @@ #ifndef BULLET_UTILITIES_H #define BULLET_UTILITIES_H +/** + @author AndreaCatania +*/ + #pragma once #define bulletnew(cl) \ diff --git a/modules/bullet/collision_object_bullet.cpp b/modules/bullet/collision_object_bullet.cpp index 1350be20b6..b3dfc2eecf 100644 --- a/modules/bullet/collision_object_bullet.cpp +++ b/modules/bullet/collision_object_bullet.cpp @@ -1,10 +1,9 @@ /*************************************************************************/ /* collision_object_bullet.cpp */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -30,14 +29,20 @@ /*************************************************************************/ #include "collision_object_bullet.h" + #include "area_bullet.h" -#include "btBulletCollisionCommon.h" #include "bullet_physics_server.h" #include "bullet_types_converter.h" #include "bullet_utilities.h" #include "shape_bullet.h" #include "space_bullet.h" +#include <btBulletCollisionCommon.h> + +/** + @author AndreaCatania +*/ + #define enableDynamicAabbTree true #define initialChildCapacity 1 diff --git a/modules/bullet/collision_object_bullet.h b/modules/bullet/collision_object_bullet.h index 6a3fbe65ff..a9b8aee019 100644 --- a/modules/bullet/collision_object_bullet.h +++ b/modules/bullet/collision_object_bullet.h @@ -1,10 +1,9 @@ /*************************************************************************/ /* collision_object_bullet.h */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -32,13 +31,18 @@ #ifndef COLLISION_OBJECT_BULLET_H #define COLLISION_OBJECT_BULLET_H -#include "LinearMath/btTransform.h" #include "core/vset.h" #include "object.h" #include "shape_owner_bullet.h" #include "transform.h" #include "vector3.h" +#include <LinearMath/btTransform.h> + +/** + @author AndreaCatania +*/ + class AreaBullet; class ShapeBullet; class btCollisionObject; diff --git a/modules/bullet/cone_twist_joint_bullet.cpp b/modules/bullet/cone_twist_joint_bullet.cpp index c8944d23c5..472ad3b52c 100644 --- a/modules/bullet/cone_twist_joint_bullet.cpp +++ b/modules/bullet/cone_twist_joint_bullet.cpp @@ -1,10 +1,9 @@ /*************************************************************************/ /* cone_twist_joint_bullet.cpp */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -30,11 +29,17 @@ /*************************************************************************/ #include "cone_twist_joint_bullet.h" -#include "BulletDynamics/ConstraintSolver/btConeTwistConstraint.h" + #include "bullet_types_converter.h" #include "bullet_utilities.h" #include "rigid_body_bullet.h" +#include <BulletDynamics/ConstraintSolver/btConeTwistConstraint.h> + +/** + @author AndreaCatania +*/ + ConeTwistJointBullet::ConeTwistJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &rbAFrame, const Transform &rbBFrame) : JointBullet() { diff --git a/modules/bullet/cone_twist_joint_bullet.h b/modules/bullet/cone_twist_joint_bullet.h index 5f0bccbd31..bd6eb49196 100644 --- a/modules/bullet/cone_twist_joint_bullet.h +++ b/modules/bullet/cone_twist_joint_bullet.h @@ -1,10 +1,9 @@ /*************************************************************************/ /* cone_twist_joint_bullet.h */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -34,6 +33,10 @@ #include "joint_bullet.h" +/** + @author AndreaCatania +*/ + class RigidBodyBullet; class ConeTwistJointBullet : public JointBullet { diff --git a/modules/bullet/constraint_bullet.cpp b/modules/bullet/constraint_bullet.cpp index 0c5ba29cb3..b60e89b6fd 100644 --- a/modules/bullet/constraint_bullet.cpp +++ b/modules/bullet/constraint_bullet.cpp @@ -1,10 +1,9 @@ /*************************************************************************/ /* constraint_bullet.cpp */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -30,9 +29,14 @@ /*************************************************************************/ #include "constraint_bullet.h" + #include "collision_object_bullet.h" #include "space_bullet.h" +/** + @author AndreaCatania +*/ + ConstraintBullet::ConstraintBullet() : space(NULL), constraint(NULL) {} diff --git a/modules/bullet/constraint_bullet.h b/modules/bullet/constraint_bullet.h index a753ee0429..23be5a5063 100644 --- a/modules/bullet/constraint_bullet.h +++ b/modules/bullet/constraint_bullet.h @@ -1,10 +1,9 @@ /*************************************************************************/ /* constraint_bullet.h */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -32,10 +31,15 @@ #ifndef CONSTRAINT_BULLET_H #define CONSTRAINT_BULLET_H -#include "BulletDynamics/ConstraintSolver/btTypedConstraint.h" #include "bullet_utilities.h" #include "rid_bullet.h" +#include <BulletDynamics/ConstraintSolver/btTypedConstraint.h> + +/** + @author AndreaCatania +*/ + class RigidBodyBullet; class SpaceBullet; class btTypedConstraint; diff --git a/modules/bullet/generic_6dof_joint_bullet.cpp b/modules/bullet/generic_6dof_joint_bullet.cpp index 674b30b23a..151a79a69f 100644 --- a/modules/bullet/generic_6dof_joint_bullet.cpp +++ b/modules/bullet/generic_6dof_joint_bullet.cpp @@ -1,10 +1,9 @@ /*************************************************************************/ /* generic_6dof_joint_bullet.cpp */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -30,11 +29,17 @@ /*************************************************************************/ #include "generic_6dof_joint_bullet.h" -#include "BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.h" + #include "bullet_types_converter.h" #include "bullet_utilities.h" #include "rigid_body_bullet.h" +#include <BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.h> + +/** + @author AndreaCatania +*/ + Generic6DOFJointBullet::Generic6DOFJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameInA, const Transform &frameInB, bool useLinearReferenceFrameA) : JointBullet() { diff --git a/modules/bullet/generic_6dof_joint_bullet.h b/modules/bullet/generic_6dof_joint_bullet.h index df66892d66..ad06582eac 100644 --- a/modules/bullet/generic_6dof_joint_bullet.h +++ b/modules/bullet/generic_6dof_joint_bullet.h @@ -1,10 +1,9 @@ /*************************************************************************/ /* generic_6dof_joint_bullet.h */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -34,6 +33,10 @@ #include "joint_bullet.h" +/** + @author AndreaCatania +*/ + class RigidBodyBullet; class Generic6DOFJointBullet : public JointBullet { diff --git a/modules/bullet/godot_collision_configuration.cpp b/modules/bullet/godot_collision_configuration.cpp index 6d83a9bccb..f4bb9acbd7 100644 --- a/modules/bullet/godot_collision_configuration.cpp +++ b/modules/bullet/godot_collision_configuration.cpp @@ -1,10 +1,9 @@ /*************************************************************************/ /* godot_collision_configuration.cpp */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -30,10 +29,16 @@ /*************************************************************************/ #include "godot_collision_configuration.h" -#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" -#include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h" + #include "godot_ray_world_algorithm.h" +#include <BulletCollision/BroadphaseCollision/btBroadphaseProxy.h> +#include <BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h> + +/** + @author AndreaCatania +*/ + GodotCollisionConfiguration::GodotCollisionConfiguration(const btDiscreteDynamicsWorld *world, const btDefaultCollisionConstructionInfo &constructionInfo) : btDefaultCollisionConfiguration(constructionInfo) { diff --git a/modules/bullet/godot_collision_configuration.h b/modules/bullet/godot_collision_configuration.h index 835edac907..9b30ad0c62 100644 --- a/modules/bullet/godot_collision_configuration.h +++ b/modules/bullet/godot_collision_configuration.h @@ -1,10 +1,9 @@ /*************************************************************************/ /* godot_collision_configuration.h */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -32,7 +31,11 @@ #ifndef GODOT_COLLISION_CONFIGURATION_H #define GODOT_COLLISION_CONFIGURATION_H -#include "BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.h" +#include <BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.h> + +/** + @author AndreaCatania +*/ class btDiscreteDynamicsWorld; diff --git a/modules/bullet/godot_collision_dispatcher.cpp b/modules/bullet/godot_collision_dispatcher.cpp index 31a965869e..1815f2152e 100644 --- a/modules/bullet/godot_collision_dispatcher.cpp +++ b/modules/bullet/godot_collision_dispatcher.cpp @@ -1,10 +1,9 @@ /*************************************************************************/ /* godot_collision_dispatcher.cpp */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -30,8 +29,13 @@ /*************************************************************************/ #include "godot_collision_dispatcher.h" + #include "collision_object_bullet.h" +/** + @author AndreaCatania +*/ + const int GodotCollisionDispatcher::CASTED_TYPE_AREA = static_cast<int>(CollisionObjectBullet::TYPE_AREA); GodotCollisionDispatcher::GodotCollisionDispatcher(btCollisionConfiguration *collisionConfiguration) : diff --git a/modules/bullet/godot_collision_dispatcher.h b/modules/bullet/godot_collision_dispatcher.h index ab3ab2af31..2e5a6c2732 100644 --- a/modules/bullet/godot_collision_dispatcher.h +++ b/modules/bullet/godot_collision_dispatcher.h @@ -1,10 +1,9 @@ /*************************************************************************/ /* godot_collision_dispatcher.h */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -33,8 +32,13 @@ #define GODOT_COLLISION_DISPATCHER_H #include "int_types.h" + #include <btBulletDynamicsCommon.h> +/** + @author AndreaCatania +*/ + /// This class is required to implement custom collision behaviour in the narrowphase class GodotCollisionDispatcher : public btCollisionDispatcher { private: diff --git a/modules/bullet/godot_motion_state.h b/modules/bullet/godot_motion_state.h index 79f139898c..2ebe368536 100644 --- a/modules/bullet/godot_motion_state.h +++ b/modules/bullet/godot_motion_state.h @@ -1,10 +1,9 @@ /*************************************************************************/ /* godot_motion_state.h */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -32,9 +31,14 @@ #ifndef GODOT_MOTION_STATE_H #define GODOT_MOTION_STATE_H -#include "LinearMath/btMotionState.h" #include "rigid_body_bullet.h" +#include <LinearMath/btMotionState.h> + +/** + @author AndreaCatania +*/ + class RigidBodyBullet; // This clas is responsible to move kinematic actor diff --git a/modules/bullet/godot_ray_world_algorithm.cpp b/modules/bullet/godot_ray_world_algorithm.cpp index 3dd10b9ab3..709eed9e40 100644 --- a/modules/bullet/godot_ray_world_algorithm.cpp +++ b/modules/bullet/godot_ray_world_algorithm.cpp @@ -1,10 +1,9 @@ /*************************************************************************/ /* godot_ray_world_algorithm.cpp */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -30,10 +29,16 @@ /*************************************************************************/ #include "godot_ray_world_algorithm.h" -#include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h" + #include "btRayShape.h" #include "collision_object_bullet.h" +#include <BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h> + +/** + @author AndreaCatania +*/ + GodotRayWorldAlgorithm::CreateFunc::CreateFunc(const btDiscreteDynamicsWorld *world) : m_world(world) {} diff --git a/modules/bullet/godot_ray_world_algorithm.h b/modules/bullet/godot_ray_world_algorithm.h index f2c9008f58..c716c1d88d 100644 --- a/modules/bullet/godot_ray_world_algorithm.h +++ b/modules/bullet/godot_ray_world_algorithm.h @@ -1,10 +1,9 @@ /*************************************************************************/ /* godot_ray_world_algorithm.h */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -32,9 +31,13 @@ #ifndef GODOT_RAY_WORLD_ALGORITHM_H #define GODOT_RAY_WORLD_ALGORITHM_H -#include "BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.h" -#include "BulletCollision/CollisionDispatch/btCollisionCreateFunc.h" -#include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h" +#include <BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.h> +#include <BulletCollision/CollisionDispatch/btCollisionCreateFunc.h> +#include <BulletCollision/CollisionDispatch/btCollisionDispatcher.h> + +/** + @author AndreaCatania +*/ class btDiscreteDynamicsWorld; diff --git a/modules/bullet/godot_result_callbacks.cpp b/modules/bullet/godot_result_callbacks.cpp index a91cbec340..8d4ca6d6a7 100644 --- a/modules/bullet/godot_result_callbacks.cpp +++ b/modules/bullet/godot_result_callbacks.cpp @@ -1,10 +1,9 @@ /*************************************************************************/ /* godot_result_callbacks.cpp */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -30,10 +29,15 @@ /*************************************************************************/ #include "godot_result_callbacks.h" + #include "bullet_types_converter.h" #include "collision_object_bullet.h" #include "rigid_body_bullet.h" +/** + @author AndreaCatania +*/ + bool GodotFilterCallback::test_collision_filters(uint32_t body0_collision_layer, uint32_t body0_collision_mask, uint32_t body1_collision_layer, uint32_t body1_collision_mask) { return body0_collision_layer & body1_collision_mask || body1_collision_layer & body0_collision_mask; } diff --git a/modules/bullet/godot_result_callbacks.h b/modules/bullet/godot_result_callbacks.h index 407fb79b9a..b18965a5b8 100644 --- a/modules/bullet/godot_result_callbacks.h +++ b/modules/bullet/godot_result_callbacks.h @@ -1,10 +1,9 @@ /*************************************************************************/ /* godot_result_callbacks.h */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -32,10 +31,15 @@ #ifndef GODOT_RESULT_CALLBACKS_H #define GODOT_RESULT_CALLBACKS_H -#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" -#include "btBulletDynamicsCommon.h" #include "servers/physics_server.h" +#include <BulletCollision/BroadphaseCollision/btBroadphaseProxy.h> +#include <btBulletDynamicsCommon.h> + +/** + @author AndreaCatania +*/ + class RigidBodyBullet; /// This class is required to implement custom collision behaviour in the broadphase diff --git a/modules/bullet/hinge_joint_bullet.cpp b/modules/bullet/hinge_joint_bullet.cpp index c731a3c134..97ea7ca3df 100644 --- a/modules/bullet/hinge_joint_bullet.cpp +++ b/modules/bullet/hinge_joint_bullet.cpp @@ -1,10 +1,9 @@ /*************************************************************************/ /* hinge_joint_bullet.cpp */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -30,11 +29,17 @@ /*************************************************************************/ #include "hinge_joint_bullet.h" -#include "BulletDynamics/ConstraintSolver/btHingeConstraint.h" + #include "bullet_types_converter.h" #include "bullet_utilities.h" #include "rigid_body_bullet.h" +#include <BulletDynamics/ConstraintSolver/btHingeConstraint.h> + +/** + @author AndreaCatania +*/ + HingeJointBullet::HingeJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameA, const Transform &frameB) : JointBullet() { diff --git a/modules/bullet/hinge_joint_bullet.h b/modules/bullet/hinge_joint_bullet.h index 72146fca8b..ca87c8dd8c 100644 --- a/modules/bullet/hinge_joint_bullet.h +++ b/modules/bullet/hinge_joint_bullet.h @@ -1,10 +1,9 @@ /*************************************************************************/ /* hinge_joint_bullet.h */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -34,6 +33,10 @@ #include "joint_bullet.h" +/** + @author AndreaCatania +*/ + class HingeJointBullet : public JointBullet { class btHingeConstraint *hingeConstraint; diff --git a/modules/bullet/joint_bullet.cpp b/modules/bullet/joint_bullet.cpp index 8aa15e731d..aaeb9f9ce7 100644 --- a/modules/bullet/joint_bullet.cpp +++ b/modules/bullet/joint_bullet.cpp @@ -1,10 +1,9 @@ /*************************************************************************/ /* joint_bullet.cpp */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -30,8 +29,13 @@ /*************************************************************************/ #include "joint_bullet.h" + #include "space_bullet.h" +/** + @author AndreaCatania +*/ + JointBullet::JointBullet() : ConstraintBullet() {} diff --git a/modules/bullet/joint_bullet.h b/modules/bullet/joint_bullet.h index 2d4f774345..4a5333fb85 100644 --- a/modules/bullet/joint_bullet.h +++ b/modules/bullet/joint_bullet.h @@ -1,10 +1,9 @@ /*************************************************************************/ /* joint_bullet.h */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -35,6 +34,10 @@ #include "constraint_bullet.h" #include "servers/physics_server.h" +/** + @author AndreaCatania +*/ + class RigidBodyBullet; class btTypedConstraint; diff --git a/modules/bullet/pin_joint_bullet.cpp b/modules/bullet/pin_joint_bullet.cpp index 7c44548496..c4e5b8cdbe 100644 --- a/modules/bullet/pin_joint_bullet.cpp +++ b/modules/bullet/pin_joint_bullet.cpp @@ -1,10 +1,9 @@ /*************************************************************************/ /* pin_joint_bullet.cpp */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -30,10 +29,16 @@ /*************************************************************************/ #include "pin_joint_bullet.h" -#include "BulletDynamics/ConstraintSolver/btPoint2PointConstraint.h" + #include "bullet_types_converter.h" #include "rigid_body_bullet.h" +#include <BulletDynamics/ConstraintSolver/btPoint2PointConstraint.h> + +/** + @author AndreaCatania +*/ + PinJointBullet::PinJointBullet(RigidBodyBullet *p_body_a, const Vector3 &p_pos_a, RigidBodyBullet *p_body_b, const Vector3 &p_pos_b) : JointBullet() { if (p_body_b) { diff --git a/modules/bullet/pin_joint_bullet.h b/modules/bullet/pin_joint_bullet.h index 5610e6aa05..648010bf78 100644 --- a/modules/bullet/pin_joint_bullet.h +++ b/modules/bullet/pin_joint_bullet.h @@ -1,10 +1,9 @@ /*************************************************************************/ /* pin_joint_bullet.h */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -34,6 +33,10 @@ #include "joint_bullet.h" +/** + @author AndreaCatania +*/ + class RigidBodyBullet; class PinJointBullet : public JointBullet { diff --git a/modules/bullet/register_types.cpp b/modules/bullet/register_types.cpp index 2a420f424b..b119b7720f 100644 --- a/modules/bullet/register_types.cpp +++ b/modules/bullet/register_types.cpp @@ -1,10 +1,9 @@ /*************************************************************************/ /* register_types.cpp */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -30,9 +29,14 @@ /*************************************************************************/ #include "register_types.h" + #include "bullet_physics_server.h" #include "class_db.h" +/** + @author AndreaCatania +*/ + PhysicsServer *_createBulletPhysicsCallback() { return memnew(BulletPhysicsServer); } diff --git a/modules/bullet/register_types.h b/modules/bullet/register_types.h index 4edc3fb839..226bcd9402 100644 --- a/modules/bullet/register_types.h +++ b/modules/bullet/register_types.h @@ -1,10 +1,9 @@ /*************************************************************************/ /* register_types.h */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -32,6 +31,10 @@ #ifndef REGISTER_BULLET_TYPES_H #define REGISTER_BULLET_TYPES_H +/** + @author AndreaCatania +*/ + void register_bullet_types(); void unregister_bullet_types(); #endif diff --git a/modules/bullet/rid_bullet.h b/modules/bullet/rid_bullet.h index 72859b628e..a9351d7728 100644 --- a/modules/bullet/rid_bullet.h +++ b/modules/bullet/rid_bullet.h @@ -1,10 +1,9 @@ /*************************************************************************/ /* rid_bullet.h */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -34,6 +33,10 @@ #include "core/rid.h" +/** + @author AndreaCatania +*/ + class BulletPhysicsServer; class RIDBullet : public RID_Data { diff --git a/modules/bullet/rigid_body_bullet.cpp b/modules/bullet/rigid_body_bullet.cpp index c183b012ab..0e293a38a6 100644 --- a/modules/bullet/rigid_body_bullet.cpp +++ b/modules/bullet/rigid_body_bullet.cpp @@ -1,10 +1,9 @@ /*************************************************************************/ -/* body_bullet.cpp */ -/* Author: AndreaCatania */ +/* rigid_body_bullet.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -30,18 +29,25 @@ /*************************************************************************/ #include "rigid_body_bullet.h" -#include "BulletCollision/CollisionDispatch/btGhostObject.h" -#include "BulletCollision/CollisionShapes/btConvexPointCloudShape.h" -#include "BulletDynamics/Dynamics/btRigidBody.h" -#include "btBulletCollisionCommon.h" + #include "btRayShape.h" #include "bullet_physics_server.h" #include "bullet_types_converter.h" #include "bullet_utilities.h" #include "godot_motion_state.h" #include "joint_bullet.h" + +#include <BulletCollision/CollisionDispatch/btGhostObject.h> +#include <BulletCollision/CollisionShapes/btConvexPointCloudShape.h> +#include <BulletDynamics/Dynamics/btRigidBody.h> +#include <btBulletCollisionCommon.h> + #include <assert.h> +/** + @author AndreaCatania +*/ + BulletPhysicsDirectBodyState *BulletPhysicsDirectBodyState::singleton = NULL; Vector3 BulletPhysicsDirectBodyState::get_total_gravity() const { diff --git a/modules/bullet/rigid_body_bullet.h b/modules/bullet/rigid_body_bullet.h index ff1596e6f4..eb9417e391 100644 --- a/modules/bullet/rigid_body_bullet.h +++ b/modules/bullet/rigid_body_bullet.h @@ -1,10 +1,9 @@ /*************************************************************************/ -/* body_bullet.h */ -/* Author: AndreaCatania */ +/* rigid_body_bullet.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -32,11 +31,16 @@ #ifndef BODYBULLET_H #define BODYBULLET_H -#include "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h" -#include "LinearMath/btTransform.h" #include "collision_object_bullet.h" #include "space_bullet.h" +#include <BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h> +#include <LinearMath/btTransform.h> + +/** + @author AndreaCatania +*/ + class AreaBullet; class SpaceBullet; class btRigidBody; diff --git a/modules/bullet/shape_bullet.cpp b/modules/bullet/shape_bullet.cpp index d5a89e39e2..ee1cc418bc 100644 --- a/modules/bullet/shape_bullet.cpp +++ b/modules/bullet/shape_bullet.cpp @@ -1,10 +1,9 @@ /*************************************************************************/ /* shape_bullet.cpp */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -30,15 +29,21 @@ /*************************************************************************/ #include "shape_bullet.h" -#include "BulletCollision/CollisionShapes/btConvexPointCloudShape.h" -#include "BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h" -#include "btBulletCollisionCommon.h" + #include "btRayShape.h" #include "bullet_physics_server.h" #include "bullet_types_converter.h" #include "bullet_utilities.h" #include "shape_owner_bullet.h" +#include <BulletCollision/CollisionShapes/btConvexPointCloudShape.h> +#include <BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h> +#include <btBulletCollisionCommon.h> + +/** + @author AndreaCatania +*/ + ShapeBullet::ShapeBullet() {} ShapeBullet::~ShapeBullet() {} diff --git a/modules/bullet/shape_bullet.h b/modules/bullet/shape_bullet.h index a9782a9333..12fa9754bd 100644 --- a/modules/bullet/shape_bullet.h +++ b/modules/bullet/shape_bullet.h @@ -1,10 +1,9 @@ /*************************************************************************/ /* shape_bullet.h */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -32,14 +31,19 @@ #ifndef SHAPE_BULLET_H #define SHAPE_BULLET_H -#include "LinearMath/btAlignedObjectArray.h" -#include "LinearMath/btScalar.h" -#include "LinearMath/btVector3.h" #include "core/variant.h" #include "geometry.h" #include "rid_bullet.h" #include "servers/physics_server.h" +#include <LinearMath/btAlignedObjectArray.h> +#include <LinearMath/btScalar.h> +#include <LinearMath/btVector3.h> + +/** + @author AndreaCatania +*/ + class ShapeBullet; class btCollisionShape; class ShapeOwnerBullet; diff --git a/modules/bullet/shape_owner_bullet.cpp b/modules/bullet/shape_owner_bullet.cpp index 7b753e1c48..d6ba5d81bc 100644 --- a/modules/bullet/shape_owner_bullet.cpp +++ b/modules/bullet/shape_owner_bullet.cpp @@ -1,10 +1,9 @@ /*************************************************************************/ /* shape_owner_bullet.cpp */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -30,3 +29,7 @@ /*************************************************************************/ #include "shape_owner_bullet.h" + +/** + @author AndreaCatania +*/ diff --git a/modules/bullet/shape_owner_bullet.h b/modules/bullet/shape_owner_bullet.h index 4e81b4be6e..29d42d12f2 100644 --- a/modules/bullet/shape_owner_bullet.h +++ b/modules/bullet/shape_owner_bullet.h @@ -1,10 +1,9 @@ /*************************************************************************/ /* shape_owner_bullet.h */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -34,11 +33,15 @@ #include "rid_bullet.h" +/** + @author AndreaCatania +*/ + class ShapeBullet; class btCollisionShape; class CollisionObjectBullet; -/// Each clas that want to use Shapes must inherit this class +/// Each class that want to use Shapes must inherit this class /// E.G. BodyShape is a child of this class ShapeOwnerBullet { public: diff --git a/modules/bullet/slider_joint_bullet.cpp b/modules/bullet/slider_joint_bullet.cpp index 09cbd5032c..9e1cd23989 100644 --- a/modules/bullet/slider_joint_bullet.cpp +++ b/modules/bullet/slider_joint_bullet.cpp @@ -1,10 +1,9 @@ /*************************************************************************/ /* slider_joint_bullet.cpp */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -30,11 +29,17 @@ /*************************************************************************/ #include "slider_joint_bullet.h" -#include "BulletDynamics/ConstraintSolver/btSliderConstraint.h" + #include "bullet_types_converter.h" #include "bullet_utilities.h" #include "rigid_body_bullet.h" +#include <BulletDynamics/ConstraintSolver/btSliderConstraint.h> + +/** + @author AndreaCatania +*/ + SliderJointBullet::SliderJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameInA, const Transform &frameInB) : JointBullet() { diff --git a/modules/bullet/slider_joint_bullet.h b/modules/bullet/slider_joint_bullet.h index 4b9a70a323..d532906c0d 100644 --- a/modules/bullet/slider_joint_bullet.h +++ b/modules/bullet/slider_joint_bullet.h @@ -1,10 +1,9 @@ /*************************************************************************/ /* slider_joint_bullet.h */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -34,6 +33,10 @@ #include "joint_bullet.h" +/** + @author AndreaCatania +*/ + class RigidBodyBullet; class SliderJointBullet : public JointBullet { diff --git a/modules/bullet/soft_body_bullet.cpp b/modules/bullet/soft_body_bullet.cpp index 268967f014..5c20eb73f1 100644 --- a/modules/bullet/soft_body_bullet.cpp +++ b/modules/bullet/soft_body_bullet.cpp @@ -1,10 +1,9 @@ /*************************************************************************/ /* soft_body_bullet.cpp */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -30,11 +29,15 @@ /*************************************************************************/ #include "soft_body_bullet.h" + #include "bullet_types_converter.h" #include "bullet_utilities.h" +#include "scene/3d/immediate_geometry.h" #include "space_bullet.h" -#include "scene/3d/immediate_geometry.h" +/** + @author AndreaCatania +*/ SoftBodyBullet::SoftBodyBullet() : CollisionObjectBullet(CollisionObjectBullet::TYPE_SOFT_BODY), diff --git a/modules/bullet/soft_body_bullet.h b/modules/bullet/soft_body_bullet.h index 83597ae7d2..9895643b84 100644 --- a/modules/bullet/soft_body_bullet.h +++ b/modules/bullet/soft_body_bullet.h @@ -1,10 +1,9 @@ /*************************************************************************/ /* soft_body_bullet.h */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -32,14 +31,16 @@ #ifndef SOFT_BODY_BULLET_H #define SOFT_BODY_BULLET_H +#include "collision_object_bullet.h" +#include "scene/resources/material.h" // TODO remove this please + #ifdef None /// This is required to remove the macro None defined by x11 compiler because this word "None" is used internally by Bullet #undef None #define x11_None 0L #endif -#include "BulletSoftBody/btSoftBodyHelpers.h" -#include "collision_object_bullet.h" +#include <BulletSoftBody/btSoftBodyHelpers.h> #ifdef x11_None /// This is required to re add the macro None defined by x11 compiler @@ -47,7 +48,9 @@ #define None 0L #endif -#include "scene/resources/material.h" // TODO remove thsi please +/** + @author AndreaCatania +*/ struct SoftShapeData {}; struct TrimeshSoftShapeData : public SoftShapeData { diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp index a67c627ba4..83dd055760 100644 --- a/modules/bullet/space_bullet.cpp +++ b/modules/bullet/space_bullet.cpp @@ -1,10 +1,9 @@ /*************************************************************************/ /* space_bullet.cpp */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -30,14 +29,7 @@ /*************************************************************************/ #include "space_bullet.h" -#include "BulletCollision/CollisionDispatch/btCollisionObject.h" -#include "BulletCollision/CollisionDispatch/btGhostObject.h" -#include "BulletCollision/NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.h" -#include "BulletCollision/NarrowPhaseCollision/btGjkPairDetector.h" -#include "BulletCollision/NarrowPhaseCollision/btPointCollector.h" -#include "BulletSoftBody/btSoftBodyRigidBodyCollisionConfiguration.h" -#include "BulletSoftBody/btSoftRigidDynamicsWorld.h" -#include "btBulletDynamicsCommon.h" + #include "bullet_physics_server.h" #include "bullet_types_converter.h" #include "bullet_utilities.h" @@ -48,8 +40,22 @@ #include "servers/physics_server.h" #include "soft_body_bullet.h" #include "ustring.h" + +#include <BulletCollision/CollisionDispatch/btCollisionObject.h> +#include <BulletCollision/CollisionDispatch/btGhostObject.h> +#include <BulletCollision/NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.h> +#include <BulletCollision/NarrowPhaseCollision/btGjkPairDetector.h> +#include <BulletCollision/NarrowPhaseCollision/btPointCollector.h> +#include <BulletSoftBody/btSoftBodyRigidBodyCollisionConfiguration.h> +#include <BulletSoftBody/btSoftRigidDynamicsWorld.h> +#include <btBulletDynamicsCommon.h> + #include <assert.h> +/** + @author AndreaCatania +*/ + BulletPhysicsDirectSpaceState::BulletPhysicsDirectSpaceState(SpaceBullet *p_space) : PhysicsDirectSpaceState(), space(p_space) {} diff --git a/modules/bullet/space_bullet.h b/modules/bullet/space_bullet.h index 69ea2fcc58..8d31ab765b 100644 --- a/modules/bullet/space_bullet.h +++ b/modules/bullet/space_bullet.h @@ -1,10 +1,9 @@ /*************************************************************************/ /* space_bullet.h */ -/* Author: AndreaCatania */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -32,17 +31,22 @@ #ifndef SPACE_BULLET_H #define SPACE_BULLET_H -#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" -#include "BulletCollision/BroadphaseCollision/btOverlappingPairCache.h" -#include "LinearMath/btScalar.h" -#include "LinearMath/btTransform.h" -#include "LinearMath/btVector3.h" #include "core/variant.h" #include "core/vector.h" #include "godot_result_callbacks.h" #include "rid_bullet.h" #include "servers/physics_server.h" +#include <BulletCollision/BroadphaseCollision/btBroadphaseProxy.h> +#include <BulletCollision/BroadphaseCollision/btOverlappingPairCache.h> +#include <LinearMath/btScalar.h> +#include <LinearMath/btTransform.h> +#include <LinearMath/btVector3.h> + +/** + @author AndreaCatania +*/ + class AreaBullet; class btBroadphaseInterface; class btCollisionDispatcher; diff --git a/modules/dds/register_types.cpp b/modules/dds/register_types.cpp index 76244c76a4..d6351fb6fe 100644 --- a/modules/dds/register_types.cpp +++ b/modules/dds/register_types.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "register_types.h" #include "texture_loader_dds.h" diff --git a/modules/dds/register_types.h b/modules/dds/register_types.h index 74db58937e..c7f7839c24 100644 --- a/modules/dds/register_types.h +++ b/modules/dds/register_types.h @@ -27,5 +27,6 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_dds_types(); void unregister_dds_types(); diff --git a/modules/dds/texture_loader_dds.cpp b/modules/dds/texture_loader_dds.cpp index d01af20544..9424080b6d 100644 --- a/modules/dds/texture_loader_dds.cpp +++ b/modules/dds/texture_loader_dds.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "texture_loader_dds.h" #include "os/file_access.h" diff --git a/modules/dds/texture_loader_dds.h b/modules/dds/texture_loader_dds.h index 0adae2fb2a..14d99ff506 100644 --- a/modules/dds/texture_loader_dds.h +++ b/modules/dds/texture_loader_dds.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef TEXTURE_LOADER_DDS_H #define TEXTURE_LOADER_DDS_H diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp index 2b5dd67938..3ad80d3978 100644 --- a/modules/enet/networked_multiplayer_enet.cpp +++ b/modules/enet/networked_multiplayer_enet.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "networked_multiplayer_enet.h" #include "io/marshalls.h" #include "os/os.h" diff --git a/modules/enet/networked_multiplayer_enet.h b/modules/enet/networked_multiplayer_enet.h index d6644aed2d..93758de94b 100644 --- a/modules/enet/networked_multiplayer_enet.h +++ b/modules/enet/networked_multiplayer_enet.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef NETWORKED_MULTIPLAYER_ENET_H #define NETWORKED_MULTIPLAYER_ENET_H diff --git a/modules/enet/register_types.cpp b/modules/enet/register_types.cpp index 94d0eaa43f..cabaeb692a 100644 --- a/modules/enet/register_types.cpp +++ b/modules/enet/register_types.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "register_types.h" #include "error_macros.h" #include "networked_multiplayer_enet.h" diff --git a/modules/enet/register_types.h b/modules/enet/register_types.h index 03cc2c8525..bcf0893ae4 100644 --- a/modules/enet/register_types.h +++ b/modules/enet/register_types.h @@ -27,5 +27,6 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_enet_types(); void unregister_enet_types(); diff --git a/modules/etc/image_etc.cpp b/modules/etc/image_etc.cpp index 2224ecc356..e56ec774dd 100644 --- a/modules/etc/image_etc.cpp +++ b/modules/etc/image_etc.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "image_etc.h" #include "Etc.h" #include "EtcFilter.h" diff --git a/modules/etc/image_etc.h b/modules/etc/image_etc.h index fb32a120b1..371c38176f 100644 --- a/modules/etc/image_etc.h +++ b/modules/etc/image_etc.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef IMAGE_ETC1_H #define IMAGE_ETC1_H diff --git a/modules/etc/register_types.cpp b/modules/etc/register_types.cpp index 42baf91dfa..1d1f0e1b77 100644 --- a/modules/etc/register_types.cpp +++ b/modules/etc/register_types.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "register_types.h" #include "image_etc.h" diff --git a/modules/etc/register_types.h b/modules/etc/register_types.h index 1f1336dc10..4a8513a687 100644 --- a/modules/etc/register_types.h +++ b/modules/etc/register_types.h @@ -27,5 +27,6 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_etc_types(); void unregister_etc_types(); diff --git a/modules/etc/texture_loader_pkm.cpp b/modules/etc/texture_loader_pkm.cpp index 4f6df04341..ac89259c9b 100644 --- a/modules/etc/texture_loader_pkm.cpp +++ b/modules/etc/texture_loader_pkm.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "texture_loader_pkm.h" #include "os/file_access.h" diff --git a/modules/etc/texture_loader_pkm.h b/modules/etc/texture_loader_pkm.h index 1e8833b547..3c6d9180bd 100644 --- a/modules/etc/texture_loader_pkm.h +++ b/modules/etc/texture_loader_pkm.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef TEXTURE_LOADER_PKM_H #define TEXTURE_LOADER_PKM_H diff --git a/modules/freetype/register_types.cpp b/modules/freetype/register_types.cpp index c3fa84417d..bde04b714c 100644 --- a/modules/freetype/register_types.cpp +++ b/modules/freetype/register_types.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "register_types.h" void register_freetype_types() {} diff --git a/modules/freetype/register_types.h b/modules/freetype/register_types.h index 959d646cd4..0cec0e3951 100644 --- a/modules/freetype/register_types.h +++ b/modules/freetype/register_types.h @@ -27,5 +27,6 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_freetype_types(); void unregister_freetype_types(); diff --git a/modules/gdnative/SCsub b/modules/gdnative/SCsub index 4e73ebfb9d..c92c3f30a2 100644 --- a/modules/gdnative/SCsub +++ b/modules/gdnative/SCsub @@ -245,6 +245,14 @@ if ARGUMENTS.get('gdnative_wrapper', False): gd_wrapper_env = env.Clone() gd_wrapper_env.Append(CPPPATH=['#modules/gdnative/include/']) + if gd_wrapper_env['use_lto']: + if not env.msvc: + gd_wrapper_env.Append(CCFLAGS=['--no-lto']) + gd_wrapper_env.Append(LINKFLAGS=['--no-lto']) + else: + gd_wrapper_env.Append(CCFLAGS=['/GL-']) + gd_wrapper_env.Append(LINKFLAGS=['/LTCG:OFF']) + if not env.msvc: gd_wrapper_env.Append(CCFLAGS=['-fPIC']) diff --git a/modules/gdnative/doc_classes/GDNativeLibrary.xml b/modules/gdnative/doc_classes/GDNativeLibrary.xml index 647d27929f..14bd0e9654 100644 --- a/modules/gdnative/doc_classes/GDNativeLibrary.xml +++ b/modules/gdnative/doc_classes/GDNativeLibrary.xml @@ -31,6 +31,8 @@ <members> <member name="load_once" type="bool" setter="set_load_once" getter="should_load_once"> </member> + <member name="reloadable" type="bool" setter="set_reloadable" getter="is_reloadable"> + </member> <member name="singleton" type="bool" setter="set_singleton" getter="is_singleton"> </member> <member name="symbol_prefix" type="String" setter="set_symbol_prefix" getter="get_symbol_prefix"> diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp index 57db9ac51c..1379083b42 100644 --- a/modules/gdnative/gdnative.cpp +++ b/modules/gdnative/gdnative.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "gdnative.h" #include "global_constants.h" @@ -37,9 +38,12 @@ #include "scene/main/scene_tree.h" -const String init_symbol = "gdnative_init"; -const String terminate_symbol = "gdnative_terminate"; -const String default_symbol_prefix = "godot_"; +static const String init_symbol = "gdnative_init"; +static const String terminate_symbol = "gdnative_terminate"; +static const String default_symbol_prefix = "godot_"; +static const bool default_singleton = false; +static const bool default_load_once = true; +static const bool default_reloadable = true; // Defined in gdnative_api_struct.gen.cpp extern const godot_gdnative_core_api_struct api_struct; @@ -50,6 +54,9 @@ GDNativeLibrary::GDNativeLibrary() { config_file.instance(); symbol_prefix = default_symbol_prefix; + load_once = default_load_once; + singleton = default_singleton; + reloadable = default_reloadable; if (GDNativeLibrary::loaded_libraries == NULL) { GDNativeLibrary::loaded_libraries = memnew((Map<String, Vector<Ref<GDNative> > >)); @@ -68,14 +75,17 @@ void GDNativeLibrary::_bind_methods() { ClassDB::bind_method(D_METHOD("should_load_once"), &GDNativeLibrary::should_load_once); ClassDB::bind_method(D_METHOD("is_singleton"), &GDNativeLibrary::is_singleton); ClassDB::bind_method(D_METHOD("get_symbol_prefix"), &GDNativeLibrary::get_symbol_prefix); + ClassDB::bind_method(D_METHOD("is_reloadable"), &GDNativeLibrary::is_reloadable); ClassDB::bind_method(D_METHOD("set_load_once", "load_once"), &GDNativeLibrary::set_load_once); ClassDB::bind_method(D_METHOD("set_singleton", "singleton"), &GDNativeLibrary::set_singleton); ClassDB::bind_method(D_METHOD("set_symbol_prefix", "symbol_prefix"), &GDNativeLibrary::set_symbol_prefix); + ClassDB::bind_method(D_METHOD("set_reloadable", "reloadable"), &GDNativeLibrary::set_reloadable); ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "load_once"), "set_load_once", "should_load_once"); ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "singleton"), "set_singleton", "is_singleton"); ADD_PROPERTYNZ(PropertyInfo(Variant::STRING, "symbol_prefix"), "set_symbol_prefix", "get_symbol_prefix"); + ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "reloadable"), "set_reloadable", "is_reloadable"); } GDNative::GDNative() { @@ -317,9 +327,10 @@ RES GDNativeLibraryResourceLoader::load(const String &p_path, const String &p_or *r_error = err; } - lib->set_singleton(config->get_value("general", "singleton", false)); - lib->set_load_once(config->get_value("general", "load_once", true)); + lib->set_singleton(config->get_value("general", "singleton", default_singleton)); + lib->set_load_once(config->get_value("general", "load_once", default_load_once)); lib->set_symbol_prefix(config->get_value("general", "symbol_prefix", default_symbol_prefix)); + lib->set_reloadable(config->get_value("general", "reloadable", default_reloadable)); String entry_lib_path; { @@ -415,6 +426,7 @@ Error GDNativeLibraryResourceSaver::save(const String &p_path, const RES &p_reso config->set_value("general", "singleton", lib->is_singleton()); config->set_value("general", "load_once", lib->should_load_once()); config->set_value("general", "symbol_prefix", lib->get_symbol_prefix()); + config->set_value("general", "reloadable", lib->is_reloadable()); return config->save(p_path); } diff --git a/modules/gdnative/gdnative.h b/modules/gdnative/gdnative.h index 26c19dcf22..3298ea950f 100644 --- a/modules/gdnative/gdnative.h +++ b/modules/gdnative/gdnative.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GDNATIVE_H #define GDNATIVE_H @@ -59,6 +60,7 @@ class GDNativeLibrary : public Resource { bool singleton; bool load_once; String symbol_prefix; + bool reloadable; public: GDNativeLibrary(); @@ -86,6 +88,10 @@ public: return symbol_prefix; } + _FORCE_INLINE_ bool is_reloadable() const { + return reloadable; + } + _FORCE_INLINE_ void set_load_once(bool p_load_once) { load_once = p_load_once; } @@ -96,6 +102,10 @@ public: symbol_prefix = p_symbol_prefix; } + _FORCE_INLINE_ void set_reloadable(bool p_reloadable) { + reloadable = p_reloadable; + } + static void _bind_methods(); }; diff --git a/modules/gdnative/gdnative/aabb.cpp b/modules/gdnative/gdnative/aabb.cpp index 706e81a606..0597e1cdd6 100644 --- a/modules/gdnative/gdnative/aabb.cpp +++ b/modules/gdnative/gdnative/aabb.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* aabb.cpp */ +/* aabb.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "gdnative/aabb.h" #include "core/math/aabb.h" diff --git a/modules/gdnative/gdnative/array.cpp b/modules/gdnative/gdnative/array.cpp index 72020b5361..1fb0ff0500 100644 --- a/modules/gdnative/gdnative/array.cpp +++ b/modules/gdnative/gdnative/array.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "gdnative/array.h" #include "core/array.h" diff --git a/modules/gdnative/gdnative/basis.cpp b/modules/gdnative/gdnative/basis.cpp index 7b9acc6bd0..372bdf3fb1 100644 --- a/modules/gdnative/gdnative/basis.cpp +++ b/modules/gdnative/gdnative/basis.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "gdnative/basis.h" #include "core/math/matrix3.h" diff --git a/modules/gdnative/gdnative/color.cpp b/modules/gdnative/gdnative/color.cpp index 4fd4458bfb..4089f4458a 100644 --- a/modules/gdnative/gdnative/color.cpp +++ b/modules/gdnative/gdnative/color.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "gdnative/color.h" #include "core/color.h" diff --git a/modules/gdnative/gdnative/dictionary.cpp b/modules/gdnative/gdnative/dictionary.cpp index b2ac8e0426..786e614158 100644 --- a/modules/gdnative/gdnative/dictionary.cpp +++ b/modules/gdnative/gdnative/dictionary.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "gdnative/dictionary.h" #include "core/variant.h" diff --git a/modules/gdnative/gdnative/gdnative.cpp b/modules/gdnative/gdnative/gdnative.cpp index 38fb2ee818..041990e137 100644 --- a/modules/gdnative/gdnative/gdnative.cpp +++ b/modules/gdnative/gdnative/gdnative.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "gdnative/gdnative.h" #include "class_db.h" diff --git a/modules/gdnative/gdnative/node_path.cpp b/modules/gdnative/gdnative/node_path.cpp index 8c490709c0..f24facaae8 100644 --- a/modules/gdnative/gdnative/node_path.cpp +++ b/modules/gdnative/gdnative/node_path.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "gdnative/node_path.h" #include "core/node_path.h" diff --git a/modules/gdnative/gdnative/plane.cpp b/modules/gdnative/gdnative/plane.cpp index de272d6f08..be821edcc3 100644 --- a/modules/gdnative/gdnative/plane.cpp +++ b/modules/gdnative/gdnative/plane.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "gdnative/plane.h" #include "core/math/plane.h" diff --git a/modules/gdnative/gdnative/pool_arrays.cpp b/modules/gdnative/gdnative/pool_arrays.cpp index dc24bf4d15..6e014905a3 100644 --- a/modules/gdnative/gdnative/pool_arrays.cpp +++ b/modules/gdnative/gdnative/pool_arrays.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "gdnative/pool_arrays.h" #include "array.h" diff --git a/modules/gdnative/gdnative/quat.cpp b/modules/gdnative/gdnative/quat.cpp index 2f577e485a..56ff7fe3a8 100644 --- a/modules/gdnative/gdnative/quat.cpp +++ b/modules/gdnative/gdnative/quat.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "gdnative/quat.h" #include "core/math/quat.h" diff --git a/modules/gdnative/gdnative/rect2.cpp b/modules/gdnative/gdnative/rect2.cpp index c449a0d14c..83c58db520 100644 --- a/modules/gdnative/gdnative/rect2.cpp +++ b/modules/gdnative/gdnative/rect2.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "gdnative/rect2.h" #include "core/math/math_2d.h" diff --git a/modules/gdnative/gdnative/rid.cpp b/modules/gdnative/gdnative/rid.cpp index fe04f1e92f..4374738f48 100644 --- a/modules/gdnative/gdnative/rid.cpp +++ b/modules/gdnative/gdnative/rid.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "gdnative/rid.h" #include "core/resource.h" diff --git a/modules/gdnative/gdnative/string.cpp b/modules/gdnative/gdnative/string.cpp index a99adb3beb..350dc540f7 100644 --- a/modules/gdnative/gdnative/string.cpp +++ b/modules/gdnative/gdnative/string.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "gdnative/string.h" #include "core/string_db.h" diff --git a/modules/gdnative/gdnative/string_name.cpp b/modules/gdnative/gdnative/string_name.cpp index 86067df433..b2a86b843c 100644 --- a/modules/gdnative/gdnative/string_name.cpp +++ b/modules/gdnative/gdnative/string_name.cpp @@ -1,9 +1,9 @@ /*************************************************************************/ -/* string_name.cpp */ +/* string_name.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "gdnative/string_name.h" #include "core/string_db.h" diff --git a/modules/gdnative/gdnative/transform.cpp b/modules/gdnative/gdnative/transform.cpp index 4b6589a209..9bd8c99612 100644 --- a/modules/gdnative/gdnative/transform.cpp +++ b/modules/gdnative/gdnative/transform.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "gdnative/transform.h" #include "core/math/transform.h" diff --git a/modules/gdnative/gdnative/transform2d.cpp b/modules/gdnative/gdnative/transform2d.cpp index 0ff5420f4f..c69607a18a 100644 --- a/modules/gdnative/gdnative/transform2d.cpp +++ b/modules/gdnative/gdnative/transform2d.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "gdnative/transform2d.h" #include "core/math/math_2d.h" diff --git a/modules/gdnative/gdnative/variant.cpp b/modules/gdnative/gdnative/variant.cpp index 6447641096..423f3312e1 100644 --- a/modules/gdnative/gdnative/variant.cpp +++ b/modules/gdnative/gdnative/variant.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "gdnative/variant.h" #include "core/reference.h" diff --git a/modules/gdnative/gdnative/vector2.cpp b/modules/gdnative/gdnative/vector2.cpp index aadce281b3..9e40b42373 100644 --- a/modules/gdnative/gdnative/vector2.cpp +++ b/modules/gdnative/gdnative/vector2.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "gdnative/vector2.h" #include "core/math/math_2d.h" diff --git a/modules/gdnative/gdnative/vector3.cpp b/modules/gdnative/gdnative/vector3.cpp index 4de9889c23..a7e18fa22b 100644 --- a/modules/gdnative/gdnative/vector3.cpp +++ b/modules/gdnative/gdnative/vector3.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "gdnative/vector3.h" #include "core/variant.h" diff --git a/modules/gdnative/gdnative_library_editor_plugin.h b/modules/gdnative/gdnative_library_editor_plugin.h index 2b635d0937..94bc2adc7d 100644 --- a/modules/gdnative/gdnative_library_editor_plugin.h +++ b/modules/gdnative/gdnative_library_editor_plugin.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GDNATIVE_LIBRARY_EDITOR_PLUGIN_H #define GDNATIVE_LIBRARY_EDITOR_PLUGIN_H diff --git a/modules/gdnative/gdnative_library_singleton_editor.cpp b/modules/gdnative/gdnative_library_singleton_editor.cpp index 4c0049f90d..0aafb95e2e 100644 --- a/modules/gdnative/gdnative_library_singleton_editor.cpp +++ b/modules/gdnative/gdnative_library_singleton_editor.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* gdnative_library_singleton_editor.cpp */ +/* gdnative_library_singleton_editor.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifdef TOOLS_ENABLED #include "gdnative_library_singleton_editor.h" #include "gdnative.h" diff --git a/modules/gdnative/gdnative_library_singleton_editor.h b/modules/gdnative/gdnative_library_singleton_editor.h index d00ddc9211..d3b5ba3846 100644 --- a/modules/gdnative/gdnative_library_singleton_editor.h +++ b/modules/gdnative/gdnative_library_singleton_editor.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* gdnative_library_singleton_editor.h */ +/* gdnative_library_singleton_editor.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GD_NATIVE_LIBRARY_EDITOR_H #define GD_NATIVE_LIBRARY_EDITOR_H diff --git a/modules/gdnative/include/arvr/godot_arvr.h b/modules/gdnative/include/arvr/godot_arvr.h index fc4626c967..b9aedc0bef 100644 --- a/modules/gdnative/include/arvr/godot_arvr.h +++ b/modules/gdnative/include/arvr/godot_arvr.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GODOT_NATIVEARVR_H #define GODOT_NATIVEARVR_H diff --git a/modules/gdnative/include/gdnative/aabb.h b/modules/gdnative/include/gdnative/aabb.h index a40061ce2e..dca5d4bb14 100644 --- a/modules/gdnative/include/gdnative/aabb.h +++ b/modules/gdnative/include/gdnative/aabb.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* aabb.h */ +/* aabb.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GODOT_AABB_H #define GODOT_AABB_H diff --git a/modules/gdnative/include/gdnative/basis.h b/modules/gdnative/include/gdnative/basis.h index ce9ac590d9..53e950b4a2 100644 --- a/modules/gdnative/include/gdnative/basis.h +++ b/modules/gdnative/include/gdnative/basis.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GODOT_BASIS_H #define GODOT_BASIS_H diff --git a/modules/gdnative/include/gdnative/color.h b/modules/gdnative/include/gdnative/color.h index 14086c1155..1f0ac8354d 100644 --- a/modules/gdnative/include/gdnative/color.h +++ b/modules/gdnative/include/gdnative/color.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GODOT_COLOR_H #define GODOT_COLOR_H diff --git a/modules/gdnative/include/gdnative/dictionary.h b/modules/gdnative/include/gdnative/dictionary.h index 07ffb3346b..a86d60dc72 100644 --- a/modules/gdnative/include/gdnative/dictionary.h +++ b/modules/gdnative/include/gdnative/dictionary.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GODOT_DICTIONARY_H #define GODOT_DICTIONARY_H diff --git a/modules/gdnative/include/gdnative/gdnative.h b/modules/gdnative/include/gdnative/gdnative.h index d066df8046..56d3779d34 100644 --- a/modules/gdnative/include/gdnative/gdnative.h +++ b/modules/gdnative/include/gdnative/gdnative.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GODOT_GDNATIVE_H #define GODOT_GDNATIVE_H diff --git a/modules/gdnative/include/gdnative/node_path.h b/modules/gdnative/include/gdnative/node_path.h index e58c332cdf..2b55e01d13 100644 --- a/modules/gdnative/include/gdnative/node_path.h +++ b/modules/gdnative/include/gdnative/node_path.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GODOT_NODE_PATH_H #define GODOT_NODE_PATH_H diff --git a/modules/gdnative/include/gdnative/plane.h b/modules/gdnative/include/gdnative/plane.h index d40a76374f..6c8a6ae1a4 100644 --- a/modules/gdnative/include/gdnative/plane.h +++ b/modules/gdnative/include/gdnative/plane.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GODOT_PLANE_H #define GODOT_PLANE_H diff --git a/modules/gdnative/include/gdnative/pool_arrays.h b/modules/gdnative/include/gdnative/pool_arrays.h index f91bd4694b..69a93725a8 100644 --- a/modules/gdnative/include/gdnative/pool_arrays.h +++ b/modules/gdnative/include/gdnative/pool_arrays.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GODOT_POOL_ARRAYS_H #define GODOT_POOL_ARRAYS_H diff --git a/modules/gdnative/include/gdnative/quat.h b/modules/gdnative/include/gdnative/quat.h index 3696a303df..4e86960aaf 100644 --- a/modules/gdnative/include/gdnative/quat.h +++ b/modules/gdnative/include/gdnative/quat.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GODOT_QUAT_H #define GODOT_QUAT_H diff --git a/modules/gdnative/include/gdnative/rect2.h b/modules/gdnative/include/gdnative/rect2.h index 7b223b450e..4adcb73e3d 100644 --- a/modules/gdnative/include/gdnative/rect2.h +++ b/modules/gdnative/include/gdnative/rect2.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GODOT_RECT2_H #define GODOT_RECT2_H diff --git a/modules/gdnative/include/gdnative/rid.h b/modules/gdnative/include/gdnative/rid.h index effa89bbbd..0942334ee5 100644 --- a/modules/gdnative/include/gdnative/rid.h +++ b/modules/gdnative/include/gdnative/rid.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GODOT_RID_H #define GODOT_RID_H diff --git a/modules/gdnative/include/gdnative/string.h b/modules/gdnative/include/gdnative/string.h index 90397b0e40..080c0aa171 100644 --- a/modules/gdnative/include/gdnative/string.h +++ b/modules/gdnative/include/gdnative/string.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GODOT_STRING_H #define GODOT_STRING_H diff --git a/modules/gdnative/include/gdnative/string_name.h b/modules/gdnative/include/gdnative/string_name.h index 287f98d523..5068a3d8f9 100644 --- a/modules/gdnative/include/gdnative/string_name.h +++ b/modules/gdnative/include/gdnative/string_name.h @@ -1,9 +1,9 @@ /*************************************************************************/ -/* string_name.h */ +/* string_name.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GODOT_STRING_NAME_H #define GODOT_STRING_NAME_H diff --git a/modules/gdnative/include/gdnative/transform.h b/modules/gdnative/include/gdnative/transform.h index d5e2e9364f..10a242b205 100644 --- a/modules/gdnative/include/gdnative/transform.h +++ b/modules/gdnative/include/gdnative/transform.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GODOT_TRANSFORM_H #define GODOT_TRANSFORM_H diff --git a/modules/gdnative/include/gdnative/transform2d.h b/modules/gdnative/include/gdnative/transform2d.h index c92225a110..aed941f139 100644 --- a/modules/gdnative/include/gdnative/transform2d.h +++ b/modules/gdnative/include/gdnative/transform2d.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GODOT_TRANSFORM2D_H #define GODOT_TRANSFORM2D_H diff --git a/modules/gdnative/include/gdnative/variant.h b/modules/gdnative/include/gdnative/variant.h index af26ab99db..d2e8246bfb 100644 --- a/modules/gdnative/include/gdnative/variant.h +++ b/modules/gdnative/include/gdnative/variant.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GODOT_VARIANT_H #define GODOT_VARIANT_H diff --git a/modules/gdnative/include/gdnative/vector2.h b/modules/gdnative/include/gdnative/vector2.h index c7e7926b0a..af97524dac 100644 --- a/modules/gdnative/include/gdnative/vector2.h +++ b/modules/gdnative/include/gdnative/vector2.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GODOT_VECTOR2_H #define GODOT_VECTOR2_H diff --git a/modules/gdnative/include/gdnative/vector3.h b/modules/gdnative/include/gdnative/vector3.h index c117bad380..e0299a8a30 100644 --- a/modules/gdnative/include/gdnative/vector3.h +++ b/modules/gdnative/include/gdnative/vector3.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GODOT_VECTOR3_H #define GODOT_VECTOR3_H diff --git a/modules/gdnative/include/nativescript/godot_nativescript.h b/modules/gdnative/include/nativescript/godot_nativescript.h index e6fd9d3f84..fdd2a65bb2 100644 --- a/modules/gdnative/include/nativescript/godot_nativescript.h +++ b/modules/gdnative/include/nativescript/godot_nativescript.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GODOT_NATIVESCRIPT_H #define GODOT_NATIVESCRIPT_H diff --git a/modules/gdnative/include/pluginscript/godot_pluginscript.h b/modules/gdnative/include/pluginscript/godot_pluginscript.h index fca29b67ca..671be3bbb9 100644 --- a/modules/gdnative/include/pluginscript/godot_pluginscript.h +++ b/modules/gdnative/include/pluginscript/godot_pluginscript.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* godot_nativescript.h */ +/* godot_pluginscript.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GODOT_PLUGINSCRIPT_H #define GODOT_PLUGINSCRIPT_H diff --git a/modules/gdnative/nativescript/api_generator.cpp b/modules/gdnative/nativescript/api_generator.cpp index 687aa66219..4012e821bb 100644 --- a/modules/gdnative/nativescript/api_generator.cpp +++ b/modules/gdnative/nativescript/api_generator.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "api_generator.h" #ifdef TOOLS_ENABLED diff --git a/modules/gdnative/nativescript/api_generator.h b/modules/gdnative/nativescript/api_generator.h index 23fd0377ad..de234b2f0d 100644 --- a/modules/gdnative/nativescript/api_generator.h +++ b/modules/gdnative/nativescript/api_generator.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef API_GENERATOR_H #define API_GENERATOR_H diff --git a/modules/gdnative/nativescript/godot_nativescript.cpp b/modules/gdnative/nativescript/godot_nativescript.cpp index c9434c404e..b4f7e1555e 100644 --- a/modules/gdnative/nativescript/godot_nativescript.cpp +++ b/modules/gdnative/nativescript/godot_nativescript.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "nativescript/godot_nativescript.h" #include "class_db.h" diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp index 823d794f72..e9e3180835 100644 --- a/modules/gdnative/nativescript/nativescript.cpp +++ b/modules/gdnative/nativescript/nativescript.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "nativescript.h" #include "gdnative/gdnative.h" @@ -789,8 +790,13 @@ NativeScriptInstance::~NativeScriptInstance() { NativeScriptLanguage *NativeScriptLanguage::singleton; -void NativeScriptLanguage::_unload_stuff() { +void NativeScriptLanguage::_unload_stuff(bool p_reload) { for (Map<String, Map<StringName, NativeScriptDesc> >::Element *L = library_classes.front(); L; L = L->next()) { + + if (p_reload && !library_gdnatives[L->key()]->get_library()->is_reloadable()) { + continue; + } + for (Map<StringName, NativeScriptDesc>::Element *C = L->get().front(); C; C = C->next()) { // free property stuff first @@ -1107,10 +1113,16 @@ void NativeReloadNode::_notification(int p_what) { #ifndef NO_THREADS MutexLock lock(NSL->mutex); #endif - NSL->_unload_stuff(); + NSL->_unload_stuff(true); for (Map<String, Ref<GDNative> >::Element *L = NSL->library_gdnatives.front(); L; L = L->next()) { - L->get()->terminate(); + Ref<GDNative> gdn = L->get(); + + if (!gdn->get_library()->is_reloadable()) { + continue; + } + + gdn->terminate(); NSL->library_classes.erase(L->key()); } @@ -1128,21 +1140,23 @@ void NativeReloadNode::_notification(int p_what) { Set<StringName> libs_to_remove; for (Map<String, Ref<GDNative> >::Element *L = NSL->library_gdnatives.front(); L; L = L->next()) { - if (!L->get()->initialize()) { + Ref<GDNative> gdn = L->get(); + + if (!gdn->get_library()->is_reloadable()) { + continue; + } + + if (!gdn->initialize()) { libs_to_remove.insert(L->key()); continue; } NSL->library_classes.insert(L->key(), Map<StringName, NativeScriptDesc>()); - void *args[1] = { - (void *)&L->key() - }; - // here the library registers all the classes and stuff. void *proc_ptr; - Error err = L->get()->get_symbol(L->get()->get_library()->get_symbol_prefix() + "nativescript_init", proc_ptr); + Error err = gdn->get_symbol(gdn->get_library()->get_symbol_prefix() + "nativescript_init", proc_ptr); if (err != OK) { ERR_PRINT(String("No godot_nativescript_init in \"" + L->key() + "\" found").utf8().get_data()); } else { diff --git a/modules/gdnative/nativescript/nativescript.h b/modules/gdnative/nativescript/nativescript.h index 5eefdf1567..ac94c84bc4 100644 --- a/modules/gdnative/nativescript/nativescript.h +++ b/modules/gdnative/nativescript/nativescript.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef NATIVE_SCRIPT_H #define NATIVE_SCRIPT_H @@ -204,7 +205,7 @@ class NativeScriptLanguage : public ScriptLanguage { private: static NativeScriptLanguage *singleton; - void _unload_stuff(); + void _unload_stuff(bool p_reload = false); #ifndef NO_THREADS Mutex *mutex; diff --git a/modules/gdnative/nativescript/register_types.cpp b/modules/gdnative/nativescript/register_types.cpp index d7d2c11d54..cb55a13b3e 100644 --- a/modules/gdnative/nativescript/register_types.cpp +++ b/modules/gdnative/nativescript/register_types.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "register_types.h" #include "io/resource_loader.h" diff --git a/modules/gdnative/nativescript/register_types.h b/modules/gdnative/nativescript/register_types.h index 66cd4c33bb..7389010f8e 100644 --- a/modules/gdnative/nativescript/register_types.h +++ b/modules/gdnative/nativescript/register_types.h @@ -27,5 +27,6 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_nativescript_types(); void unregister_nativescript_types(); diff --git a/modules/gdnative/pluginscript/pluginscript_instance.cpp b/modules/gdnative/pluginscript/pluginscript_instance.cpp index c9e7c60399..52d112bc93 100644 --- a/modules/gdnative/pluginscript/pluginscript_instance.cpp +++ b/modules/gdnative/pluginscript/pluginscript_instance.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/modules/gdnative/pluginscript/pluginscript_instance.h b/modules/gdnative/pluginscript/pluginscript_instance.h index 7848739d9b..3c7b360ad9 100644 --- a/modules/gdnative/pluginscript/pluginscript_instance.h +++ b/modules/gdnative/pluginscript/pluginscript_instance.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/modules/gdnative/pluginscript/pluginscript_language.cpp b/modules/gdnative/pluginscript/pluginscript_language.cpp index 382b28a0bb..2405afc677 100644 --- a/modules/gdnative/pluginscript/pluginscript_language.cpp +++ b/modules/gdnative/pluginscript/pluginscript_language.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/modules/gdnative/pluginscript/pluginscript_language.h b/modules/gdnative/pluginscript/pluginscript_language.h index 5bbd3507e3..709345885b 100644 --- a/modules/gdnative/pluginscript/pluginscript_language.h +++ b/modules/gdnative/pluginscript/pluginscript_language.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/modules/gdnative/pluginscript/pluginscript_loader.cpp b/modules/gdnative/pluginscript/pluginscript_loader.cpp index 62ba41a24e..acba297fa0 100644 --- a/modules/gdnative/pluginscript/pluginscript_loader.cpp +++ b/modules/gdnative/pluginscript/pluginscript_loader.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/modules/gdnative/pluginscript/pluginscript_loader.h b/modules/gdnative/pluginscript/pluginscript_loader.h index 5e59d25d75..9276ea3ef9 100644 --- a/modules/gdnative/pluginscript/pluginscript_loader.h +++ b/modules/gdnative/pluginscript/pluginscript_loader.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/modules/gdnative/pluginscript/pluginscript_script.cpp b/modules/gdnative/pluginscript/pluginscript_script.cpp index 876719820b..b4525ff8aa 100644 --- a/modules/gdnative/pluginscript/pluginscript_script.cpp +++ b/modules/gdnative/pluginscript/pluginscript_script.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/modules/gdnative/pluginscript/pluginscript_script.h b/modules/gdnative/pluginscript/pluginscript_script.h index 9928e115ea..6b343ad844 100644 --- a/modules/gdnative/pluginscript/pluginscript_script.h +++ b/modules/gdnative/pluginscript/pluginscript_script.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/modules/gdnative/pluginscript/register_types.cpp b/modules/gdnative/pluginscript/register_types.cpp index b7c8b6f536..8888f9e157 100644 --- a/modules/gdnative/pluginscript/register_types.cpp +++ b/modules/gdnative/pluginscript/register_types.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "register_types.h" #include "core/project_settings.h" diff --git a/modules/gdnative/pluginscript/register_types.h b/modules/gdnative/pluginscript/register_types.h index be2b1ca4c8..76651aa986 100644 --- a/modules/gdnative/pluginscript/register_types.h +++ b/modules/gdnative/pluginscript/register_types.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -27,5 +27,6 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_pluginscript_types(); void unregister_pluginscript_types(); diff --git a/modules/gdnative/register_types.cpp b/modules/gdnative/register_types.cpp index 21330dfefd..a0b6fbeb75 100644 --- a/modules/gdnative/register_types.cpp +++ b/modules/gdnative/register_types.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "register_types.h" #include "gdnative/gdnative.h" diff --git a/modules/gdnative/register_types.h b/modules/gdnative/register_types.h index 39d47dccb0..4549687f55 100644 --- a/modules/gdnative/register_types.h +++ b/modules/gdnative/register_types.h @@ -27,5 +27,6 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_gdnative_types(); void unregister_gdnative_types(); diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index 11c13ce2ea..228c7dc56f 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "gdscript.h" #include "engine.h" diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h index d669fd6664..b5bbaa6dc9 100644 --- a/modules/gdscript/gdscript.h +++ b/modules/gdscript/gdscript.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GDSCRIPT_H #define GDSCRIPT_H diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp index 360cce9ca0..f380bedf7f 100644 --- a/modules/gdscript/gdscript_compiler.cpp +++ b/modules/gdscript/gdscript_compiler.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "gdscript_compiler.h" #include "gdscript.h" diff --git a/modules/gdscript/gdscript_compiler.h b/modules/gdscript/gdscript_compiler.h index 4b35898bb0..62aafdbe01 100644 --- a/modules/gdscript/gdscript_compiler.h +++ b/modules/gdscript/gdscript_compiler.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GDSCRIPT_COMPILER_H #define GDSCRIPT_COMPILER_H diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index 9dcaaf828f..bcfe8525b4 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "gdscript.h" #include "core/engine.h" diff --git a/modules/gdscript/gdscript_function.cpp b/modules/gdscript/gdscript_function.cpp index 3023b489e5..a2f449909f 100644 --- a/modules/gdscript/gdscript_function.cpp +++ b/modules/gdscript/gdscript_function.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "gdscript_function.h" #include "gdscript.h" diff --git a/modules/gdscript/gdscript_function.h b/modules/gdscript/gdscript_function.h index e499820954..9310444c7a 100644 --- a/modules/gdscript/gdscript_function.h +++ b/modules/gdscript/gdscript_function.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GDSCRIPT_FUNCTION_H #define GDSCRIPT_FUNCTION_H diff --git a/modules/gdscript/gdscript_functions.cpp b/modules/gdscript/gdscript_functions.cpp index cae3bcadfe..f15f2197da 100644 --- a/modules/gdscript/gdscript_functions.cpp +++ b/modules/gdscript/gdscript_functions.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "gdscript_functions.h" #include "class_db.h" diff --git a/modules/gdscript/gdscript_functions.h b/modules/gdscript/gdscript_functions.h index 5bbd848339..1d54006084 100644 --- a/modules/gdscript/gdscript_functions.h +++ b/modules/gdscript/gdscript_functions.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GDSCRIPT_FUNCTIONS_H #define GDSCRIPT_FUNCTIONS_H diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 4b3feb49b9..2a6d37812e 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "gdscript_parser.h" #include "gdscript.h" diff --git a/modules/gdscript/gdscript_parser.h b/modules/gdscript/gdscript_parser.h index 1b851434db..485ba1263d 100644 --- a/modules/gdscript/gdscript_parser.h +++ b/modules/gdscript/gdscript_parser.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GDSCRIPT_PARSER_H #define GDSCRIPT_PARSER_H diff --git a/modules/gdscript/gdscript_tokenizer.cpp b/modules/gdscript/gdscript_tokenizer.cpp index 281aa6ca44..6a844cd651 100644 --- a/modules/gdscript/gdscript_tokenizer.cpp +++ b/modules/gdscript/gdscript_tokenizer.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "gdscript_tokenizer.h" #include "gdscript_functions.h" diff --git a/modules/gdscript/gdscript_tokenizer.h b/modules/gdscript/gdscript_tokenizer.h index 9a09058cf3..b020c85199 100644 --- a/modules/gdscript/gdscript_tokenizer.h +++ b/modules/gdscript/gdscript_tokenizer.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GDSCRIPT_TOKENIZER_H #define GDSCRIPT_TOKENIZER_H diff --git a/modules/gdscript/register_types.cpp b/modules/gdscript/register_types.cpp index 50f5da9995..95efcda80f 100644 --- a/modules/gdscript/register_types.cpp +++ b/modules/gdscript/register_types.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "register_types.h" #include "gdscript.h" diff --git a/modules/gdscript/register_types.h b/modules/gdscript/register_types.h index 21ad85f12e..2b88a67c7e 100644 --- a/modules/gdscript/register_types.h +++ b/modules/gdscript/register_types.h @@ -27,5 +27,6 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_gdscript_types(); void unregister_gdscript_types(); diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index 9a03bc410a..e8e9419af8 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "grid_map.h" #include "message_queue.h" #include "scene/3d/light.h" diff --git a/modules/gridmap/grid_map.h b/modules/gridmap/grid_map.h index 7b97fe3183..b17fe43ae8 100644 --- a/modules/gridmap/grid_map.h +++ b/modules/gridmap/grid_map.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GRID_MAP_H #define GRID_MAP_H diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp index dc7dbb0b0d..7b7bc0fa2a 100644 --- a/modules/gridmap/grid_map_editor_plugin.cpp +++ b/modules/gridmap/grid_map_editor_plugin.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "grid_map_editor_plugin.h" #include "editor/editor_scale.h" #include "editor/editor_settings.h" diff --git a/modules/gridmap/grid_map_editor_plugin.h b/modules/gridmap/grid_map_editor_plugin.h index a49b44e7a2..3fc92bf7aa 100644 --- a/modules/gridmap/grid_map_editor_plugin.h +++ b/modules/gridmap/grid_map_editor_plugin.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GRID_MAP_EDITOR_PLUGIN_H #define GRID_MAP_EDITOR_PLUGIN_H diff --git a/modules/gridmap/register_types.cpp b/modules/gridmap/register_types.cpp index 23a8d16497..a3ceea10af 100644 --- a/modules/gridmap/register_types.cpp +++ b/modules/gridmap/register_types.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "register_types.h" #ifndef _3D_DISABLED #include "class_db.h" diff --git a/modules/gridmap/register_types.h b/modules/gridmap/register_types.h index 0e19f1ce8d..4ff107bec8 100644 --- a/modules/gridmap/register_types.h +++ b/modules/gridmap/register_types.h @@ -27,5 +27,6 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_gridmap_types(); void unregister_gridmap_types(); diff --git a/modules/hdr/image_loader_hdr.cpp b/modules/hdr/image_loader_hdr.cpp index 2b829ef246..3cc362b5d6 100644 --- a/modules/hdr/image_loader_hdr.cpp +++ b/modules/hdr/image_loader_hdr.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "image_loader_hdr.h" #include "os/os.h" diff --git a/modules/hdr/image_loader_hdr.h b/modules/hdr/image_loader_hdr.h index 4d4edc4df7..3cce483745 100644 --- a/modules/hdr/image_loader_hdr.h +++ b/modules/hdr/image_loader_hdr.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef IMAGE_LOADER_HDR_H #define IMAGE_LOADER_HDR_H diff --git a/modules/hdr/register_types.cpp b/modules/hdr/register_types.cpp index 469fdfc85e..8688daad69 100644 --- a/modules/hdr/register_types.cpp +++ b/modules/hdr/register_types.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "register_types.h" #include "image_loader_hdr.h" diff --git a/modules/hdr/register_types.h b/modules/hdr/register_types.h index b3f69405f2..e064f5d945 100644 --- a/modules/hdr/register_types.h +++ b/modules/hdr/register_types.h @@ -27,5 +27,6 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_hdr_types(); void unregister_hdr_types(); diff --git a/modules/jpg/image_loader_jpegd.cpp b/modules/jpg/image_loader_jpegd.cpp index b90d968753..0168be3a26 100644 --- a/modules/jpg/image_loader_jpegd.cpp +++ b/modules/jpg/image_loader_jpegd.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "image_loader_jpegd.h" #include "os/os.h" diff --git a/modules/jpg/image_loader_jpegd.h b/modules/jpg/image_loader_jpegd.h index b4bcb11239..3e3ac5217f 100644 --- a/modules/jpg/image_loader_jpegd.h +++ b/modules/jpg/image_loader_jpegd.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef IMAGE_LOADER_JPG_H #define IMAGE_LOADER_JPG_H diff --git a/modules/jpg/register_types.cpp b/modules/jpg/register_types.cpp index 809c934be4..450ac065f4 100644 --- a/modules/jpg/register_types.cpp +++ b/modules/jpg/register_types.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "register_types.h" #include "image_loader_jpegd.h" diff --git a/modules/jpg/register_types.h b/modules/jpg/register_types.h index d38fb908d3..6f10c18c12 100644 --- a/modules/jpg/register_types.h +++ b/modules/jpg/register_types.h @@ -27,5 +27,6 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_jpg_types(); void unregister_jpg_types(); diff --git a/modules/mobile_vr/mobile_interface.cpp b/modules/mobile_vr/mobile_interface.cpp index 4e8894f9fb..07a81e07b0 100644 --- a/modules/mobile_vr/mobile_interface.cpp +++ b/modules/mobile_vr/mobile_interface.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/modules/mobile_vr/mobile_interface.h b/modules/mobile_vr/mobile_interface.h index 4a2484667d..bb84281b46 100644 --- a/modules/mobile_vr/mobile_interface.h +++ b/modules/mobile_vr/mobile_interface.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef MOBILE_VR_INTERFACE_H #define MOBILE_VR_INTERFACE_H diff --git a/modules/mobile_vr/register_types.cpp b/modules/mobile_vr/register_types.cpp index 6a513607fa..0655727a4a 100644 --- a/modules/mobile_vr/register_types.cpp +++ b/modules/mobile_vr/register_types.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "register_types.h" #include "mobile_interface.h" diff --git a/modules/mobile_vr/register_types.h b/modules/mobile_vr/register_types.h index d9625d1bba..621f8dea80 100644 --- a/modules/mobile_vr/register_types.h +++ b/modules/mobile_vr/register_types.h @@ -27,5 +27,6 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_mobile_vr_types(); void unregister_mobile_vr_types(); diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index f95a3dab2d..949c636050 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "csharp_script.h" #include <mono/metadata/threads.h> @@ -913,19 +914,23 @@ bool CSharpInstance::set(const StringName &p_name, const Variant &p_value) { ERR_FAIL_COND_V(!script.is_valid(), false); + MonoObject *mono_object = get_mono_object(); + ERR_FAIL_NULL_V(mono_object, false); + GDMonoClass *top = script->script_class; while (top && top != script->native) { GDMonoField *field = script->script_class->get_field(p_name); if (field) { - MonoObject *mono_object = get_mono_object(); - - ERR_EXPLAIN("Reference has been garbage collected?"); - ERR_FAIL_NULL_V(mono_object, false); + field->set_value_from_variant(mono_object, p_value); + return true; + } - field->set_value(mono_object, p_value); + GDMonoProperty *property = script->script_class->get_property(p_name); + if (property) { + property->set_value(mono_object, GDMonoMarshal::variant_to_mono_object(p_value)); return true; } @@ -934,16 +939,15 @@ bool CSharpInstance::set(const StringName &p_name, const Variant &p_value) { // Call _set - Variant name = p_name; - const Variant *args[2] = { &name, &p_value }; - - MonoObject *mono_object = get_mono_object(); top = script->script_class; while (top && top != script->native) { GDMonoMethod *method = top->get_method(CACHED_STRING_NAME(_set), 2); if (method) { + Variant name = p_name; + const Variant *args[2] = { &name, &p_value }; + MonoObject *ret = method->invoke(mono_object, args); if (ret && GDMonoMarshal::unbox<MonoBoolean>(ret) == true) @@ -960,31 +964,49 @@ bool CSharpInstance::get(const StringName &p_name, Variant &r_ret) const { ERR_FAIL_COND_V(!script.is_valid(), false); + MonoObject *mono_object = get_mono_object(); + ERR_FAIL_NULL_V(mono_object, false); + GDMonoClass *top = script->script_class; while (top && top != script->native) { GDMonoField *field = top->get_field(p_name); if (field) { - MonoObject *mono_object = get_mono_object(); - - ERR_EXPLAIN("Reference has been garbage collected?"); - ERR_FAIL_NULL_V(mono_object, false); - MonoObject *value = field->get_value(mono_object); r_ret = GDMonoMarshal::mono_object_to_variant(value, field->get_type()); return true; } - // Call _get + GDMonoProperty *property = top->get_property(p_name); + + if (property) { + MonoObject *exc = NULL; + MonoObject *value = property->get_value(mono_object, &exc); + if (exc) { + r_ret = Variant(); + GDMonoUtils::print_unhandled_exception(exc); + } else { + r_ret = GDMonoMarshal::mono_object_to_variant(value, property->get_type()); + } + return true; + } + top = top->get_parent_class(); + } + + // Call _get + + top = script->script_class; + + while (top && top != script->native) { GDMonoMethod *method = top->get_method(CACHED_STRING_NAME(_get), 1); if (method) { Variant name = p_name; const Variant *args[1] = { &name }; - MonoObject *ret = method->invoke(get_mono_object(), args); + MonoObject *ret = method->invoke(mono_object, args); if (ret) { r_ret = GDMonoMarshal::mono_object_to_variant(ret); @@ -1186,6 +1208,20 @@ bool CSharpInstance::refcount_decremented() { return ref_dying; } +ScriptInstance::RPCMode CSharpInstance::_member_get_rpc_mode(GDMonoClassMember *p_member) const { + + if (p_member->has_attribute(CACHED_CLASS(RemoteAttribute))) + return RPC_MODE_REMOTE; + if (p_member->has_attribute(CACHED_CLASS(SyncAttribute))) + return RPC_MODE_SYNC; + if (p_member->has_attribute(CACHED_CLASS(MasterAttribute))) + return RPC_MODE_MASTER; + if (p_member->has_attribute(CACHED_CLASS(SlaveAttribute))) + return RPC_MODE_SLAVE; + + return RPC_MODE_DISABLED; +} + ScriptInstance::RPCMode CSharpInstance::get_rpc_mode(const StringName &p_method) const { GDMonoClass *top = script->script_class; @@ -1193,17 +1229,8 @@ ScriptInstance::RPCMode CSharpInstance::get_rpc_mode(const StringName &p_method) while (top && top != script->native) { GDMonoMethod *method = top->get_method(p_method); - if (method) { // TODO should we reject static methods? - // TODO cache result - if (method->has_attribute(CACHED_CLASS(RemoteAttribute))) - return RPC_MODE_REMOTE; - if (method->has_attribute(CACHED_CLASS(SyncAttribute))) - return RPC_MODE_SYNC; - if (method->has_attribute(CACHED_CLASS(MasterAttribute))) - return RPC_MODE_MASTER; - if (method->has_attribute(CACHED_CLASS(SlaveAttribute))) - return RPC_MODE_SLAVE; - } + if (method && !method->is_static()) + return _member_get_rpc_mode(method); top = top->get_parent_class(); } @@ -1218,17 +1245,13 @@ ScriptInstance::RPCMode CSharpInstance::get_rset_mode(const StringName &p_variab while (top && top != script->native) { GDMonoField *field = top->get_field(p_variable); - if (field) { // TODO should we reject static fields? - // TODO cache result - if (field->has_attribute(CACHED_CLASS(RemoteAttribute))) - return RPC_MODE_REMOTE; - if (field->has_attribute(CACHED_CLASS(SyncAttribute))) - return RPC_MODE_SYNC; - if (field->has_attribute(CACHED_CLASS(MasterAttribute))) - return RPC_MODE_MASTER; - if (field->has_attribute(CACHED_CLASS(SlaveAttribute))) - return RPC_MODE_SLAVE; - } + if (field && !field->is_static()) + return _member_get_rpc_mode(field); + + GDMonoProperty *property = top->get_property(p_variable); + + if (property && !property->is_static()) + return _member_get_rpc_mode(property); top = top->get_parent_class(); } @@ -1353,7 +1376,7 @@ bool CSharpScript::_update_exports() { // We are creating a temporary new instance of the class here to get the default value // TODO Workaround. Should be replaced with IL opcodes analysis - MonoObject *tmp_object = mono_object_new(SCRIPTS_DOMAIN, script_class->get_raw()); + MonoObject *tmp_object = mono_object_new(SCRIPTS_DOMAIN, script_class->get_mono_ptr()); if (tmp_object) { CACHED_FIELD(GodotObject, ptr)->set_value_raw(tmp_object, tmp_object); // FIXME WTF is this workaround @@ -1376,65 +1399,55 @@ bool CSharpScript::_update_exports() { GDMonoClass *top = script_class; while (top && top != native) { + PropertyInfo prop_info; + bool exported; + const Vector<GDMonoField *> &fields = top->get_all_fields(); for (int i = fields.size() - 1; i >= 0; i--) { GDMonoField *field = fields[i]; - if (field->is_static()) { - if (field->has_attribute(CACHED_CLASS(ExportAttribute))) - ERR_PRINTS("Cannot export field because it is static: " + top->get_full_name() + "." + field->get_name()); - continue; - } - - String name = field->get_name(); - StringName cname = name; + if (_get_member_export(top, field, prop_info, exported)) { + StringName name = field->get_name(); - if (member_info.has(cname)) - continue; + if (exported) { + member_info[name] = prop_info; + exported_members_cache.push_front(prop_info); - ManagedType field_type = field->get_type(); - Variant::Type type = GDMonoMarshal::managed_to_variant_type(field_type); + if (tmp_object) { + exported_members_defval_cache[name] = GDMonoMarshal::mono_object_to_variant(field->get_value(tmp_object)); + } + } else { + member_info[name] = prop_info; + } + } + } - if (field->has_attribute(CACHED_CLASS(ExportAttribute))) { - // Field has Export attribute - MonoObject *attr = field->get_attribute(CACHED_CLASS(ExportAttribute)); + const Vector<GDMonoProperty *> &properties = top->get_all_properties(); - PropertyHint hint; - String hint_string; + for (int i = properties.size() - 1; i >= 0; i--) { + GDMonoProperty *property = properties[i]; - if (type == Variant::NIL) { - ERR_PRINTS("Unknown type of exported field: " + top->get_full_name() + "." + field->get_name()); - continue; - } else if (type == Variant::INT && field_type.type_encoding == MONO_TYPE_VALUETYPE && mono_class_is_enum(field_type.type_class->get_raw())) { - type = Variant::INT; - hint = PROPERTY_HINT_ENUM; + if (_get_member_export(top, property, prop_info, exported)) { + StringName name = property->get_name(); - Vector<MonoClassField *> fields = field_type.type_class->get_enum_fields(); + if (exported) { + member_info[name] = prop_info; + exported_members_cache.push_front(prop_info); - for (int i = 0; i < fields.size(); i++) { - if (i > 0) - hint_string += ","; - hint_string += mono_field_get_name(fields[i]); + if (tmp_object) { + MonoObject *exc = NULL; + MonoObject *ret = property->get_value(tmp_object, &exc); + if (exc) { + exported_members_defval_cache[name] = Variant(); + GDMonoUtils::print_unhandled_exception(exc); + } else { + exported_members_defval_cache[name] = GDMonoMarshal::mono_object_to_variant(ret); + } } - } else if (type == Variant::OBJECT && CACHED_CLASS(GodotReference)->is_assignable_from(field_type.type_class)) { - hint = PROPERTY_HINT_RESOURCE_TYPE; - hint_string = NATIVE_GDMONOCLASS_NAME(field_type.type_class); } else { - hint = PropertyHint(CACHED_FIELD(ExportAttribute, hint)->get_int_value(attr)); - hint_string = CACHED_FIELD(ExportAttribute, hintString)->get_string_value(attr); + member_info[name] = prop_info; } - - PropertyInfo prop_info = PropertyInfo(type, name, hint, hint_string, PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_SCRIPT_VARIABLE); - - member_info[cname] = prop_info; - exported_members_cache.push_front(prop_info); - - if (tmp_object) { - exported_members_defval_cache[cname] = GDMonoMarshal::mono_object_to_variant(field->get_value(tmp_object)); - } - } else { - member_info[cname] = PropertyInfo(type, name, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_SCRIPT_VARIABLE); } } @@ -1458,6 +1471,77 @@ bool CSharpScript::_update_exports() { return false; } +bool CSharpScript::_get_member_export(GDMonoClass *p_class, GDMonoClassMember *p_member, PropertyInfo &r_prop_info, bool &r_exported) { + + StringName name = p_member->get_name(); + + if (p_member->is_static()) { + if (p_member->has_attribute(CACHED_CLASS(ExportAttribute))) + ERR_PRINTS("Cannot export member because it is static: " + p_class->get_full_name() + "." + name.operator String()); + return false; + } + + if (member_info.has(name)) + return false; + + ManagedType type; + + if (p_member->get_member_type() == GDMonoClassMember::MEMBER_TYPE_FIELD) { + type = static_cast<GDMonoField *>(p_member)->get_type(); + } else if (p_member->get_member_type() == GDMonoClassMember::MEMBER_TYPE_PROPERTY) { + type = static_cast<GDMonoProperty *>(p_member)->get_type(); + } else { + CRASH_NOW(); + } + + Variant::Type variant_type = GDMonoMarshal::managed_to_variant_type(type); + + if (p_member->has_attribute(CACHED_CLASS(ExportAttribute))) { + if (p_member->get_member_type() == GDMonoClassMember::MEMBER_TYPE_PROPERTY) { + GDMonoProperty *property = static_cast<GDMonoProperty *>(p_member); + if (!property->has_getter() || !property->has_setter()) { + ERR_PRINTS("Cannot export property because it does not provide a getter or a setter: " + p_class->get_full_name() + "." + name.operator String()); + return false; + } + } + + MonoObject *attr = p_member->get_attribute(CACHED_CLASS(ExportAttribute)); + + PropertyHint hint; + String hint_string; + + if (variant_type == Variant::NIL) { + ERR_PRINTS("Unknown type of exported member: " + p_class->get_full_name() + "." + name.operator String()); + return false; + } else if (variant_type == Variant::INT && type.type_encoding == MONO_TYPE_VALUETYPE && mono_class_is_enum(type.type_class->get_mono_ptr())) { + variant_type = Variant::INT; + hint = PROPERTY_HINT_ENUM; + + Vector<MonoClassField *> fields = type.type_class->get_enum_fields(); + + for (int i = 0; i < fields.size(); i++) { + if (i > 0) + hint_string += ","; + hint_string += mono_field_get_name(fields[i]); + } + } else if (variant_type == Variant::OBJECT && CACHED_CLASS(GodotReference)->is_assignable_from(type.type_class)) { + hint = PROPERTY_HINT_RESOURCE_TYPE; + hint_string = NATIVE_GDMONOCLASS_NAME(type.type_class); + } else { + hint = PropertyHint(CACHED_FIELD(ExportAttribute, hint)->get_int_value(attr)); + hint_string = CACHED_FIELD(ExportAttribute, hintString)->get_string_value(attr); + } + + r_prop_info = PropertyInfo(variant_type, name.operator String(), hint, hint_string, PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_SCRIPT_VARIABLE); + r_exported = true; + } else { + r_prop_info = PropertyInfo(variant_type, name.operator String(), PROPERTY_HINT_NONE, "", PROPERTY_USAGE_SCRIPT_VARIABLE); + r_exported = false; + } + + return true; +} + void CSharpScript::_clear() { tool = false; @@ -1626,7 +1710,7 @@ CSharpInstance *CSharpScript::_create_instance(const Variant **p_args, int p_arg /* STEP 2, INITIALIZE AND CONSTRUCT */ - MonoObject *mono_object = mono_object_new(SCRIPTS_DOMAIN, script_class->get_raw()); + MonoObject *mono_object = mono_object_new(SCRIPTS_DOMAIN, script_class->get_mono_ptr()); if (!mono_object) { instance->script = Ref<CSharpScript>(); diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h index 27e68a7a56..171601f3d8 100644 --- a/modules/mono/csharp_script.h +++ b/modules/mono/csharp_script.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef CSHARP_SCRIPT_H #define CSHARP_SCRIPT_H @@ -104,6 +105,8 @@ class CSharpScript : public Script { void _clear(); bool _update_exports(); + bool _get_member_export(GDMonoClass *p_class, GDMonoClassMember *p_member, PropertyInfo &r_prop_info, bool &r_exported); + CSharpInstance *_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_isref, Variant::CallError &r_error); Variant _new(const Variant **p_args, int p_argcount, Variant::CallError &r_error); @@ -178,6 +181,8 @@ class CSharpInstance : public ScriptInstance { void _call_multilevel(MonoObject *p_mono_object, const StringName &p_method, const Variant **p_args, int p_argcount); + RPCMode _member_get_rpc_mode(GDMonoClassMember *p_member) const; + public: MonoObject *get_mono_object() const; diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp index 0e41e00f30..2205ac4e98 100644 --- a/modules/mono/editor/bindings_generator.cpp +++ b/modules/mono/editor/bindings_generator.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "bindings_generator.h" #ifdef DEBUG_METHODS_ENABLED diff --git a/modules/mono/editor/bindings_generator.h b/modules/mono/editor/bindings_generator.h index 9da7add867..717a6b7a6b 100644 --- a/modules/mono/editor/bindings_generator.h +++ b/modules/mono/editor/bindings_generator.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef BINDINGS_GENERATOR_H #define BINDINGS_GENERATOR_H diff --git a/modules/mono/editor/csharp_project.cpp b/modules/mono/editor/csharp_project.cpp index 89e72e5c4b..e4269b0aec 100644 --- a/modules/mono/editor/csharp_project.cpp +++ b/modules/mono/editor/csharp_project.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "csharp_project.h" #include "os/os.h" diff --git a/modules/mono/editor/csharp_project.h b/modules/mono/editor/csharp_project.h index 59277664b2..381dd17e02 100644 --- a/modules/mono/editor/csharp_project.h +++ b/modules/mono/editor/csharp_project.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef CSHARP_PROJECT_H #define CSHARP_PROJECT_H diff --git a/modules/mono/editor/godotsharp_builds.cpp b/modules/mono/editor/godotsharp_builds.cpp index 58d26a0f83..6b41b10981 100644 --- a/modules/mono/editor/godotsharp_builds.cpp +++ b/modules/mono/editor/godotsharp_builds.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "godotsharp_builds.h" #include "main/main.h" @@ -446,7 +447,7 @@ void GodotSharpBuilds::BuildProcess::start(bool p_blocking) { GDMonoClass *klass = GDMono::get_singleton()->get_editor_tools_assembly()->get_class("GodotSharpTools.Build", "BuildInstance"); - MonoObject *mono_object = mono_object_new(mono_domain_get(), klass->get_raw()); + MonoObject *mono_object = mono_object_new(mono_domain_get(), klass->get_mono_ptr()); // Construct diff --git a/modules/mono/editor/godotsharp_builds.h b/modules/mono/editor/godotsharp_builds.h index 956f8f6253..5d2390ecd9 100644 --- a/modules/mono/editor/godotsharp_builds.h +++ b/modules/mono/editor/godotsharp_builds.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GODOTSHARP_BUILDS_H #define GODOTSHARP_BUILDS_H diff --git a/modules/mono/editor/godotsharp_editor.cpp b/modules/mono/editor/godotsharp_editor.cpp index f964fac8e9..da0a7b4fbd 100644 --- a/modules/mono/editor/godotsharp_editor.cpp +++ b/modules/mono/editor/godotsharp_editor.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "godotsharp_editor.h" #include "core/os/os.h" diff --git a/modules/mono/editor/godotsharp_editor.h b/modules/mono/editor/godotsharp_editor.h index f9b4fb42fb..1b83bae1cd 100644 --- a/modules/mono/editor/godotsharp_editor.h +++ b/modules/mono/editor/godotsharp_editor.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GODOTSHARP_EDITOR_H #define GODOTSHARP_EDITOR_H diff --git a/modules/mono/editor/mono_bottom_panel.cpp b/modules/mono/editor/mono_bottom_panel.cpp index 7c8d822037..43689548b5 100644 --- a/modules/mono/editor/mono_bottom_panel.cpp +++ b/modules/mono/editor/mono_bottom_panel.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "mono_bottom_panel.h" #include "../csharp_script.h" diff --git a/modules/mono/editor/mono_bottom_panel.h b/modules/mono/editor/mono_bottom_panel.h index d7573361ab..a44d3a9af8 100644 --- a/modules/mono/editor/mono_bottom_panel.h +++ b/modules/mono/editor/mono_bottom_panel.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef MONO_BOTTOM_PANEL_H #define MONO_BOTTOM_PANEL_H diff --git a/modules/mono/editor/mono_build_info.h b/modules/mono/editor/mono_build_info.h index 115fc9ea55..4806764a61 100644 --- a/modules/mono/editor/mono_build_info.h +++ b/modules/mono/editor/mono_build_info.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef MONO_BUILD_INFO_H #define MONO_BUILD_INFO_H diff --git a/modules/mono/editor/monodevelop_instance.cpp b/modules/mono/editor/monodevelop_instance.cpp index 57b3382bff..0b0b36e1e3 100644 --- a/modules/mono/editor/monodevelop_instance.cpp +++ b/modules/mono/editor/monodevelop_instance.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "monodevelop_instance.h" #include "../mono_gd/gd_mono.h" @@ -62,7 +63,7 @@ MonoDevelopInstance::MonoDevelopInstance(const String &p_solution) { GDMonoClass *klass = GDMono::get_singleton()->get_editor_tools_assembly()->get_class("GodotSharpTools.Editor", "MonoDevelopInstance"); - MonoObject *obj = mono_object_new(TOOLS_DOMAIN, klass->get_raw()); + MonoObject *obj = mono_object_new(TOOLS_DOMAIN, klass->get_mono_ptr()); GDMonoMethod *ctor = klass->get_method(".ctor", 1); MonoObject *ex = NULL; diff --git a/modules/mono/editor/monodevelop_instance.h b/modules/mono/editor/monodevelop_instance.h index 783d12325f..7e8a76b595 100644 --- a/modules/mono/editor/monodevelop_instance.h +++ b/modules/mono/editor/monodevelop_instance.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef MONODEVELOP_INSTANCE_H #define MONODEVELOP_INSTANCE_H diff --git a/modules/mono/editor/net_solution.cpp b/modules/mono/editor/net_solution.cpp index b9df5b5327..dab96e44e9 100644 --- a/modules/mono/editor/net_solution.cpp +++ b/modules/mono/editor/net_solution.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "net_solution.h" #include "os/dir_access.h" diff --git a/modules/mono/editor/net_solution.h b/modules/mono/editor/net_solution.h index 21af1938cb..293e86917a 100644 --- a/modules/mono/editor/net_solution.h +++ b/modules/mono/editor/net_solution.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef NET_SOLUTION_H #define NET_SOLUTION_H diff --git a/modules/mono/glue/glue_header.h b/modules/mono/glue/glue_header.h index 1d64fa4d72..32988c5afa 100644 --- a/modules/mono/glue/glue_header.h +++ b/modules/mono/glue/glue_header.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "../csharp_script.h" #include "../mono_gd/gd_mono_class.h" #include "../mono_gd/gd_mono_internals.h" diff --git a/modules/mono/godotsharp_defs.h b/modules/mono/godotsharp_defs.h index 1679eb6242..4c26c3e6bd 100644 --- a/modules/mono/godotsharp_defs.h +++ b/modules/mono/godotsharp_defs.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GODOTSHARP_DEFS_H #define GODOTSHARP_DEFS_H diff --git a/modules/mono/godotsharp_dirs.cpp b/modules/mono/godotsharp_dirs.cpp index a2965080d6..92c5cdc5c1 100644 --- a/modules/mono/godotsharp_dirs.cpp +++ b/modules/mono/godotsharp_dirs.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "godotsharp_dirs.h" #include "os/os.h" diff --git a/modules/mono/godotsharp_dirs.h b/modules/mono/godotsharp_dirs.h index 0e484fea91..e87b5a4150 100644 --- a/modules/mono/godotsharp_dirs.h +++ b/modules/mono/godotsharp_dirs.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GODOTSHARP_DIRS_H #define GODOTSHARP_DIRS_H diff --git a/modules/mono/mono_gc_handle.cpp b/modules/mono/mono_gc_handle.cpp index 5ae12f5ebf..4e82bcd03e 100644 --- a/modules/mono/mono_gc_handle.cpp +++ b/modules/mono/mono_gc_handle.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "mono_gc_handle.h" #include "mono_gd/gd_mono.h" diff --git a/modules/mono/mono_gc_handle.h b/modules/mono/mono_gc_handle.h index 565f5d4f76..9cb3ef0fbb 100644 --- a/modules/mono/mono_gc_handle.h +++ b/modules/mono/mono_gc_handle.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef CSHARP_GC_HANDLE_H #define CSHARP_GC_HANDLE_H diff --git a/modules/mono/mono_gd/gd_mono.cpp b/modules/mono/mono_gd/gd_mono.cpp index 5b65f020fc..d4df7e0cb2 100644 --- a/modules/mono/mono_gd/gd_mono.cpp +++ b/modules/mono/mono_gd/gd_mono.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "gd_mono.h" #include <mono/metadata/exception.h> @@ -52,8 +53,7 @@ void gdmono_unhandled_exception_hook(MonoObject *exc, void *user_data) { (void)user_data; // UNUSED - ERR_PRINT(GDMonoUtils::get_exception_name_and_message(exc).utf8()); - mono_print_unhandled_exception(exc); + GDMonoUtils::print_unhandled_exception(exc); abort(); } diff --git a/modules/mono/mono_gd/gd_mono.h b/modules/mono/mono_gd/gd_mono.h index c565e26de6..67251778c6 100644 --- a/modules/mono/mono_gd/gd_mono.h +++ b/modules/mono/mono_gd/gd_mono.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GD_MONO_H #define GD_MONO_H @@ -112,14 +113,6 @@ public: #endif #endif - enum MemberVisibility { - PRIVATE, - PROTECTED_AND_INTERNAL, // FAM_AND_ASSEM - INTERNAL, // ASSEMBLY - PROTECTED, // FAMILY - PUBLIC - }; - static GDMono *get_singleton() { return singleton; } // Do not use these, unless you know what you're doing diff --git a/modules/mono/mono_gd/gd_mono_assembly.cpp b/modules/mono/mono_gd/gd_mono_assembly.cpp index 7a1bf99a36..ba56ed6ed5 100644 --- a/modules/mono/mono_gd/gd_mono_assembly.cpp +++ b/modules/mono/mono_gd/gd_mono_assembly.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "gd_mono_assembly.h" #include <mono/metadata/mono-debug.h> @@ -318,7 +319,7 @@ GDMonoClass *GDMonoAssembly::get_object_derived_class(const StringName &p_class) void *iter = NULL; while (true) { - MonoClass *raw_nested = mono_class_get_nested_types(current_nested->get_raw(), &iter); + MonoClass *raw_nested = mono_class_get_nested_types(current_nested->get_mono_ptr(), &iter); if (!raw_nested) break; diff --git a/modules/mono/mono_gd/gd_mono_assembly.h b/modules/mono/mono_gd/gd_mono_assembly.h index 9f38202758..8e7aa701bf 100644 --- a/modules/mono/mono_gd/gd_mono_assembly.h +++ b/modules/mono/mono_gd/gd_mono_assembly.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GD_MONO_ASSEMBLY_H #define GD_MONO_ASSEMBLY_H diff --git a/modules/mono/mono_gd/gd_mono_class.cpp b/modules/mono/mono_gd/gd_mono_class.cpp index 2bcce86d8c..d3315568cb 100644 --- a/modules/mono/mono_gd/gd_mono_class.cpp +++ b/modules/mono/mono_gd/gd_mono_class.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "gd_mono_class.h" #include <mono/metadata/attrdefs.h> @@ -35,7 +36,7 @@ MonoType *GDMonoClass::get_raw_type(GDMonoClass *p_class) { - return mono_class_get_type(p_class->get_raw()); + return mono_class_get_type(p_class->get_mono_ptr()); } bool GDMonoClass::is_assignable_from(GDMonoClass *p_from) const { @@ -74,7 +75,7 @@ Vector<MonoClassField *> GDMonoClass::get_enum_fields() { void *iter = NULL; MonoClassField *raw_field = NULL; - while ((raw_field = mono_class_get_fields(get_raw(), &iter)) != NULL) { + while ((raw_field = mono_class_get_fields(get_mono_ptr(), &iter)) != NULL) { uint32_t field_flags = mono_field_get_flags(raw_field); // Enums have an instance field named value__ which holds the value of the enum. @@ -105,7 +106,7 @@ bool GDMonoClass::has_attribute(GDMonoClass *p_attr_class) { if (!attributes) return false; - return mono_custom_attrs_has_attr(attributes, p_attr_class->get_raw()); + return mono_custom_attrs_has_attr(attributes, p_attr_class->get_mono_ptr()); } MonoObject *GDMonoClass::get_attribute(GDMonoClass *p_attr_class) { @@ -120,14 +121,14 @@ MonoObject *GDMonoClass::get_attribute(GDMonoClass *p_attr_class) { if (!attributes) return NULL; - return mono_custom_attrs_get_attr(attributes, p_attr_class->get_raw()); + return mono_custom_attrs_get_attr(attributes, p_attr_class->get_mono_ptr()); } void GDMonoClass::fetch_attributes() { ERR_FAIL_COND(attributes != NULL); - attributes = mono_custom_attrs_from_class(get_raw()); + attributes = mono_custom_attrs_from_class(get_mono_ptr()); attrs_fetched = true; } @@ -140,7 +141,7 @@ void GDMonoClass::fetch_methods_with_godot_api_checks(GDMonoClass *p_native_base void *iter = NULL; MonoMethod *raw_method = NULL; - while ((raw_method = mono_class_get_methods(get_raw(), &iter)) != NULL) { + while ((raw_method = mono_class_get_methods(get_mono_ptr(), &iter)) != NULL) { StringName name = mono_method_get_name(raw_method); GDMonoMethod *method = get_method(raw_method, name); @@ -334,7 +335,7 @@ const Vector<GDMonoField *> &GDMonoClass::get_all_fields() { void *iter = NULL; MonoClassField *raw_field = NULL; - while ((raw_field = mono_class_get_fields(get_raw(), &iter)) != NULL) { + while ((raw_field = mono_class_get_fields(mono_class, &iter)) != NULL) { StringName name = mono_field_get_name(raw_field); Map<StringName, GDMonoField *>::Element *match = fields.find(name); @@ -353,6 +354,54 @@ const Vector<GDMonoField *> &GDMonoClass::get_all_fields() { return fields_list; } +GDMonoProperty *GDMonoClass::get_property(const StringName &p_name) { + + Map<StringName, GDMonoProperty *>::Element *result = properties.find(p_name); + + if (result) + return result->value(); + + if (properties_fetched) + return NULL; + + MonoProperty *raw_property = mono_class_get_property_from_name(mono_class, String(p_name).utf8().get_data()); + + if (raw_property) { + GDMonoProperty *property = memnew(GDMonoProperty(raw_property, this)); + properties.insert(p_name, property); + + return property; + } + + return NULL; +} + +const Vector<GDMonoProperty *> &GDMonoClass::get_all_properties() { + + if (properties_fetched) + return properties_list; + + void *iter = NULL; + MonoProperty *raw_property = NULL; + while ((raw_property = mono_class_get_properties(mono_class, &iter)) != NULL) { + StringName name = mono_property_get_name(raw_property); + + Map<StringName, GDMonoProperty *>::Element *match = properties.find(name); + + if (match) { + properties_list.push_back(match->get()); + } else { + GDMonoProperty *property = memnew(GDMonoProperty(raw_property, this)); + properties.insert(name, property); + properties_list.push_back(property); + } + } + + properties_fetched = true; + + return properties_list; +} + GDMonoClass::GDMonoClass(const StringName &p_namespace, const StringName &p_name, MonoClass *p_class, GDMonoAssembly *p_assembly) { namespace_name = p_namespace; @@ -365,6 +414,7 @@ GDMonoClass::GDMonoClass(const StringName &p_namespace, const StringName &p_name methods_fetched = false; fields_fetched = false; + properties_fetched = false; } GDMonoClass::~GDMonoClass() { @@ -377,6 +427,10 @@ GDMonoClass::~GDMonoClass() { memdelete(E->value()); } + for (Map<StringName, GDMonoProperty *>::Element *E = properties.front(); E; E = E->next()) { + memdelete(E->value()); + } + { // Ugly workaround... // We may have duplicated values, because we redirect snake_case methods to PascalCasel (only Godot API methods). diff --git a/modules/mono/mono_gd/gd_mono_class.h b/modules/mono/mono_gd/gd_mono_class.h index b9d34eef3a..b6052ac0ed 100644 --- a/modules/mono/mono_gd/gd_mono_class.h +++ b/modules/mono/mono_gd/gd_mono_class.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GD_MONO_CLASS_H #define GD_MONO_CLASS_H @@ -38,6 +39,7 @@ #include "gd_mono_field.h" #include "gd_mono_header.h" #include "gd_mono_method.h" +#include "gd_mono_property.h" #include "gd_mono_utils.h" class GDMonoClass { @@ -84,6 +86,10 @@ class GDMonoClass { Map<StringName, GDMonoField *> fields; Vector<GDMonoField *> fields_list; + bool properties_fetched; + Map<StringName, GDMonoProperty *> properties; + Vector<GDMonoProperty *> properties_list; + friend class GDMonoAssembly; GDMonoClass(const StringName &p_namespace, const StringName &p_name, MonoClass *p_class, GDMonoAssembly *p_assembly); @@ -95,7 +101,7 @@ public: _FORCE_INLINE_ StringName get_namespace() const { return namespace_name; } _FORCE_INLINE_ StringName get_name() const { return class_name; } - _FORCE_INLINE_ MonoClass *get_raw() const { return mono_class; } + _FORCE_INLINE_ MonoClass *get_mono_ptr() const { return mono_class; } _FORCE_INLINE_ const GDMonoAssembly *get_assembly() const { return assembly; } String get_full_name() const; @@ -124,6 +130,9 @@ public: GDMonoField *get_field(const StringName &p_name); const Vector<GDMonoField *> &get_all_fields(); + GDMonoProperty *get_property(const StringName &p_name); + const Vector<GDMonoProperty *> &get_all_properties(); + ~GDMonoClass(); }; diff --git a/modules/pbm/bitmap_loader_pbm.h b/modules/mono/mono_gd/gd_mono_class_member.h index d5955adba3..008ea0e416 100644 --- a/modules/pbm/bitmap_loader_pbm.h +++ b/modules/mono/mono_gd/gd_mono_class_member.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* bitmap_loader_pbm.h */ +/* gd_mono_class_member.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -27,21 +27,41 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef BITMAP_LOADER_PBM_H -#define BITMAP_LOADER_PBM_H +#ifndef GD_MONO_CLASS_MEMBER_H +#define GD_MONO_CLASS_MEMBER_H -#include "io/resource_loader.h" +#include "gd_mono_header.h" -/** - @author Juan Linietsky <reduzio@gmail.com> -*/ -class ResourceFormatPBM : public ResourceFormatLoader { +#include <mono/metadata/object.h> +class GDMonoClassMember { public: - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL); - virtual void get_recognized_extensions(List<String> *p_extensions) const; - virtual bool handles_type(const String &p_type) const; - virtual String get_resource_type(const String &p_path) const; + enum Visibility { + PRIVATE, + PROTECTED_AND_INTERNAL, // FAM_AND_ASSEM + INTERNAL, // ASSEMBLY + PROTECTED, // FAMILY + PUBLIC + }; + + enum MemberType { + MEMBER_TYPE_FIELD, + MEMBER_TYPE_PROPERTY, + MEMBER_TYPE_METHOD + }; + + virtual ~GDMonoClassMember() {} + + virtual MemberType get_member_type() = 0; + + virtual StringName get_name() = 0; + + virtual bool is_static() = 0; + + virtual Visibility get_visibility() = 0; + + virtual bool has_attribute(GDMonoClass *p_attr_class) = 0; + virtual MonoObject *get_attribute(GDMonoClass *p_attr_class) = 0; }; -#endif +#endif // GD_MONO_CLASS_MEMBER_H diff --git a/modules/mono/mono_gd/gd_mono_field.cpp b/modules/mono/mono_gd/gd_mono_field.cpp index 133cfc9145..3b91777ed4 100644 --- a/modules/mono/mono_gd/gd_mono_field.cpp +++ b/modules/mono/mono_gd/gd_mono_field.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "gd_mono_field.h" #include <mono/metadata/attrdefs.h> @@ -38,7 +39,7 @@ void GDMonoField::set_value_raw(MonoObject *p_object, void *p_ptr) { mono_field_set_value(p_object, mono_field, &p_ptr); } -void GDMonoField::set_value(MonoObject *p_object, const Variant &p_value) { +void GDMonoField::set_value_from_variant(MonoObject *p_object, const Variant &p_value) { #define SET_FROM_STRUCT_AND_BREAK(m_type) \ { \ const m_type &val = p_value.operator ::m_type(); \ @@ -138,7 +139,7 @@ void GDMonoField::set_value(MonoObject *p_object, const Variant &p_value) { if (tclass == CACHED_CLASS(Plane)) SET_FROM_STRUCT_AND_BREAK(Plane); - if (mono_class_is_enum(tclass->get_raw())) + if (mono_class_is_enum(tclass->get_mono_ptr())) SET_FROM_PRIMITIVE(signed int); ERR_EXPLAIN(String() + "Attempted to set the value of a field of unmarshallable type: " + tclass->get_name()); @@ -264,7 +265,7 @@ void GDMonoField::set_value(MonoObject *p_object, const Variant &p_value) { } break; case MONO_TYPE_GENERICINST: { - if (CACHED_RAW_MONO_CLASS(Dictionary) == type.type_class->get_raw()) { + if (CACHED_RAW_MONO_CLASS(Dictionary) == type.type_class->get_mono_ptr()) { MonoObject *managed = GDMonoMarshal::Dictionary_to_mono_object(p_value.operator Dictionary()); mono_field_set_value(p_object, mono_field, managed); break; @@ -280,6 +281,10 @@ void GDMonoField::set_value(MonoObject *p_object, const Variant &p_value) { #undef SET_FROM_PRIMITIVE } +MonoObject *GDMonoField::get_value(MonoObject *p_object) { + return mono_field_get_value_object(mono_domain_get(), mono_field, p_object); +} + bool GDMonoField::get_bool_value(MonoObject *p_object) { return (bool)GDMonoMarshal::unbox<MonoBoolean>(get_value(p_object)); } @@ -302,7 +307,7 @@ bool GDMonoField::has_attribute(GDMonoClass *p_attr_class) { if (!attributes) return false; - return mono_custom_attrs_has_attr(attributes, p_attr_class->get_raw()); + return mono_custom_attrs_has_attr(attributes, p_attr_class->get_mono_ptr()); } MonoObject *GDMonoField::get_attribute(GDMonoClass *p_attr_class) { @@ -314,12 +319,12 @@ MonoObject *GDMonoField::get_attribute(GDMonoClass *p_attr_class) { if (!attributes) return NULL; - return mono_custom_attrs_get_attr(attributes, p_attr_class->get_raw()); + return mono_custom_attrs_get_attr(attributes, p_attr_class->get_mono_ptr()); } void GDMonoField::fetch_attributes() { ERR_FAIL_COND(attributes != NULL); - attributes = mono_custom_attrs_from_field(owner->get_raw(), get_raw()); + attributes = mono_custom_attrs_from_field(owner->get_mono_ptr(), mono_field); attrs_fetched = true; } @@ -327,26 +332,26 @@ bool GDMonoField::is_static() { return mono_field_get_flags(mono_field) & MONO_FIELD_ATTR_STATIC; } -GDMono::MemberVisibility GDMonoField::get_visibility() { +GDMonoClassMember::Visibility GDMonoField::get_visibility() { switch (mono_field_get_flags(mono_field) & MONO_FIELD_ATTR_FIELD_ACCESS_MASK) { case MONO_FIELD_ATTR_PRIVATE: - return GDMono::PRIVATE; + return GDMonoClassMember::PRIVATE; case MONO_FIELD_ATTR_FAM_AND_ASSEM: - return GDMono::PROTECTED_AND_INTERNAL; + return GDMonoClassMember::PROTECTED_AND_INTERNAL; case MONO_FIELD_ATTR_ASSEMBLY: - return GDMono::INTERNAL; + return GDMonoClassMember::INTERNAL; case MONO_FIELD_ATTR_FAMILY: - return GDMono::PROTECTED; + return GDMonoClassMember::PROTECTED; case MONO_FIELD_ATTR_PUBLIC: - return GDMono::PUBLIC; + return GDMonoClassMember::PUBLIC; default: - ERR_FAIL_V(GDMono::PRIVATE); + ERR_FAIL_V(GDMonoClassMember::PRIVATE); } } -GDMonoField::GDMonoField(MonoClassField *p_raw_field, GDMonoClass *p_owner) { +GDMonoField::GDMonoField(MonoClassField *p_mono_field, GDMonoClass *p_owner) { owner = p_owner; - mono_field = p_raw_field; + mono_field = p_mono_field; name = mono_field_get_name(mono_field); MonoType *field_type = mono_field_get_type(mono_field); type.type_encoding = mono_type_get_type(field_type); diff --git a/modules/mono/mono_gd/gd_mono_field.h b/modules/mono/mono_gd/gd_mono_field.h index a5559df059..a6b368c4d6 100644 --- a/modules/mono/mono_gd/gd_mono_field.h +++ b/modules/mono/mono_gd/gd_mono_field.h @@ -27,47 +27,49 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GDMONOFIELD_H #define GDMONOFIELD_H #include "gd_mono.h" +#include "gd_mono_class_member.h" #include "gd_mono_header.h" -class GDMonoField { +class GDMonoField : public GDMonoClassMember { + GDMonoClass *owner; MonoClassField *mono_field; - String name; + StringName name; ManagedType type; bool attrs_fetched; MonoCustomAttrInfo *attributes; public: - _FORCE_INLINE_ String get_name() const { return name; } - _FORCE_INLINE_ ManagedType get_type() const { return type; } + virtual MemberType get_member_type() { return MEMBER_TYPE_FIELD; } - _FORCE_INLINE_ MonoClassField *get_raw() const { return mono_field; } + virtual StringName get_name() { return name; } + + virtual bool is_static(); + virtual Visibility get_visibility(); + + virtual bool has_attribute(GDMonoClass *p_attr_class); + virtual MonoObject *get_attribute(GDMonoClass *p_attr_class); + void fetch_attributes(); + + _FORCE_INLINE_ ManagedType get_type() const { return type; } void set_value_raw(MonoObject *p_object, void *p_ptr); - void set_value(MonoObject *p_object, const Variant &p_value); + void set_value_from_variant(MonoObject *p_object, const Variant &p_value); - _FORCE_INLINE_ MonoObject *get_value(MonoObject *p_object) { - return mono_field_get_value_object(mono_domain_get(), mono_field, p_object); - } + MonoObject *get_value(MonoObject *p_object); bool get_bool_value(MonoObject *p_object); int get_int_value(MonoObject *p_object); String get_string_value(MonoObject *p_object); - bool has_attribute(GDMonoClass *p_attr_class); - MonoObject *get_attribute(GDMonoClass *p_attr_class); - void fetch_attributes(); - - bool is_static(); - GDMono::MemberVisibility get_visibility(); - - GDMonoField(MonoClassField *p_raw_field, GDMonoClass *p_owner); + GDMonoField(MonoClassField *p_mono_field, GDMonoClass *p_owner); ~GDMonoField(); }; diff --git a/modules/mono/mono_gd/gd_mono_header.h b/modules/mono/mono_gd/gd_mono_header.h index a749aa8768..2b5110f0b9 100644 --- a/modules/mono/mono_gd/gd_mono_header.h +++ b/modules/mono/mono_gd/gd_mono_header.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GD_MONO_HEADER_H #define GD_MONO_HEADER_H @@ -34,8 +35,10 @@ class GDMonoAssembly; class GDMonoClass; -class GDMonoMethod; +class GDMonoClassMember; class GDMonoField; +class GDMonoProperty; +class GDMonoMethod; struct ManagedType { int type_encoding; diff --git a/modules/mono/mono_gd/gd_mono_internals.cpp b/modules/mono/mono_gd/gd_mono_internals.cpp index 95d15c3581..a1a79f957f 100644 --- a/modules/mono/mono_gd/gd_mono_internals.cpp +++ b/modules/mono/mono_gd/gd_mono_internals.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* godotsharp_internals.cpp */ +/* gd_mono_internals.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "gd_mono_internals.h" #include "../csharp_script.h" diff --git a/modules/mono/mono_gd/gd_mono_internals.h b/modules/mono/mono_gd/gd_mono_internals.h index 91f6fcbbc7..abec65e7d4 100644 --- a/modules/mono/mono_gd/gd_mono_internals.h +++ b/modules/mono/mono_gd/gd_mono_internals.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* godotsharp_internals.h */ +/* gd_mono_internals.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GD_MONO_INTERNALS_H #define GD_MONO_INTERNALS_H diff --git a/modules/mono/mono_gd/gd_mono_log.cpp b/modules/mono/mono_gd/gd_mono_log.cpp index f954530552..eabea8dc3c 100644 --- a/modules/mono/mono_gd/gd_mono_log.cpp +++ b/modules/mono/mono_gd/gd_mono_log.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "gd_mono_log.h" #include <mono/utils/mono-logger.h> diff --git a/modules/mono/mono_gd/gd_mono_log.h b/modules/mono/mono_gd/gd_mono_log.h index 4ed5f2a255..a7e374858c 100644 --- a/modules/mono/mono_gd/gd_mono_log.h +++ b/modules/mono/mono_gd/gd_mono_log.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GD_MONO_LOG_H #define GD_MONO_LOG_H diff --git a/modules/mono/mono_gd/gd_mono_marshal.cpp b/modules/mono/mono_gd/gd_mono_marshal.cpp index 48d08b159c..1ec8f41c91 100644 --- a/modules/mono/mono_gd/gd_mono_marshal.cpp +++ b/modules/mono/mono_gd/gd_mono_marshal.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "gd_mono_marshal.h" #include "gd_mono.h" @@ -113,7 +114,7 @@ Variant::Type managed_to_variant_type(const ManagedType &p_type) { if (tclass == CACHED_CLASS(Plane)) return Variant::PLANE; - if (mono_class_is_enum(tclass->get_raw())) + if (mono_class_is_enum(tclass->get_mono_ptr())) return Variant::INT; } break; @@ -164,7 +165,7 @@ Variant::Type managed_to_variant_type(const ManagedType &p_type) { } break; case MONO_TYPE_GENERICINST: { - if (CACHED_RAW_MONO_CLASS(Dictionary) == p_type.type_class->get_raw()) { + if (CACHED_RAW_MONO_CLASS(Dictionary) == p_type.type_class->get_mono_ptr()) { return Variant::DICTIONARY; } } break; @@ -306,9 +307,9 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty if (tclass == CACHED_CLASS(Plane)) RETURN_BOXED_STRUCT(Plane, p_var); - if (mono_class_is_enum(tclass->get_raw())) { + if (mono_class_is_enum(tclass->get_mono_ptr())) { int val = p_var->operator signed int(); - return BOX_ENUM(tclass->get_raw(), val); + return BOX_ENUM(tclass->get_mono_ptr(), val); } } break; @@ -432,7 +433,7 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty } break; case MONO_TYPE_GENERICINST: { - if (CACHED_RAW_MONO_CLASS(Dictionary) == p_type.type_class->get_raw()) { + if (CACHED_RAW_MONO_CLASS(Dictionary) == p_type.type_class->get_mono_ptr()) { return Dictionary_to_mono_object(p_var->operator Dictionary()); } } break; @@ -528,7 +529,7 @@ Variant mono_object_to_variant(MonoObject *p_obj, const ManagedType &p_type) { if (tclass == CACHED_CLASS(Plane)) RETURN_UNBOXED_STRUCT(Plane, p_obj); - if (mono_class_is_enum(tclass->get_raw())) + if (mono_class_is_enum(tclass->get_mono_ptr())) return unbox<int32_t>(p_obj); } break; @@ -585,7 +586,7 @@ Variant mono_object_to_variant(MonoObject *p_obj, const ManagedType &p_type) { } break; case MONO_TYPE_GENERICINST: { - if (CACHED_RAW_MONO_CLASS(Dictionary) == p_type.type_class->get_raw()) { + if (CACHED_RAW_MONO_CLASS(Dictionary) == p_type.type_class->get_mono_ptr()) { return mono_object_to_Dictionary(p_obj); } } break; diff --git a/modules/mono/mono_gd/gd_mono_marshal.h b/modules/mono/mono_gd/gd_mono_marshal.h index 0570415575..727b9fa230 100644 --- a/modules/mono/mono_gd/gd_mono_marshal.h +++ b/modules/mono/mono_gd/gd_mono_marshal.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GDMONOMARSHAL_H #define GDMONOMARSHAL_H diff --git a/modules/mono/mono_gd/gd_mono_method.cpp b/modules/mono/mono_gd/gd_mono_method.cpp index 01afd1e51e..1f8e9a1926 100644 --- a/modules/mono/mono_gd/gd_mono_method.cpp +++ b/modules/mono/mono_gd/gd_mono_method.cpp @@ -27,11 +27,14 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "gd_mono_method.h" #include "gd_mono_class.h" #include "gd_mono_marshal.h" +#include <mono/metadata/attrdefs.h> + void GDMonoMethod::_update_signature() { // Apparently MonoMethodSignature needs not to be freed. // mono_method_signature caches the result, we don't need to cache it ourselves. @@ -41,7 +44,6 @@ void GDMonoMethod::_update_signature() { } void GDMonoMethod::_update_signature(MonoMethodSignature *p_method_sig) { - is_instance = mono_signature_is_instance(p_method_sig); params_count = mono_signature_get_param_count(p_method_sig); MonoType *ret_type = mono_signature_get_return_type(p_method_sig); @@ -61,15 +63,34 @@ void GDMonoMethod::_update_signature(MonoMethodSignature *p_method_sig) { param_type.type_encoding = mono_type_get_type(param_raw_type); - if (param_type.type_encoding != MONO_TYPE_VOID) { - MonoClass *param_type_class = mono_class_from_mono_type(param_raw_type); - param_type.type_class = GDMono::get_singleton()->get_class(param_type_class); - } + MonoClass *param_type_class = mono_class_from_mono_type(param_raw_type); + param_type.type_class = GDMono::get_singleton()->get_class(param_type_class); param_types.push_back(param_type); } } +bool GDMonoMethod::is_static() { + return mono_method_get_flags(mono_method, NULL) & MONO_METHOD_ATTR_STATIC; +} + +GDMonoClassMember::Visibility GDMonoMethod::get_visibility() { + switch (mono_method_get_flags(mono_method, NULL) & MONO_METHOD_ATTR_ACCESS_MASK) { + case MONO_METHOD_ATTR_PRIVATE: + return GDMonoClassMember::PRIVATE; + case MONO_METHOD_ATTR_FAM_AND_ASSEM: + return GDMonoClassMember::PROTECTED_AND_INTERNAL; + case MONO_METHOD_ATTR_ASSEM: + return GDMonoClassMember::INTERNAL; + case MONO_METHOD_ATTR_FAMILY: + return GDMonoClassMember::PROTECTED; + case MONO_METHOD_ATTR_PUBLIC: + return GDMonoClassMember::PUBLIC; + default: + ERR_FAIL_V(GDMonoClassMember::PRIVATE); + } +} + void *GDMonoMethod::get_thunk() { return mono_method_get_unmanaged_thunk(mono_method); } @@ -87,11 +108,11 @@ MonoObject *GDMonoMethod::invoke(MonoObject *p_object, const Variant **p_params, MonoObject *ret = mono_runtime_invoke_array(mono_method, p_object, params, &exc); if (exc) { + ret = NULL; if (r_exc) { *r_exc = exc; } else { - ERR_PRINT(GDMonoUtils::get_exception_name_and_message(exc).utf8()); - mono_print_unhandled_exception(exc); + GDMonoUtils::print_unhandled_exception(exc); } } @@ -104,8 +125,7 @@ MonoObject *GDMonoMethod::invoke(MonoObject *p_object, const Variant **p_params, if (r_exc) { *r_exc = exc; } else { - ERR_PRINT(GDMonoUtils::get_exception_name_and_message(exc).utf8()); - mono_print_unhandled_exception(exc); + GDMonoUtils::print_unhandled_exception(exc); } } @@ -123,11 +143,11 @@ MonoObject *GDMonoMethod::invoke_raw(MonoObject *p_object, void **p_params, Mono MonoObject *ret = mono_runtime_invoke(mono_method, p_object, p_params, &exc); if (exc) { + ret = NULL; if (r_exc) { *r_exc = exc; } else { - ERR_PRINT(GDMonoUtils::get_exception_name_and_message(exc).utf8()); - mono_print_unhandled_exception(exc); + GDMonoUtils::print_unhandled_exception(exc); } } @@ -143,7 +163,7 @@ bool GDMonoMethod::has_attribute(GDMonoClass *p_attr_class) { if (!attributes) return false; - return mono_custom_attrs_has_attr(attributes, p_attr_class->get_raw()); + return mono_custom_attrs_has_attr(attributes, p_attr_class->get_mono_ptr()); } MonoObject *GDMonoMethod::get_attribute(GDMonoClass *p_attr_class) { @@ -155,7 +175,7 @@ MonoObject *GDMonoMethod::get_attribute(GDMonoClass *p_attr_class) { if (!attributes) return NULL; - return mono_custom_attrs_get_attr(attributes, p_attr_class->get_raw()); + return mono_custom_attrs_get_attr(attributes, p_attr_class->get_mono_ptr()); } void GDMonoMethod::fetch_attributes() { diff --git a/modules/mono/mono_gd/gd_mono_method.h b/modules/mono/mono_gd/gd_mono_method.h index f1f6e51d45..14df8dcfb4 100644 --- a/modules/mono/mono_gd/gd_mono_method.h +++ b/modules/mono/mono_gd/gd_mono_method.h @@ -27,17 +27,18 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GD_MONO_METHOD_H #define GD_MONO_METHOD_H #include "gd_mono.h" +#include "gd_mono_class_member.h" #include "gd_mono_header.h" -class GDMonoMethod { +class GDMonoMethod : public GDMonoClassMember { StringName name; - bool is_instance; int params_count; ManagedType return_type; Vector<ManagedType> param_types; @@ -53,9 +54,18 @@ class GDMonoMethod { MonoMethod *mono_method; public: - _FORCE_INLINE_ StringName get_name() { return name; } + virtual MemberType get_member_type() { return MEMBER_TYPE_METHOD; } + + virtual StringName get_name() { return name; } + + virtual bool is_static(); + + virtual Visibility get_visibility(); + + virtual bool has_attribute(GDMonoClass *p_attr_class); + virtual MonoObject *get_attribute(GDMonoClass *p_attr_class); + virtual void fetch_attributes(); - _FORCE_INLINE_ bool is_static() { return !is_instance; } _FORCE_INLINE_ int get_parameters_count() { return params_count; } _FORCE_INLINE_ ManagedType get_return_type() { return return_type; } @@ -65,10 +75,6 @@ public: MonoObject *invoke(MonoObject *p_object, MonoObject **r_exc = NULL); MonoObject *invoke_raw(MonoObject *p_object, void **p_params, MonoObject **r_exc = NULL); - bool has_attribute(GDMonoClass *p_attr_class); - MonoObject *get_attribute(GDMonoClass *p_attr_class); - void fetch_attributes(); - String get_full_name(bool p_signature = false) const; String get_full_name_no_class() const; String get_ret_type_full_name() const; diff --git a/modules/mono/mono_gd/gd_mono_property.cpp b/modules/mono/mono_gd/gd_mono_property.cpp new file mode 100644 index 0000000000..bc5a1d3a39 --- /dev/null +++ b/modules/mono/mono_gd/gd_mono_property.cpp @@ -0,0 +1,199 @@ +/*************************************************************************/ +/* gd_mono_property.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#include "gd_mono_property.h" + +#include "gd_mono_class.h" +#include "gd_mono_marshal.h" + +#include <mono/metadata/attrdefs.h> + +GDMonoProperty::GDMonoProperty(MonoProperty *p_mono_property, GDMonoClass *p_owner) { + owner = p_owner; + mono_property = p_mono_property; + name = mono_property_get_name(mono_property); + + MonoMethod *prop_method = mono_property_get_get_method(mono_property); + + if (prop_method) { + MonoMethodSignature *getter_sig = mono_method_signature(prop_method); + + MonoType *ret_type = mono_signature_get_return_type(getter_sig); + + type.type_encoding = mono_type_get_type(ret_type); + MonoClass *ret_type_class = mono_class_from_mono_type(ret_type); + type.type_class = GDMono::get_singleton()->get_class(ret_type_class); + } else { + prop_method = mono_property_get_set_method(mono_property); + + MonoMethodSignature *setter_sig = mono_method_signature(prop_method); + + void *iter = NULL; + MonoType *param_raw_type = mono_signature_get_params(setter_sig, &iter); + + type.type_encoding = mono_type_get_type(param_raw_type); + MonoClass *param_type_class = mono_class_from_mono_type(param_raw_type); + type.type_class = GDMono::get_singleton()->get_class(param_type_class); + } + + attrs_fetched = false; + attributes = NULL; +} + +GDMonoProperty::~GDMonoProperty() { + if (attributes) { + mono_custom_attrs_free(attributes); + } +} + +bool GDMonoProperty::is_static() { + MonoMethod *prop_method = mono_property_get_get_method(mono_property); + if (prop_method == NULL) + prop_method = mono_property_get_set_method(mono_property); + return mono_method_get_flags(prop_method, NULL) & MONO_METHOD_ATTR_STATIC; +} + +GDMonoClassMember::Visibility GDMonoProperty::get_visibility() { + MonoMethod *prop_method = mono_property_get_get_method(mono_property); + if (prop_method == NULL) + prop_method = mono_property_get_set_method(mono_property); + + switch (mono_method_get_flags(prop_method, NULL) & MONO_METHOD_ATTR_ACCESS_MASK) { + case MONO_METHOD_ATTR_PRIVATE: + return GDMonoClassMember::PRIVATE; + case MONO_METHOD_ATTR_FAM_AND_ASSEM: + return GDMonoClassMember::PROTECTED_AND_INTERNAL; + case MONO_METHOD_ATTR_ASSEM: + return GDMonoClassMember::INTERNAL; + case MONO_METHOD_ATTR_FAMILY: + return GDMonoClassMember::PROTECTED; + case MONO_METHOD_ATTR_PUBLIC: + return GDMonoClassMember::PUBLIC; + default: + ERR_FAIL_V(GDMonoClassMember::PRIVATE); + } +} + +bool GDMonoProperty::has_attribute(GDMonoClass *p_attr_class) { + ERR_FAIL_NULL_V(p_attr_class, false); + + if (!attrs_fetched) + fetch_attributes(); + + if (!attributes) + return false; + + return mono_custom_attrs_has_attr(attributes, p_attr_class->get_mono_ptr()); +} + +MonoObject *GDMonoProperty::get_attribute(GDMonoClass *p_attr_class) { + ERR_FAIL_NULL_V(p_attr_class, NULL); + + if (!attrs_fetched) + fetch_attributes(); + + if (!attributes) + return NULL; + + return mono_custom_attrs_get_attr(attributes, p_attr_class->get_mono_ptr()); +} + +void GDMonoProperty::fetch_attributes() { + ERR_FAIL_COND(attributes != NULL); + attributes = mono_custom_attrs_from_property(owner->get_mono_ptr(), mono_property); + attrs_fetched = true; +} + +bool GDMonoProperty::has_getter() { + return mono_property_get_get_method(mono_property) != NULL; +} + +bool GDMonoProperty::has_setter() { + return mono_property_get_set_method(mono_property) != NULL; +} + +void GDMonoProperty::set_value(MonoObject *p_object, MonoObject *p_value, MonoObject **r_exc) { + MonoMethod *prop_method = mono_property_get_get_method(mono_property); + + MonoArray *params = mono_array_new(mono_domain_get(), CACHED_CLASS_RAW(MonoObject), 1); + mono_array_set(params, MonoObject *, 0, p_value); + + MonoObject *exc = NULL; + mono_runtime_invoke_array(prop_method, p_object, params, &exc); + + if (exc) { + if (r_exc) { + *r_exc = exc; + } else { + GDMonoUtils::print_unhandled_exception(exc); + } + } +} + +void GDMonoProperty::set_value(MonoObject *p_object, void **p_params, MonoObject **r_exc) { + MonoObject *exc = NULL; + mono_property_set_value(mono_property, p_object, p_params, &exc); + + if (exc) { + if (r_exc) { + *r_exc = exc; + } else { + GDMonoUtils::print_unhandled_exception(exc); + } + } +} + +MonoObject *GDMonoProperty::get_value(MonoObject *p_object, MonoObject **r_exc) { + MonoObject *exc = NULL; + MonoObject *ret = mono_property_get_value(mono_property, p_object, NULL, &exc); + + if (exc) { + ret = NULL; + if (r_exc) { + *r_exc = exc; + } else { + GDMonoUtils::print_unhandled_exception(exc); + } + } + + return ret; +} + +bool GDMonoProperty::get_bool_value(MonoObject *p_object) { + return (bool)GDMonoMarshal::unbox<MonoBoolean>(get_value(p_object)); +} + +int GDMonoProperty::get_int_value(MonoObject *p_object) { + return GDMonoMarshal::unbox<int32_t>(get_value(p_object)); +} + +String GDMonoProperty::get_string_value(MonoObject *p_object) { + MonoObject *val = get_value(p_object); + return GDMonoMarshal::mono_string_to_godot((MonoString *)val); +} diff --git a/modules/pbm/register_types.cpp b/modules/mono/mono_gd/gd_mono_property.h index c2a1585afa..2a0065e850 100644 --- a/modules/pbm/register_types.cpp +++ b/modules/mono/mono_gd/gd_mono_property.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* register_types.cpp */ +/* gd_mono_property.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -27,19 +27,51 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "register_types.h" +#ifndef GD_MONO_PROPERTY_H +#define GD_MONO_PROPERTY_H -#include "bitmap_loader_pbm.h" +#include "gd_mono.h" +#include "gd_mono_class_member.h" +#include "gd_mono_header.h" -static ResourceFormatPBM *pbm_loader = NULL; +class GDMonoProperty : public GDMonoClassMember { -void register_pbm_types() { + GDMonoClass *owner; + MonoProperty *mono_property; - pbm_loader = memnew(ResourceFormatPBM); - ResourceLoader::add_resource_format_loader(pbm_loader); -} + StringName name; + ManagedType type; -void unregister_pbm_types() { + bool attrs_fetched; + MonoCustomAttrInfo *attributes; - memdelete(pbm_loader); -} +public: + virtual MemberType get_member_type() { return MEMBER_TYPE_PROPERTY; } + + virtual StringName get_name() { return name; } + + virtual bool is_static(); + virtual Visibility get_visibility(); + + virtual bool has_attribute(GDMonoClass *p_attr_class); + virtual MonoObject *get_attribute(GDMonoClass *p_attr_class); + void fetch_attributes(); + + bool has_getter(); + bool has_setter(); + + _FORCE_INLINE_ ManagedType get_type() const { return type; } + + void set_value(MonoObject *p_object, MonoObject *p_value, MonoObject **r_exc = NULL); + void set_value(MonoObject *p_object, void **p_params, MonoObject **r_exc = NULL); + MonoObject *get_value(MonoObject *p_object, MonoObject **r_exc = NULL); + + bool get_bool_value(MonoObject *p_object); + int get_int_value(MonoObject *p_object); + String get_string_value(MonoObject *p_object); + + GDMonoProperty(MonoProperty *p_mono_property, GDMonoClass *p_owner); + ~GDMonoProperty(); +}; + +#endif // GD_MONO_PROPERTY_H diff --git a/modules/mono/mono_gd/gd_mono_utils.cpp b/modules/mono/mono_gd/gd_mono_utils.cpp index 03f3053372..ff999b36f2 100644 --- a/modules/mono/mono_gd/gd_mono_utils.cpp +++ b/modules/mono/mono_gd/gd_mono_utils.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "gd_mono_utils.h" #include "os/dir_access.h" @@ -198,7 +199,7 @@ void update_godot_api_cache() { CACHE_RAW_MONO_CLASS_AND_CHECK(Dictionary, mono_class_from_mono_type(dict_type)); } - MonoObject *task_scheduler = mono_object_new(SCRIPTS_DOMAIN, GODOT_API_CLASS(GodotTaskScheduler)->get_raw()); + MonoObject *task_scheduler = mono_object_new(SCRIPTS_DOMAIN, GODOT_API_CLASS(GodotTaskScheduler)->get_mono_ptr()); mono_runtime_object_init(task_scheduler); mono_cache.task_scheduler_handle = MonoGCHandle::create_strong(task_scheduler); } @@ -298,7 +299,7 @@ MonoObject *create_managed_for_godot_object(GDMonoClass *p_class, const StringNa ERR_FAIL_V(NULL); } - MonoObject *mono_object = mono_object_new(SCRIPTS_DOMAIN, p_class->get_raw()); + MonoObject *mono_object = mono_object_new(SCRIPTS_DOMAIN, p_class->get_mono_ptr()); ERR_FAIL_NULL_V(mono_object, NULL); CACHED_FIELD(GodotObject, ptr)->set_value_raw(mono_object, p_object); @@ -364,4 +365,10 @@ String get_exception_name_and_message(MonoObject *p_ex) { return res; } + +void print_unhandled_exception(MonoObject *p_ex) { + ERR_PRINT(GDMonoUtils::get_exception_name_and_message(p_ex).utf8()); + mono_print_unhandled_exception(p_ex); +} + } // namespace GDMonoUtils diff --git a/modules/mono/mono_gd/gd_mono_utils.h b/modules/mono/mono_gd/gd_mono_utils.h index 62d31f78fb..284585856e 100644 --- a/modules/mono/mono_gd/gd_mono_utils.h +++ b/modules/mono/mono_gd/gd_mono_utils.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef GD_MONOUTILS_H #define GD_MONOUTILS_H @@ -166,12 +167,14 @@ MonoDomain *create_domain(const String &p_friendly_name); String get_exception_name_and_message(MonoObject *p_ex); +void print_unhandled_exception(MonoObject *p_ex); + } // namespace GDMonoUtils #define NATIVE_GDMONOCLASS_NAME(m_class) (GDMonoMarshal::mono_string_to_godot((MonoString *)m_class->get_field(BINDINGS_NATIVE_NAME_FIELD)->get_value(NULL))) #define CACHED_CLASS(m_class) (GDMonoUtils::mono_cache.class_##m_class) -#define CACHED_CLASS_RAW(m_class) (GDMonoUtils::mono_cache.class_##m_class->get_raw()) +#define CACHED_CLASS_RAW(m_class) (GDMonoUtils::mono_cache.class_##m_class->get_mono_ptr()) #define CACHED_NS_CLASS(m_ns, m_class) (GDMonoUtils::mono_cache.class_##m_ns##_##m_class) #define CACHED_RAW_MONO_CLASS(m_class) (GDMonoUtils::mono_cache.rawclass_##m_class) #define CACHED_FIELD(m_class, m_field) (GDMonoUtils::mono_cache.field_##m_class##_##m_field) diff --git a/modules/mono/register_types.cpp b/modules/mono/register_types.cpp index 9bc384063d..4410996546 100644 --- a/modules/mono/register_types.cpp +++ b/modules/mono/register_types.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "register_types.h" #include "engine.h" diff --git a/modules/mono/register_types.h b/modules/mono/register_types.h index d4f052b793..ab8a7d6463 100644 --- a/modules/mono/register_types.h +++ b/modules/mono/register_types.h @@ -27,5 +27,6 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_mono_types(); void unregister_mono_types(); diff --git a/modules/mono/signal_awaiter_utils.cpp b/modules/mono/signal_awaiter_utils.cpp index bad75224dc..2671e9a970 100644 --- a/modules/mono/signal_awaiter_utils.cpp +++ b/modules/mono/signal_awaiter_utils.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "signal_awaiter_utils.h" #include "csharp_script.h" diff --git a/modules/mono/signal_awaiter_utils.h b/modules/mono/signal_awaiter_utils.h index 97cf4238da..a6a205ff8d 100644 --- a/modules/mono/signal_awaiter_utils.h +++ b/modules/mono/signal_awaiter_utils.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef SIGNAL_AWAITER_UTILS_H #define SIGNAL_AWAITER_UTILS_H diff --git a/modules/mono/utils/mono_reg_utils.cpp b/modules/mono/utils/mono_reg_utils.cpp index 8d91e16c5c..9bb8da8ac0 100644 --- a/modules/mono/utils/mono_reg_utils.cpp +++ b/modules/mono/utils/mono_reg_utils.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "mono_reg_utils.h" #ifdef WINDOWS_ENABLED diff --git a/modules/mono/utils/mono_reg_utils.h b/modules/mono/utils/mono_reg_utils.h index 80270ad794..edf31f5a07 100644 --- a/modules/mono/utils/mono_reg_utils.h +++ b/modules/mono/utils/mono_reg_utils.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef MONO_REG_UTILS_H #define MONO_REG_UTILS_H diff --git a/modules/mono/utils/path_utils.cpp b/modules/mono/utils/path_utils.cpp index dfbb1b9ba4..4b77aeb54e 100644 --- a/modules/mono/utils/path_utils.cpp +++ b/modules/mono/utils/path_utils.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "path_utils.h" #include "os/dir_access.h" diff --git a/modules/mono/utils/path_utils.h b/modules/mono/utils/path_utils.h index 4e8d8f2815..184cacfac7 100644 --- a/modules/mono/utils/path_utils.h +++ b/modules/mono/utils/path_utils.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef PATH_UTILS_H #define PATH_UTILS_H diff --git a/modules/mono/utils/string_utils.cpp b/modules/mono/utils/string_utils.cpp index 4bea504d28..8691932f9a 100644 --- a/modules/mono/utils/string_utils.cpp +++ b/modules/mono/utils/string_utils.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "string_utils.h" namespace { diff --git a/modules/mono/utils/string_utils.h b/modules/mono/utils/string_utils.h index b02abc77be..5dddaee6e8 100644 --- a/modules/mono/utils/string_utils.h +++ b/modules/mono/utils/string_utils.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef STRING_FORMAT_H #define STRING_FORMAT_H diff --git a/modules/ogg/register_types.cpp b/modules/ogg/register_types.cpp index 993b2f9e1b..dba5dcc6e2 100644 --- a/modules/ogg/register_types.cpp +++ b/modules/ogg/register_types.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "register_types.h" // Dummy module as libogg is needed by other modules (vorbis, theora, opus, ...) diff --git a/modules/ogg/register_types.h b/modules/ogg/register_types.h index 39482dc71b..e82c90de0b 100644 --- a/modules/ogg/register_types.h +++ b/modules/ogg/register_types.h @@ -27,5 +27,6 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_ogg_types(); void unregister_ogg_types(); diff --git a/modules/openssl/register_types.cpp b/modules/openssl/register_types.cpp index e103b3b9bf..916acc260e 100644 --- a/modules/openssl/register_types.cpp +++ b/modules/openssl/register_types.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "register_types.h" #include "stream_peer_openssl.h" diff --git a/modules/openssl/register_types.h b/modules/openssl/register_types.h index d87f1a31df..94d917ca81 100644 --- a/modules/openssl/register_types.h +++ b/modules/openssl/register_types.h @@ -27,5 +27,6 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_openssl_types(); void unregister_openssl_types(); diff --git a/modules/openssl/stream_peer_openssl.cpp b/modules/openssl/stream_peer_openssl.cpp index 30a03f9000..e3cb9bbdf8 100644 --- a/modules/openssl/stream_peer_openssl.cpp +++ b/modules/openssl/stream_peer_openssl.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "stream_peer_openssl.h" // Compatibility with OpenSSL 1.1.0. diff --git a/modules/openssl/stream_peer_openssl.h b/modules/openssl/stream_peer_openssl.h index a696e29d6c..29c8647e58 100644 --- a/modules/openssl/stream_peer_openssl.h +++ b/modules/openssl/stream_peer_openssl.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef STREAM_PEER_OPEN_SSL_H #define STREAM_PEER_OPEN_SSL_H diff --git a/modules/opus/audio_stream_opus.cpp b/modules/opus/audio_stream_opus.cpp index 260612e370..8323ff33ac 100644 --- a/modules/opus/audio_stream_opus.cpp +++ b/modules/opus/audio_stream_opus.cpp @@ -8,8 +8,6 @@ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ /* */ -/* Author: George Marques <george@gmarqu.es> */ -/* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ /* "Software"), to deal in the Software without restriction, including */ @@ -29,8 +27,13 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "audio_stream_opus.h" +/** + @author George Marques <george@gmarqu.es> +*/ + const float AudioStreamPlaybackOpus::osrate = 48000.0f; int AudioStreamPlaybackOpus::_op_read_func(void *_stream, unsigned char *_ptr, int _nbytes) { diff --git a/modules/opus/audio_stream_opus.h b/modules/opus/audio_stream_opus.h index 7be133b5bc..3ffdaf2c18 100644 --- a/modules/opus/audio_stream_opus.h +++ b/modules/opus/audio_stream_opus.h @@ -8,8 +8,6 @@ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ /* */ -/* Author: George Marques <george@gmarqu.es> */ -/* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ /* "Software"), to deal in the Software without restriction, including */ @@ -39,6 +37,10 @@ #include <opus/opusfile.h> +/** + @author George Marques <george@gmarqu.es> +*/ + class AudioStreamPlaybackOpus : public AudioStreamPlayback { GDCLASS(AudioStreamPlaybackOpus, AudioStreamPlayback) diff --git a/modules/opus/register_types.cpp b/modules/opus/register_types.cpp index 41bee6d552..f34555841e 100644 --- a/modules/opus/register_types.cpp +++ b/modules/opus/register_types.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "register_types.h" #include "audio_stream_opus.h" diff --git a/modules/opus/register_types.h b/modules/opus/register_types.h index 85a7efbfc0..84335adfc9 100644 --- a/modules/opus/register_types.h +++ b/modules/opus/register_types.h @@ -27,5 +27,6 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_opus_types(); void unregister_opus_types(); diff --git a/modules/opus/stub/register_types.cpp b/modules/opus/stub/register_types.cpp index 449edcc0f5..fe2bce63ba 100644 --- a/modules/opus/stub/register_types.cpp +++ b/modules/opus/stub/register_types.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "register_types.h" // Dummy module as libvorbis is needed by other modules (theora ...) diff --git a/modules/opus/stub/register_types.h b/modules/opus/stub/register_types.h index c41cc4818c..84335adfc9 100644 --- a/modules/opus/stub/register_types.h +++ b/modules/opus/stub/register_types.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -27,5 +27,6 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_opus_types(); void unregister_opus_types(); diff --git a/modules/pbm/SCsub b/modules/pbm/SCsub deleted file mode 100644 index fa328be025..0000000000 --- a/modules/pbm/SCsub +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env python - -Import('env') -Import('env_modules') - -env_pbm = env_modules.Clone() - -env_pbm.add_source_files(env.modules_sources, "*.cpp") diff --git a/modules/pbm/bitmap_loader_pbm.cpp b/modules/pbm/bitmap_loader_pbm.cpp deleted file mode 100644 index 39d238ae5c..0000000000 --- a/modules/pbm/bitmap_loader_pbm.cpp +++ /dev/null @@ -1,236 +0,0 @@ -/*************************************************************************/ -/* bitmap_loader_pbm.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#include "bitmap_loader_pbm.h" -#include "os/file_access.h" -#include "scene/resources/bit_mask.h" - -static bool _get_token(FileAccessRef &f, uint8_t &saved, PoolVector<uint8_t> &r_token, bool p_binary = false, bool p_single_chunk = false) { - - int token_max = r_token.size(); - PoolVector<uint8_t>::Write w; - if (token_max) - w = r_token.write(); - int ofs = 0; - bool lf = false; - - while (true) { - - uint8_t b; - if (saved) { - b = saved; - saved = 0; - } else { - b = f->get_8(); - } - if (f->eof_reached()) { - if (ofs) { - w = PoolVector<uint8_t>::Write(); - r_token.resize(ofs); - return true; - } else { - return false; - } - } - - if (!ofs && !p_binary && b == '#') { - //skip comment - while (b != '\n') { - if (f->eof_reached()) { - return false; - } - - b = f->get_8(); - } - - lf = true; - - } else if (b <= 32 && !(p_binary && (ofs || lf))) { - - if (b == '\n') { - lf = true; - } - - if (ofs && !p_single_chunk) { - w = PoolVector<uint8_t>::Write(); - r_token.resize(ofs); - saved = b; - - return true; - } - } else { - - bool resized = false; - while (ofs >= token_max) { - if (token_max) - token_max <<= 1; - else - token_max = 1; - resized = true; - } - if (resized) { - // Note: Certain C++ static analyzers might point out that the following assigment is unnecessary. - // This is wrong since PoolVector<class T>::Write has an operator= method where the lhs gets updated under certain conditions. - // See core/dvector.h. - w = PoolVector<uint8_t>::Write(); - r_token.resize(token_max); - w = r_token.write(); - } - w[ofs++] = b; - } - } - - return false; -} - -static int _get_number_from_token(PoolVector<uint8_t> &r_token) { - - int len = r_token.size(); - PoolVector<uint8_t>::Read r = r_token.read(); - return String::to_int((const char *)r.ptr(), len); -} - -RES ResourceFormatPBM::load(const String &p_path, const String &p_original_path, Error *r_error) { - -#define _RETURN(m_err) \ - { \ - if (r_error) \ - *r_error = m_err; \ - ERR_FAIL_V(RES()); \ - } - - FileAccessRef f = FileAccess::open(p_path, FileAccess::READ); - uint8_t saved = 0; - if (!f) - _RETURN(ERR_CANT_OPEN); - - PoolVector<uint8_t> token; - - if (!_get_token(f, saved, token)) { - _RETURN(ERR_PARSE_ERROR); - } - - if (token.size() != 2) { - _RETURN(ERR_FILE_CORRUPT); - } - if (token[0] != 'P') { - _RETURN(ERR_FILE_CORRUPT); - } - if (token[1] != '1' && token[1] != '4') { - _RETURN(ERR_FILE_CORRUPT); - } - - bool bits = token[1] == '4'; - - if (!_get_token(f, saved, token)) { - _RETURN(ERR_PARSE_ERROR); - } - - int width = _get_number_from_token(token); - if (width <= 0) { - _RETURN(ERR_FILE_CORRUPT); - } - - if (!_get_token(f, saved, token)) { - _RETURN(ERR_PARSE_ERROR); - } - - int height = _get_number_from_token(token); - if (height <= 0) { - _RETURN(ERR_FILE_CORRUPT); - } - - Ref<BitMap> bm; - bm.instance(); - bm->create(Size2i(width, height)); - - if (!bits) { - - int required_bytes = width * height; - if (!_get_token(f, saved, token, false, true)) { - _RETURN(ERR_PARSE_ERROR); - } - - if (token.size() < required_bytes) { - _RETURN(ERR_FILE_CORRUPT); - } - - PoolVector<uint8_t>::Read r = token.read(); - - for (int i = 0; i < height; i++) { - for (int j = 0; j < width; j++) { - - char num = r[i * width + j]; - bm->set_bit(Point2i(j, i), num == '0'); - } - } - - } else { - //a single, entire token of bits! - if (!_get_token(f, saved, token, true)) { - _RETURN(ERR_PARSE_ERROR); - } - int required_bytes = Math::ceil((width * height) / 8.0); - if (token.size() < required_bytes) { - _RETURN(ERR_FILE_CORRUPT); - } - - PoolVector<uint8_t>::Read r = token.read(); - int bitwidth = width; - if (bitwidth % 8) - bitwidth += 8 - (bitwidth % 8); - - for (int i = 0; i < height; i++) { - for (int j = 0; j < width; j++) { - - int ofs = bitwidth * i + j; - - uint8_t byte = r[ofs / 8]; - bool bit = (byte >> (7 - (ofs % 8))) & 1; - - bm->set_bit(Point2i(j, i), !bit); - } - } - } - - return bm; -} - -void ResourceFormatPBM::get_recognized_extensions(List<String> *p_extensions) const { - p_extensions->push_back("pbm"); -} -bool ResourceFormatPBM::handles_type(const String &p_type) const { - return p_type == "BitMap"; -} -String ResourceFormatPBM::get_resource_type(const String &p_path) const { - - if (p_path.get_extension().to_lower() == "pbm") - return "BitMap"; - return ""; -} diff --git a/modules/pbm/config.py b/modules/pbm/config.py deleted file mode 100644 index 5f133eba90..0000000000 --- a/modules/pbm/config.py +++ /dev/null @@ -1,5 +0,0 @@ -def can_build(platform): - return True - -def configure(env): - pass diff --git a/modules/pbm/register_types.h b/modules/pbm/register_types.h deleted file mode 100644 index 958e162da1..0000000000 --- a/modules/pbm/register_types.h +++ /dev/null @@ -1,31 +0,0 @@ -/*************************************************************************/ -/* register_types.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -void register_pbm_types(); -void unregister_pbm_types(); diff --git a/modules/pvr/register_types.cpp b/modules/pvr/register_types.cpp index f1cd481a4a..0991828ef2 100644 --- a/modules/pvr/register_types.cpp +++ b/modules/pvr/register_types.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "register_types.h" #include "texture_loader_pvr.h" diff --git a/modules/pvr/register_types.h b/modules/pvr/register_types.h index b53dd8da52..d187ab5334 100644 --- a/modules/pvr/register_types.h +++ b/modules/pvr/register_types.h @@ -27,5 +27,6 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_pvr_types(); void unregister_pvr_types(); diff --git a/modules/pvr/texture_loader_pvr.cpp b/modules/pvr/texture_loader_pvr.cpp index 5046526d81..76c0b969d8 100644 --- a/modules/pvr/texture_loader_pvr.cpp +++ b/modules/pvr/texture_loader_pvr.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "texture_loader_pvr.h" #include "PvrTcEncoder.h" #include "RgbaBitmap.h" diff --git a/modules/pvr/texture_loader_pvr.h b/modules/pvr/texture_loader_pvr.h index ae6df3658a..9369178336 100644 --- a/modules/pvr/texture_loader_pvr.h +++ b/modules/pvr/texture_loader_pvr.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef TEXTURE_LOADER_PVR_H #define TEXTURE_LOADER_PVR_H diff --git a/modules/regex/regex.cpp b/modules/regex/regex.cpp index 9bcbc4c4ea..3fe7e36d45 100644 --- a/modules/regex/regex.cpp +++ b/modules/regex/regex.cpp @@ -343,15 +343,20 @@ String RegEx::sub(const String &p_subject, const String &p_replacement, bool p_a ERR_FAIL_COND_V(!is_valid(), String()); - String output; - output.resize(p_subject.length()); + // safety_zone is the number of chars we allocate in addition to the number of chars expected in order to + // guard against the PCRE API writing one additional \0 at the end. PCRE's API docs are unclear on whether + // PCRE understands outlength in pcre2_substitute() as counting an implicit additional terminating char or + // not. always allocating one char more than telling PCRE has us on the safe side. + const int safety_zone = 1; + + PCRE2_SIZE olength = p_subject.length() + 1; // space for output string and one terminating \0 character + Vector<CharType> output; + output.resize(olength + safety_zone); uint32_t flags = PCRE2_SUBSTITUTE_OVERFLOW_LENGTH; if (p_all) flags |= PCRE2_SUBSTITUTE_GLOBAL; - PCRE2_SIZE olength = output.length(); - PCRE2_SIZE length = p_subject.length(); if (p_end >= 0 && (uint32_t)p_end < length) length = p_end; @@ -363,15 +368,15 @@ String RegEx::sub(const String &p_subject, const String &p_replacement, bool p_a pcre2_match_context_16 *mctx = pcre2_match_context_create_16(gctx); PCRE2_SPTR16 s = (PCRE2_SPTR16)p_subject.c_str(); PCRE2_SPTR16 r = (PCRE2_SPTR16)p_replacement.c_str(); - PCRE2_UCHAR16 *o = (PCRE2_UCHAR16 *)output.c_str(); + PCRE2_UCHAR16 *o = (PCRE2_UCHAR16 *)output.ptrw(); pcre2_match_data_16 *match = pcre2_match_data_create_from_pattern_16(c, gctx); int res = pcre2_substitute_16(c, s, length, p_offset, flags, match, mctx, r, p_replacement.length(), o, &olength); if (res == PCRE2_ERROR_NOMEMORY) { - output.resize(olength); - o = (PCRE2_UCHAR16 *)output.c_str(); + output.resize(olength + safety_zone); + o = (PCRE2_UCHAR16 *)output.ptrw(); res = pcre2_substitute_16(c, s, length, p_offset, flags, match, mctx, r, p_replacement.length(), o, &olength); } @@ -388,15 +393,15 @@ String RegEx::sub(const String &p_subject, const String &p_replacement, bool p_a pcre2_match_context_32 *mctx = pcre2_match_context_create_32(gctx); PCRE2_SPTR32 s = (PCRE2_SPTR32)p_subject.c_str(); PCRE2_SPTR32 r = (PCRE2_SPTR32)p_replacement.c_str(); - PCRE2_UCHAR32 *o = (PCRE2_UCHAR32 *)output.c_str(); + PCRE2_UCHAR32 *o = (PCRE2_UCHAR32 *)output.ptrw(); pcre2_match_data_32 *match = pcre2_match_data_create_from_pattern_32(c, gctx); int res = pcre2_substitute_32(c, s, length, p_offset, flags, match, mctx, r, p_replacement.length(), o, &olength); if (res == PCRE2_ERROR_NOMEMORY) { - output.resize(olength); - o = (PCRE2_UCHAR32 *)output.c_str(); + output.resize(olength + safety_zone); + o = (PCRE2_UCHAR32 *)output.ptrw(); res = pcre2_substitute_32(c, s, length, p_offset, flags, match, mctx, r, p_replacement.length(), o, &olength); } @@ -407,7 +412,7 @@ String RegEx::sub(const String &p_subject, const String &p_replacement, bool p_a return String(); } - return output; + return String(output.ptr(), olength); } bool RegEx::is_valid() const { diff --git a/modules/register_module_types.h b/modules/register_module_types.h index 4f9c2eb41f..f4163418e8 100644 --- a/modules/register_module_types.h +++ b/modules/register_module_types.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef REGISTER_MODULE_TYPES_H #define REGISTER_MODULE_TYPES_H diff --git a/modules/squish/image_compress_squish.cpp b/modules/squish/image_compress_squish.cpp index c97cee6e1d..0cf24dd8d8 100644 --- a/modules/squish/image_compress_squish.cpp +++ b/modules/squish/image_compress_squish.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "image_compress_squish.h" #include "print_string.h" diff --git a/modules/squish/image_compress_squish.h b/modules/squish/image_compress_squish.h index 83dab024b2..c022063fe5 100644 --- a/modules/squish/image_compress_squish.h +++ b/modules/squish/image_compress_squish.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef IMAGE_COMPRESS_SQUISH_H #define IMAGE_COMPRESS_SQUISH_H diff --git a/modules/squish/register_types.cpp b/modules/squish/register_types.cpp index 600a33cdd6..d4ed676cce 100644 --- a/modules/squish/register_types.cpp +++ b/modules/squish/register_types.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "register_types.h" #ifdef TOOLS_ENABLED diff --git a/modules/squish/register_types.h b/modules/squish/register_types.h index f9971f4f19..00f5c345c4 100644 --- a/modules/squish/register_types.h +++ b/modules/squish/register_types.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifdef TOOLS_ENABLED void register_squish_types(); void unregister_squish_types(); diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp index 786c2bf051..d06bd79460 100644 --- a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp +++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "audio_stream_ogg_vorbis.h" #include "os/file_access.h" diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.h b/modules/stb_vorbis/audio_stream_ogg_vorbis.h index 8644e1ba37..bb01c26902 100644 --- a/modules/stb_vorbis/audio_stream_ogg_vorbis.h +++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef AUDIO_STREAM_STB_VORBIS_H #define AUDIO_STREAM_STB_VORBIS_H diff --git a/modules/stb_vorbis/register_types.cpp b/modules/stb_vorbis/register_types.cpp index 992cc1f159..514ef4c071 100644 --- a/modules/stb_vorbis/register_types.cpp +++ b/modules/stb_vorbis/register_types.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "register_types.h" #include "audio_stream_ogg_vorbis.h" #include "resource_importer_ogg_vorbis.h" diff --git a/modules/stb_vorbis/register_types.h b/modules/stb_vorbis/register_types.h index 9af22e2374..142be0efdf 100644 --- a/modules/stb_vorbis/register_types.h +++ b/modules/stb_vorbis/register_types.h @@ -27,5 +27,6 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_stb_vorbis_types(); void unregister_stb_vorbis_types(); diff --git a/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp b/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp index db4443255d..16ebfa2832 100644 --- a/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp +++ b/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "resource_importer_ogg_vorbis.h" #include "io/resource_saver.h" diff --git a/modules/stb_vorbis/resource_importer_ogg_vorbis.h b/modules/stb_vorbis/resource_importer_ogg_vorbis.h index 9b7bf1946e..a1847545aa 100644 --- a/modules/stb_vorbis/resource_importer_ogg_vorbis.h +++ b/modules/stb_vorbis/resource_importer_ogg_vorbis.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef RESOURCEIMPORTEROGGVORBIS_H #define RESOURCEIMPORTEROGGVORBIS_H diff --git a/modules/svg/image_loader_svg.cpp b/modules/svg/image_loader_svg.cpp index ea538a2895..8ccd229f3d 100644 --- a/modules/svg/image_loader_svg.cpp +++ b/modules/svg/image_loader_svg.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "image_loader_svg.h" #include "os/os.h" diff --git a/modules/svg/image_loader_svg.h b/modules/svg/image_loader_svg.h index 61bf390bc7..63854da2f6 100644 --- a/modules/svg/image_loader_svg.h +++ b/modules/svg/image_loader_svg.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef IMAGE_LOADER_SVG_H #define IMAGE_LOADER_SVG_H diff --git a/modules/svg/register_types.cpp b/modules/svg/register_types.cpp index ddd63009f7..56426662cd 100644 --- a/modules/svg/register_types.cpp +++ b/modules/svg/register_types.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "register_types.h" #include "image_loader_svg.h" diff --git a/modules/svg/register_types.h b/modules/svg/register_types.h index 8759e3cdd5..015c586c6b 100644 --- a/modules/svg/register_types.h +++ b/modules/svg/register_types.h @@ -27,5 +27,6 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_svg_types(); void unregister_svg_types(); diff --git a/modules/tga/image_loader_tga.cpp b/modules/tga/image_loader_tga.cpp index dec8526b0a..7391bed699 100644 --- a/modules/tga/image_loader_tga.cpp +++ b/modules/tga/image_loader_tga.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "image_loader_tga.h" #include "os/os.h" diff --git a/modules/tga/image_loader_tga.h b/modules/tga/image_loader_tga.h index 2a0b6f4504..c4b10b7f49 100644 --- a/modules/tga/image_loader_tga.h +++ b/modules/tga/image_loader_tga.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef IMAGE_LOADER_TGA_H #define IMAGE_LOADER_TGA_H diff --git a/modules/tga/register_types.cpp b/modules/tga/register_types.cpp index 81991b1142..ac1b56af16 100644 --- a/modules/tga/register_types.cpp +++ b/modules/tga/register_types.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "register_types.h" #include "image_loader_tga.h" diff --git a/modules/tga/register_types.h b/modules/tga/register_types.h index 1b6f66a4d0..6483f2576e 100644 --- a/modules/tga/register_types.h +++ b/modules/tga/register_types.h @@ -27,5 +27,6 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_tga_types(); void unregister_tga_types(); diff --git a/modules/thekla_unwrap/register_types.cpp b/modules/thekla_unwrap/register_types.cpp index eb11325dde..c74cbd9d18 100644 --- a/modules/thekla_unwrap/register_types.cpp +++ b/modules/thekla_unwrap/register_types.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "register_types.h" #include "error_macros.h" #include "thirdparty/thekla_atlas/thekla/thekla_atlas.h" diff --git a/modules/thekla_unwrap/register_types.h b/modules/thekla_unwrap/register_types.h index 7a542592b5..8a0eab9437 100644 --- a/modules/thekla_unwrap/register_types.h +++ b/modules/thekla_unwrap/register_types.h @@ -27,5 +27,6 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_thekla_unwrap_types(); void unregister_thekla_unwrap_types(); diff --git a/modules/theora/register_types.cpp b/modules/theora/register_types.cpp index c6d125226b..9bc5ed903a 100644 --- a/modules/theora/register_types.cpp +++ b/modules/theora/register_types.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "register_types.h" #include "resource_importer_theora.h" #include "video_stream_theora.h" diff --git a/modules/theora/register_types.h b/modules/theora/register_types.h index 69b43744b5..4a81d7743b 100644 --- a/modules/theora/register_types.h +++ b/modules/theora/register_types.h @@ -27,5 +27,6 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_theora_types(); void unregister_theora_types(); diff --git a/modules/theora/resource_importer_theora.cpp b/modules/theora/resource_importer_theora.cpp index 0c9a21c825..ee9bab74a7 100644 --- a/modules/theora/resource_importer_theora.cpp +++ b/modules/theora/resource_importer_theora.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "resource_importer_theora.h" #include "io/resource_saver.h" diff --git a/modules/theora/resource_importer_theora.h b/modules/theora/resource_importer_theora.h index 913bf87a42..e3c79287ad 100644 --- a/modules/theora/resource_importer_theora.h +++ b/modules/theora/resource_importer_theora.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef RESOURCEIMPORTEROGGTHEORA_H #define RESOURCEIMPORTEROGGTHEORA_H diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp index 2ff3fb6d7a..ac1e81859a 100644 --- a/modules/theora/video_stream_theora.cpp +++ b/modules/theora/video_stream_theora.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "video_stream_theora.h" #include "os/os.h" diff --git a/modules/theora/video_stream_theora.h b/modules/theora/video_stream_theora.h index cbcdd34bfc..4bdbbdae20 100644 --- a/modules/theora/video_stream_theora.h +++ b/modules/theora/video_stream_theora.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef VIDEO_STREAM_THEORA_H #define VIDEO_STREAM_THEORA_H diff --git a/modules/tinyexr/image_loader_tinyexr.cpp b/modules/tinyexr/image_loader_tinyexr.cpp index c4d9e7c7e0..0abefe11ee 100644 --- a/modules/tinyexr/image_loader_tinyexr.cpp +++ b/modules/tinyexr/image_loader_tinyexr.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "image_loader_tinyexr.h" #include "os/os.h" diff --git a/modules/tinyexr/image_loader_tinyexr.h b/modules/tinyexr/image_loader_tinyexr.h index b46c9582e1..6706e0972a 100644 --- a/modules/tinyexr/image_loader_tinyexr.h +++ b/modules/tinyexr/image_loader_tinyexr.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef IMAGE_LOADER_TINYEXR_H #define IMAGE_LOADER_TINYEXR_H diff --git a/modules/tinyexr/register_types.cpp b/modules/tinyexr/register_types.cpp index 648cc98c25..61217805cf 100644 --- a/modules/tinyexr/register_types.cpp +++ b/modules/tinyexr/register_types.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "register_types.h" #include "image_loader_tinyexr.h" diff --git a/modules/tinyexr/register_types.h b/modules/tinyexr/register_types.h index e2bd8a0cbe..70cd0bfbf8 100644 --- a/modules/tinyexr/register_types.h +++ b/modules/tinyexr/register_types.h @@ -27,5 +27,6 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_tinyexr_types(); void unregister_tinyexr_types(); diff --git a/modules/visual_script/register_types.cpp b/modules/visual_script/register_types.cpp index a9c6554198..2809cff362 100644 --- a/modules/visual_script/register_types.cpp +++ b/modules/visual_script/register_types.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "register_types.h" #include "core/engine.h" diff --git a/modules/visual_script/register_types.h b/modules/visual_script/register_types.h index 3d6eb25d10..27b3bd649a 100644 --- a/modules/visual_script/register_types.h +++ b/modules/visual_script/register_types.h @@ -27,5 +27,6 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_visual_script_types(); void unregister_visual_script_types(); diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp index 26c3aed465..fd493978e6 100644 --- a/modules/visual_script/visual_script.cpp +++ b/modules/visual_script/visual_script.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "visual_script.h" #include "os/os.h" diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h index 76eadece66..69bb522173 100644 --- a/modules/visual_script/visual_script.h +++ b/modules/visual_script/visual_script.h @@ -27,8 +27,9 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef VSCRIPT_H -#define VSCRIPT_H + +#ifndef VISUAL_SCRIPT_H +#define VISUAL_SCRIPT_H #include "os/thread.h" #include "script_language.h" @@ -617,4 +618,4 @@ static Ref<VisualScriptNode> create_node_generic(const String &p_name) { return node; } -#endif // VSCRIPT_H +#endif // VISUAL_SCRIPT_H diff --git a/modules/visual_script/visual_script_builtin_funcs.cpp b/modules/visual_script/visual_script_builtin_funcs.cpp index 3ace2de176..1ee0989564 100644 --- a/modules/visual_script/visual_script_builtin_funcs.cpp +++ b/modules/visual_script/visual_script_builtin_funcs.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "visual_script_builtin_funcs.h" #include "class_db.h" diff --git a/modules/visual_script/visual_script_builtin_funcs.h b/modules/visual_script/visual_script_builtin_funcs.h index 1e098535f3..f862d5c26f 100644 --- a/modules/visual_script/visual_script_builtin_funcs.h +++ b/modules/visual_script/visual_script_builtin_funcs.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef VISUAL_SCRIPT_BUILTIN_FUNCS_H #define VISUAL_SCRIPT_BUILTIN_FUNCS_H diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index dfd563499f..37b0b8ac55 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "visual_script_editor.h" #include "core/script_language.h" diff --git a/modules/visual_script/visual_script_editor.h b/modules/visual_script/visual_script_editor.h index 48b6a92b76..4d789e6ef7 100644 --- a/modules/visual_script/visual_script_editor.h +++ b/modules/visual_script/visual_script_editor.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef VISUALSCRIPT_EDITOR_H #define VISUALSCRIPT_EDITOR_H diff --git a/modules/visual_script/visual_script_expression.cpp b/modules/visual_script/visual_script_expression.cpp index 2a051b3288..16de04e4cf 100644 --- a/modules/visual_script/visual_script_expression.cpp +++ b/modules/visual_script/visual_script_expression.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "visual_script_expression.h" bool VisualScriptExpression::_set(const StringName &p_name, const Variant &p_value) { diff --git a/modules/visual_script/visual_script_expression.h b/modules/visual_script/visual_script_expression.h index 628f06fc0b..1f41e442c5 100644 --- a/modules/visual_script/visual_script_expression.h +++ b/modules/visual_script/visual_script_expression.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef VISUALSCRIPTEXPRESSION_H #define VISUALSCRIPTEXPRESSION_H diff --git a/modules/visual_script/visual_script_flow_control.cpp b/modules/visual_script/visual_script_flow_control.cpp index 56aeeac7fb..5c097dfa76 100644 --- a/modules/visual_script/visual_script_flow_control.cpp +++ b/modules/visual_script/visual_script_flow_control.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "visual_script_flow_control.h" #include "io/resource_loader.h" diff --git a/modules/visual_script/visual_script_flow_control.h b/modules/visual_script/visual_script_flow_control.h index c985d1b9a9..40809d488a 100644 --- a/modules/visual_script/visual_script_flow_control.h +++ b/modules/visual_script/visual_script_flow_control.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef VISUAL_SCRIPT_FLOW_CONTROL_H #define VISUAL_SCRIPT_FLOW_CONTROL_H diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp index 345d2f7df8..130b243715 100644 --- a/modules/visual_script/visual_script_func_nodes.cpp +++ b/modules/visual_script/visual_script_func_nodes.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "visual_script_func_nodes.h" #include "engine.h" diff --git a/modules/visual_script/visual_script_func_nodes.h b/modules/visual_script/visual_script_func_nodes.h index 925f3b94aa..0b30eae65a 100644 --- a/modules/visual_script/visual_script_func_nodes.h +++ b/modules/visual_script/visual_script_func_nodes.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef VISUAL_SCRIPT_FUNC_NODES_H #define VISUAL_SCRIPT_FUNC_NODES_H diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp index a41b3fc6c9..1988eb0f5b 100644 --- a/modules/visual_script/visual_script_nodes.cpp +++ b/modules/visual_script/visual_script_nodes.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "visual_script_nodes.h" #include "engine.h" diff --git a/modules/visual_script/visual_script_nodes.h b/modules/visual_script/visual_script_nodes.h index d49f64f3a6..a581e81c8c 100644 --- a/modules/visual_script/visual_script_nodes.h +++ b/modules/visual_script/visual_script_nodes.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef VISUAL_SCRIPT_NODES_H #define VISUAL_SCRIPT_NODES_H diff --git a/modules/visual_script/visual_script_yield_nodes.cpp b/modules/visual_script/visual_script_yield_nodes.cpp index 1961809be0..a96e8408c0 100644 --- a/modules/visual_script/visual_script_yield_nodes.cpp +++ b/modules/visual_script/visual_script_yield_nodes.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "visual_script_yield_nodes.h" #include "os/os.h" diff --git a/modules/visual_script/visual_script_yield_nodes.h b/modules/visual_script/visual_script_yield_nodes.h index b6efd88c0e..4009240581 100644 --- a/modules/visual_script/visual_script_yield_nodes.h +++ b/modules/visual_script/visual_script_yield_nodes.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef VISUAL_SCRIPT_YIELD_NODES_H #define VISUAL_SCRIPT_YIELD_NODES_H diff --git a/modules/vorbis/audio_stream_ogg_vorbis.cpp b/modules/vorbis/audio_stream_ogg_vorbis.cpp index 999c06f664..bae8f7be5f 100644 --- a/modules/vorbis/audio_stream_ogg_vorbis.cpp +++ b/modules/vorbis/audio_stream_ogg_vorbis.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "audio_stream_ogg_vorbis.h" size_t AudioStreamPlaybackOGGVorbis::_ov_read_func(void *p_dst, size_t p_data, size_t p_count, void *_f) { diff --git a/modules/vorbis/audio_stream_ogg_vorbis.h b/modules/vorbis/audio_stream_ogg_vorbis.h index 24102a43ec..01de8a3143 100644 --- a/modules/vorbis/audio_stream_ogg_vorbis.h +++ b/modules/vorbis/audio_stream_ogg_vorbis.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef AUDIO_STREAM_OGG_VORBIS_H #define AUDIO_STREAM_OGG_VORBIS_H diff --git a/modules/vorbis/register_types.cpp b/modules/vorbis/register_types.cpp index ffa3971c3e..0ea1fbe8b2 100644 --- a/modules/vorbis/register_types.cpp +++ b/modules/vorbis/register_types.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "register_types.h" #include "audio_stream_ogg_vorbis.h" diff --git a/modules/vorbis/register_types.h b/modules/vorbis/register_types.h index 8e54747036..3885502da2 100644 --- a/modules/vorbis/register_types.h +++ b/modules/vorbis/register_types.h @@ -27,5 +27,6 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_vorbis_types(); void unregister_vorbis_types(); diff --git a/modules/vorbis/stub/register_types.cpp b/modules/vorbis/stub/register_types.cpp index 39abb9aafc..02ac9518c8 100644 --- a/modules/vorbis/stub/register_types.cpp +++ b/modules/vorbis/stub/register_types.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "register_types.h" // Dummy module as libvorbis is needed by other modules (theora ...) diff --git a/modules/vorbis/stub/register_types.h b/modules/vorbis/stub/register_types.h index a6c51fb3e1..3885502da2 100644 --- a/modules/vorbis/stub/register_types.h +++ b/modules/vorbis/stub/register_types.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -27,5 +27,6 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_vorbis_types(); void unregister_vorbis_types(); diff --git a/modules/webm/register_types.cpp b/modules/webm/register_types.cpp index 10c06ca4e5..1183dd41f7 100644 --- a/modules/webm/register_types.cpp +++ b/modules/webm/register_types.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "register_types.h" #include "resource_importer_webm.h" #include "video_stream_webm.h" diff --git a/modules/webm/register_types.h b/modules/webm/register_types.h index a429a9a398..102da2b0f5 100644 --- a/modules/webm/register_types.h +++ b/modules/webm/register_types.h @@ -27,5 +27,6 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_webm_types(); void unregister_webm_types(); diff --git a/modules/webm/resource_importer_webm.cpp b/modules/webm/resource_importer_webm.cpp index 2ea1485437..7124a503e8 100644 --- a/modules/webm/resource_importer_webm.cpp +++ b/modules/webm/resource_importer_webm.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "resource_importer_webm.h" #include "io/resource_saver.h" diff --git a/modules/webm/resource_importer_webm.h b/modules/webm/resource_importer_webm.h index 7cce805e70..d61e6e2a93 100644 --- a/modules/webm/resource_importer_webm.h +++ b/modules/webm/resource_importer_webm.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef RESOURCEIMPORTERWEBM_H #define RESOURCEIMPORTERWEBM_H diff --git a/modules/webm/video_stream_webm.cpp b/modules/webm/video_stream_webm.cpp index e915af3e6c..e6952d14d7 100644 --- a/modules/webm/video_stream_webm.cpp +++ b/modules/webm/video_stream_webm.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "video_stream_webm.h" #include "OpusVorbisDecoder.hpp" diff --git a/modules/webm/video_stream_webm.h b/modules/webm/video_stream_webm.h index c0b4490bf5..dde993d154 100644 --- a/modules/webm/video_stream_webm.h +++ b/modules/webm/video_stream_webm.h @@ -27,6 +27,10 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + +#ifndef VIDEO_STREAM_WEBM_H +#define VIDEO_STREAM_WEBM_H + #include "io/resource_loader.h" #include "scene/resources/video_stream.h" @@ -122,3 +126,5 @@ public: String get_file(); virtual void set_audio_track(int p_track); }; + +#endif // VIDEO_STREAM_WEBM_H diff --git a/modules/webp/image_loader_webp.cpp b/modules/webp/image_loader_webp.cpp index 903b456540..cdf2d75e96 100644 --- a/modules/webp/image_loader_webp.cpp +++ b/modules/webp/image_loader_webp.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "image_loader_webp.h" #include "io/marshalls.h" diff --git a/modules/webp/image_loader_webp.h b/modules/webp/image_loader_webp.h index b00c8b1b05..f051fed4b8 100644 --- a/modules/webp/image_loader_webp.h +++ b/modules/webp/image_loader_webp.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef IMAGE_LOADER_WEBP_H #define IMAGE_LOADER_WEBP_H diff --git a/modules/webp/register_types.cpp b/modules/webp/register_types.cpp index 86eb558dff..9a2e83c65d 100644 --- a/modules/webp/register_types.cpp +++ b/modules/webp/register_types.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "register_types.h" #include "image_loader_webp.h" diff --git a/modules/webp/register_types.h b/modules/webp/register_types.h index 025bc49be1..711f5be61d 100644 --- a/modules/webp/register_types.h +++ b/modules/webp/register_types.h @@ -27,5 +27,6 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_webp_types(); void unregister_webp_types(); |