Fight with event leaking; disabled unncecessary camera checks
This commit is contained in:
@@ -339,6 +339,7 @@ void WorldEditor::_notification(int which)
|
||||
"mouse_drag_off", args);
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
if (current_camera_mode == 1) {
|
||||
Vector2 mouse_pos =
|
||||
get_viewport()->get_mouse_position();
|
||||
@@ -350,6 +351,7 @@ void WorldEditor::_notification(int which)
|
||||
old_mouse_pos = mouse_pos;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (!dragging && drag_delay >= 0.0f)
|
||||
drag_delay -= delta;
|
||||
switch (current_mode) {
|
||||
@@ -367,41 +369,58 @@ void WorldEditor::_notification(int which)
|
||||
|
||||
void WorldEditor::_unhandled_input(const Ref<InputEvent> &event)
|
||||
{
|
||||
if (Input::get_singleton()->is_action_just_pressed("editor_cam1"))
|
||||
Ref<InputEventMouseMotion> mm = event;
|
||||
Ref<InputEventMouseButton> mb = event;
|
||||
Ref<InputEventKey> kb = event;
|
||||
bool input_handled = false;
|
||||
if (event->is_action_pressed("editor_cam1")) {
|
||||
set_camera_mode(1);
|
||||
if (Input::get_singleton()->is_action_just_pressed("editor_cam2"))
|
||||
set_camera_mode(2);
|
||||
if (Input::get_singleton()->is_action_just_pressed("editor_cam3"))
|
||||
set_camera_mode(3);
|
||||
if (current_camera_mode != 1) {
|
||||
Ref<InputEventMouseMotion> motionevt = event;
|
||||
if (motionevt.is_valid())
|
||||
motion = motionevt->get_relative();
|
||||
input_handled = true;
|
||||
}
|
||||
if (Input::get_singleton()->is_action_just_pressed("mouse1")) {
|
||||
if (event->is_action_pressed("editor_cam2")) {
|
||||
set_camera_mode(2);
|
||||
input_handled = true;
|
||||
}
|
||||
if (event->is_action_pressed("editor_cam3")) {
|
||||
set_camera_mode(3);
|
||||
input_handled = true;
|
||||
}
|
||||
if (event->is_action_pressed("mouse1")) {
|
||||
// if (Input::get_singleton()->is_action_just_pressed("mouse1")) {
|
||||
Array args;
|
||||
Vector2 position = get_viewport()->get_mouse_position();
|
||||
args.push_back(position);
|
||||
EditorEvent::get_singleton()->event.emit("mouse_press", args);
|
||||
} else if (Input::get_singleton()->is_action_pressed("mouse1")) {
|
||||
if (dragging) {
|
||||
Array args;
|
||||
Vector2 position = get_viewport()->get_mouse_position();
|
||||
args.push_back(position);
|
||||
EditorEvent::get_singleton()->event.emit("mouse_drag",
|
||||
args);
|
||||
} else {
|
||||
if (drag_delay < 0.0f && !dragging) {
|
||||
dragging = true;
|
||||
// }
|
||||
input_handled = true;
|
||||
}
|
||||
if (mm.is_valid()) {
|
||||
motion += mm->get_relative();
|
||||
if (Input::get_singleton()->is_action_pressed("mouse1")) {
|
||||
if (dragging) {
|
||||
Array args;
|
||||
Vector2 position =
|
||||
get_viewport()->get_mouse_position();
|
||||
args.push_back(position);
|
||||
EditorEvent::get_singleton()->event.emit(
|
||||
"mouse_drag_on", args);
|
||||
"mouse_drag", args);
|
||||
} else {
|
||||
if (drag_delay < 0.0f && !dragging) {
|
||||
dragging = true;
|
||||
Array args;
|
||||
Vector2 position =
|
||||
get_viewport()
|
||||
->get_mouse_position();
|
||||
args.push_back(position);
|
||||
EditorEvent::get_singleton()->event.emit(
|
||||
"mouse_drag_on", args);
|
||||
}
|
||||
}
|
||||
input_handled = true;
|
||||
}
|
||||
}
|
||||
if (input_handled)
|
||||
get_viewport()->set_input_as_handled();
|
||||
if (current_mode == MODE_ROAD_LINES)
|
||||
road_lines_editor->handle_input();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user