diff options
Diffstat (limited to 'modules')
91 files changed, 636 insertions, 373 deletions
diff --git a/modules/SCsub b/modules/SCsub index c1cf5a6c1a..e3c535e981 100644 --- a/modules/SCsub +++ b/modules/SCsub @@ -17,6 +17,6 @@ for x in env.module_list: env_modules.Append(CPPFLAGS=["-DMODULE_" + x.upper() + "_ENABLED"]) SConscript(x + "/SCsub") -lib = env_modules.Library("modules", env.modules_sources) +lib = env_modules.add_library("modules", env.modules_sources) env.Prepend(LIBS=[lib]) diff --git a/modules/bullet/area_bullet.cpp b/modules/bullet/area_bullet.cpp index 54024b4f90..fad6f52cea 100644 --- a/modules/bullet/area_bullet.cpp +++ b/modules/bullet/area_bullet.cpp @@ -37,19 +37,19 @@ #include "collision_object_bullet.h" #include "space_bullet.h" -AreaBullet::AreaBullet() - : RigidCollisionObjectBullet(CollisionObjectBullet::TYPE_AREA), - monitorable(true), - isScratched(false), - spOv_mode(PhysicsServer::AREA_SPACE_OVERRIDE_DISABLED), - spOv_gravityPoint(false), - spOv_gravityPointDistanceScale(0), - spOv_gravityPointAttenuation(1), - spOv_gravityVec(0, -1, 0), - spOv_gravityMag(10), - spOv_linearDump(0.1), - spOv_angularDump(1), - spOv_priority(0) { +AreaBullet::AreaBullet() : + RigidCollisionObjectBullet(CollisionObjectBullet::TYPE_AREA), + monitorable(true), + isScratched(false), + spOv_mode(PhysicsServer::AREA_SPACE_OVERRIDE_DISABLED), + spOv_gravityPoint(false), + spOv_gravityPointDistanceScale(0), + spOv_gravityPointAttenuation(1), + spOv_gravityVec(0, -1, 0), + spOv_gravityMag(10), + spOv_linearDump(0.1), + spOv_angularDump(1), + spOv_priority(0) { btGhost = bulletnew(btGhostObject); btGhost->setCollisionShape(compoundShape); diff --git a/modules/bullet/area_bullet.h b/modules/bullet/area_bullet.h index f6e3b7e902..95ce62bfed 100644 --- a/modules/bullet/area_bullet.h +++ b/modules/bullet/area_bullet.h @@ -47,8 +47,8 @@ public: ObjectID event_callback_id; StringName event_callback_method; - InOutEventCallback() - : event_callback_id(0) {} + InOutEventCallback() : + event_callback_id(0) {} }; enum OverlapState { @@ -62,10 +62,12 @@ public: CollisionObjectBullet *object; OverlapState state; - OverlappingObjectData() - : object(NULL), state(OVERLAP_STATE_ENTER) {} - OverlappingObjectData(CollisionObjectBullet *p_object, OverlapState p_state) - : object(p_object), state(p_state) {} + OverlappingObjectData() : + object(NULL), + state(OVERLAP_STATE_ENTER) {} + OverlappingObjectData(CollisionObjectBullet *p_object, OverlapState p_state) : + object(p_object), + state(p_state) {} OverlappingObjectData(const OverlappingObjectData &other) { operator=(other); } diff --git a/modules/bullet/btRayShape.cpp b/modules/bullet/btRayShape.cpp index ac95faaac6..bbd2b19677 100644 --- a/modules/bullet/btRayShape.cpp +++ b/modules/bullet/btRayShape.cpp @@ -33,9 +33,9 @@ #include "LinearMath/btAabbUtil2.h" #include "math/math_funcs.h" -btRayShape::btRayShape(btScalar length) - : btConvexInternalShape(), - m_shapeAxis(0, 0, 1) { +btRayShape::btRayShape(btScalar length) : + btConvexInternalShape(), + m_shapeAxis(0, 0, 1) { m_shapeType = CUSTOM_CONVEX_SHAPE_TYPE; setLength(length); } diff --git a/modules/bullet/bullet_physics_server.cpp b/modules/bullet/bullet_physics_server.cpp index 7f95d16ba6..339dccce33 100644 --- a/modules/bullet/bullet_physics_server.cpp +++ b/modules/bullet/bullet_physics_server.cpp @@ -78,10 +78,10 @@ void BulletPhysicsServer::_bind_methods() { //ClassDB::bind_method(D_METHOD("DoTest"), &BulletPhysicsServer::DoTest); } -BulletPhysicsServer::BulletPhysicsServer() - : PhysicsServer(), - active(true), - active_spaces_count(0) {} +BulletPhysicsServer::BulletPhysicsServer() : + PhysicsServer(), + active(true), + active_spaces_count(0) {} BulletPhysicsServer::~BulletPhysicsServer() {} @@ -723,15 +723,15 @@ void BulletPhysicsServer::body_set_axis_velocity(RID p_body, const Vector3 &p_ax body->set_linear_velocity(v); } -void BulletPhysicsServer::body_set_axis_lock(RID p_body, PhysicsServer::BodyAxisLock p_lock) { +void BulletPhysicsServer::body_set_axis_lock(RID p_body, int axis, bool p_lock) { RigidBodyBullet *body = rigid_body_owner.get(p_body); ERR_FAIL_COND(!body); - body->set_axis_lock(p_lock); + body->set_axis_lock(axis, p_lock); } -PhysicsServer::BodyAxisLock BulletPhysicsServer::body_get_axis_lock(RID p_body) const { +bool BulletPhysicsServer::body_get_axis_lock(RID p_body) const { const RigidBodyBullet *body = rigid_body_owner.get(p_body); - ERR_FAIL_COND_V(!body, BODY_AXIS_LOCK_DISABLED); + ERR_FAIL_COND_V(!body, 0); return body->get_axis_lock(); } @@ -798,7 +798,7 @@ bool BulletPhysicsServer::body_is_omitting_force_integration(RID p_body) const { void BulletPhysicsServer::body_set_force_integration_callback(RID p_body, Object *p_receiver, const StringName &p_method, const Variant &p_udata) { RigidBodyBullet *body = rigid_body_owner.get(p_body); ERR_FAIL_COND(!body); - body->set_force_integration_callback(p_receiver->get_instance_id(), p_method, p_udata); + body->set_force_integration_callback(p_receiver ? p_receiver->get_instance_id() : ObjectID(0), p_method, p_udata); } void BulletPhysicsServer::body_set_ray_pickable(RID p_body, bool p_enable) { diff --git a/modules/bullet/bullet_physics_server.h b/modules/bullet/bullet_physics_server.h index ad8137ee2f..ed5acb9041 100644 --- a/modules/bullet/bullet_physics_server.h +++ b/modules/bullet/bullet_physics_server.h @@ -226,8 +226,8 @@ public: virtual void body_apply_torque_impulse(RID p_body, const Vector3 &p_impulse); virtual void body_set_axis_velocity(RID p_body, const Vector3 &p_axis_velocity); - virtual void body_set_axis_lock(RID p_body, BodyAxisLock p_lock); - virtual BodyAxisLock body_get_axis_lock(RID p_body) const; + virtual void body_set_axis_lock(RID p_body, int axis, bool p_lock); + virtual bool body_get_axis_lock(RID p_body) const; virtual void body_add_collision_exception(RID p_body, RID p_body_b); virtual void body_remove_collision_exception(RID p_body, RID p_body_b); diff --git a/modules/bullet/collision_object_bullet.cpp b/modules/bullet/collision_object_bullet.cpp index 5e878b0ee4..da3a4b73cf 100644 --- a/modules/bullet/collision_object_bullet.cpp +++ b/modules/bullet/collision_object_bullet.cpp @@ -50,8 +50,14 @@ void CollisionObjectBullet::ShapeWrapper::set_transform(const btTransform &p_tra transform = p_transform; } -CollisionObjectBullet::CollisionObjectBullet(Type p_type) - : RIDBullet(), space(NULL), type(p_type), collisionsEnabled(true), m_isStatic(false), bt_collision_object(NULL), body_scale(1., 1., 1.) {} +CollisionObjectBullet::CollisionObjectBullet(Type p_type) : + RIDBullet(), + space(NULL), + type(p_type), + collisionsEnabled(true), + m_isStatic(false), + bt_collision_object(NULL), + body_scale(1., 1., 1.) {} CollisionObjectBullet::~CollisionObjectBullet() { // Remove all overlapping @@ -165,8 +171,9 @@ const btTransform &CollisionObjectBullet::get_transform__bullet() const { return bt_collision_object->getWorldTransform(); } -RigidCollisionObjectBullet::RigidCollisionObjectBullet(Type p_type) - : CollisionObjectBullet(p_type), compoundShape(bulletnew(btCompoundShape(enableDynamicAabbTree, initialChildCapacity))) { +RigidCollisionObjectBullet::RigidCollisionObjectBullet(Type p_type) : + CollisionObjectBullet(p_type), + compoundShape(bulletnew(btCompoundShape(enableDynamicAabbTree, initialChildCapacity))) { } RigidCollisionObjectBullet::~RigidCollisionObjectBullet() { diff --git a/modules/bullet/collision_object_bullet.h b/modules/bullet/collision_object_bullet.h index 153b8ea5bc..51e48909e4 100644 --- a/modules/bullet/collision_object_bullet.h +++ b/modules/bullet/collision_object_bullet.h @@ -70,16 +70,22 @@ public: btTransform transform; bool active; - ShapeWrapper() - : shape(NULL), bt_shape(NULL), active(true) {} - - ShapeWrapper(ShapeBullet *p_shape, const btTransform &p_transform, bool p_active) - : shape(p_shape), bt_shape(NULL), active(p_active) { + ShapeWrapper() : + shape(NULL), + bt_shape(NULL), + active(true) {} + + ShapeWrapper(ShapeBullet *p_shape, const btTransform &p_transform, bool p_active) : + shape(p_shape), + bt_shape(NULL), + active(p_active) { set_transform(p_transform); } - ShapeWrapper(ShapeBullet *p_shape, const Transform &p_transform, bool p_active) - : shape(p_shape), bt_shape(NULL), active(p_active) { + ShapeWrapper(ShapeBullet *p_shape, const Transform &p_transform, bool p_active) : + shape(p_shape), + bt_shape(NULL), + active(p_active) { set_transform(p_transform); } ~ShapeWrapper(); diff --git a/modules/bullet/cone_twist_joint_bullet.cpp b/modules/bullet/cone_twist_joint_bullet.cpp index f6ac40e001..7ae5e79645 100644 --- a/modules/bullet/cone_twist_joint_bullet.cpp +++ b/modules/bullet/cone_twist_joint_bullet.cpp @@ -35,8 +35,8 @@ #include "bullet_utilities.h" #include "rigid_body_bullet.h" -ConeTwistJointBullet::ConeTwistJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &rbAFrame, const Transform &rbBFrame) - : JointBullet() { +ConeTwistJointBullet::ConeTwistJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &rbAFrame, const Transform &rbBFrame) : + JointBullet() { btTransform btFrameA; G_TO_B(rbAFrame, btFrameA); if (rbB) { diff --git a/modules/bullet/constraint_bullet.cpp b/modules/bullet/constraint_bullet.cpp index 08fc36f274..505579ce9b 100644 --- a/modules/bullet/constraint_bullet.cpp +++ b/modules/bullet/constraint_bullet.cpp @@ -33,8 +33,9 @@ #include "collision_object_bullet.h" #include "space_bullet.h" -ConstraintBullet::ConstraintBullet() - : space(NULL), constraint(NULL) {} +ConstraintBullet::ConstraintBullet() : + space(NULL), + constraint(NULL) {} void ConstraintBullet::setup(btTypedConstraint *p_constraint) { constraint = p_constraint; diff --git a/modules/bullet/generic_6dof_joint_bullet.cpp b/modules/bullet/generic_6dof_joint_bullet.cpp index 647396c24c..28928bd861 100644 --- a/modules/bullet/generic_6dof_joint_bullet.cpp +++ b/modules/bullet/generic_6dof_joint_bullet.cpp @@ -35,8 +35,8 @@ #include "bullet_utilities.h" #include "rigid_body_bullet.h" -Generic6DOFJointBullet::Generic6DOFJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameInA, const Transform &frameInB, bool useLinearReferenceFrameA) - : JointBullet() { +Generic6DOFJointBullet::Generic6DOFJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameInA, const Transform &frameInB, bool useLinearReferenceFrameA) : + JointBullet() { btTransform btFrameA; G_TO_B(frameInA, btFrameA); diff --git a/modules/bullet/godot_collision_configuration.cpp b/modules/bullet/godot_collision_configuration.cpp index 4e4228cc48..136fb2ee74 100644 --- a/modules/bullet/godot_collision_configuration.cpp +++ b/modules/bullet/godot_collision_configuration.cpp @@ -34,8 +34,8 @@ #include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h" #include "godot_ray_world_algorithm.h" -GodotCollisionConfiguration::GodotCollisionConfiguration(const btDiscreteDynamicsWorld *world, const btDefaultCollisionConstructionInfo &constructionInfo) - : btDefaultCollisionConfiguration(constructionInfo) { +GodotCollisionConfiguration::GodotCollisionConfiguration(const btDiscreteDynamicsWorld *world, const btDefaultCollisionConstructionInfo &constructionInfo) : + btDefaultCollisionConfiguration(constructionInfo) { void *mem = NULL; diff --git a/modules/bullet/godot_collision_dispatcher.cpp b/modules/bullet/godot_collision_dispatcher.cpp index ea75e4eef4..e0ca29a8f3 100644 --- a/modules/bullet/godot_collision_dispatcher.cpp +++ b/modules/bullet/godot_collision_dispatcher.cpp @@ -34,8 +34,8 @@ const int GodotCollisionDispatcher::CASTED_TYPE_AREA = static_cast<int>(CollisionObjectBullet::TYPE_AREA); -GodotCollisionDispatcher::GodotCollisionDispatcher(btCollisionConfiguration *collisionConfiguration) - : btCollisionDispatcher(collisionConfiguration) {} +GodotCollisionDispatcher::GodotCollisionDispatcher(btCollisionConfiguration *collisionConfiguration) : + btCollisionDispatcher(collisionConfiguration) {} bool GodotCollisionDispatcher::needsCollision(const btCollisionObject *body0, const btCollisionObject *body1) { if (body0->getUserIndex() == CASTED_TYPE_AREA || body1->getUserIndex() == CASTED_TYPE_AREA) { diff --git a/modules/bullet/godot_motion_state.h b/modules/bullet/godot_motion_state.h index 5111807394..62ea472446 100644 --- a/modules/bullet/godot_motion_state.h +++ b/modules/bullet/godot_motion_state.h @@ -51,10 +51,10 @@ class GodotMotionState : public btMotionState { RigidBodyBullet *owner; public: - GodotMotionState(RigidBodyBullet *p_owner) - : bodyKinematicWorldTransf(btMatrix3x3(1., 0., 0., 0., 1., 0., 0., 0., 1.), btVector3(0., 0., 0.)), - bodyCurrentWorldTransform(btMatrix3x3(1., 0., 0., 0., 1., 0., 0., 0., 1.), btVector3(0., 0., 0.)), - owner(p_owner) {} + GodotMotionState(RigidBodyBullet *p_owner) : + bodyKinematicWorldTransf(btMatrix3x3(1., 0., 0., 0., 1., 0., 0., 0., 1.), btVector3(0., 0., 0.)), + bodyCurrentWorldTransform(btMatrix3x3(1., 0., 0., 0., 1., 0., 0., 0., 1.), btVector3(0., 0., 0.)), + owner(p_owner) {} /// IMPORTANT DON'T USE THIS FUNCTION TO KNOW THE CURRENT BODY TRANSFORM /// This class is used internally by Bullet diff --git a/modules/bullet/godot_ray_world_algorithm.cpp b/modules/bullet/godot_ray_world_algorithm.cpp index 98daf8398e..ba13903548 100644 --- a/modules/bullet/godot_ray_world_algorithm.cpp +++ b/modules/bullet/godot_ray_world_algorithm.cpp @@ -34,18 +34,18 @@ #include "btRayShape.h" #include "collision_object_bullet.h" -GodotRayWorldAlgorithm::CreateFunc::CreateFunc(const btDiscreteDynamicsWorld *world) - : m_world(world) {} - -GodotRayWorldAlgorithm::SwappedCreateFunc::SwappedCreateFunc(const btDiscreteDynamicsWorld *world) - : m_world(world) {} - -GodotRayWorldAlgorithm::GodotRayWorldAlgorithm(const btDiscreteDynamicsWorld *world, btPersistentManifold *mf, const btCollisionAlgorithmConstructionInfo &ci, const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, bool isSwapped) - : btActivatingCollisionAlgorithm(ci, body0Wrap, body1Wrap), - m_manifoldPtr(mf), - m_ownManifold(false), - m_world(world), - m_isSwapped(isSwapped) {} +GodotRayWorldAlgorithm::CreateFunc::CreateFunc(const btDiscreteDynamicsWorld *world) : + m_world(world) {} + +GodotRayWorldAlgorithm::SwappedCreateFunc::SwappedCreateFunc(const btDiscreteDynamicsWorld *world) : + m_world(world) {} + +GodotRayWorldAlgorithm::GodotRayWorldAlgorithm(const btDiscreteDynamicsWorld *world, btPersistentManifold *mf, const btCollisionAlgorithmConstructionInfo &ci, const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, bool isSwapped) : + btActivatingCollisionAlgorithm(ci, body0Wrap, body1Wrap), + m_manifoldPtr(mf), + m_ownManifold(false), + m_world(world), + m_isSwapped(isSwapped) {} GodotRayWorldAlgorithm::~GodotRayWorldAlgorithm() { if (m_ownManifold && m_manifoldPtr) { diff --git a/modules/bullet/godot_result_callbacks.h b/modules/bullet/godot_result_callbacks.h index ba5142676b..5750dc2acd 100644 --- a/modules/bullet/godot_result_callbacks.h +++ b/modules/bullet/godot_result_callbacks.h @@ -52,8 +52,10 @@ struct GodotClosestRayResultCallback : public btCollisionWorld::ClosestRayResult bool m_pickRay; public: - GodotClosestRayResultCallback(const btVector3 &rayFromWorld, const btVector3 &rayToWorld, const Set<RID> *p_exclude) - : btCollisionWorld::ClosestRayResultCallback(rayFromWorld, rayToWorld), m_exclude(p_exclude), m_pickRay(false) {} + GodotClosestRayResultCallback(const btVector3 &rayFromWorld, const btVector3 &rayToWorld, const Set<RID> *p_exclude) : + btCollisionWorld::ClosestRayResultCallback(rayFromWorld, rayToWorld), + m_exclude(p_exclude), + m_pickRay(false) {} virtual bool needsCollision(btBroadphaseProxy *proxy0) const; }; @@ -66,8 +68,11 @@ public: int count; const Set<RID> *m_exclude; - GodotAllConvexResultCallback(PhysicsDirectSpaceState::ShapeResult *p_results, int p_resultMax, const Set<RID> *p_exclude) - : m_results(p_results), m_exclude(p_exclude), m_resultMax(p_resultMax), count(0) {} + GodotAllConvexResultCallback(PhysicsDirectSpaceState::ShapeResult *p_results, int p_resultMax, const Set<RID> *p_exclude) : + m_results(p_results), + m_exclude(p_exclude), + m_resultMax(p_resultMax), + count(0) {} virtual bool needsCollision(btBroadphaseProxy *proxy0) const; @@ -79,8 +84,10 @@ public: const RigidBodyBullet *m_self_object; const bool m_ignore_areas; - GodotKinClosestConvexResultCallback(const btVector3 &convexFromWorld, const btVector3 &convexToWorld, const RigidBodyBullet *p_self_object, bool p_ignore_areas) - : btCollisionWorld::ClosestConvexResultCallback(convexFromWorld, convexToWorld), m_self_object(p_self_object), m_ignore_areas(p_ignore_areas) {} + GodotKinClosestConvexResultCallback(const btVector3 &convexFromWorld, const btVector3 &convexToWorld, const RigidBodyBullet *p_self_object, bool p_ignore_areas) : + btCollisionWorld::ClosestConvexResultCallback(convexFromWorld, convexToWorld), + m_self_object(p_self_object), + m_ignore_areas(p_ignore_areas) {} virtual bool needsCollision(btBroadphaseProxy *proxy0) const; }; @@ -90,8 +97,9 @@ public: const Set<RID> *m_exclude; int m_shapeId; - GodotClosestConvexResultCallback(const btVector3 &convexFromWorld, const btVector3 &convexToWorld, const Set<RID> *p_exclude) - : btCollisionWorld::ClosestConvexResultCallback(convexFromWorld, convexToWorld), m_exclude(p_exclude) {} + GodotClosestConvexResultCallback(const btVector3 &convexFromWorld, const btVector3 &convexToWorld, const Set<RID> *p_exclude) : + btCollisionWorld::ClosestConvexResultCallback(convexFromWorld, convexToWorld), + m_exclude(p_exclude) {} virtual bool needsCollision(btBroadphaseProxy *proxy0) const; @@ -106,8 +114,12 @@ public: int m_count; const Set<RID> *m_exclude; - GodotAllContactResultCallback(btCollisionObject *p_self_object, PhysicsDirectSpaceState::ShapeResult *p_results, int p_resultMax, const Set<RID> *p_exclude) - : m_self_object(p_self_object), m_results(p_results), m_exclude(p_exclude), m_resultMax(p_resultMax), m_count(0) {} + GodotAllContactResultCallback(btCollisionObject *p_self_object, PhysicsDirectSpaceState::ShapeResult *p_results, int p_resultMax, const Set<RID> *p_exclude) : + m_self_object(p_self_object), + m_results(p_results), + m_exclude(p_exclude), + m_resultMax(p_resultMax), + m_count(0) {} virtual bool needsCollision(btBroadphaseProxy *proxy0) const; @@ -123,8 +135,12 @@ public: int m_count; const Set<RID> *m_exclude; - GodotContactPairContactResultCallback(btCollisionObject *p_self_object, Vector3 *p_results, int p_resultMax, const Set<RID> *p_exclude) - : m_self_object(p_self_object), m_results(p_results), m_exclude(p_exclude), m_resultMax(p_resultMax), m_count(0) {} + GodotContactPairContactResultCallback(btCollisionObject *p_self_object, Vector3 *p_results, int p_resultMax, const Set<RID> *p_exclude) : + m_self_object(p_self_object), + m_results(p_results), + m_exclude(p_exclude), + m_resultMax(p_resultMax), + m_count(0) {} virtual bool needsCollision(btBroadphaseProxy *proxy0) const; @@ -141,8 +157,12 @@ public: btVector3 m_rest_info_bt_point; const Set<RID> *m_exclude; - GodotRestInfoContactResultCallback(btCollisionObject *p_self_object, PhysicsDirectSpaceState::ShapeRestInfo *p_result, const Set<RID> *p_exclude) - : m_self_object(p_self_object), m_result(p_result), m_exclude(p_exclude), m_collided(false), m_min_distance(0) {} + GodotRestInfoContactResultCallback(btCollisionObject *p_self_object, PhysicsDirectSpaceState::ShapeRestInfo *p_result, const Set<RID> *p_exclude) : + m_self_object(p_self_object), + m_result(p_result), + m_exclude(p_exclude), + m_collided(false), + m_min_distance(0) {} virtual bool needsCollision(btBroadphaseProxy *proxy0) const; @@ -158,12 +178,12 @@ struct GodotDeepPenetrationContactResultCallback : public btManifoldResult { btScalar m_most_penetrated_distance; - GodotDeepPenetrationContactResultCallback(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap) - : btManifoldResult(body0Wrap, body1Wrap), - m_pointCollisionObject(NULL), - m_penetration_distance(0), - m_other_compound_shape_index(0), - m_most_penetrated_distance(1e20) {} + GodotDeepPenetrationContactResultCallback(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap) : + btManifoldResult(body0Wrap, body1Wrap), + m_pointCollisionObject(NULL), + m_penetration_distance(0), + m_other_compound_shape_index(0), + m_most_penetrated_distance(1e20) {} void reset() { m_pointCollisionObject = NULL; diff --git a/modules/bullet/hinge_joint_bullet.cpp b/modules/bullet/hinge_joint_bullet.cpp index bb70babd99..d3288807b3 100644 --- a/modules/bullet/hinge_joint_bullet.cpp +++ b/modules/bullet/hinge_joint_bullet.cpp @@ -35,8 +35,8 @@ #include "bullet_utilities.h" #include "rigid_body_bullet.h" -HingeJointBullet::HingeJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameA, const Transform &frameB) - : JointBullet() { +HingeJointBullet::HingeJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameA, const Transform &frameB) : + JointBullet() { btTransform btFrameA; G_TO_B(frameA, btFrameA); @@ -53,8 +53,8 @@ HingeJointBullet::HingeJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, c setup(hingeConstraint); } -HingeJointBullet::HingeJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Vector3 &pivotInA, const Vector3 &pivotInB, const Vector3 &axisInA, const Vector3 &axisInB) - : JointBullet() { +HingeJointBullet::HingeJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Vector3 &pivotInA, const Vector3 &pivotInB, const Vector3 &axisInA, const Vector3 &axisInB) : + JointBullet() { btVector3 btPivotA; btVector3 btAxisA; diff --git a/modules/bullet/joint_bullet.cpp b/modules/bullet/joint_bullet.cpp index be544f89bf..c8d91aa257 100644 --- a/modules/bullet/joint_bullet.cpp +++ b/modules/bullet/joint_bullet.cpp @@ -32,7 +32,7 @@ #include "joint_bullet.h" #include "space_bullet.h" -JointBullet::JointBullet() - : ConstraintBullet() {} +JointBullet::JointBullet() : + ConstraintBullet() {} JointBullet::~JointBullet() {} diff --git a/modules/bullet/pin_joint_bullet.cpp b/modules/bullet/pin_joint_bullet.cpp index cd9e9a4557..8c74fcbc94 100644 --- a/modules/bullet/pin_joint_bullet.cpp +++ b/modules/bullet/pin_joint_bullet.cpp @@ -34,8 +34,8 @@ #include "bullet_types_converter.h" #include "rigid_body_bullet.h" -PinJointBullet::PinJointBullet(RigidBodyBullet *p_body_a, const Vector3 &p_pos_a, RigidBodyBullet *p_body_b, const Vector3 &p_pos_b) - : JointBullet() { +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) { btVector3 btPivotA; diff --git a/modules/bullet/rigid_body_bullet.cpp b/modules/bullet/rigid_body_bullet.cpp index f5ab8221e3..843bdab31f 100644 --- a/modules/bullet/rigid_body_bullet.cpp +++ b/modules/bullet/rigid_body_bullet.cpp @@ -176,9 +176,9 @@ PhysicsDirectSpaceState *BulletPhysicsDirectBodyState::get_space_state() { return body->get_space()->get_direct_state(); } -RigidBodyBullet::KinematicUtilities::KinematicUtilities(RigidBodyBullet *p_owner) - : owner(p_owner), - safe_margin(0.001) { +RigidBodyBullet::KinematicUtilities::KinematicUtilities(RigidBodyBullet *p_owner) : + owner(p_owner), + safe_margin(0.001) { } RigidBodyBullet::KinematicUtilities::~KinematicUtilities() { @@ -250,22 +250,22 @@ void RigidBodyBullet::KinematicUtilities::just_delete_shapes(int new_size) { shapes.resize(new_size); } -RigidBodyBullet::RigidBodyBullet() - : RigidCollisionObjectBullet(CollisionObjectBullet::TYPE_RIGID_BODY), - kinematic_utilities(NULL), - gravity_scale(1), - mass(1), - linearDamp(0), - angularDamp(0), - can_sleep(true), - force_integration_callback(NULL), - isTransformChanged(false), - maxCollisionsDetection(0), - collisionsCount(0), - maxAreasWhereIam(10), - areaWhereIamCount(0), - countGravityPointSpaces(0), - isScratchedSpaceOverrideModificator(false) { +RigidBodyBullet::RigidBodyBullet() : + RigidCollisionObjectBullet(CollisionObjectBullet::TYPE_RIGID_BODY), + kinematic_utilities(NULL), + gravity_scale(1), + mass(1), + linearDamp(0), + angularDamp(0), + can_sleep(true), + force_integration_callback(NULL), + isTransformChanged(false), + maxCollisionsDetection(0), + collisionsCount(0), + maxAreasWhereIam(10), + areaWhereIamCount(0), + countGravityPointSpaces(0), + isScratchedSpaceOverrideModificator(false) { godotMotionState = bulletnew(GodotMotionState(this)); @@ -277,7 +277,7 @@ RigidBodyBullet::RigidBodyBullet() setupBulletCollisionObject(btBody); set_mode(PhysicsServer::BODY_MODE_RIGID); - set_axis_lock(PhysicsServer::BODY_AXIS_LOCK_DISABLED); + set_axis_lock(0, locked_axis[0]); areasWhereIam.resize(maxAreasWhereIam); for (int i = areasWhereIam.size() - 1; 0 <= i; --i) { @@ -498,25 +498,25 @@ void RigidBodyBullet::set_mode(PhysicsServer::BodyMode p_mode) { switch (p_mode) { case PhysicsServer::BODY_MODE_KINEMATIC: mode = PhysicsServer::BODY_MODE_KINEMATIC; - set_axis_lock(axis_lock); // Reload axis lock + set_axis_lock(0, locked_axis[0]); // Reload axis lock _internal_set_mass(0); init_kinematic_utilities(); break; case PhysicsServer::BODY_MODE_STATIC: mode = PhysicsServer::BODY_MODE_STATIC; - set_axis_lock(axis_lock); // Reload axis lock + set_axis_lock(0, locked_axis[0]); // Reload axis lock _internal_set_mass(0); break; case PhysicsServer::BODY_MODE_RIGID: { mode = PhysicsServer::BODY_MODE_RIGID; - set_axis_lock(axis_lock); // Reload axis lock + set_axis_lock(0, locked_axis[0]); // Reload axis lock _internal_set_mass(0 == mass ? 1 : mass); scratch_space_override_modificator(); break; } case PhysicsServer::BODY_MODE_CHARACTER: { mode = PhysicsServer::BODY_MODE_CHARACTER; - set_axis_lock(axis_lock); // Reload axis lock + set_axis_lock(0, locked_axis[0]); // Reload axis lock _internal_set_mass(0 == mass ? 1 : mass); scratch_space_override_modificator(); break; @@ -655,22 +655,14 @@ Vector3 RigidBodyBullet::get_applied_torque() const { return gTotTorq; } -void RigidBodyBullet::set_axis_lock(PhysicsServer::BodyAxisLock p_lock) { - axis_lock = p_lock; +void RigidBodyBullet::set_axis_lock(int axis, bool p_lock) { + locked_axis[axis] = p_lock; - if (PhysicsServer::BODY_AXIS_LOCK_DISABLED == axis_lock) { - btBody->setLinearFactor(btVector3(1., 1., 1.)); + btBody->setLinearFactor(btVector3(locked_axis[0] ? 0 : 1., locked_axis[1] ? 0 : 1., locked_axis[2] ? 0 : 1.)); + if (locked_axis[0] || locked_axis[1] || locked_axis[2]) + btBody->setAngularFactor(btVector3(locked_axis[0] ? 1. : 0, locked_axis[1] ? 1. : 0, locked_axis[2] ? 1. : 0)); + else btBody->setAngularFactor(btVector3(1., 1., 1.)); - } else if (PhysicsServer::BODY_AXIS_LOCK_X == axis_lock) { - btBody->setLinearFactor(btVector3(0., 1., 1.)); - btBody->setAngularFactor(btVector3(1., 0., 0.)); - } else if (PhysicsServer::BODY_AXIS_LOCK_Y == axis_lock) { - btBody->setLinearFactor(btVector3(1., 0., 1.)); - btBody->setAngularFactor(btVector3(0., 1., 0.)); - } else if (PhysicsServer::BODY_AXIS_LOCK_Z == axis_lock) { - btBody->setLinearFactor(btVector3(1., 1., 0.)); - btBody->setAngularFactor(btVector3(0., 0., 1.)); - } if (PhysicsServer::BODY_MODE_CHARACTER == mode) { /// When character lock angular @@ -678,17 +670,8 @@ void RigidBodyBullet::set_axis_lock(PhysicsServer::BodyAxisLock p_lock) { } } -PhysicsServer::BodyAxisLock RigidBodyBullet::get_axis_lock() const { - btVector3 vec = btBody->getLinearFactor(); - if (0. == vec.x()) { - return PhysicsServer::BODY_AXIS_LOCK_X; - } else if (0. == vec.y()) { - return PhysicsServer::BODY_AXIS_LOCK_Y; - } else if (0. == vec.z()) { - return PhysicsServer::BODY_AXIS_LOCK_Z; - } else { - return PhysicsServer::BODY_AXIS_LOCK_DISABLED; - } +bool RigidBodyBullet::get_axis_lock() const { + return locked_axis; } void RigidBodyBullet::set_continuous_collision_detection(bool p_enable) { diff --git a/modules/bullet/rigid_body_bullet.h b/modules/bullet/rigid_body_bullet.h index ab3c3e58b2..fde8b21e17 100644 --- a/modules/bullet/rigid_body_bullet.h +++ b/modules/bullet/rigid_body_bullet.h @@ -156,8 +156,8 @@ public: class btConvexShape *shape; btTransform transform; - KinematicShape() - : shape(NULL) {} + KinematicShape() : + shape(NULL) {} const bool is_active() const { return shape; } }; @@ -184,7 +184,7 @@ private: KinematicUtilities *kinematic_utilities; PhysicsServer::BodyMode mode; - PhysicsServer::BodyAxisLock axis_lock; + bool locked_axis[3] = { false, false, false }; GodotMotionState *godotMotionState; btRigidBody *btBody; real_t mass; @@ -269,8 +269,8 @@ public: void set_applied_torque(const Vector3 &p_torque); Vector3 get_applied_torque() const; - void set_axis_lock(PhysicsServer::BodyAxisLock p_lock); - PhysicsServer::BodyAxisLock get_axis_lock() const; + void set_axis_lock(int axis, bool p_lock); + bool get_axis_lock() const; /// Doc: /// http://www.bulletphysics.org/mediawiki-1.5.8/index.php?title=Anti_tunneling_by_Motion_Clamping diff --git a/modules/bullet/shape_bullet.cpp b/modules/bullet/shape_bullet.cpp index f51af93a31..572a3b4476 100644 --- a/modules/bullet/shape_bullet.cpp +++ b/modules/bullet/shape_bullet.cpp @@ -130,8 +130,8 @@ btRayShape *ShapeBullet::create_shape_ray(real_t p_length) { /* PLANE */ -PlaneShapeBullet::PlaneShapeBullet() - : ShapeBullet() {} +PlaneShapeBullet::PlaneShapeBullet() : + ShapeBullet() {} void PlaneShapeBullet::set_data(const Variant &p_data) { setup(p_data); @@ -158,8 +158,8 @@ btCollisionShape *PlaneShapeBullet::create_bt_shape() { /* Sphere */ -SphereShapeBullet::SphereShapeBullet() - : ShapeBullet() {} +SphereShapeBullet::SphereShapeBullet() : + ShapeBullet() {} void SphereShapeBullet::set_data(const Variant &p_data) { setup(p_data); @@ -183,8 +183,8 @@ btCollisionShape *SphereShapeBullet::create_bt_shape() { } /* Box */ -BoxShapeBullet::BoxShapeBullet() - : ShapeBullet() {} +BoxShapeBullet::BoxShapeBullet() : + ShapeBullet() {} void BoxShapeBullet::set_data(const Variant &p_data) { setup(p_data); @@ -211,8 +211,8 @@ btCollisionShape *BoxShapeBullet::create_bt_shape() { /* Capsule */ -CapsuleShapeBullet::CapsuleShapeBullet() - : ShapeBullet() {} +CapsuleShapeBullet::CapsuleShapeBullet() : + ShapeBullet() {} void CapsuleShapeBullet::set_data(const Variant &p_data) { Dictionary d = p_data; @@ -244,8 +244,8 @@ btCollisionShape *CapsuleShapeBullet::create_bt_shape() { /* Convex polygon */ -ConvexPolygonShapeBullet::ConvexPolygonShapeBullet() - : ShapeBullet() {} +ConvexPolygonShapeBullet::ConvexPolygonShapeBullet() : + ShapeBullet() {} void ConvexPolygonShapeBullet::set_data(const Variant &p_data) { setup(p_data); @@ -286,8 +286,9 @@ btCollisionShape *ConvexPolygonShapeBullet::create_bt_shape() { /* Concave polygon */ -ConcavePolygonShapeBullet::ConcavePolygonShapeBullet() - : ShapeBullet(), meshShape(NULL) {} +ConcavePolygonShapeBullet::ConcavePolygonShapeBullet() : + ShapeBullet(), + meshShape(NULL) {} ConcavePolygonShapeBullet::~ConcavePolygonShapeBullet() { if (meshShape) { @@ -359,8 +360,8 @@ btCollisionShape *ConcavePolygonShapeBullet::create_bt_shape() { /* Height map shape */ -HeightMapShapeBullet::HeightMapShapeBullet() - : ShapeBullet() {} +HeightMapShapeBullet::HeightMapShapeBullet() : + ShapeBullet() {} void HeightMapShapeBullet::set_data(const Variant &p_data) { ERR_FAIL_COND(p_data.get_type() != Variant::DICTIONARY); @@ -411,8 +412,9 @@ btCollisionShape *HeightMapShapeBullet::create_bt_shape() { } /* Ray shape */ -RayShapeBullet::RayShapeBullet() - : ShapeBullet(), length(1) {} +RayShapeBullet::RayShapeBullet() : + ShapeBullet(), + length(1) {} void RayShapeBullet::set_data(const Variant &p_data) { setup(p_data); diff --git a/modules/bullet/slider_joint_bullet.cpp b/modules/bullet/slider_joint_bullet.cpp index 2da65677f5..f1d60679ec 100644 --- a/modules/bullet/slider_joint_bullet.cpp +++ b/modules/bullet/slider_joint_bullet.cpp @@ -35,8 +35,8 @@ #include "bullet_utilities.h" #include "rigid_body_bullet.h" -SliderJointBullet::SliderJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameInA, const Transform &frameInB) - : JointBullet() { +SliderJointBullet::SliderJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameInA, const Transform &frameInB) : + JointBullet() { btTransform btFrameA; G_TO_B(frameInA, btFrameA); if (rbB) { diff --git a/modules/bullet/soft_body_bullet.cpp b/modules/bullet/soft_body_bullet.cpp index 64ef7bfad2..ef5c8cac6f 100644 --- a/modules/bullet/soft_body_bullet.cpp +++ b/modules/bullet/soft_body_bullet.cpp @@ -36,8 +36,18 @@ #include "scene/3d/immediate_geometry.h" -SoftBodyBullet::SoftBodyBullet() - : CollisionObjectBullet(CollisionObjectBullet::TYPE_SOFT_BODY), mass(1), simulation_precision(5), stiffness(0.5f), pressure_coefficient(50), damping_coefficient(0.005), drag_coefficient(0.005), bt_soft_body(NULL), soft_shape_type(SOFT_SHAPETYPE_NONE), isScratched(false), soft_body_shape_data(NULL) { +SoftBodyBullet::SoftBodyBullet() : + CollisionObjectBullet(CollisionObjectBullet::TYPE_SOFT_BODY), + mass(1), + simulation_precision(5), + stiffness(0.5f), + pressure_coefficient(50), + damping_coefficient(0.005), + drag_coefficient(0.005), + bt_soft_body(NULL), + soft_shape_type(SOFT_SHAPETYPE_NONE), + isScratched(false), + soft_body_shape_data(NULL) { test_geometry = memnew(ImmediateGeometry); diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp index d8c8cab17a..c1f6e81734 100644 --- a/modules/bullet/space_bullet.cpp +++ b/modules/bullet/space_bullet.cpp @@ -50,8 +50,9 @@ #include "ustring.h" #include <assert.h> -BulletPhysicsDirectSpaceState::BulletPhysicsDirectSpaceState(SpaceBullet *p_space) - : PhysicsDirectSpaceState(), space(p_space) {} +BulletPhysicsDirectSpaceState::BulletPhysicsDirectSpaceState(SpaceBullet *p_space) : + PhysicsDirectSpaceState(), + space(p_space) {} int BulletPhysicsDirectSpaceState::intersect_point(const Vector3 &p_point, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude, uint32_t p_collision_mask) { @@ -330,18 +331,18 @@ Vector3 BulletPhysicsDirectSpaceState::get_closest_point_to_object_volume(RID p_ } } -SpaceBullet::SpaceBullet(bool p_create_soft_world) - : broadphase(NULL), - dispatcher(NULL), - solver(NULL), - collisionConfiguration(NULL), - dynamicsWorld(NULL), - soft_body_world_info(NULL), - ghostPairCallback(NULL), - godotFilterCallback(NULL), - gravityDirection(0, -1, 0), - gravityMagnitude(10), - contactDebugCount(0) { +SpaceBullet::SpaceBullet(bool p_create_soft_world) : + broadphase(NULL), + dispatcher(NULL), + solver(NULL), + collisionConfiguration(NULL), + dynamicsWorld(NULL), + soft_body_world_info(NULL), + ghostPairCallback(NULL), + godotFilterCallback(NULL), + gravityDirection(0, -1, 0), + gravityMagnitude(10), + contactDebugCount(0) { create_empty_world(p_create_soft_world); direct_access = memnew(BulletPhysicsDirectSpaceState(this)); @@ -939,14 +940,14 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f r_result->collider_shape = r_recover_result.other_compound_shape_index; r_result->collision_local_shape = r_recover_result.local_shape_most_recovered; -//{ /// Add manifold point to manage collisions -// btPersistentManifold* manifold = dynamicsWorld->getDispatcher()->getNewManifold(p_body->getBtBody(), btRigid); -// btManifoldPoint manifoldPoint(result_callabck.m_pointWorld, result_callabck.m_pointWorld, result_callabck.m_pointNormalWorld, result_callabck.m_penetration_distance); -// manifoldPoint.m_index0 = r_result->collision_local_shape; -// manifoldPoint.m_index1 = r_result->collider_shape; -// manifold->addManifoldPoint(manifoldPoint); -// p_body->get_kinematic_utilities()->m_generatedManifold.push_back(manifold); -//} + //{ /// Add manifold point to manage collisions + // btPersistentManifold* manifold = dynamicsWorld->getDispatcher()->getNewManifold(p_body->getBtBody(), btRigid); + // btManifoldPoint manifoldPoint(result_callabck.m_pointWorld, result_callabck.m_pointWorld, result_callabck.m_pointNormalWorld, result_callabck.m_penetration_distance); + // manifoldPoint.m_index0 = r_result->collision_local_shape; + // manifoldPoint.m_index1 = r_result->collider_shape; + // manifold->addManifoldPoint(manifoldPoint); + // p_body->get_kinematic_utilities()->m_generatedManifold.push_back(manifold); + //} #if debug_test_motion Vector3 sup_line2; @@ -979,10 +980,10 @@ public: Vector<btCollisionObject *> result_collision_objects; public: - RecoverPenetrationBroadPhaseCallback(const btCollisionObject *p_self_collision_object, uint32_t p_collision_layer, uint32_t p_collision_mask) - : self_collision_object(p_self_collision_object), - collision_layer(p_collision_layer), - collision_mask(p_collision_mask) {} + RecoverPenetrationBroadPhaseCallback(const btCollisionObject *p_self_collision_object, uint32_t p_collision_layer, uint32_t p_collision_mask) : + self_collision_object(p_self_collision_object), + collision_layer(p_collision_layer), + collision_mask(p_collision_mask) {} virtual ~RecoverPenetrationBroadPhaseCallback() {} diff --git a/modules/bullet/space_bullet.h b/modules/bullet/space_bullet.h index 99bcfb8563..e5267c01a9 100644 --- a/modules/bullet/space_bullet.h +++ b/modules/bullet/space_bullet.h @@ -185,8 +185,8 @@ private: const btCollisionObject *other_collision_object; int local_shape_most_recovered; - RecoverResult() - : hasPenetration(false) {} + RecoverResult() : + hasPenetration(false) {} }; bool recover_from_penetration(RigidBodyBullet *p_body, const btTransform &p_from, btVector3 &r_recover_position, RecoverResult *r_recover_result = NULL); diff --git a/modules/freetype/SCsub b/modules/freetype/SCsub index 19e384af73..f69b632e76 100644 --- a/modules/freetype/SCsub +++ b/modules/freetype/SCsub @@ -68,7 +68,7 @@ if env['builtin_freetype']: if env['builtin_libpng']: env.Append(CPPPATH=["#thirdparty/libpng"]) - lib = env.Library("freetype_builtin", thirdparty_sources) + lib = env.add_library("freetype_builtin", thirdparty_sources) # Needs to be appended to arrive after libscene in the linker call, # but we don't want it to arrive *after* system libs, so manual hack # LIBS contains first SCons Library objects ("SCons.Node.FS.File object") diff --git a/modules/gdnative/SCsub b/modules/gdnative/SCsub index f5a593cf4e..fd11c8d094 100644 --- a/modules/gdnative/SCsub +++ b/modules/gdnative/SCsub @@ -248,4 +248,4 @@ if ARGUMENTS.get('gdnative_wrapper', False): if not env.msvc: gd_wrapper_env.Append(CCFLAGS=['-fPIC']) - gd_wrapper_env.Library("#bin/gdnative_wrapper_code", [gensource]) + lib = gd_wrapper_env.add_library("#bin/gdnative_wrapper_code", [gensource]) diff --git a/modules/gdnative/arvr/arvr_interface_gdnative.cpp b/modules/gdnative/arvr/arvr_interface_gdnative.cpp index 02f2ee7424..29e4775e62 100644 --- a/modules/gdnative/arvr/arvr_interface_gdnative.cpp +++ b/modules/gdnative/arvr/arvr_interface_gdnative.cpp @@ -219,7 +219,7 @@ extern "C" { void GDAPI godot_arvr_register_interface(const godot_arvr_interface_gdnative *p_interface) { Ref<ARVRInterfaceGDNative> new_interface; new_interface.instance(); - new_interface->set_interface((godot_arvr_interface_gdnative * const)p_interface); + new_interface->set_interface((godot_arvr_interface_gdnative *const)p_interface); ARVRServer::get_singleton()->add_interface(new_interface); } @@ -344,7 +344,7 @@ void GDAPI godot_arvr_set_controller_transform(godot_int p_controller_id, godot_ tracker->set_orientation(transform->basis); } if (p_tracks_position) { - tracker->set_position(transform->origin); + tracker->set_rw_position(transform->origin); } } } diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp index 0132ef3c5d..9c0041cbe0 100644 --- a/modules/gdnative/gdnative.cpp +++ b/modules/gdnative/gdnative.cpp @@ -144,7 +144,7 @@ bool GDNative::initialize() { } } - Error err = OS::get_singleton()->open_dynamic_library(path, native_handle); + Error err = OS::get_singleton()->open_dynamic_library(path, native_handle, true); if (err != OK) { return false; } diff --git a/modules/gdnative/gdnative.h b/modules/gdnative/gdnative.h index bb260bdd1b..993cd0ece7 100644 --- a/modules/gdnative/gdnative.h +++ b/modules/gdnative/gdnative.h @@ -106,8 +106,8 @@ struct GDNativeCallRegistry { return singleton; } - inline GDNativeCallRegistry() - : native_calls() {} + inline GDNativeCallRegistry() : + native_calls() {} Map<StringName, native_call_cb> native_calls; diff --git a/modules/gdnative/gdnative/basis.cpp b/modules/gdnative/gdnative/basis.cpp index 39ca754dc7..7a65996036 100644 --- a/modules/gdnative/gdnative/basis.cpp +++ b/modules/gdnative/gdnative/basis.cpp @@ -221,7 +221,7 @@ godot_basis GDAPI godot_basis_operator_add(const godot_basis *p_self, const godo return raw_dest; } -godot_basis GDAPI godot_basis_operator_substract(const godot_basis *p_self, const godot_basis *p_b) { +godot_basis GDAPI godot_basis_operator_subtract(const godot_basis *p_self, const godot_basis *p_b) { godot_basis raw_dest; Basis *dest = (Basis *)&raw_dest; const Basis *self = (const Basis *)p_self; diff --git a/modules/gdnative/gdnative/quat.cpp b/modules/gdnative/gdnative/quat.cpp index 2d012c069f..c308e5973d 100644 --- a/modules/gdnative/gdnative/quat.cpp +++ b/modules/gdnative/gdnative/quat.cpp @@ -181,7 +181,7 @@ godot_quat GDAPI godot_quat_operator_add(const godot_quat *p_self, const godot_q return raw_dest; } -godot_quat GDAPI godot_quat_operator_substract(const godot_quat *p_self, const godot_quat *p_b) { +godot_quat GDAPI godot_quat_operator_subtract(const godot_quat *p_self, const godot_quat *p_b) { godot_quat raw_dest; Quat *dest = (Quat *)&raw_dest; const Quat *self = (const Quat *)p_self; diff --git a/modules/gdnative/gdnative/vector2.cpp b/modules/gdnative/gdnative/vector2.cpp index 7a5b29e0c4..7be08929b1 100644 --- a/modules/gdnative/gdnative/vector2.cpp +++ b/modules/gdnative/gdnative/vector2.cpp @@ -207,7 +207,7 @@ godot_vector2 GDAPI godot_vector2_operator_add(const godot_vector2 *p_self, cons return raw_dest; } -godot_vector2 GDAPI godot_vector2_operator_substract(const godot_vector2 *p_self, const godot_vector2 *p_b) { +godot_vector2 GDAPI godot_vector2_operator_subtract(const godot_vector2 *p_self, const godot_vector2 *p_b) { godot_vector2 raw_dest; Vector2 *dest = (Vector2 *)&raw_dest; const Vector2 *self = (const Vector2 *)p_self; diff --git a/modules/gdnative/gdnative/vector3.cpp b/modules/gdnative/gdnative/vector3.cpp index 11ffb3320b..0027d236f2 100644 --- a/modules/gdnative/gdnative/vector3.cpp +++ b/modules/gdnative/gdnative/vector3.cpp @@ -224,7 +224,7 @@ godot_vector3 GDAPI godot_vector3_operator_add(const godot_vector3 *p_self, cons return raw_dest; } -godot_vector3 GDAPI godot_vector3_operator_substract(const godot_vector3 *p_self, const godot_vector3 *p_b) { +godot_vector3 GDAPI godot_vector3_operator_subtract(const godot_vector3 *p_self, const godot_vector3 *p_b) { godot_vector3 raw_dest; Vector3 *dest = (Vector3 *)&raw_dest; Vector3 *self = (Vector3 *)p_self; diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json index 488ed93206..31f3b0b77b 100644 --- a/modules/gdnative/gdnative_api.json +++ b/modules/gdnative/gdnative_api.json @@ -387,7 +387,7 @@ ] }, { - "name": "godot_vector2_operator_substract", + "name": "godot_vector2_operator_subtract", "return_type": "godot_vector2", "arguments": [ ["const godot_vector2 *", "p_self"], @@ -663,7 +663,7 @@ ] }, { - "name": "godot_quat_operator_substract", + "name": "godot_quat_operator_subtract", "return_type": "godot_quat", "arguments": [ ["const godot_quat *", "p_self"], @@ -907,7 +907,7 @@ ] }, { - "name": "godot_basis_operator_substract", + "name": "godot_basis_operator_subtract", "return_type": "godot_basis", "arguments": [ ["const godot_basis *", "p_self"], @@ -1142,7 +1142,7 @@ ] }, { - "name": "godot_vector3_operator_substract", + "name": "godot_vector3_operator_subtract", "return_type": "godot_vector3", "arguments": [ ["const godot_vector3 *", "p_self"], diff --git a/modules/gdnative/include/gdnative/basis.h b/modules/gdnative/include/gdnative/basis.h index 49ca765a01..4898eab24c 100644 --- a/modules/gdnative/include/gdnative/basis.h +++ b/modules/gdnative/include/gdnative/basis.h @@ -111,7 +111,7 @@ godot_bool GDAPI godot_basis_operator_equal(const godot_basis *p_self, const god godot_basis GDAPI godot_basis_operator_add(const godot_basis *p_self, const godot_basis *p_b); -godot_basis GDAPI godot_basis_operator_substract(const godot_basis *p_self, const godot_basis *p_b); +godot_basis GDAPI godot_basis_operator_subtract(const godot_basis *p_self, const godot_basis *p_b); godot_basis GDAPI godot_basis_operator_multiply_vector(const godot_basis *p_self, const godot_basis *p_b); diff --git a/modules/gdnative/include/gdnative/gdnative.h b/modules/gdnative/include/gdnative/gdnative.h index 6e69d43469..f7f5606428 100644 --- a/modules/gdnative/include/gdnative/gdnative.h +++ b/modules/gdnative/include/gdnative/gdnative.h @@ -115,8 +115,6 @@ typedef enum { GODOT_ERR_HELP, ///< user requested help!! GODOT_ERR_BUG, ///< a bug in the software certainly happened, due to a double check failing or unexpected behavior. GODOT_ERR_PRINTER_ON_FIRE, /// the parallel port printer is engulfed in flames - GODOT_ERR_OMFG_THIS_IS_VERY_VERY_BAD, ///< shit happens, has never been used, though - GODOT_ERR_WTF = GODOT_ERR_OMFG_THIS_IS_VERY_VERY_BAD ///< short version of the above } godot_error; ////// bool diff --git a/modules/gdnative/include/gdnative/quat.h b/modules/gdnative/include/gdnative/quat.h index acae6e3e90..2be9d8849d 100644 --- a/modules/gdnative/include/gdnative/quat.h +++ b/modules/gdnative/include/gdnative/quat.h @@ -98,7 +98,7 @@ godot_quat GDAPI godot_quat_operator_multiply(const godot_quat *p_self, const go godot_quat GDAPI godot_quat_operator_add(const godot_quat *p_self, const godot_quat *p_b); -godot_quat GDAPI godot_quat_operator_substract(const godot_quat *p_self, const godot_quat *p_b); +godot_quat GDAPI godot_quat_operator_subtract(const godot_quat *p_self, const godot_quat *p_b); godot_quat GDAPI godot_quat_operator_divide(const godot_quat *p_self, const godot_real p_b); diff --git a/modules/gdnative/include/gdnative/vector2.h b/modules/gdnative/include/gdnative/vector2.h index 07105abaf2..4d1117e3aa 100644 --- a/modules/gdnative/include/gdnative/vector2.h +++ b/modules/gdnative/include/gdnative/vector2.h @@ -106,7 +106,7 @@ godot_vector2 GDAPI godot_vector2_clamped(const godot_vector2 *p_self, const god godot_vector2 GDAPI godot_vector2_operator_add(const godot_vector2 *p_self, const godot_vector2 *p_b); -godot_vector2 GDAPI godot_vector2_operator_substract(const godot_vector2 *p_self, const godot_vector2 *p_b); +godot_vector2 GDAPI godot_vector2_operator_subtract(const godot_vector2 *p_self, const godot_vector2 *p_b); godot_vector2 GDAPI godot_vector2_operator_multiply_vector(const godot_vector2 *p_self, const godot_vector2 *p_b); diff --git a/modules/gdnative/include/gdnative/vector3.h b/modules/gdnative/include/gdnative/vector3.h index 3ed23778ec..135a13acc8 100644 --- a/modules/gdnative/include/gdnative/vector3.h +++ b/modules/gdnative/include/gdnative/vector3.h @@ -117,7 +117,7 @@ godot_vector3 GDAPI godot_vector3_reflect(const godot_vector3 *p_self, const god godot_vector3 GDAPI godot_vector3_operator_add(const godot_vector3 *p_self, const godot_vector3 *p_b); -godot_vector3 GDAPI godot_vector3_operator_substract(const godot_vector3 *p_self, const godot_vector3 *p_b); +godot_vector3 GDAPI godot_vector3_operator_subtract(const godot_vector3 *p_self, const godot_vector3 *p_b); godot_vector3 GDAPI godot_vector3_operator_multiply_vector(const godot_vector3 *p_self, const godot_vector3 *p_b); diff --git a/modules/gdnative/nativescript/api_generator.cpp b/modules/gdnative/nativescript/api_generator.cpp index f9d699fb59..653445c2db 100644 --- a/modules/gdnative/nativescript/api_generator.cpp +++ b/modules/gdnative/nativescript/api_generator.cpp @@ -468,8 +468,6 @@ static List<String> generate_c_api_json(const List<ClassAPI> &p_api) { return source; } -// - #endif /* diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp index c2c7c27f25..965de062e3 100644 --- a/modules/gdnative/nativescript/nativescript.cpp +++ b/modules/gdnative/nativescript/nativescript.cpp @@ -437,11 +437,11 @@ NativeScript::~NativeScript() { #endif } -// -// -// ScriptInstance stuff -// -// + // + // + // ScriptInstance stuff + // + // #define GET_SCRIPT_DESC() script->get_script_desc() diff --git a/modules/gdnative/nativescript/nativescript.h b/modules/gdnative/nativescript/nativescript.h index f0f14e2f30..30fa400cb0 100644 --- a/modules/gdnative/nativescript/nativescript.h +++ b/modules/gdnative/nativescript/nativescript.h @@ -76,12 +76,12 @@ struct NativeScriptDesc { bool is_tool; - inline NativeScriptDesc() - : methods(), - properties(), - signals_(), - base(), - base_native_type() { + inline NativeScriptDesc() : + methods(), + properties(), + signals_(), + base(), + base_native_type() { zeromem(&create_func, sizeof(godot_instance_create_func)); zeromem(&destroy_func, sizeof(godot_instance_destroy_func)); } diff --git a/modules/gdnative/pluginscript/pluginscript_language.cpp b/modules/gdnative/pluginscript/pluginscript_language.cpp index 40feb5ae43..e358c2fb69 100644 --- a/modules/gdnative/pluginscript/pluginscript_language.cpp +++ b/modules/gdnative/pluginscript/pluginscript_language.cpp @@ -410,8 +410,8 @@ void PluginScriptLanguage::unlock() { #endif } -PluginScriptLanguage::PluginScriptLanguage(const godot_pluginscript_language_desc *desc) - : _desc(*desc) { +PluginScriptLanguage::PluginScriptLanguage(const godot_pluginscript_language_desc *desc) : + _desc(*desc) { _resource_loader = memnew(ResourceFormatLoaderPluginScript(this)); _resource_saver = memnew(ResourceFormatSaverPluginScript(this)); diff --git a/modules/gdnative/pluginscript/pluginscript_script.cpp b/modules/gdnative/pluginscript/pluginscript_script.cpp index 4169b07f63..0b71b3b10d 100644 --- a/modules/gdnative/pluginscript/pluginscript_script.cpp +++ b/modules/gdnative/pluginscript/pluginscript_script.cpp @@ -423,8 +423,11 @@ ScriptInstance::RPCMode PluginScript::get_rset_mode(const StringName &p_variable } } -PluginScript::PluginScript() - : _data(NULL), _tool(false), _valid(false), _script_list(this) { +PluginScript::PluginScript() : + _data(NULL), + _tool(false), + _valid(false), + _script_list(this) { } void PluginScript::init(PluginScriptLanguage *language) { diff --git a/modules/gdnative/register_types.cpp b/modules/gdnative/register_types.cpp index 34099bf528..365def75bc 100644 --- a/modules/gdnative/register_types.cpp +++ b/modules/gdnative/register_types.cpp @@ -103,16 +103,34 @@ static void actual_discoverer_handler() { Set<String> file_paths = get_gdnative_singletons(dir); + bool changed = false; + Array current_files = ProjectSettings::get_singleton()->get("gdnative/singletons"); Array files; files.resize(file_paths.size()); int i = 0; for (Set<String>::Element *E = file_paths.front(); E; i++, E = E->next()) { + if (!current_files.has(E->get())) { + changed = true; + } files.set(i, E->get()); } - ProjectSettings::get_singleton()->set("gdnative/singletons", files); + // Check for removed files + if (!changed) { + for (int i = 0; i < current_files.size(); i++) { + if (!file_paths.has(current_files[i])) { + changed = true; + break; + } + } + } - ProjectSettings::get_singleton()->save(); + if (changed) { + + ProjectSettings::get_singleton()->set("gdnative/singletons", files); + + ProjectSettings::get_singleton()->save(); + } } static GDNativeSingletonDiscover *discoverer = NULL; diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index 9496d0b310..b75f670906 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -100,7 +100,7 @@ GDScriptInstance *GDScript::_create_instance(const Variant **p_args, int p_argco #endif instance->owner->set_script_instance(instance); -/* STEP 2, INITIALIZE AND CONSRTUCT */ + /* STEP 2, INITIALIZE AND CONSRTUCT */ #ifndef NO_THREADS GDScriptLanguage::singleton->lock->lock(); @@ -876,8 +876,8 @@ void GDScript::get_script_signal_list(List<MethodInfo> *r_signals) const { #endif } -GDScript::GDScript() - : script_list(this) { +GDScript::GDScript() : + script_list(this) { _static_ref = this; valid = false; diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp index 4cd6472b7f..f9385d7a11 100644 --- a/modules/gdscript/gdscript_compiler.cpp +++ b/modules/gdscript/gdscript_compiler.cpp @@ -806,8 +806,8 @@ int GDScriptCompiler::_parse_expression(CodeGen &codegen, const GDScriptParser:: ERR_FAIL_COND_V(on->arguments.size() != 2, -1); if (on->arguments[0]->type == GDScriptParser::Node::TYPE_OPERATOR && (static_cast<GDScriptParser::OperatorNode *>(on->arguments[0])->op == GDScriptParser::OperatorNode::OP_INDEX || static_cast<GDScriptParser::OperatorNode *>(on->arguments[0])->op == GDScriptParser::OperatorNode::OP_INDEX_NAMED)) { -//SET (chained) MODE!! + // SET (chained) MODE! #ifdef DEBUG_ENABLED if (static_cast<GDScriptParser::OperatorNode *>(on->arguments[0])->op == GDScriptParser::OperatorNode::OP_INDEX_NAMED) { const GDScriptParser::OperatorNode *inon = static_cast<GDScriptParser::OperatorNode *>(on->arguments[0]); diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index e7100d835c..adf6780278 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -1795,8 +1795,8 @@ static void _find_type_arguments(GDScriptCompletionContext &context, const GDScr } } else { -//regular method + //regular method #if defined(DEBUG_METHODS_ENABLED) && defined(TOOLS_ENABLED) if (p_argidx < m->get_argument_count()) { PropertyInfo pi = m->get_argument_info(p_argidx); diff --git a/modules/gdscript/gdscript_function.cpp b/modules/gdscript/gdscript_function.cpp index 765a76fec4..d2ce318f82 100644 --- a/modules/gdscript/gdscript_function.cpp +++ b/modules/gdscript/gdscript_function.cpp @@ -250,7 +250,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a #ifdef DEBUG_ENABLED -//GDScriptLanguage::get_singleton()->calls++; + //GDScriptLanguage::get_singleton()->calls++; #endif @@ -515,7 +515,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a } else { v = "of type '" + _get_var_type(index) + "'"; } - err_text = "Invalid set index " + v + " (on base: '" + _get_var_type(dst) + "')."; + err_text = "Invalid set index " + v + " (on base: '" + _get_var_type(dst) + "') with value of type '"+_get_var_type(value)+"'"; OPCODE_BREAK; } #endif @@ -574,7 +574,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a #ifdef DEBUG_ENABLED if (!valid) { String err_type; - err_text = "Invalid set index '" + String(*index) + "' (on base: '" + _get_var_type(dst) + "')."; + err_text = "Invalid set index '" + String(*index) + "' (on base: '" + _get_var_type(dst) + "') with value of type '"+_get_var_type(value)+"'."; OPCODE_BREAK; } #endif @@ -1432,8 +1432,8 @@ void GDScriptFunction::debug_get_stack_member_state(int p_line, List<Pair<String } } -GDScriptFunction::GDScriptFunction() - : function_list(this) { +GDScriptFunction::GDScriptFunction() : + function_list(this) { _stack_size = 0; _call_size = 0; diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index bee9ef1998..e48b03968b 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -2976,10 +2976,9 @@ void GDScriptParser::_parse_extends(ClassNode *p_class) { case GDScriptTokenizer::TK_IDENTIFIER: { - StringName identifier = tokenizer->get_token_identifier(); - p_class->extends_class.push_back(identifier); - } - break; + StringName identifier = tokenizer->get_token_identifier(); + p_class->extends_class.push_back(identifier); + } break; case GDScriptTokenizer::TK_PERIOD: break; diff --git a/modules/mobile_vr/mobile_interface.cpp b/modules/mobile_vr/mobile_interface.cpp index 3a0b83d534..35253d5a77 100644 --- a/modules/mobile_vr/mobile_interface.cpp +++ b/modules/mobile_vr/mobile_interface.cpp @@ -461,6 +461,7 @@ MobileVRInterface::MobileVRInterface() { glGenBuffers(1, &half_screen_quad); glBindBuffer(GL_ARRAY_BUFFER, half_screen_quad); { + /* clang-format off */ const float qv[16] = { 0, -1, -1, -1, @@ -471,6 +472,7 @@ MobileVRInterface::MobileVRInterface() { 1, -1, 1, -1, }; + /* clang-format on */ glBufferData(GL_ARRAY_BUFFER, sizeof(float) * 16, qv, GL_STATIC_DRAW); } diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index dfa5e720ae..af5a0334c3 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -1332,7 +1332,7 @@ bool CSharpScript::_update_exports() { while (top && top != native) { const Vector<GDMonoField *> &fields = top->get_all_fields(); - for (int i = 0; i < fields.size(); i++) { + for (int i = fields.size() - 1; i >= 0; i--) { GDMonoField *field = fields[i]; if (field->is_static()) { @@ -1382,7 +1382,7 @@ bool CSharpScript::_update_exports() { 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_back(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)); @@ -1885,8 +1885,8 @@ StringName CSharpScript::get_script_name() const { return name; } -CSharpScript::CSharpScript() - : script_list(this) { +CSharpScript::CSharpScript() : + script_list(this) { _clear(); diff --git a/modules/mono/editor/csharp_project.cpp b/modules/mono/editor/csharp_project.cpp index bde5f0fd0b..9a1efb4423 100644 --- a/modules/mono/editor/csharp_project.cpp +++ b/modules/mono/editor/csharp_project.cpp @@ -117,4 +117,4 @@ void add_item(const String &p_project_path, const String &p_item_type, const Str ERR_FAIL(); } } -} // CSharpProject +} // namespace CSharpProject diff --git a/modules/mono/editor/csharp_project.h b/modules/mono/editor/csharp_project.h index 4832d2251e..44e8325a59 100644 --- a/modules/mono/editor/csharp_project.h +++ b/modules/mono/editor/csharp_project.h @@ -39,6 +39,6 @@ String generate_editor_api_project(const String &p_dir, const String &p_core_dll String generate_game_project(const String &p_dir, const String &p_name, const Vector<String> &p_files = Vector<String>()); void add_item(const String &p_project_path, const String &p_item_type, const String &p_include); -} +} // namespace CSharpProject #endif // CSHARP_PROJECT_H diff --git a/modules/mono/glue/cs_files/Error.cs b/modules/mono/glue/cs_files/Error.cs index 3f4a92603d..dee4b88f74 100644 --- a/modules/mono/glue/cs_files/Error.cs +++ b/modules/mono/glue/cs_files/Error.cs @@ -42,7 +42,6 @@ namespace Godot ERR_CYCLIC_LINK = 40, ERR_BUSY = 44, ERR_HELP = 46, - ERR_BUG = 47, - ERR_WTF = 49 + ERR_BUG = 47 } } diff --git a/modules/mono/godotsharp_dirs.cpp b/modules/mono/godotsharp_dirs.cpp index a0c2508b0d..0f6245a37c 100644 --- a/modules/mono/godotsharp_dirs.cpp +++ b/modules/mono/godotsharp_dirs.cpp @@ -192,4 +192,4 @@ String get_project_csproj_path() { return _GodotSharpDirs::get_singleton().csproj_filepath; } #endif -} +} // namespace GodotSharpDirs diff --git a/modules/mono/godotsharp_dirs.h b/modules/mono/godotsharp_dirs.h index ba2c065210..914df40629 100644 --- a/modules/mono/godotsharp_dirs.h +++ b/modules/mono/godotsharp_dirs.h @@ -53,6 +53,6 @@ String get_custom_project_settings_dir(); String get_project_sln_path(); String get_project_csproj_path(); -} +} // namespace GodotSharpDirs #endif // GODOTSHARP_DIRS_H diff --git a/modules/mono/mono_gc_handle.cpp b/modules/mono/mono_gc_handle.cpp index e10e06df0e..121392b3f8 100644 --- a/modules/mono/mono_gc_handle.cpp +++ b/modules/mono/mono_gc_handle.cpp @@ -36,7 +36,7 @@ uint32_t MonoGCHandle::make_strong_handle(MonoObject *p_object) { return mono_gchandle_new( p_object, false /* do not pin the object */ - ); + ); } uint32_t MonoGCHandle::make_weak_handle(MonoObject *p_object) { @@ -44,7 +44,7 @@ uint32_t MonoGCHandle::make_weak_handle(MonoObject *p_object) { return mono_gchandle_new_weakref( p_object, true /* track_resurrection: allows us to invoke _notification(NOTIFICATION_PREDELETE) while disposing */ - ); + ); } Ref<MonoGCHandle> MonoGCHandle::create_strong(MonoObject *p_object) { diff --git a/modules/mono/mono_gd/gd_mono_internals.cpp b/modules/mono/mono_gd/gd_mono_internals.cpp index cfe2148b80..56e8a01567 100644 --- a/modules/mono/mono_gd/gd_mono_internals.cpp +++ b/modules/mono/mono_gd/gd_mono_internals.cpp @@ -63,4 +63,4 @@ void tie_managed_to_unmanaged(MonoObject *managed, Object *unmanaged) { return; } -} +} // namespace GDMonoInternals diff --git a/modules/mono/signal_awaiter_utils.cpp b/modules/mono/signal_awaiter_utils.cpp index 7e99df29a1..47cc11cc0a 100644 --- a/modules/mono/signal_awaiter_utils.cpp +++ b/modules/mono/signal_awaiter_utils.cpp @@ -62,7 +62,7 @@ Error connect_signal_awaiter(Object *p_source, const String &p_signal, Object *p return err; } -} +} // namespace SignalAwaiterUtils Variant SignalAwaiterHandle::_signal_callback(const Variant **p_args, int p_argcount, Variant::CallError &r_error) { @@ -116,8 +116,8 @@ void SignalAwaiterHandle::_bind_methods() { ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "_signal_callback", &SignalAwaiterHandle::_signal_callback, MethodInfo("_signal_callback")); } -SignalAwaiterHandle::SignalAwaiterHandle(uint32_t p_managed_handle) - : MonoGCHandle(p_managed_handle) { +SignalAwaiterHandle::SignalAwaiterHandle(uint32_t p_managed_handle) : + MonoGCHandle(p_managed_handle) { #ifdef DEBUG_ENABLED conn_target_id = 0; diff --git a/modules/mono/utils/mono_reg_utils.h b/modules/mono/utils/mono_reg_utils.h index 4cc4965acb..599828aa80 100644 --- a/modules/mono/utils/mono_reg_utils.h +++ b/modules/mono/utils/mono_reg_utils.h @@ -47,7 +47,7 @@ namespace MonoRegUtils { MonoRegInfo find_mono(); String find_msbuild_tools_path(); -} // MonoRegUtils +} // namespace MonoRegUtils #endif // WINDOWS_ENABLED diff --git a/modules/mono/utils/string_utils.cpp b/modules/mono/utils/string_utils.cpp index f26663ea11..8f817771ac 100644 --- a/modules/mono/utils/string_utils.cpp +++ b/modules/mono/utils/string_utils.cpp @@ -78,7 +78,7 @@ int sfind(const String &p_text, int p_from) { return -1; } -} +} // namespace String sformat(const String &p_text, const Variant &p1, const Variant &p2, const Variant &p3, const Variant &p4, const Variant &p5) { if (p_text.length() < 2) diff --git a/modules/opus/audio_stream_opus.cpp b/modules/opus/audio_stream_opus.cpp index 06eab4c94d..5742102dae 100644 --- a/modules/opus/audio_stream_opus.cpp +++ b/modules/opus/audio_stream_opus.cpp @@ -62,7 +62,7 @@ int AudioStreamPlaybackOpus::_op_seek_func(void *_stream, opus_int64 _offset, in fa->seek_end(_offset); } break; default: { - ERR_PRINT("BUG, wtf was whence set to?\n"); + ERR_PRINT("Opus seek function failure: Unexpected value in _whence\n"); } } int ret = fa->eof_reached() ? -1 : 0; diff --git a/modules/pvr/texture_loader_pvr.cpp b/modules/pvr/texture_loader_pvr.cpp index 03592047ad..4415c888a4 100644 --- a/modules/pvr/texture_loader_pvr.cpp +++ b/modules/pvr/texture_loader_pvr.cpp @@ -239,11 +239,11 @@ ResourceFormatPVR::ResourceFormatPVR() { Image::_image_compress_pvrtc2_func = _compress_pvrtc4; } -///////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////// -//PVRTC decompressor, Based on PVRTC decompressor by IMGTEC. + //PVRTC decompressor, Based on PVRTC decompressor by IMGTEC. -///////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////// #define PT_INDEX 2 #define BLK_Y_SIZE 4 diff --git a/modules/recast/SCsub b/modules/recast/SCsub index 500c0ec055..530df9a37c 100644 --- a/modules/recast/SCsub +++ b/modules/recast/SCsub @@ -24,7 +24,7 @@ if env['builtin_recast']: env.Append(CPPPATH=[thirdparty_dir, thirdparty_dir + "/Include"]) - lib = env.Library("recast_builtin", thirdparty_sources) + lib = env.add_library("recast_builtin", thirdparty_sources) env.Append(LIBS=[lib]) # Godot source files diff --git a/modules/squish/image_compress_squish.cpp b/modules/squish/image_compress_squish.cpp index 072f18b990..ac436c3c26 100644 --- a/modules/squish/image_compress_squish.cpp +++ b/modules/squish/image_compress_squish.cpp @@ -64,7 +64,7 @@ void image_decompress_squish(Image *p_image) { } else if (p_image->get_format() == Image::FORMAT_RGTC_RG) { squish_flags = squish::kBc5; } else { - print_line("wtf askd to decompress.. " + itos(p_image->get_format())); + print_line("Can't decompress unknown format: " + itos(p_image->get_format())); ERR_FAIL_COND(true); return; } diff --git a/modules/stb_vorbis/doc_classes/AudioStreamOGGVorbis.xml b/modules/stb_vorbis/doc_classes/AudioStreamOGGVorbis.xml index c0f8c6b9c7..4533d59cae 100644 --- a/modules/stb_vorbis/doc_classes/AudioStreamOGGVorbis.xml +++ b/modules/stb_vorbis/doc_classes/AudioStreamOGGVorbis.xml @@ -11,18 +11,49 @@ <demos> </demos> <methods> + <method name="get_data" qualifiers="const"> + <return type="PoolByteArray"> + </return> + <description> + </description> + </method> + <method name="get_loop_offset" qualifiers="const"> + <return type="float"> + </return> + <description> + </description> + </method> + <method name="has_loop" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> + <method name="set_data"> + <return type="void"> + </return> + <argument index="0" name="data" type="PoolByteArray"> + </argument> + <description> + </description> + </method> + <method name="set_loop"> + <return type="void"> + </return> + <argument index="0" name="enable" type="bool"> + </argument> + <description> + </description> + </method> + <method name="set_loop_offset"> + <return type="void"> + </return> + <argument index="0" name="seconds" type="float"> + </argument> + <description> + </description> + </method> </methods> - <members> - <member name="data" type="PoolByteArray" setter="set_data" getter="get_data"> - Raw audio data. - </member> - <member name="loop" type="bool" setter="set_loop" getter="has_loop"> - If [code]true[/code], audio will loop continuously. Default value: [code]false[/code]. - </member> - <member name="loop_offset" type="float" setter="set_loop_offset" getter="get_loop_offset"> - If loop is [code]true[/code], loop starts from this position, in seconds. - </member> - </members> <constants> </constants> </class> diff --git a/modules/svg/SCsub b/modules/svg/SCsub index 5be9367808..e12abac8c1 100644 --- a/modules/svg/SCsub +++ b/modules/svg/SCsub @@ -12,7 +12,8 @@ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] # env.add_source_files(env.modules_sources, thirdparty_sources) -lib = env.Library("svg_builtin", thirdparty_sources) +lib = env.add_library("svg_builtin", thirdparty_sources) + # Needs to be appended to arrive after libscene in the linker call, # but we don't want it to arrive *after* system libs, so manual hack # LIBS contains first SCons Library objects ("SCons.Node.FS.File object") diff --git a/modules/thekla_unwrap/SCsub b/modules/thekla_unwrap/SCsub new file mode 100644 index 0000000000..2b1349a15f --- /dev/null +++ b/modules/thekla_unwrap/SCsub @@ -0,0 +1,68 @@ +#!/usr/bin/env python + +Import('env') +Import('env_modules') + +env_thekla_unwrap = env_modules.Clone() + +# Thirdparty source files +if env['builtin_thekla_atlas']: + thirdparty_dir = "#thirdparty/thekla_atlas/" + thirdparty_sources = [ + "nvcore/Memory.cpp", + "nvcore/Debug.cpp", + "nvcore/StrLib.cpp", + "nvcore/FileSystem.cpp", + "nvcore/RadixSort.cpp", + "nvmath/Basis.cpp", + "nvmath/ConvexHull.cpp", + "nvmath/Fitting.cpp", + "nvmath/Plane.cpp", + "nvmath/ProximityGrid.cpp", + "nvmath/Random.cpp", + "nvmath/Solver.cpp", + "nvmath/Sparse.cpp", + "nvmath/TypeSerialization.cpp", + "poshlib/posh.c", + "nvimage/BitMap.cpp", + "nvimage/Image.cpp", + "nvmesh/BaseMesh.cpp", + "nvmesh/MeshBuilder.cpp", + "nvmesh/TriMesh.cpp", + "nvmesh/QuadTriMesh.cpp", + "nvmesh/MeshTopology.cpp", + "nvmesh/halfedge/Edge.cpp", + "nvmesh/halfedge/Mesh.cpp", + "nvmesh/halfedge/Face.cpp", + "nvmesh/halfedge/Vertex.cpp", + "nvmesh/geometry/Bounds.cpp", + "nvmesh/geometry/Measurements.cpp", + "nvmesh/raster/Raster.cpp", + "nvmesh/param/Atlas.cpp", + "nvmesh/param/AtlasBuilder.cpp", + "nvmesh/param/AtlasPacker.cpp", + "nvmesh/param/LeastSquaresConformalMap.cpp", + "nvmesh/param/OrthogonalProjectionMap.cpp", + "nvmesh/param/ParameterizationQuality.cpp", + "nvmesh/param/SingleFaceMap.cpp", + "nvmesh/param/Util.cpp", + "nvmesh/weld/VertexWeld.cpp", + "nvmesh/weld/Snap.cpp" + ] + thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] + + env_thekla_unwrap.add_source_files(env.modules_sources, thirdparty_sources) + env_thekla_unwrap.Append(CPPPATH=[thirdparty_dir, thirdparty_dir + "/poshlib", thirdparty_dir + "/nvcore", thirdparty_dir + "/nvmesh"]) + + # upstream uses c++11 + env_thekla_unwrap.Append(CXXFLAGS="-std=gnu++11") + + if env["platform"] == 'x11': + env_thekla_unwrap.Append(CCFLAGS=["-DNV_OS_LINUX"]) + elif env["platform"] == 'osx': + env_thekla_unwrap.Append(CCFLAGS=["-DNV_OS_DARWIN"]) + elif env["platform"] == 'windows': + env_thekla_unwrap.Append(CCFLAGS=["-DNV_OS_WIN32"]) + +# Godot source files +env_thekla_unwrap.add_source_files(env.modules_sources, "*.cpp") diff --git a/modules/thekla_unwrap/config.py b/modules/thekla_unwrap/config.py new file mode 100644 index 0000000000..b1ce7d4b91 --- /dev/null +++ b/modules/thekla_unwrap/config.py @@ -0,0 +1,7 @@ +def can_build(platform): + return platform != "android" and platform != "ios" + +def configure(env): + if not env['tools']: + env['builtin_thekla_atlas'] = False + env.disabled_modules.append("thekla_unwrap") diff --git a/modules/thekla_unwrap/register_types.cpp b/modules/thekla_unwrap/register_types.cpp new file mode 100644 index 0000000000..8a9f8341e8 --- /dev/null +++ b/modules/thekla_unwrap/register_types.cpp @@ -0,0 +1,34 @@ +/*************************************************************************/ +/* register_types.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 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 "register_types.h" + +void register_thekla_unwrap_types() {} + +void unregister_thekla_unwrap_types() {} diff --git a/modules/thekla_unwrap/register_types.h b/modules/thekla_unwrap/register_types.h new file mode 100644 index 0000000000..2bc3d16c64 --- /dev/null +++ b/modules/thekla_unwrap/register_types.h @@ -0,0 +1,31 @@ +/*************************************************************************/ +/* register_types.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 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_thekla_unwrap_types(); +void unregister_thekla_unwrap_types(); diff --git a/modules/theora/doc_classes/VideoStreamTheora.xml b/modules/theora/doc_classes/VideoStreamTheora.xml index 61884f47fa..6c8806ed72 100644 --- a/modules/theora/doc_classes/VideoStreamTheora.xml +++ b/modules/theora/doc_classes/VideoStreamTheora.xml @@ -9,11 +9,21 @@ <demos> </demos> <methods> + <method name="get_file"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="set_file"> + <return type="void"> + </return> + <argument index="0" name="file" type="String"> + </argument> + <description> + </description> + </method> </methods> - <members> - <member name="file" type="String" setter="set_file" getter="get_file"> - </member> - </members> <constants> </constants> </class> diff --git a/modules/tinyexr/image_loader_tinyexr.cpp b/modules/tinyexr/image_loader_tinyexr.cpp index 49a4db237a..c88662454c 100644 --- a/modules/tinyexr/image_loader_tinyexr.cpp +++ b/modules/tinyexr/image_loader_tinyexr.cpp @@ -47,6 +47,11 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f f->close(); + // Re-implementation of tinyexr's LoadEXRFromMemory using Godot types to store the Image data + // and Godot's error codes. + // When debugging after updating the thirdparty library, check that we're still in sync with + // their API usage in LoadEXRFromMemory. + EXRVersion exr_version; EXRImage exr_image; EXRHeader exr_header; @@ -68,6 +73,13 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f return ERR_FILE_CORRUPT; } + // Read HALF channel as FLOAT. (GH-13490) + for (int i = 0; i < exr_header.num_channels; i++) { + if (exr_header.pixel_types[i] == TINYEXR_PIXELTYPE_HALF) { + exr_header.requested_pixel_types[i] = TINYEXR_PIXELTYPE_FLOAT; + } + } + InitEXRImage(&exr_image); ret = LoadEXRImageFromMemory(&exr_image, &exr_header, w.ptr(), src_image_len, &err); if (ret != TINYEXR_SUCCESS) { @@ -95,23 +107,25 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f } if (idxR == -1) { - ERR_PRINT("R channel not found"); + ERR_PRINT("TinyEXR: R channel not found."); // @todo { free exr_image } return ERR_FILE_CORRUPT; } if (idxG == -1) { - ERR_PRINT("G channel not found\n") + ERR_PRINT("TinyEXR: G channel not found.") // @todo { free exr_image } return ERR_FILE_CORRUPT; } if (idxB == -1) { - ERR_PRINT("B channel not found\n") + ERR_PRINT("TinyEXR: B channel not found.") // @todo { free exr_image } return ERR_FILE_CORRUPT; } + // EXR image data loaded, now parse it into Godot-friendly image data + PoolVector<uint8_t> imgdata; Image::Format format; @@ -126,7 +140,6 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f } { - PoolVector<uint8_t>::Write wd = imgdata.write(); uint16_t *iw = (uint16_t *)wd.ptr(); @@ -151,11 +164,13 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f } } - print_line("EXR w: " + itos(exr_image.width) + " h:" + itos(exr_image.height) + " format " + Image::get_format_name(format)); p_image->create(exr_image.width, exr_image.height, false, format, imgdata); w = PoolVector<uint8_t>::Write(); + FreeEXRHeader(&exr_header); + FreeEXRImage(&exr_image); + return OK; } diff --git a/modules/visual_script/doc_classes/VisualScript.xml b/modules/visual_script/doc_classes/VisualScript.xml index cc55b72ec7..46bd35dd73 100644 --- a/modules/visual_script/doc_classes/VisualScript.xml +++ b/modules/visual_script/doc_classes/VisualScript.xml @@ -495,10 +495,6 @@ </description> </method> </methods> - <members> - <member name="data" type="Dictionary" setter="_set_data" getter="_get_data"> - </member> - </members> <signals> <signal name="node_ports_changed"> <argument index="0" name="function" type="String"> diff --git a/modules/visual_script/doc_classes/VisualScriptConstructor.xml b/modules/visual_script/doc_classes/VisualScriptConstructor.xml index f3c6b6a304..cbe8c6c096 100644 --- a/modules/visual_script/doc_classes/VisualScriptConstructor.xml +++ b/modules/visual_script/doc_classes/VisualScriptConstructor.xml @@ -11,31 +11,35 @@ <demos> </demos> <methods> + <method name="get_constructor" qualifiers="const"> + <return type="Dictionary"> + </return> + <description> + </description> + </method> + <method name="get_constructor_type" qualifiers="const"> + <return type="int" enum="Variant.Type"> + </return> + <description> + </description> + </method> + <method name="set_constructor"> + <return type="void"> + </return> + <argument index="0" name="constructor" type="Dictionary"> + </argument> + <description> + </description> + </method> + <method name="set_constructor_type"> + <return type="void"> + </return> + <argument index="0" name="type" type="int" enum="Variant.Type"> + </argument> + <description> + </description> + </method> </methods> - <members> - <member name="constructor" type="Dictionary" setter="set_constructor" getter="get_constructor"> - The constructor function's method info. Has roughly the following structure: - [codeblock] - { - name = "string", - args = [{ - name = "string" - class_name = "string" - type = TYPE_* - hint = PROPERTY_HINT_* - hint_string = "string" - }] - default_args = [] # Array of variants - flags = METHOD_FLAG_* - id = 0 - return = {type = TYPE_*} - } - [/codeblock] - </member> - <member name="type" type="int" setter="set_constructor_type" getter="get_constructor_type" enum="Variant.Type"> - The type to be constructed. - </member> - </members> <constants> </constants> </class> diff --git a/modules/visual_script/doc_classes/VisualScriptDeconstruct.xml b/modules/visual_script/doc_classes/VisualScriptDeconstruct.xml index 86cf4410ac..0f396564e2 100644 --- a/modules/visual_script/doc_classes/VisualScriptDeconstruct.xml +++ b/modules/visual_script/doc_classes/VisualScriptDeconstruct.xml @@ -13,8 +13,6 @@ <methods> </methods> <members> - <member name="elem_cache" type="Array" setter="_set_elem_cache" getter="_get_elem_cache"> - </member> <member name="type" type="int" setter="set_deconstruct_type" getter="get_deconstruct_type" enum="Variant.Type"> The type to deconstruct. </member> diff --git a/modules/visual_script/doc_classes/VisualScriptFunctionCall.xml b/modules/visual_script/doc_classes/VisualScriptFunctionCall.xml index cc2360fc2e..03c47dca7c 100644 --- a/modules/visual_script/doc_classes/VisualScriptFunctionCall.xml +++ b/modules/visual_script/doc_classes/VisualScriptFunctionCall.xml @@ -11,8 +11,6 @@ <methods> </methods> <members> - <member name="argument_cache" type="Dictionary" setter="_set_argument_cache" getter="_get_argument_cache"> - </member> <member name="base_script" type="String" setter="set_base_script" getter="get_base_script"> </member> <member name="base_type" type="String" setter="set_base_type" getter="get_base_type"> diff --git a/modules/visual_script/doc_classes/VisualScriptNode.xml b/modules/visual_script/doc_classes/VisualScriptNode.xml index 94fed44950..ef7cf7c3b8 100644 --- a/modules/visual_script/doc_classes/VisualScriptNode.xml +++ b/modules/visual_script/doc_classes/VisualScriptNode.xml @@ -46,10 +46,6 @@ </description> </method> </methods> - <members> - <member name="_default_input_values" type="Array" setter="_set_default_input_values" getter="_get_default_input_values"> - </member> - </members> <signals> <signal name="ports_changed"> <description> diff --git a/modules/visual_script/doc_classes/VisualScriptPropertyGet.xml b/modules/visual_script/doc_classes/VisualScriptPropertyGet.xml index f68f0edeea..11c50f2b97 100644 --- a/modules/visual_script/doc_classes/VisualScriptPropertyGet.xml +++ b/modules/visual_script/doc_classes/VisualScriptPropertyGet.xml @@ -25,8 +25,6 @@ </member> <member name="set_mode" type="int" setter="set_call_mode" getter="get_call_mode" enum="VisualScriptPropertyGet.CallMode"> </member> - <member name="type_cache" type="int" setter="_set_type_cache" getter="_get_type_cache" enum="Variant.Type"> - </member> </members> <constants> <constant name="CALL_MODE_SELF" value="0" enum="CallMode"> diff --git a/modules/visual_script/doc_classes/VisualScriptPropertySet.xml b/modules/visual_script/doc_classes/VisualScriptPropertySet.xml index d4305af57f..2e96ccc1f6 100644 --- a/modules/visual_script/doc_classes/VisualScriptPropertySet.xml +++ b/modules/visual_script/doc_classes/VisualScriptPropertySet.xml @@ -27,8 +27,6 @@ </member> <member name="set_mode" type="int" setter="set_call_mode" getter="get_call_mode" enum="VisualScriptPropertySet.CallMode"> </member> - <member name="type_cache" type="Dictionary" setter="_set_type_cache" getter="_get_type_cache"> - </member> </members> <constants> <constant name="CALL_MODE_SELF" value="0" enum="CallMode"> diff --git a/modules/visual_script/doc_classes/VisualScriptYield.xml b/modules/visual_script/doc_classes/VisualScriptYield.xml index b42fc027cf..72ef586c1f 100644 --- a/modules/visual_script/doc_classes/VisualScriptYield.xml +++ b/modules/visual_script/doc_classes/VisualScriptYield.xml @@ -9,10 +9,22 @@ <demos> </demos> <methods> + <method name="get_yield_mode"> + <return type="int" enum="VisualScriptYield.YieldMode"> + </return> + <description> + </description> + </method> + <method name="set_yield_mode"> + <return type="void"> + </return> + <argument index="0" name="mode" type="int" enum="VisualScriptYield.YieldMode"> + </argument> + <description> + </description> + </method> </methods> <members> - <member name="mode" type="int" setter="set_yield_mode" getter="get_yield_mode" enum="VisualScriptYield.YieldMode"> - </member> <member name="wait_time" type="float" setter="set_wait_time" getter="get_wait_time"> </member> </members> diff --git a/modules/visual_script/register_types.cpp b/modules/visual_script/register_types.cpp index b6ce10381d..ecdca7eb42 100644 --- a/modules/visual_script/register_types.cpp +++ b/modules/visual_script/register_types.cpp @@ -53,7 +53,7 @@ void register_visual_script_types() { ClassDB::register_class<VisualScript>(); ClassDB::register_virtual_class<VisualScriptNode>(); - ClassDB::register_virtual_class<VisualScriptFunctionState>(); + ClassDB::register_class<VisualScriptFunctionState>(); ClassDB::register_class<VisualScriptFunction>(); ClassDB::register_class<VisualScriptOperator>(); ClassDB::register_class<VisualScriptVariableSet>(); diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp index 26f2d687d8..53d93798d9 100644 --- a/modules/visual_script/visual_script.cpp +++ b/modules/visual_script/visual_script.cpp @@ -2047,6 +2047,7 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o function.argument_count = func_node->get_argument_count(); function.max_stack += function.argument_count; function.flow_stack_size = func_node->is_stack_less() ? 0 : func_node->get_stack_size(); + max_input_args = MAX(max_input_args, function.argument_count); } //multiple passes are required to set up this complex thing.. @@ -2289,7 +2290,7 @@ void VisualScriptFunctionState::connect_to_signal(Object *p_obj, const String &p binds.push_back(p_binds[i]); } binds.push_back(Ref<VisualScriptFunctionState>(this)); //add myself on the back to avoid dying from unreferencing - p_obj->connect(p_signal, this, "_signal_callback", binds); + p_obj->connect(p_signal, this, "_signal_callback", binds, CONNECT_ONESHOT); } bool VisualScriptFunctionState::is_valid() const { diff --git a/modules/visual_script/visual_script_flow_control.cpp b/modules/visual_script/visual_script_flow_control.cpp index 59d9540239..a38266acc0 100644 --- a/modules/visual_script/visual_script_flow_control.cpp +++ b/modules/visual_script/visual_script_flow_control.cpp @@ -731,9 +731,9 @@ void VisualScriptSwitch::_bind_methods() { VisualScriptSwitch::VisualScriptSwitch() { } -////////////////////////////////////////// -////////////////EVENT ACTION FILTER/////////// -////////////////////////////////////////// + ////////////////////////////////////////// + ////////////////EVENT ACTION FILTER/////////// + ////////////////////////////////////////// #if 0 int VisualScriptInputFilter::get_output_sequence_port_count() const { diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp index 95ad7256b3..5f98951bec 100644 --- a/modules/visual_script/visual_script_nodes.cpp +++ b/modules/visual_script/visual_script_nodes.cpp @@ -390,7 +390,7 @@ PropertyInfo VisualScriptOperator::get_input_value_port_info(int p_idx) const { { Variant::NIL, Variant::NIL }, //OP_GREATER_EQUAL, //mathematic { Variant::NIL, Variant::NIL }, //OP_ADD, - { Variant::NIL, Variant::NIL }, //OP_SUBSTRACT, + { Variant::NIL, Variant::NIL }, //OP_SUBTRACT, { Variant::NIL, Variant::NIL }, //OP_MULTIPLY, { Variant::NIL, Variant::NIL }, //OP_DIVIDE, { Variant::NIL, Variant::NIL }, //OP_NEGATE, @@ -433,7 +433,7 @@ PropertyInfo VisualScriptOperator::get_output_value_port_info(int p_idx) const { Variant::BOOL, //OP_GREATER_EQUAL, //mathematic Variant::NIL, //OP_ADD, - Variant::NIL, //OP_SUBSTRACT, + Variant::NIL, //OP_SUBTRACT, Variant::NIL, //OP_MULTIPLY, Variant::NIL, //OP_DIVIDE, Variant::NIL, //OP_NEGATE, @@ -474,7 +474,7 @@ static const char *op_names[] = { "GreaterEq", //OP_GREATER_EQUAL, //mathematic "Add", //OP_ADD, - "Subtract", //OP_SUBSTRACT, + "Subtract", //OP_SUBTRACT, "Multiply", //OP_MULTIPLY, "Divide", //OP_DIVIDE, "Negate", //OP_NEGATE, @@ -514,7 +514,7 @@ String VisualScriptOperator::get_text() const { L"A \u2265 B", //OP_GREATER_EQUAL, //mathematic L"A + B", //OP_ADD, - L"A - B", //OP_SUBSTRACT, + L"A - B", //OP_SUBTRACT, L"A x B", //OP_MULTIPLY, L"A \u00F7 B", //OP_DIVIDE, L"\u00AC A", //OP_NEGATE, diff --git a/modules/vorbis/audio_stream_ogg_vorbis.cpp b/modules/vorbis/audio_stream_ogg_vorbis.cpp index 9fb6fa8197..03c0bfb1c2 100644 --- a/modules/vorbis/audio_stream_ogg_vorbis.cpp +++ b/modules/vorbis/audio_stream_ogg_vorbis.cpp @@ -64,7 +64,7 @@ int AudioStreamPlaybackOGGVorbis::_ov_seek_func(void *_f, ogg_int64_t offs, int fa->seek_end(offs); } else { - ERR_PRINT("BUG, wtf was whence set to?\n"); + ERR_PRINT("Vorbis seek function failure: Unexpected value in _whence\n"); } int ret = fa->eof_reached() ? -1 : 0; //printf("returning %i\n",ret); diff --git a/modules/webm/doc_classes/VideoStreamWebm.xml b/modules/webm/doc_classes/VideoStreamWebm.xml index 8b6696cfe9..6e8120b1de 100644 --- a/modules/webm/doc_classes/VideoStreamWebm.xml +++ b/modules/webm/doc_classes/VideoStreamWebm.xml @@ -9,11 +9,21 @@ <demos> </demos> <methods> + <method name="get_file"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="set_file"> + <return type="void"> + </return> + <argument index="0" name="file" type="String"> + </argument> + <description> + </description> + </method> </methods> - <members> - <member name="file" type="String" setter="set_file" getter="get_file"> - </member> - </members> <constants> </constants> </class> diff --git a/modules/webm/video_stream_webm.cpp b/modules/webm/video_stream_webm.cpp index 0fc9df5b58..b055ccf5aa 100644 --- a/modules/webm/video_stream_webm.cpp +++ b/modules/webm/video_stream_webm.cpp @@ -92,21 +92,27 @@ private: /**/ -VideoStreamPlaybackWebm::VideoStreamPlaybackWebm() - : audio_track(0), - webm(NULL), - video(NULL), - audio(NULL), - video_frames(NULL), audio_frame(NULL), - video_frames_pos(0), video_frames_capacity(0), - num_decoded_samples(0), samples_offset(-1), - mix_callback(NULL), - mix_udata(NULL), - playing(false), paused(false), - delay_compensation(0.0), - time(0.0), video_frame_delay(0.0), video_pos(0.0), - texture(memnew(ImageTexture)), - pcm(NULL) {} +VideoStreamPlaybackWebm::VideoStreamPlaybackWebm() : + audio_track(0), + webm(NULL), + video(NULL), + audio(NULL), + video_frames(NULL), + audio_frame(NULL), + video_frames_pos(0), + video_frames_capacity(0), + num_decoded_samples(0), + samples_offset(-1), + mix_callback(NULL), + mix_udata(NULL), + playing(false), + paused(false), + delay_compensation(0.0), + time(0.0), + video_frame_delay(0.0), + video_pos(0.0), + texture(memnew(ImageTexture)), + pcm(NULL) {} VideoStreamPlaybackWebm::~VideoStreamPlaybackWebm() { delete_pointers(); @@ -403,8 +409,8 @@ void VideoStreamPlaybackWebm::delete_pointers() { /**/ -VideoStreamWebm::VideoStreamWebm() - : audio_track(0) {} +VideoStreamWebm::VideoStreamWebm() : + audio_track(0) {} Ref<VideoStreamPlayback> VideoStreamWebm::instance_playback() { |