Remove NOTIFICATION_MOVED_IN_PARENT
* This notification makes node children management very inefficient. * Replaced by a NOTIFICATION_CHILDREN_CHANGED (and children_changed signal). * Changed Canvas code (and similar) to use the above signal, to perform more efficiently. This PR breaks compatibility (although this notification was very rarely used, even within the engine), but provides an alternate way to do the same. It is required for the changes in #75627 to be entirely effective.
This commit is contained in:
parent
44d539465a
commit
104392ef4e
12 changed files with 109 additions and 51 deletions
|
|
@ -115,6 +115,7 @@ void Bone2D::_notification(int p_what) {
|
|||
bone.bone = this;
|
||||
skeleton->bones.push_back(bone);
|
||||
skeleton->_make_bone_setup_dirty();
|
||||
get_parent()->connect(SNAME("child_order_changed"), callable_mp(skeleton, &Skeleton2D::_make_bone_setup_dirty), CONNECT_REFERENCE_COUNTED);
|
||||
}
|
||||
|
||||
cache_transform = get_transform();
|
||||
|
|
@ -154,15 +155,6 @@ void Bone2D::_notification(int p_what) {
|
|||
#endif // TOOLS_ENABLED
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_MOVED_IN_PARENT: {
|
||||
if (skeleton) {
|
||||
skeleton->_make_bone_setup_dirty();
|
||||
}
|
||||
if (copy_transform_to_cache) {
|
||||
cache_transform = get_transform();
|
||||
}
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_EXIT_TREE: {
|
||||
if (skeleton) {
|
||||
for (int i = 0; i < skeleton->bones.size(); i++) {
|
||||
|
|
@ -172,7 +164,7 @@ void Bone2D::_notification(int p_what) {
|
|||
}
|
||||
}
|
||||
skeleton->_make_bone_setup_dirty();
|
||||
skeleton = nullptr;
|
||||
get_parent()->disconnect(SNAME("child_order_changed"), callable_mp(skeleton, &Skeleton2D::_make_bone_setup_dirty));
|
||||
}
|
||||
parent_bone = nullptr;
|
||||
set_transform(cache_transform);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue