| 1401 | } |
| 1402 | |
| 1403 | void SceneTree::_call_input_pause(const StringName &p_group, CallInputType p_call_type, const Ref<InputEvent> &p_input, Viewport *p_viewport) { |
| 1404 | Vector<Node *> nodes_copy; |
| 1405 | { |
| 1406 | _THREAD_SAFE_METHOD_ |
| 1407 | |
| 1408 | HashMap<StringName, Group>::Iterator E = group_map.find(p_group); |
| 1409 | if (!E) { |
| 1410 | return; |
| 1411 | } |
| 1412 | Group &g = E->value; |
| 1413 | if (g.nodes.is_empty()) { |
| 1414 | return; |
| 1415 | } |
| 1416 | |
| 1417 | _update_group_order(g); |
| 1418 | |
| 1419 | //copy, so copy on write happens in case something is removed from process while being called |
| 1420 | //performance is not lost because only if something is added/removed the vector is copied. |
| 1421 | nodes_copy = g.nodes; |
| 1422 | } |
| 1423 | |
| 1424 | int gr_node_count = nodes_copy.size(); |
| 1425 | Node **gr_nodes = nodes_copy.ptrw(); |
| 1426 | |
| 1427 | { |
| 1428 | _THREAD_SAFE_METHOD_ |
| 1429 | nodes_removed_on_group_call_lock++; |
| 1430 | } |
| 1431 | |
| 1432 | Vector<ObjectID> no_context_node_ids; // Nodes may be deleted due to this shortcut input. |
| 1433 | |
| 1434 | for (int i = gr_node_count - 1; i >= 0; i--) { |
| 1435 | if (p_viewport->is_input_handled()) { |
| 1436 | break; |
| 1437 | } |
| 1438 | |
| 1439 | Node *n = gr_nodes[i]; |
| 1440 | if (nodes_removed_on_group_call.has(n)) { |
| 1441 | continue; |
| 1442 | } |
| 1443 | |
| 1444 | if (!n->can_process()) { |
| 1445 | continue; |
| 1446 | } |
| 1447 | |
| 1448 | switch (p_call_type) { |
| 1449 | case CALL_INPUT_TYPE_INPUT: |
| 1450 | n->_call_input(p_input); |
| 1451 | break; |
| 1452 | case CALL_INPUT_TYPE_SHORTCUT_INPUT: { |
| 1453 | const Control *c = Object::cast_to<Control>(n); |
| 1454 | if (c) { |
| 1455 | // If calling shortcut input on a control, ensure it respects the shortcut context. |
| 1456 | // Shortcut context (based on focus) only makes sense for controls (UI), so don't need to worry about it for nodes |
| 1457 | if (c->get_shortcut_context() == nullptr) { |
| 1458 | no_context_node_ids.append(n->get_instance_id()); |
| 1459 | continue; |
| 1460 | } |
no test coverage detected