summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/bind/core_bind.cpp10
-rw-r--r--core/bind/core_bind.h2
-rw-r--r--core/os/os.cpp12
-rw-r--r--core/os/os.h2
-rw-r--r--drivers/coremidi/core_midi.cpp19
-rw-r--r--drivers/coremidi/core_midi.h2
-rw-r--r--drivers/gles2/shaders/cubemap_filter.glsl6
-rw-r--r--drivers/gles3/shaders/cubemap_filter.glsl10
-rw-r--r--drivers/winmidi/win_midi.cpp6
-rw-r--r--modules/bullet/bullet_physics_server.cpp2
-rw-r--r--modules/bullet/cone_twist_joint_bullet.cpp20
-rw-r--r--modules/bullet/cone_twist_joint_bullet.h8
-rw-r--r--modules/bullet/generic_6dof_joint_bullet.cpp53
-rw-r--r--modules/bullet/generic_6dof_joint_bullet.h4
-rw-r--r--platform/osx/os_osx.mm4
-rw-r--r--platform/windows/os_windows.cpp4
-rw-r--r--platform/x11/os_x11.cpp4
-rw-r--r--scene/3d/physics_joint.cpp15
18 files changed, 82 insertions, 101 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index 26ba28370f..2bd271205a 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -240,6 +240,14 @@ PoolStringArray _OS::get_connected_midi_inputs() {
return OS::get_singleton()->get_connected_midi_inputs();
}
+void _OS::open_midi_inputs() {
+ return OS::get_singleton()->open_midi_inputs();
+}
+
+void _OS::close_midi_inputs() {
+ return OS::get_singleton()->close_midi_inputs();
+}
+
void _OS::set_video_mode(const Size2 &p_size, bool p_fullscreen, bool p_resizeable, int p_screen) {
OS::VideoMode vm;
@@ -1085,6 +1093,8 @@ void _OS::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_audio_driver_count"), &_OS::get_audio_driver_count);
ClassDB::bind_method(D_METHOD("get_audio_driver_name", "driver"), &_OS::get_audio_driver_name);
ClassDB::bind_method(D_METHOD("get_connected_midi_inputs"), &_OS::get_connected_midi_inputs);
+ ClassDB::bind_method(D_METHOD("open_midi_inputs"), &_OS::open_midi_inputs);
+ ClassDB::bind_method(D_METHOD("close_midi_inputs"), &_OS::close_midi_inputs);
ClassDB::bind_method(D_METHOD("get_screen_count"), &_OS::get_screen_count);
ClassDB::bind_method(D_METHOD("get_current_screen"), &_OS::get_current_screen);
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index b587b9257f..21aea12b23 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -157,6 +157,8 @@ public:
virtual String get_audio_driver_name(int p_driver) const;
virtual PoolStringArray get_connected_midi_inputs();
+ virtual void open_midi_inputs();
+ virtual void close_midi_inputs();
virtual int get_screen_count() const;
virtual int get_current_screen() const;
diff --git a/core/os/os.cpp b/core/os/os.cpp
index 97dae05919..e90d714450 100644
--- a/core/os/os.cpp
+++ b/core/os/os.cpp
@@ -689,6 +689,18 @@ PoolStringArray OS::get_connected_midi_inputs() {
return list;
}
+void OS::open_midi_inputs() {
+
+ if (MIDIDriver::get_singleton())
+ MIDIDriver::get_singleton()->open();
+}
+
+void OS::close_midi_inputs() {
+
+ if (MIDIDriver::get_singleton())
+ MIDIDriver::get_singleton()->close();
+}
+
OS::OS() {
void *volatile stack_bottom;
diff --git a/core/os/os.h b/core/os/os.h
index 12c0222ad4..6f9a72d451 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -190,6 +190,8 @@ public:
virtual const char *get_audio_driver_name(int p_driver) const;
virtual PoolStringArray get_connected_midi_inputs();
+ virtual void open_midi_inputs();
+ virtual void close_midi_inputs();
virtual int get_screen_count() const { return 1; }
virtual int get_current_screen() const { return 0; }
diff --git a/drivers/coremidi/core_midi.cpp b/drivers/coremidi/core_midi.cpp
index 3619be4a8e..6d4624e05b 100644
--- a/drivers/coremidi/core_midi.cpp
+++ b/drivers/coremidi/core_midi.cpp
@@ -92,6 +92,25 @@ void MIDIDriverCoreMidi::close() {
}
}
+PoolStringArray MIDIDriverCoreMidi::get_connected_inputs() {
+
+ PoolStringArray list;
+
+ for (int i = 0; i < connected_sources.size(); i++) {
+ MIDIEndpointRef source = connected_sources[i];
+ CFStringRef ref = NULL;
+ char name[256];
+
+ MIDIObjectGetStringProperty(source, kMIDIPropertyDisplayName, &ref);
+ CFStringGetCString(ref, name, sizeof(name), kCFStringEncodingUTF8);
+ CFRelease(ref);
+
+ list.push_back(name);
+ }
+
+ return list;
+}
+
MIDIDriverCoreMidi::MIDIDriverCoreMidi() {
client = 0;
diff --git a/drivers/coremidi/core_midi.h b/drivers/coremidi/core_midi.h
index fd35e12f4b..c6b443764f 100644
--- a/drivers/coremidi/core_midi.h
+++ b/drivers/coremidi/core_midi.h
@@ -53,6 +53,8 @@ public:
virtual Error open();
virtual void close();
+ PoolStringArray get_connected_inputs();
+
MIDIDriverCoreMidi();
virtual ~MIDIDriverCoreMidi();
};
diff --git a/drivers/gles2/shaders/cubemap_filter.glsl b/drivers/gles2/shaders/cubemap_filter.glsl
index 6c26c5ce89..0d60104480 100644
--- a/drivers/gles2/shaders/cubemap_filter.glsl
+++ b/drivers/gles2/shaders/cubemap_filter.glsl
@@ -170,10 +170,10 @@ void main() {
if (NdotL > 0.0) {
#ifdef USE_SOURCE_PANORAMA
- sum.rgb += texturePanorama(source_panorama, H).rgb * NdotL;
+ sum.rgb += texturePanorama(source_panorama, L).rgb * NdotL;
#else
- H.y = -H.y;
- sum.rgb += textureCubeLod(source_cube, H, 0.0).rgb * NdotL;
+ L.y = -L.y;
+ sum.rgb += textureCubeLod(source_cube, L, 0.0).rgb * NdotL;
#endif
sum.a += NdotL;
diff --git a/drivers/gles3/shaders/cubemap_filter.glsl b/drivers/gles3/shaders/cubemap_filter.glsl
index 1462aacf89..7f2dc5057c 100644
--- a/drivers/gles3/shaders/cubemap_filter.glsl
+++ b/drivers/gles3/shaders/cubemap_filter.glsl
@@ -244,23 +244,23 @@ void main() {
vec3 H = ImportanceSampleGGX(xi, roughness, N);
vec3 V = N;
- vec3 L = normalize(2.0 * dot(V, H) * H - V);
+ vec3 L = (2.0 * dot(V, H) * H - V);
float ndotl = clamp(dot(N, L), 0.0, 1.0);
if (ndotl > 0.0) {
#ifdef USE_SOURCE_PANORAMA
- sum.rgb += texturePanorama(H, source_panorama).rgb * ndotl;
+ sum.rgb += texturePanorama(L, source_panorama).rgb * ndotl;
#endif
#ifdef USE_SOURCE_DUAL_PARABOLOID_ARRAY
- sum.rgb += textureDualParaboloidArray(H).rgb * ndotl;
+ sum.rgb += textureDualParaboloidArray(L).rgb * ndotl;
#endif
#if !defined(USE_SOURCE_DUAL_PARABOLOID_ARRAY) && !defined(USE_SOURCE_PANORAMA)
- H.y = -H.y;
- sum.rgb += textureLod(source_cube, H, 0.0).rgb * ndotl;
+ L.y = -L.y;
+ sum.rgb += textureLod(source_cube, L, 0.0).rgb * ndotl;
#endif
sum.a += ndotl;
}
diff --git a/drivers/winmidi/win_midi.cpp b/drivers/winmidi/win_midi.cpp
index 6da6e31b2b..63f7f13685 100644
--- a/drivers/winmidi/win_midi.cpp
+++ b/drivers/winmidi/win_midi.cpp
@@ -53,6 +53,12 @@ Error MIDIDriverWinMidi::open() {
char err[256];
midiInGetErrorText(res, err, 256);
ERR_PRINTS("midiInOpen error: " + String(err));
+
+ MIDIINCAPS caps;
+ res = midiInGetDevCaps(i, &caps, sizeof(MIDIINCAPS));
+ if (res == MMSYSERR_NOERROR) {
+ ERR_PRINTS("Can't open MIDI device \"" + String(caps.szPname) + "\", is it being used by another application?");
+ }
}
}
diff --git a/modules/bullet/bullet_physics_server.cpp b/modules/bullet/bullet_physics_server.cpp
index 3a2cd3b2f1..dbd27a3564 100644
--- a/modules/bullet/bullet_physics_server.cpp
+++ b/modules/bullet/bullet_physics_server.cpp
@@ -1441,7 +1441,7 @@ RID BulletPhysicsServer::joint_create_generic_6dof(RID p_body_A, const Transform
ERR_FAIL_COND_V(body_A == body_B, RID());
- JointBullet *joint = bulletnew(Generic6DOFJointBullet(body_A, body_B, p_local_frame_A, p_local_frame_B, true));
+ JointBullet *joint = bulletnew(Generic6DOFJointBullet(body_A, body_B, p_local_frame_A, p_local_frame_B));
AddJointToSpace(body_A, joint);
CreateThenReturnRID(joint_owner, joint);
diff --git a/modules/bullet/cone_twist_joint_bullet.cpp b/modules/bullet/cone_twist_joint_bullet.cpp
index 472ad3b52c..6b5438c60f 100644
--- a/modules/bullet/cone_twist_joint_bullet.cpp
+++ b/modules/bullet/cone_twist_joint_bullet.cpp
@@ -64,26 +64,6 @@ ConeTwistJointBullet::ConeTwistJointBullet(RigidBodyBullet *rbA, RigidBodyBullet
setup(coneConstraint);
}
-void ConeTwistJointBullet::set_angular_only(bool angularOnly) {
- coneConstraint->setAngularOnly(angularOnly);
-}
-
-void ConeTwistJointBullet::set_limit(real_t _swingSpan1, real_t _swingSpan2, real_t _twistSpan, real_t _softness, real_t _biasFactor, real_t _relaxationFactor) {
- coneConstraint->setLimit(_swingSpan1, _swingSpan2, _twistSpan, _softness, _biasFactor, _relaxationFactor);
-}
-
-int ConeTwistJointBullet::get_solve_twist_limit() {
- return coneConstraint->getSolveTwistLimit();
-}
-
-int ConeTwistJointBullet::get_solve_swing_limit() {
- return coneConstraint->getSolveSwingLimit();
-}
-
-real_t ConeTwistJointBullet::get_twist_limit_sign() {
- return coneConstraint->getTwistLimitSign();
-}
-
void ConeTwistJointBullet::set_param(PhysicsServer::ConeTwistJointParam p_param, real_t p_value) {
switch (p_param) {
case PhysicsServer::CONE_TWIST_JOINT_SWING_SPAN:
diff --git a/modules/bullet/cone_twist_joint_bullet.h b/modules/bullet/cone_twist_joint_bullet.h
index bd6eb49196..d6040fd6ec 100644
--- a/modules/bullet/cone_twist_joint_bullet.h
+++ b/modules/bullet/cone_twist_joint_bullet.h
@@ -47,14 +47,6 @@ public:
virtual PhysicsServer::JointType get_type() const { return PhysicsServer::JOINT_CONE_TWIST; }
- void set_angular_only(bool angularOnly);
-
- void set_limit(real_t _swingSpan1, real_t _swingSpan2, real_t _twistSpan, real_t _softness = 0.8f, real_t _biasFactor = 0.3f, real_t _relaxationFactor = 1.0f);
- int get_solve_twist_limit();
-
- int get_solve_swing_limit();
- real_t get_twist_limit_sign();
-
void set_param(PhysicsServer::ConeTwistJointParam p_param, real_t p_value);
real_t get_param(PhysicsServer::ConeTwistJointParam p_param) const;
};
diff --git a/modules/bullet/generic_6dof_joint_bullet.cpp b/modules/bullet/generic_6dof_joint_bullet.cpp
index adfad7803f..6275a0d2ed 100644
--- a/modules/bullet/generic_6dof_joint_bullet.cpp
+++ b/modules/bullet/generic_6dof_joint_bullet.cpp
@@ -34,13 +34,13 @@
#include "bullet_utilities.h"
#include "rigid_body_bullet.h"
-#include <BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.h>
+#include <BulletDynamics/ConstraintSolver/btGeneric6DofSpring2Constraint.h>
/**
@author AndreaCatania
*/
-Generic6DOFJointBullet::Generic6DOFJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameInA, const Transform &frameInB, bool useLinearReferenceFrameA) :
+Generic6DOFJointBullet::Generic6DOFJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameInA, const Transform &frameInB) :
JointBullet() {
Transform scaled_AFrame(frameInA.scaled(rbA->get_body_scale()));
@@ -58,9 +58,9 @@ Generic6DOFJointBullet::Generic6DOFJointBullet(RigidBodyBullet *rbA, RigidBodyBu
btTransform btFrameB;
G_TO_B(scaled_BFrame, btFrameB);
- sixDOFConstraint = bulletnew(btGeneric6DofConstraint(*rbA->get_bt_rigid_body(), *rbB->get_bt_rigid_body(), btFrameA, btFrameB, useLinearReferenceFrameA));
+ sixDOFConstraint = bulletnew(btGeneric6DofSpring2Constraint(*rbA->get_bt_rigid_body(), *rbB->get_bt_rigid_body(), btFrameA, btFrameB));
} else {
- sixDOFConstraint = bulletnew(btGeneric6DofConstraint(*rbA->get_bt_rigid_body(), btFrameA, useLinearReferenceFrameA));
+ sixDOFConstraint = bulletnew(btGeneric6DofSpring2Constraint(*rbA->get_bt_rigid_body(), btFrameA));
}
setup(sixDOFConstraint);
@@ -123,20 +123,11 @@ void Generic6DOFJointBullet::set_param(Vector3::Axis p_axis, PhysicsServer::G6DO
switch (p_param) {
case PhysicsServer::G6DOF_JOINT_LINEAR_LOWER_LIMIT:
limits_lower[0][p_axis] = p_value;
- set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, flags[p_axis][p_param]); // Reload bullet parameter
+ set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, flags[p_axis][PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT]); // Reload bullet parameter
break;
case PhysicsServer::G6DOF_JOINT_LINEAR_UPPER_LIMIT:
limits_upper[0][p_axis] = p_value;
- set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, flags[p_axis][p_param]); // Reload bullet parameter
- break;
- case PhysicsServer::G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS:
- sixDOFConstraint->getTranslationalLimitMotor()->m_limitSoftness = p_value;
- break;
- case PhysicsServer::G6DOF_JOINT_LINEAR_RESTITUTION:
- sixDOFConstraint->getTranslationalLimitMotor()->m_restitution = p_value;
- break;
- case PhysicsServer::G6DOF_JOINT_LINEAR_DAMPING:
- sixDOFConstraint->getTranslationalLimitMotor()->m_damping = p_value;
+ set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, flags[p_axis][PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT]); // Reload bullet parameter
break;
case PhysicsServer::G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY:
sixDOFConstraint->getTranslationalLimitMotor()->m_targetVelocity.m_floats[p_axis] = p_value;
@@ -146,23 +137,11 @@ void Generic6DOFJointBullet::set_param(Vector3::Axis p_axis, PhysicsServer::G6DO
break;
case PhysicsServer::G6DOF_JOINT_ANGULAR_LOWER_LIMIT:
limits_lower[1][p_axis] = p_value;
- set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT, flags[p_axis][p_param]); // Reload bullet parameter
+ set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT, flags[p_axis][PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT]); // Reload bullet parameter
break;
case PhysicsServer::G6DOF_JOINT_ANGULAR_UPPER_LIMIT:
limits_upper[1][p_axis] = p_value;
- set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, flags[p_axis][p_param]); // Reload bullet parameter
- break;
- case PhysicsServer::G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS:
- sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_limitSoftness = p_value;
- break;
- case PhysicsServer::G6DOF_JOINT_ANGULAR_DAMPING:
- sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_damping = p_value;
- break;
- case PhysicsServer::G6DOF_JOINT_ANGULAR_RESTITUTION:
- sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_bounce = p_value;
- break;
- case PhysicsServer::G6DOF_JOINT_ANGULAR_FORCE_LIMIT:
- sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_maxLimitForce = p_value;
+ set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT, flags[p_axis][PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT]); // Reload bullet parameter
break;
case PhysicsServer::G6DOF_JOINT_ANGULAR_ERP:
sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_stopERP = p_value;
@@ -171,7 +150,7 @@ void Generic6DOFJointBullet::set_param(Vector3::Axis p_axis, PhysicsServer::G6DO
sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_targetVelocity = p_value;
break;
case PhysicsServer::G6DOF_JOINT_ANGULAR_MOTOR_FORCE_LIMIT:
- sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_maxLimitForce = p_value;
+ sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_maxMotorForce = p_value;
break;
default:
WARN_PRINT("This parameter is not supported");
@@ -185,12 +164,6 @@ real_t Generic6DOFJointBullet::get_param(Vector3::Axis p_axis, PhysicsServer::G6
return limits_lower[0][p_axis];
case PhysicsServer::G6DOF_JOINT_LINEAR_UPPER_LIMIT:
return limits_upper[0][p_axis];
- case PhysicsServer::G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS:
- return sixDOFConstraint->getTranslationalLimitMotor()->m_limitSoftness;
- case PhysicsServer::G6DOF_JOINT_LINEAR_RESTITUTION:
- return sixDOFConstraint->getTranslationalLimitMotor()->m_restitution;
- case PhysicsServer::G6DOF_JOINT_LINEAR_DAMPING:
- return sixDOFConstraint->getTranslationalLimitMotor()->m_damping;
case PhysicsServer::G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY:
return sixDOFConstraint->getTranslationalLimitMotor()->m_targetVelocity.m_floats[p_axis];
case PhysicsServer::G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT:
@@ -199,20 +172,14 @@ real_t Generic6DOFJointBullet::get_param(Vector3::Axis p_axis, PhysicsServer::G6
return limits_lower[1][p_axis];
case PhysicsServer::G6DOF_JOINT_ANGULAR_UPPER_LIMIT:
return limits_upper[1][p_axis];
- case PhysicsServer::G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS:
- return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_limitSoftness;
- case PhysicsServer::G6DOF_JOINT_ANGULAR_DAMPING:
- return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_damping;
case PhysicsServer::G6DOF_JOINT_ANGULAR_RESTITUTION:
return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_bounce;
- case PhysicsServer::G6DOF_JOINT_ANGULAR_FORCE_LIMIT:
- return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_maxLimitForce;
case PhysicsServer::G6DOF_JOINT_ANGULAR_ERP:
return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_stopERP;
case PhysicsServer::G6DOF_JOINT_ANGULAR_MOTOR_TARGET_VELOCITY:
return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_targetVelocity;
case PhysicsServer::G6DOF_JOINT_ANGULAR_MOTOR_FORCE_LIMIT:
- return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_maxLimitForce;
+ return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_maxMotorForce;
default:
WARN_PRINT("This parameter is not supported");
return 0.;
diff --git a/modules/bullet/generic_6dof_joint_bullet.h b/modules/bullet/generic_6dof_joint_bullet.h
index ad06582eac..176127ed6c 100644
--- a/modules/bullet/generic_6dof_joint_bullet.h
+++ b/modules/bullet/generic_6dof_joint_bullet.h
@@ -40,7 +40,7 @@
class RigidBodyBullet;
class Generic6DOFJointBullet : public JointBullet {
- class btGeneric6DofConstraint *sixDOFConstraint;
+ class btGeneric6DofSpring2Constraint *sixDOFConstraint;
// First is linear second is angular
Vector3 limits_lower[2];
@@ -48,7 +48,7 @@ class Generic6DOFJointBullet : public JointBullet {
bool flags[3][PhysicsServer::G6DOF_JOINT_FLAG_MAX];
public:
- Generic6DOFJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameInA, const Transform &frameInB, bool useLinearReferenceFrameA);
+ Generic6DOFJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameInA, const Transform &frameInB);
virtual PhysicsServer::JointType get_type() const { return PhysicsServer::JOINT_6DOF; }
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 7bf274310d..41cfada723 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -1351,8 +1351,6 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
AudioDriverManager::initialize(p_audio_driver);
- midi_driver.open();
-
input = memnew(InputDefault);
joypad_osx = memnew(JoypadOSX);
@@ -1370,6 +1368,8 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
void OS_OSX::finalize() {
+ midi_driver.close();
+
CFNotificationCenterRemoveObserver(CFNotificationCenterGetDistributedCenter(), NULL, kTISNotifySelectedKeyboardInputSourceChanged, NULL);
CGDisplayRemoveReconfigurationCallback(displays_arrangement_changed, NULL);
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index b7b207dde1..fa8717a4b8 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -1321,10 +1321,6 @@ Error OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int
AudioDriverManager::initialize(p_audio_driver);
-#ifdef WINMIDI_ENABLED
- driver_midi.open();
-#endif
-
TRACKMOUSEEVENT tme;
tme.cbSize = sizeof(TRACKMOUSEEVENT);
tme.dwFlags = TME_LEAVE;
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 043902f48c..56b0c975c4 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -341,10 +341,6 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
AudioDriverManager::initialize(p_audio_driver);
-#ifdef ALSAMIDI_ENABLED
- driver_alsamidi.open();
-#endif
-
ERR_FAIL_COND_V(!visual_server, ERR_UNAVAILABLE);
ERR_FAIL_COND_V(x11_window == 0, ERR_UNAVAILABLE);
diff --git a/scene/3d/physics_joint.cpp b/scene/3d/physics_joint.cpp
index 7988c43eab..a30fc0ac3e 100644
--- a/scene/3d/physics_joint.cpp
+++ b/scene/3d/physics_joint.cpp
@@ -48,18 +48,14 @@ void Joint::_update_joint(bool p_only_free) {
Node *node_a = has_node(get_node_a()) ? get_node(get_node_a()) : (Node *)NULL;
Node *node_b = has_node(get_node_b()) ? get_node(get_node_b()) : (Node *)NULL;
- if (!node_a || !node_b)
- return;
-
PhysicsBody *body_a = Object::cast_to<PhysicsBody>(node_a);
PhysicsBody *body_b = Object::cast_to<PhysicsBody>(node_b);
- if (!body_a || !body_b)
- return;
-
- if (!body_a) {
+ if (!body_a && body_b)
SWAP(body_a, body_b);
- }
+
+ if (!body_a)
+ return;
joint = _configure_joint(body_a, body_b);
@@ -69,7 +65,8 @@ void Joint::_update_joint(bool p_only_free) {
PhysicsServer::get_singleton()->joint_set_solver_priority(joint, solver_priority);
ba = body_a->get_rid();
- bb = body_b->get_rid();
+ if (body_b)
+ bb = body_b->get_rid();
PhysicsServer::get_singleton()->joint_disable_collisions_between_bodies(joint, exclude_from_collision);
}