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

Method _call_input_pause

scene/main/scene_tree.cpp:1403–1497  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1401}
1402
1403void 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 }

Callers 3

_process_pickingMethod · 0.80
push_inputMethod · 0.80

Calls 15

is_input_handledMethod · 0.80
_call_inputMethod · 0.80
get_shortcut_contextMethod · 0.80
_call_shortcut_inputMethod · 0.80
_call_unhandled_inputMethod · 0.80
sizeMethod · 0.65
findMethod · 0.45
is_emptyMethod · 0.45
ptrwMethod · 0.45

Tested by

no test coverage detected