mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-22 20:06:49 +01:00
Stop processing no context node inputs when the input gets handled. Also use ObjectIDs in case Nodes get deleted.
This commit is contained in:
parent
041de5607e
commit
93f4077e73
@ -1280,8 +1280,6 @@ void SceneTree::_call_input_pause(const StringName &p_group, const CallInputType
|
|||||||
call_lock++;
|
call_lock++;
|
||||||
_THREAD_SAFE_UNLOCK_
|
_THREAD_SAFE_UNLOCK_
|
||||||
|
|
||||||
Vector<Node *> no_context_nodes;
|
|
||||||
|
|
||||||
StringName method;
|
StringName method;
|
||||||
|
|
||||||
switch (p_call_type) {
|
switch (p_call_type) {
|
||||||
@ -1318,6 +1316,8 @@ void SceneTree::_call_input_pause(const StringName &p_group, const CallInputType
|
|||||||
//ERR_FAIL_COND(node_count != g.nodes.size());
|
//ERR_FAIL_COND(node_count != g.nodes.size());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Vector<ObjectID> no_context_node_ids;
|
||||||
|
|
||||||
for (int i = node_count - 1; i >= 0; i--) {
|
for (int i = node_count - 1; i >= 0; i--) {
|
||||||
if (input_handled) {
|
if (input_handled) {
|
||||||
break;
|
break;
|
||||||
@ -1337,7 +1337,7 @@ void SceneTree::_call_input_pause(const StringName &p_group, const CallInputType
|
|||||||
// If calling shortcut input on a control, ensure it respects the shortcut context.
|
// If calling shortcut input on a control, ensure it respects the shortcut context.
|
||||||
// Shortcut context (based on focus) only makes sense for controls (UI), so don't need to worry about it for nodes
|
// Shortcut context (based on focus) only makes sense for controls (UI), so don't need to worry about it for nodes
|
||||||
if (c->get_shortcut_context() == NULL) {
|
if (c->get_shortcut_context() == NULL) {
|
||||||
no_context_nodes.push_back(n);
|
no_context_node_ids.push_back(n->get_instance_id());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!c->is_focus_owner_in_shortcut_context()) {
|
if (!c->is_focus_owner_in_shortcut_context()) {
|
||||||
@ -1349,11 +1349,17 @@ void SceneTree::_call_input_pause(const StringName &p_group, const CallInputType
|
|||||||
//ERR_FAIL_COND(node_count != g.nodes.size());
|
//ERR_FAIL_COND(node_count != g.nodes.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
int ncns = no_context_nodes.size();
|
int ncns = no_context_node_ids.size();
|
||||||
|
|
||||||
for (int i = 0; i < ncns; ++i) {
|
for (int i = 0; i < ncns; ++i) {
|
||||||
Node *n = no_context_nodes[i];
|
if (input_handled) {
|
||||||
n->call_multilevel(method, (const Variant **)v, 1);
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
Node *n = Object::cast_to<Node>(ObjectDB::get_instance(no_context_node_ids[i]));
|
||||||
|
if (n) {
|
||||||
|
n->call_multilevel(method, (const Variant **)v, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user