diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp index 9b2bd308689..0cab8c10ef3 100644 --- a/core/os/input_event.cpp +++ b/core/os/input_event.cpp @@ -32,14 +32,6 @@ #include "input_map.h" #include "os/keyboard.h" -void InputEvent::set_id(uint32_t p_id) { - id = p_id; -} - -uint32_t InputEvent::get_id() const { - return id; -} - void InputEvent::set_device(int p_device) { device = p_device; } @@ -99,9 +91,6 @@ bool InputEvent::is_action_type() const { void InputEvent::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_id", "id"), &InputEvent::set_id); - ClassDB::bind_method(D_METHOD("get_id"), &InputEvent::get_id); - ClassDB::bind_method(D_METHOD("set_device", "device"), &InputEvent::set_device); ClassDB::bind_method(D_METHOD("get_device"), &InputEvent::get_device); @@ -125,7 +114,6 @@ void InputEvent::_bind_methods() { InputEvent::InputEvent() { - id = 0; device = 0; } @@ -441,7 +429,6 @@ Ref InputEventMouseButton::xformed_by(const Transform2D &p_xform, co Ref mb; mb.instance(); - mb->set_id(get_id()); mb->set_device(get_device()); mb->set_modifiers_from_event(this); @@ -557,7 +544,6 @@ Ref InputEventMouseMotion::xformed_by(const Transform2D &p_xform, co Ref mm; mm.instance(); - mm->set_id(get_id()); mm->set_device(get_device()); mm->set_modifiers_from_event(this); @@ -764,7 +750,6 @@ Ref InputEventScreenTouch::xformed_by(const Transform2D &p_xform, co Ref st; st.instance(); - st->set_id(get_id()); st->set_device(get_device()); st->set_index(index); st->set_position(p_xform.xform(pos + p_local_ofs)); @@ -845,7 +830,6 @@ Ref InputEventScreenDrag::xformed_by(const Transform2D &p_xform, con sd.instance(); - sd->set_id(get_id()); sd->set_device(get_device()); sd->set_index(index); @@ -968,7 +952,6 @@ Ref InputEventMagnifyGesture::xformed_by(const Transform2D &p_xform, Ref ev; ev.instance(); - ev->set_id(get_id()); ev->set_device(get_device()); ev->set_modifiers_from_event(this); @@ -1006,7 +989,6 @@ Ref InputEventPanGesture::xformed_by(const Transform2D &p_xform, con Ref ev; ev.instance(); - ev->set_id(get_id()); ev->set_device(get_device()); ev->set_modifiers_from_event(this); diff --git a/core/os/input_event.h b/core/os/input_event.h index 614a3289ba4..9b1a2736b17 100644 --- a/core/os/input_event.h +++ b/core/os/input_event.h @@ -144,16 +144,12 @@ enum JoystickList { class InputEvent : public Resource { GDCLASS(InputEvent, Resource) - uint32_t id; int device; protected: static void _bind_methods(); public: - void set_id(uint32_t p_id); - uint32_t get_id() const; - void set_device(int p_device); int get_device() const; diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 6879aa1ce74..51ad22e271f 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -1775,7 +1775,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool case TreeItem::CELL_MODE_STRING: { //nothing in particular - if (select_mode == SELECT_MULTI && (get_tree()->get_last_event_id() == focus_in_id || !already_cursor)) { + if (select_mode == SELECT_MULTI && (get_tree()->get_event_count() == focus_in_id || !already_cursor)) { bring_up_editor = false; } @@ -1863,7 +1863,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool } else { editor_text = String::num(p_item->cells[col].val, Math::step_decimals(p_item->cells[col].step)); - if (select_mode == SELECT_MULTI && get_tree()->get_last_event_id() == focus_in_id) + if (select_mode == SELECT_MULTI && get_tree()->get_event_count() == focus_in_id) bring_up_editor = false; } } @@ -2786,7 +2786,7 @@ void Tree::_notification(int p_what) { if (p_what == NOTIFICATION_FOCUS_ENTER) { - focus_in_id = get_tree()->get_last_event_id(); + focus_in_id = get_tree()->get_event_count(); } if (p_what == NOTIFICATION_MOUSE_EXIT) { diff --git a/scene/gui/tree.h b/scene/gui/tree.h index 85c07e192b1..b8d94bcffb6 100644 --- a/scene/gui/tree.h +++ b/scene/gui/tree.h @@ -359,7 +359,7 @@ private: LineEdit *text_editor; HSlider *value_editor; bool updating_value_editor; - uint32_t focus_in_id; + int64_t focus_in_id; PopupMenu *popup_menu; Vector columns; diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 7c31b72bb52..db39b37bd5d 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -391,13 +391,12 @@ void SceneTree::input_event(const Ref &p_event) { if (Engine::get_singleton()->is_editor_hint() && (Object::cast_to(p_event.ptr()) || Object::cast_to(*p_event))) return; //avoid joy input on editor + current_event++; root_lock++; - //last_id=p_event.ID; input_handled = false; Ref ev = p_event; - ev->set_id(++last_id); //this should work better MainLoop::input_event(ev); @@ -941,11 +940,6 @@ void SceneMainLoop::_update_listener_2d() { } */ -uint32_t SceneTree::get_last_event_id() const { - - return last_id; -} - Variant SceneTree::_call_group_flags(const Variant **p_args, int p_argcount, Variant::CallError &r_error) { r_error.error = Variant::CallError::CALL_OK; @@ -994,6 +988,10 @@ int64_t SceneTree::get_frame() const { return current_frame; } +int64_t SceneTree::get_event_count() const { + + return current_event; +} Array SceneTree::_get_nodes_in_group(const StringName &p_group) { @@ -2287,9 +2285,10 @@ SceneTree::SceneTree() { tree_version = 1; physics_process_time = 1; idle_process_time = 1; - last_id = 1; + root = NULL; current_frame = 0; + current_event = 0; tree_changed_name = "tree_changed"; node_added_name = "node_added"; node_removed_name = "node_removed"; diff --git a/scene/main/scene_tree.h b/scene/main/scene_tree.h index 9c5b0f69cb4..a6f641647f7 100644 --- a/scene/main/scene_tree.h +++ b/scene/main/scene_tree.h @@ -109,7 +109,6 @@ private: float idle_process_time; bool accept_quit; bool quit_on_go_back; - uint32_t last_id; #ifdef DEBUG_ENABLED bool debug_collisions_hint; @@ -130,6 +129,7 @@ private: bool use_font_oversampling; int64_t current_frame; + int64_t current_event; int node_count; #ifdef TOOLS_ENABLED @@ -335,8 +335,6 @@ public: _FORCE_INLINE_ Viewport *get_root() const { return root; } - uint32_t get_last_event_id() const; - void call_group_flags(uint32_t p_call_flags, const StringName &p_group, const StringName &p_function, VARIANT_ARG_LIST); void notify_group_flags(uint32_t p_call_flags, const StringName &p_group, int p_notification); void set_group_flags(uint32_t p_call_flags, const StringName &p_group, const String &p_name, const Variant &p_value); @@ -412,6 +410,7 @@ public: int get_collision_debug_contact_count() { return collision_debug_contacts; } int64_t get_frame() const; + int64_t get_event_count() const; int get_node_count() const; diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 76af70f32fd..fa6a7832f54 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -184,7 +184,6 @@ Viewport::GUI::GUI() { key_focus = NULL; mouse_over = NULL; - cancelled_input_ID = 0; tooltip = NULL; tooltip_popup = NULL; tooltip_label = NULL; @@ -1620,9 +1619,6 @@ bool Viewport::_gui_drop(Control *p_at_control, Point2 p_at_pos, bool p_just_che void Viewport::_gui_input_event(Ref p_event) { - if (p_event->get_id() == gui.cancelled_input_ID) { - return; - } //? /* if (!is_visible()) { @@ -1752,7 +1748,6 @@ void Viewport::_gui_input_event(Ref p_event) { _gui_call_input(gui.mouse_focus, mb); } - get_tree()->call_group_flags(SceneTree::GROUP_CALL_REALTIME, "windows", "_cancel_input_ID", mb->get_id()); get_tree()->set_input_as_handled(); if (gui.drag_data.get_type() != Variant::NIL && mb->get_button_index() == BUTTON_LEFT) { @@ -1825,7 +1820,6 @@ void Viewport::_gui_input_event(Ref p_event) { gui.drag_data=Variant(); //always clear }*/ - get_tree()->call_group_flags(SceneTree::GROUP_CALL_REALTIME, "windows", "_cancel_input_ID", mb->get_id()); get_tree()->set_input_as_handled(); } } diff --git a/scene/main/viewport.h b/scene/main/viewport.h index 0835e3f69ae..c084e348b5c 100644 --- a/scene/main/viewport.h +++ b/scene/main/viewport.h @@ -269,7 +269,6 @@ private: float tooltip_timer; float tooltip_delay; List modal_stack; - unsigned int cancelled_input_ID; Transform2D focus_inv_xform; bool subwindow_order_dirty; List subwindows;