Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow all editor modes to select nodes in the viewport #86804

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions editor/plugins/canvas_item_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2014,14 +2014,14 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
if ((b->is_alt_pressed() && !b->is_command_or_control_pressed()) || tool == TOOL_MOVE) {
List<CanvasItem *> selection = _get_edited_canvas_items();

drag_selection.clear();
for (int i = 0; i < selection.size(); i++) {
if (_is_node_movable(selection[i], true)) {
drag_selection.push_back(selection[i]);
if (selection.size() > 0) {
drag_selection.clear();
for (int i = 0; i < selection.size(); i++) {
if (_is_node_movable(selection[i], true)) {
drag_selection.push_back(selection[i]);
}
}
}

if (selection.size() > 0) {
drag_type = DRAG_MOVE;

CanvasItem *ci = selection[0];
Expand All @@ -2043,8 +2043,9 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {

drag_from = transform.affine_inverse().xform(b->get_position());
_save_canvas_item_state(drag_selection);

return true;
}
return true;
}
}
}
Expand Down Expand Up @@ -2344,7 +2345,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
return true;
}

if (b.is_valid() && b->get_button_index() == MouseButton::LEFT && b->is_pressed() && tool == TOOL_SELECT && !panner->is_panning()) {
if (b.is_valid() && b->get_button_index() == MouseButton::LEFT && b->is_pressed() && !panner->is_panning() && (tool == TOOL_SELECT || tool == TOOL_MOVE || tool == TOOL_SCALE || tool == TOOL_ROTATE)) {
// Single item selection
Point2 click = transform.affine_inverse().xform(b->get_position());

Expand Down Expand Up @@ -2379,7 +2380,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
} else {
bool still_selected = _select_click_on_item(ci, click, b->is_shift_pressed());
// Start dragging
if (still_selected) {
if (still_selected && (tool == TOOL_SELECT || tool == TOOL_MOVE)) {
// Drag the node(s) if requested
drag_start_origin = click;
drag_type = DRAG_QUEUED;
Expand Down
6 changes: 3 additions & 3 deletions editor/plugins/node_3d_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1839,17 +1839,17 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {

clicked = ObjectID();

if ((spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_SELECT && b->is_command_or_control_pressed()) || spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_ROTATE) {
if (can_select_gizmos && ((spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_SELECT && b->is_command_or_control_pressed()) || spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_ROTATE)) {
KoBeWi marked this conversation as resolved.
Show resolved Hide resolved
begin_transform(TRANSFORM_ROTATE, false);
break;
}

if (spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_MOVE) {
if (can_select_gizmos && spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_MOVE) {
begin_transform(TRANSFORM_TRANSLATE, false);
break;
}

if (spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_SCALE) {
if (can_select_gizmos && spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_SCALE) {
begin_transform(TRANSFORM_SCALE, false);
break;
}
Expand Down
Loading