diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/2d/screen_button.cpp | 23 | ||||
-rw-r--r-- | scene/2d/screen_button.h | 1 | ||||
-rw-r--r-- | scene/main/node.cpp | 7 | ||||
-rw-r--r-- | scene/resources/packed_scene.cpp | 25 | ||||
-rw-r--r-- | scene/resources/packed_scene.h | 2 | ||||
-rw-r--r-- | scene/resources/shader_graph.cpp | 2 |
6 files changed, 44 insertions, 16 deletions
diff --git a/scene/2d/screen_button.cpp b/scene/2d/screen_button.cpp index 9b9fa6cfa8..db822ed306 100644 --- a/scene/2d/screen_button.cpp +++ b/scene/2d/screen_button.cpp @@ -135,7 +135,7 @@ void TouchScreenButton::_notification(int p_what) { update(); if (!get_tree()->is_editor_hint()) - set_process_input(true); + set_process_input(is_visible_in_tree()); if (action.operator String() != "" && InputMap::get_singleton()->has_action(action)) { action_id = InputMap::get_singleton()->get_action_id(action); @@ -147,10 +147,21 @@ void TouchScreenButton::_notification(int p_what) { if (is_pressed()) _release(true); } break; + case NOTIFICATION_VISIBILITY_CHANGED: { + if (get_tree()->is_editor_hint()) + break; + if (is_visible_in_tree()) { + set_process_input(true); + } else { + set_process_input(false); + if (is_pressed()) + _release(); + } + } break; case NOTIFICATION_PAUSED: { - // So the button can be pressed again even though the release gets unhandled because of coming during pause - allow_repress = true; - } + if (is_pressed()) + _release(); + } break; } } @@ -230,7 +241,7 @@ void TouchScreenButton::_input(const InputEvent &p_event) { if (!is_visible_in_tree()) return; - const bool can_press = finger_pressed == -1 || allow_repress; + const bool can_press = finger_pressed == -1; if (!can_press) return; //already fingering @@ -276,7 +287,6 @@ void TouchScreenButton::_input(const InputEvent &p_event) { void TouchScreenButton::_press(int p_finger_pressed) { finger_pressed = p_finger_pressed; - allow_repress = false; if (action_id != -1) { @@ -394,7 +404,6 @@ void TouchScreenButton::_bind_methods() { TouchScreenButton::TouchScreenButton() { finger_pressed = -1; - allow_repress = false; action_id = -1; passby_press = false; visibility = VISIBILITY_ALWAYS; diff --git a/scene/2d/screen_button.h b/scene/2d/screen_button.h index d648920b21..201d908bf6 100644 --- a/scene/2d/screen_button.h +++ b/scene/2d/screen_button.h @@ -56,7 +56,6 @@ private: StringName action; bool passby_press; int finger_pressed; - bool allow_repress; int action_id; VisibilityMode visibility; diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 864e26a651..0245944154 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -2498,8 +2498,11 @@ void Node::_replace_connections_target(Node *p_new_target) { Connection &c = E->get(); - c.source->disconnect(c.signal, this, c.method); - c.source->connect(c.signal, p_new_target, c.method, c.binds, c.flags); + if (c.flags & CONNECT_PERSIST) { + c.source->disconnect(c.signal, this, c.method); + ERR_CONTINUE(!p_new_target->has_method(c.method)); + c.source->connect(c.signal, p_new_target, c.method, c.binds, c.flags); + } } } diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index 0c2f07aa4a..e46d9db7bc 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -995,12 +995,12 @@ int SceneState::find_node_by_path(const NodePath &p_node) const { if (_get_base_scene_state().is_valid()) { int idx = _get_base_scene_state()->find_node_by_path(p_node); if (idx >= 0) { - if (!base_scene_node_remap.has(idx)) { - int ridx = nodes.size() + base_scene_node_remap.size(); - base_scene_node_remap[ridx] = idx; + int rkey = _find_base_scene_node_remap_key(idx); + if (rkey == -1) { + rkey = nodes.size() + base_scene_node_remap.size(); + base_scene_node_remap[rkey] = idx; } - - return base_scene_node_remap[idx]; + return rkey; } } return -1; @@ -1013,11 +1013,24 @@ int SceneState::find_node_by_path(const NodePath &p_node) const { //the node in the instanced scene, as a property may be missing //from the local one int idx = _get_base_scene_state()->find_node_by_path(p_node); - base_scene_node_remap[nid] = idx; + if (idx != -1) { + base_scene_node_remap[nid] = idx; + } } return nid; } + +int SceneState::_find_base_scene_node_remap_key(int p_idx) const { + + for (Map<int, int>::Element *E = base_scene_node_remap.front(); E; E = E->next()) { + if (E->value() == p_idx) { + return E->key(); + } + } + return -1; +} + Variant SceneState::get_property_value(int p_node, const StringName &p_property, bool &found) const { found = false; diff --git a/scene/resources/packed_scene.h b/scene/resources/packed_scene.h index 5fa54413a8..b0e89205cb 100644 --- a/scene/resources/packed_scene.h +++ b/scene/resources/packed_scene.h @@ -100,6 +100,8 @@ class SceneState : public Reference { PoolVector<String> _get_node_groups(int p_idx) const; + int _find_base_scene_node_remap_key(int p_idx) const; + protected: static void _bind_methods(); diff --git a/scene/resources/shader_graph.cpp b/scene/resources/shader_graph.cpp index 49e987727d..28b8490cb4 100644 --- a/scene/resources/shader_graph.cpp +++ b/scene/resources/shader_graph.cpp @@ -1469,6 +1469,7 @@ const ShaderGraph::InOutParamInfo ShaderGraph::inout_param_info[]={ {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"Var1","VAR1.rgb","",SLOT_TYPE_VEC,SLOT_IN}, {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"Var2","VAR2.rgb","",SLOT_TYPE_VEC,SLOT_IN}, {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"PointCoord","POINT_COORD","",SLOT_TYPE_VEC,SLOT_IN}, + {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"Position","POSITION","",SLOT_TYPE_VEC,SLOT_IN}, //canvas item fragment out {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"Color","COLOR.rgb","",SLOT_TYPE_VEC,SLOT_OUT}, {MODE_CANVAS_ITEM,SHADER_TYPE_FRAGMENT,"Alpha","COLOR.a","",SLOT_TYPE_SCALAR,SLOT_OUT}, @@ -1489,6 +1490,7 @@ const ShaderGraph::InOutParamInfo ShaderGraph::inout_param_info[]={ {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"Var1","VAR1.rgb","",SLOT_TYPE_VEC,SLOT_IN}, {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"Var2","VAR2.rgb","",SLOT_TYPE_VEC,SLOT_IN}, {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"PointCoord","POINT_COORD","",SLOT_TYPE_VEC,SLOT_IN}, + {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"Position","POSITION","",SLOT_TYPE_VEC,SLOT_IN}, //canvas item light out {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"LightColor","LIGHT.rgb","",SLOT_TYPE_VEC,SLOT_OUT}, {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"LightAlpha","LIGHT.a","",SLOT_TYPE_SCALAR,SLOT_OUT}, |