summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp29
-rw-r--r--editor/plugins/canvas_item_editor_plugin.h3
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp32
-rw-r--r--editor/plugins/tile_map_editor_plugin.cpp1
4 files changed, 39 insertions, 26 deletions
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 7170ce30cc..fcbd68a60f 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -3671,7 +3671,7 @@ void CanvasItemEditor::_notification(int p_what) {
int nb_having_pivot = 0;
// Update the viewport if the canvas_item changes
- List<CanvasItem *> selection = _get_edited_canvas_items();
+ List<CanvasItem *> selection = _get_edited_canvas_items(true);
for (List<CanvasItem *>::Element *E = selection.front(); E; E = E->next()) {
CanvasItem *canvas_item = E->get();
CanvasItemEditorSelectedItem *se = editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(canvas_item);
@@ -3971,9 +3971,9 @@ void CanvasItemEditor::_update_scrollbars() {
updating_scroll = true;
// Move the zoom buttons
- Point2 zoom_hb_begin = Point2(5, 5);
- zoom_hb_begin += (show_rulers) ? Point2(RULER_WIDTH, RULER_WIDTH) : Point2();
- zoom_hb->set_begin(zoom_hb_begin);
+ Point2 controls_vb_begin = Point2(5, 5);
+ controls_vb_begin += (show_rulers) ? Point2(RULER_WIDTH, RULER_WIDTH) : Point2();
+ controls_vb->set_begin(controls_vb_begin);
// Move and resize the scrollbars
Size2 size = viewport->get_size();
@@ -5308,6 +5308,14 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
scene_tree->set_anchors_and_margins_preset(Control::PRESET_WIDE);
scene_tree->add_child(p_editor->get_scene_root());
+ controls_vb = memnew(VBoxContainer);
+ controls_vb->set_begin(Point2(5, 5));
+
+ zoom_hb = memnew(HBoxContainer);
+ // Bring the zoom percentage closer to the zoom buttons
+ zoom_hb->add_constant_override("separation", Math::round(-8 * EDSCALE));
+ controls_vb->add_child(zoom_hb);
+
viewport = memnew(CanvasItemEditorViewport(p_editor, this));
viewport_scrollable->add_child(viewport);
viewport->set_mouse_filter(MOUSE_FILTER_PASS);
@@ -5351,11 +5359,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
v_scroll->connect("value_changed", this, "_update_scroll");
v_scroll->hide();
- zoom_hb = memnew(HBoxContainer);
- viewport->add_child(zoom_hb);
- zoom_hb->set_begin(Point2(5, 5));
- // Bring the zoom percentage closer to the zoom buttons
- zoom_hb->add_constant_override("separation", Math::round(-8 * EDSCALE));
+ viewport->add_child(controls_vb);
zoom_minus = memnew(ToolButton);
zoom_hb->add_child(zoom_minus);
@@ -5742,8 +5746,6 @@ void CanvasItemEditorViewport::_on_change_type_closed() {
}
void CanvasItemEditorViewport::_create_preview(const Vector<String> &files) const {
- label->set_position(get_global_position() + Point2(14, 14) * EDSCALE);
- label_desc->set_position(label->get_position() + Point2(0, label->get_size().height));
bool add_preview = false;
for (int i = 0; i < files.size(); i++) {
String path = files[i];
@@ -6165,7 +6167,7 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte
label->add_color_override("font_color_shadow", Color(0, 0, 0, 1));
label->add_constant_override("shadow_as_outline", 1 * EDSCALE);
label->hide();
- editor->get_gui_base()->add_child(label);
+ canvas_item_editor->get_controls_container()->add_child(label);
label_desc = memnew(Label);
label_desc->set_text(TTR("Drag & drop + Shift : Add node as sibling\nDrag & drop + Alt : Change node type"));
@@ -6174,7 +6176,8 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte
label_desc->add_constant_override("shadow_as_outline", 1 * EDSCALE);
label_desc->add_constant_override("line_spacing", 0);
label_desc->hide();
- editor->get_gui_base()->add_child(label_desc);
+ canvas_item_editor->get_controls_container()->add_child(label_desc);
+
VS::get_singleton()->canvas_set_disable_scale(true);
}
diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h
index 3fdf00d611..3ba66c00f9 100644
--- a/editor/plugins/canvas_item_editor_plugin.h
+++ b/editor/plugins/canvas_item_editor_plugin.h
@@ -530,6 +530,7 @@ private:
void _button_toggle_anchor_mode(bool p_status);
+ VBoxContainer *controls_vb;
HBoxContainer *zoom_hb;
void _zoom_on_position(float p_zoom, Point2 p_position = Point2());
void _update_zoom_label();
@@ -627,6 +628,8 @@ public:
Control *get_viewport_control() { return viewport; }
+ Control *get_controls_container() { return controls_vb; }
+
void update_viewport();
Tool get_current_tool() { return tool; }
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index e0189f8a92..d187e4ff4a 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -965,7 +965,7 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
}
if (b->is_pressed()) {
- int mod = _get_key_modifier(b);
+ const int mod = _get_key_modifier(b);
if (!orthogonal) {
if (mod == _get_key_modifier_setting("editors/3d/freelook/freelook_activation_modifier")) {
set_freelook_active(true);
@@ -1656,14 +1656,16 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
if (nav_scheme == NAVIGATION_GODOT) {
- int mod = _get_key_modifier(m);
+ const int mod = _get_key_modifier(m);
- if (mod == _get_key_modifier_setting("editors/3d/navigation/pan_modifier"))
+ if (mod == _get_key_modifier_setting("editors/3d/navigation/pan_modifier")) {
nav_mode = NAVIGATION_PAN;
- else if (mod == _get_key_modifier_setting("editors/3d/navigation/zoom_modifier"))
+ } else if (mod == _get_key_modifier_setting("editors/3d/navigation/zoom_modifier")) {
nav_mode = NAVIGATION_ZOOM;
- else if (mod == _get_key_modifier_setting("editors/3d/navigation/orbit_modifier"))
+ } else if (mod == KEY_ALT || mod == _get_key_modifier_setting("editors/3d/navigation/orbit_modifier")) {
+ // Always allow Alt as a modifier to better support graphic tablets.
nav_mode = NAVIGATION_ORBIT;
+ }
} else if (nav_scheme == NAVIGATION_MAYA) {
if (m->get_alt())
@@ -1672,15 +1674,17 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
} else if (EditorSettings::get_singleton()->get("editors/3d/navigation/emulate_3_button_mouse")) {
// Handle trackpad (no external mouse) use case
- int mod = _get_key_modifier(m);
+ const int mod = _get_key_modifier(m);
if (mod) {
- if (mod == _get_key_modifier_setting("editors/3d/navigation/pan_modifier"))
+ if (mod == _get_key_modifier_setting("editors/3d/navigation/pan_modifier")) {
nav_mode = NAVIGATION_PAN;
- else if (mod == _get_key_modifier_setting("editors/3d/navigation/zoom_modifier"))
+ } else if (mod == _get_key_modifier_setting("editors/3d/navigation/zoom_modifier")) {
nav_mode = NAVIGATION_ZOOM;
- else if (mod == _get_key_modifier_setting("editors/3d/navigation/orbit_modifier"))
+ } else if (mod == KEY_ALT || mod == _get_key_modifier_setting("editors/3d/navigation/orbit_modifier")) {
+ // Always allow Alt as a modifier to better support graphic tablets.
nav_mode = NAVIGATION_ORBIT;
+ }
}
}
@@ -1727,14 +1731,16 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
if (nav_scheme == NAVIGATION_GODOT) {
- int mod = _get_key_modifier(pan_gesture);
+ const int mod = _get_key_modifier(pan_gesture);
- if (mod == _get_key_modifier_setting("editors/3d/navigation/pan_modifier"))
+ if (mod == _get_key_modifier_setting("editors/3d/navigation/pan_modifier")) {
nav_mode = NAVIGATION_PAN;
- else if (mod == _get_key_modifier_setting("editors/3d/navigation/zoom_modifier"))
+ } else if (mod == _get_key_modifier_setting("editors/3d/navigation/zoom_modifier")) {
nav_mode = NAVIGATION_ZOOM;
- else if (mod == _get_key_modifier_setting("editors/3d/navigation/orbit_modifier"))
+ } else if (mod == KEY_ALT || mod == _get_key_modifier_setting("editors/3d/navigation/orbit_modifier")) {
+ // Always allow Alt as a modifier to better support graphic tablets.
nav_mode = NAVIGATION_ORBIT;
+ }
} else if (nav_scheme == NAVIGATION_MAYA) {
if (pan_gesture->get_alt())
diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp
index 10567557d6..385ba4cfda 100644
--- a/editor/plugins/tile_map_editor_plugin.cpp
+++ b/editor/plugins/tile_map_editor_plugin.cpp
@@ -515,6 +515,7 @@ void TileMapEditor::_update_palette() {
sel_tile = selected.get(Math::rand() % selected.size());
} else if (palette->get_item_count() > 0) {
palette->select(0);
+ sel_tile = palette->get_selected_items().get(0);
}
if (sel_tile != TileMap::INVALID_CELL && ((manual_autotile && tileset->tile_get_tile_mode(sel_tile) == TileSet::AUTO_TILE) || (!priority_atlastile && tileset->tile_get_tile_mode(sel_tile) == TileSet::ATLAS_TILE))) {