MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / _process_group

Method _process_group

scene/main/scene_tree.cpp:1153–1209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1151}
1152
1153void 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

Callers

nothing calls this directly

Calls 12

is_inside_treeMethod · 0.80
is_physics_processingMethod · 0.80
is_processingMethod · 0.80
sizeMethod · 0.65
flushMethod · 0.45
is_emptyMethod · 0.45
ptrMethod · 0.45
hasMethod · 0.45
can_processMethod · 0.45
notificationMethod · 0.45

Tested by

no test coverage detected