Joint2D and Joint: update joint on NOTIFICATION_POST_ENTER_TREE
This allows reparenting, etc.
(cherry picked from commit f197e5eebb
)
This commit is contained in:
parent
fbd74ae941
commit
fb6394f58c
@ -168,14 +168,17 @@ NodePath Joint2D::get_node_b() const {
|
|||||||
|
|
||||||
void Joint2D::_notification(int p_what) {
|
void Joint2D::_notification(int p_what) {
|
||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case NOTIFICATION_READY: {
|
case NOTIFICATION_POST_ENTER_TREE: {
|
||||||
|
if (joint.is_valid()) {
|
||||||
|
_disconnect_signals();
|
||||||
|
}
|
||||||
_update_joint();
|
_update_joint();
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
if (joint.is_valid()) {
|
if (joint.is_valid()) {
|
||||||
_disconnect_signals();
|
_disconnect_signals();
|
||||||
_update_joint(true);
|
|
||||||
}
|
}
|
||||||
|
_update_joint(true);
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -178,14 +178,17 @@ int Joint::get_solver_priority() const {
|
|||||||
|
|
||||||
void Joint::_notification(int p_what) {
|
void Joint::_notification(int p_what) {
|
||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case NOTIFICATION_READY: {
|
case NOTIFICATION_POST_ENTER_TREE: {
|
||||||
|
if (joint.is_valid()) {
|
||||||
|
_disconnect_signals();
|
||||||
|
}
|
||||||
_update_joint();
|
_update_joint();
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
if (joint.is_valid()) {
|
if (joint.is_valid()) {
|
||||||
_disconnect_signals();
|
_disconnect_signals();
|
||||||
_update_joint(true);
|
|
||||||
}
|
}
|
||||||
|
_update_joint(true);
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user