| 1151 | } |
| 1152 | |
| 1153 | void SceneTree::_process_group(ProcessGroup *p_group, bool p_physics) { |
| 1154 | p_group->call_queue.flush(); // Flush messages before processing. |
| 1155 | |
| 1156 | Vector<Node *> &nodes = p_physics ? p_group->physics_nodes : p_group->nodes; |
| 1157 | if (nodes.is_empty()) { |
| 1158 | return; |
| 1159 | } |
| 1160 | |
| 1161 | if (p_physics) { |
| 1162 | if (p_group->physics_node_order_dirty) { |
| 1163 | nodes.sort_custom<Node::ComparatorWithPhysicsPriority>(); |
| 1164 | p_group->physics_node_order_dirty = false; |
| 1165 | } |
| 1166 | } else { |
| 1167 | if (p_group->node_order_dirty) { |
| 1168 | nodes.sort_custom<Node::ComparatorWithPriority>(); |
| 1169 | p_group->node_order_dirty = false; |
| 1170 | } |
| 1171 | } |
| 1172 | |
| 1173 | // Make a copy, so if nodes are added/removed from process, this does not break |
| 1174 | Vector<Node *> nodes_copy = nodes; |
| 1175 | |
| 1176 | uint32_t node_count = nodes_copy.size(); |
| 1177 | Node **nodes_ptr = (Node **)nodes_copy.ptr(); // Force cast, pointer will not change. |
| 1178 | |
| 1179 | for (uint32_t i = 0; i < node_count; i++) { |
| 1180 | Node *n = nodes_ptr[i]; |
| 1181 | if (nodes_removed_on_group_call.has(n)) { |
| 1182 | // Node may have been removed during process, skip it. |
| 1183 | // Keep in mind removals can only happen on the main thread. |
| 1184 | continue; |
| 1185 | } |
| 1186 | |
| 1187 | if (!n->can_process() || !n->is_inside_tree()) { |
| 1188 | continue; |
| 1189 | } |
| 1190 | |
| 1191 | if (p_physics) { |
| 1192 | if (n->is_physics_processing_internal()) { |
| 1193 | n->notification(Node::NOTIFICATION_INTERNAL_PHYSICS_PROCESS); |
| 1194 | } |
| 1195 | if (n->is_physics_processing()) { |
| 1196 | n->notification(Node::NOTIFICATION_PHYSICS_PROCESS); |
| 1197 | } |
| 1198 | } else { |
| 1199 | if (n->is_processing_internal()) { |
| 1200 | n->notification(Node::NOTIFICATION_INTERNAL_PROCESS); |
| 1201 | } |
| 1202 | if (n->is_processing()) { |
| 1203 | n->notification(Node::NOTIFICATION_PROCESS); |
| 1204 | } |
| 1205 | } |
| 1206 | } |
| 1207 | |
| 1208 | p_group->call_queue.flush(); // Flush messages also after processing (for potential deferred calls). |
| 1209 | } |
| 1210 |
nothing calls this directly
no test coverage detected