summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_node.cpp24
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp5
-rw-r--r--editor/plugins/node_3d_editor_plugin.cpp21
-rw-r--r--editor/plugins/node_3d_editor_plugin.h4
-rw-r--r--editor/plugins/tile_map_editor_plugin.cpp209
-rw-r--r--editor/plugins/tile_map_editor_plugin.h3
-rw-r--r--editor/quick_open.cpp82
-rw-r--r--editor/quick_open.h4
8 files changed, 237 insertions, 115 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index d8bc555d6d..f2f8805aaf 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -360,7 +360,7 @@ void EditorNode::_notification(int p_what) {
bool dof_jitter = GLOBAL_GET("rendering/quality/depth_of_field/depth_of_field_use_jitter");
RS::get_singleton()->camera_effects_set_dof_blur_quality(dof_quality, dof_jitter);
RS::get_singleton()->environment_set_ssao_quality(RS::EnvironmentSSAOQuality(int(GLOBAL_GET("rendering/quality/ssao/quality"))), GLOBAL_GET("rendering/quality/ssao/half_size"));
- RS::get_singleton()->screen_space_roughness_limiter_set_active(GLOBAL_GET("rendering/quality/screen_filters/screen_space_roughness_limiter"), GLOBAL_GET("rendering/quality/screen_filters/screen_space_roughness_limiter_curve"));
+ RS::get_singleton()->screen_space_roughness_limiter_set_active(GLOBAL_GET("rendering/quality/screen_filters/screen_space_roughness_limiter_enable"), GLOBAL_GET("rendering/quality/screen_filters/screen_space_roughness_limiter_amount"), GLOBAL_GET("rendering/quality/screen_filters/screen_space_roughness_limiter_limit"));
bool glow_bicubic = int(GLOBAL_GET("rendering/quality/glow/upscale_mode")) > 0;
RS::get_singleton()->environment_glow_set_use_bicubic_upscale(glow_bicubic);
RS::EnvironmentSSRRoughnessQuality ssr_roughness_quality = RS::EnvironmentSSRRoughnessQuality(int(GLOBAL_GET("rendering/quality/screen_space_reflection/roughness_quality")));
@@ -376,6 +376,12 @@ void EditorNode::_notification(int p_what) {
RS::get_singleton()->directional_shadow_quality_set(directional_shadow_quality);
float probe_update_speed = GLOBAL_GET("rendering/lightmapper/probe_capture_update_speed");
RS::get_singleton()->lightmap_set_probe_capture_update_speed(probe_update_speed);
+ RS::EnvironmentSDFGIFramesToConverge frames_to_converge = RS::EnvironmentSDFGIFramesToConverge(int(GLOBAL_GET("rendering/sdfgi/frames_to_converge")));
+ RS::get_singleton()->environment_set_sdfgi_frames_to_converge(frames_to_converge);
+ RS::EnvironmentSDFGIRayCount ray_count = RS::EnvironmentSDFGIRayCount(int(GLOBAL_GET("rendering/sdfgi/probe_ray_count")));
+ RS::get_singleton()->environment_set_sdfgi_ray_count(ray_count);
+ RS::GIProbeQuality gi_probe_quality = RS::GIProbeQuality(int(GLOBAL_GET("rendering/quality/gi_probes/quality")));
+ RS::get_singleton()->gi_probe_set_quality(gi_probe_quality);
}
ResourceImporterTexture::get_singleton()->update_imports();
@@ -3637,16 +3643,13 @@ Ref<Texture2D> EditorNode::get_object_icon(const Object *p_object, const String
Ref<Texture2D> EditorNode::get_class_icon(const String &p_class, const String &p_fallback) const {
ERR_FAIL_COND_V_MSG(p_class.empty(), nullptr, "Class name cannot be empty.");
- if (gui_base->has_theme_icon(p_class, "EditorIcons")) {
- return gui_base->get_theme_icon(p_class, "EditorIcons");
- }
-
if (ScriptServer::is_global_class(p_class)) {
Ref<ImageTexture> icon;
Ref<Script> script = EditorNode::get_editor_data().script_class_load_script(p_class);
+ StringName name = p_class;
while (script.is_valid()) {
- StringName name = EditorNode::get_editor_data().script_class_get_name(script->get_path());
+ name = EditorNode::get_editor_data().script_class_get_name(script->get_path());
String current_icon_path = EditorNode::get_editor_data().script_class_get_icon_path(name);
icon = _load_custom_class_icon(current_icon_path);
if (icon.is_valid()) {
@@ -3656,7 +3659,7 @@ Ref<Texture2D> EditorNode::get_class_icon(const String &p_class, const String &p
}
if (icon.is_null()) {
- icon = gui_base->get_theme_icon(ScriptServer::get_global_class_base(p_class), "EditorIcons");
+ icon = gui_base->get_theme_icon(ScriptServer::get_global_class_base(name), "EditorIcons");
}
return icon;
@@ -3674,6 +3677,10 @@ Ref<Texture2D> EditorNode::get_class_icon(const String &p_class, const String &p
}
}
+ if (gui_base->has_theme_icon(p_class, "EditorIcons")) {
+ return gui_base->get_theme_icon(p_class, "EditorIcons");
+ }
+
if (p_fallback.length() && gui_base->has_theme_icon(p_fallback, "EditorIcons")) {
return gui_base->get_theme_icon(p_fallback, "EditorIcons");
}
@@ -4152,7 +4159,6 @@ void EditorNode::_update_dock_slots_visibility() {
}
right_hsplit->hide();
- bottom_panel->hide();
} else {
for (int i = 0; i < DOCK_SLOT_MAX; i++) {
int tabs_visible = 0;
@@ -4182,7 +4188,6 @@ void EditorNode::_update_dock_slots_visibility() {
dock_slot[i]->set_current_tab(0);
}
}
- bottom_panel->show();
if (right_l_vsplit->is_visible() || right_r_vsplit->is_visible()) {
right_hsplit->show();
@@ -6483,6 +6488,7 @@ EditorNode::EditorNode() {
}
resource_preview->add_preview_generator(Ref<EditorTexturePreviewPlugin>(memnew(EditorTexturePreviewPlugin)));
+ resource_preview->add_preview_generator(Ref<EditorImagePreviewPlugin>(memnew(EditorImagePreviewPlugin)));
resource_preview->add_preview_generator(Ref<EditorPackedScenePreviewPlugin>(memnew(EditorPackedScenePreviewPlugin)));
resource_preview->add_preview_generator(Ref<EditorMaterialPreviewPlugin>(memnew(EditorMaterialPreviewPlugin)));
resource_preview->add_preview_generator(Ref<EditorScriptPreviewPlugin>(memnew(EditorScriptPreviewPlugin)));
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index e35cbfcfb0..3af0b0d4e1 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -6149,6 +6149,11 @@ bool CanvasItemEditorViewport::_create_instance(Node *parent, String &path, cons
Vector2 target_pos = canvas_item_editor->get_canvas_transform().affine_inverse().xform(p_point);
target_pos = canvas_item_editor->snap_point(target_pos);
target_pos = parent_ci->get_global_transform_with_canvas().affine_inverse().xform(target_pos);
+ // Preserve instance position of the original scene.
+ CanvasItem *instance_ci = Object::cast_to<CanvasItem>(instanced_scene);
+ if (instance_ci) {
+ target_pos += instance_ci->_edit_get_position();
+ }
editor_data->get_undo_redo().add_do_method(instanced_scene, "set_position", target_pos);
}
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp
index ebd9c7f070..b51ea9e1c6 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -487,6 +487,10 @@ ObjectID Node3DEditorViewport::_select_ray(const Point2 &p_pos, bool p_append, b
Vector3 pos = _get_ray_pos(p_pos);
Vector2 shrinked_pos = p_pos / subviewport_container->get_stretch_shrink();
+ if (viewport->get_debug_draw() == Viewport::DEBUG_DRAW_SDFGI_PROBES) {
+ RS::get_singleton()->sdfgi_set_debug_probe_select(pos, ray);
+ }
+
Vector<ObjectID> instances = RenderingServer::get_singleton()->instances_cull_ray(pos, ray, get_tree()->get_root()->get_world_3d()->get_scenario());
Set<Ref<EditorNode3DGizmo>> found_gizmos;
@@ -2984,7 +2988,9 @@ void Node3DEditorViewport::_menu_option(int p_option) {
case VIEW_DISPLAY_DEBUG_SSAO:
case VIEW_DISPLAY_DEBUG_PSSM_SPLITS:
case VIEW_DISPLAY_DEBUG_DECAL_ATLAS:
- case VIEW_DISPLAY_DEBUG_ROUGHNESS_LIMITER: {
+ case VIEW_DISPLAY_DEBUG_SDFGI:
+ case VIEW_DISPLAY_DEBUG_SDFGI_PROBES:
+ case VIEW_DISPLAY_DEBUG_GI_BUFFER: {
static const int display_options[] = {
VIEW_DISPLAY_NORMAL,
VIEW_DISPLAY_WIREFRAME,
@@ -3000,9 +3006,11 @@ void Node3DEditorViewport::_menu_option(int p_option) {
VIEW_DISPLAY_DEBUG_GIPROBE_EMISSION,
VIEW_DISPLAY_DEBUG_SCENE_LUMINANCE,
VIEW_DISPLAY_DEBUG_SSAO,
- VIEW_DISPLAY_DEBUG_ROUGHNESS_LIMITER,
+ VIEW_DISPLAY_DEBUG_GI_BUFFER,
VIEW_DISPLAY_DEBUG_PSSM_SPLITS,
VIEW_DISPLAY_DEBUG_DECAL_ATLAS,
+ VIEW_DISPLAY_DEBUG_SDFGI,
+ VIEW_DISPLAY_DEBUG_SDFGI_PROBES,
VIEW_MAX
};
static const Viewport::DebugDraw debug_draw_modes[] = {
@@ -3020,9 +3028,11 @@ void Node3DEditorViewport::_menu_option(int p_option) {
Viewport::DEBUG_DRAW_GI_PROBE_EMISSION,
Viewport::DEBUG_DRAW_SCENE_LUMINANCE,
Viewport::DEBUG_DRAW_SSAO,
- Viewport::DEBUG_DRAW_ROUGHNESS_LIMITER,
+ Viewport::DEBUG_DRAW_GI_BUFFER,
Viewport::DEBUG_DRAW_PSSM_SPLITS,
Viewport::DEBUG_DRAW_DECAL_ATLAS,
+ Viewport::DEBUG_DRAW_SDFGI,
+ Viewport::DEBUG_DRAW_SDFGI_PROBES,
};
int idx = 0;
@@ -3898,11 +3908,14 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, Edito
display_submenu->add_radio_check_item(TTR("GIProbe Albedo"), VIEW_DISPLAY_DEBUG_GIPROBE_ALBEDO);
display_submenu->add_radio_check_item(TTR("GIProbe Emission"), VIEW_DISPLAY_DEBUG_GIPROBE_EMISSION);
display_submenu->add_separator();
+ display_submenu->add_radio_check_item(TTR("SDFGI Cascades"), VIEW_DISPLAY_DEBUG_SDFGI);
+ display_submenu->add_radio_check_item(TTR("SDFGI Probes"), VIEW_DISPLAY_DEBUG_SDFGI_PROBES);
+ display_submenu->add_separator();
display_submenu->add_radio_check_item(TTR("Scene Luminance"), VIEW_DISPLAY_DEBUG_SCENE_LUMINANCE);
display_submenu->add_separator();
display_submenu->add_radio_check_item(TTR("SSAO"), VIEW_DISPLAY_DEBUG_SSAO);
display_submenu->add_separator();
- display_submenu->add_radio_check_item(TTR("Roughness Limiter"), VIEW_DISPLAY_DEBUG_ROUGHNESS_LIMITER);
+ display_submenu->add_radio_check_item(TTR("GI Buffer"), VIEW_DISPLAY_DEBUG_GI_BUFFER);
display_submenu->set_name("display_advanced");
view_menu->get_popup()->add_submenu_item(TTR("Display Advanced..."), "display_advanced", VIEW_DISPLAY_ADVANCED);
view_menu->get_popup()->add_separator();
diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h
index 2fe1938f28..a40de78795 100644
--- a/editor/plugins/node_3d_editor_plugin.h
+++ b/editor/plugins/node_3d_editor_plugin.h
@@ -214,9 +214,11 @@ class Node3DEditorViewport : public Control {
VIEW_DISPLAY_DEBUG_GIPROBE_EMISSION,
VIEW_DISPLAY_DEBUG_SCENE_LUMINANCE,
VIEW_DISPLAY_DEBUG_SSAO,
- VIEW_DISPLAY_DEBUG_ROUGHNESS_LIMITER,
VIEW_DISPLAY_DEBUG_PSSM_SPLITS,
VIEW_DISPLAY_DEBUG_DECAL_ATLAS,
+ VIEW_DISPLAY_DEBUG_SDFGI,
+ VIEW_DISPLAY_DEBUG_SDFGI_PROBES,
+ VIEW_DISPLAY_DEBUG_GI_BUFFER,
VIEW_LOCK_ROTATION,
VIEW_CINEMATIC_PREVIEW,
VIEW_AUTO_ORTHOGONAL,
diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp
index 158f9e8587..307a8a9001 100644
--- a/editor/plugins/tile_map_editor_plugin.cpp
+++ b/editor/plugins/tile_map_editor_plugin.cpp
@@ -64,6 +64,8 @@ void TileMapEditor::_notification(int p_what) {
}
paint_button->set_icon(get_theme_icon("Edit", "EditorIcons"));
+ line_button->set_icon(get_theme_icon("CurveLinear", "EditorIcons"));
+ rectangle_button->set_icon(get_theme_icon("RectangleShape2D", "EditorIcons"));
bucket_fill_button->set_icon(get_theme_icon("Bucket", "EditorIcons"));
picker_button->set_icon(get_theme_icon("ColorPick", "EditorIcons"));
select_button->set_icon(get_theme_icon("ActionCopy", "EditorIcons"));
@@ -91,9 +93,10 @@ void TileMapEditor::_notification(int p_what) {
}
void TileMapEditor::_update_button_tool() {
- Button *tb[4] = { paint_button, bucket_fill_button, picker_button, select_button };
+ Button *tb[6] = { paint_button, line_button, rectangle_button, bucket_fill_button, picker_button, select_button };
+
// Unpress all buttons
- for (int i = 0; i < 4; i++) {
+ for (int i = 0; i < 6; i++) {
tb[i]->set_pressed(false);
}
@@ -103,6 +106,12 @@ void TileMapEditor::_update_button_tool() {
case TOOL_PAINTING: {
paint_button->set_pressed(true);
} break;
+ case TOOL_LINE_PAINT: {
+ line_button->set_pressed(true);
+ } break;
+ case TOOL_RECTANGLE_PAINT: {
+ rectangle_button->set_pressed(true);
+ } break;
case TOOL_BUCKET: {
bucket_fill_button->set_pressed(true);
} break;
@@ -993,19 +1002,8 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
}
if (tool == TOOL_NONE) {
- if (mb->get_shift()) {
- if (mb->get_command()) {
- tool = TOOL_RECTANGLE_PAINT;
- } else {
- tool = TOOL_LINE_PAINT;
- }
-
- selection_active = false;
- rectangle_begin = over_tile;
-
- _update_button_tool();
- return true;
- }
+ tool = TOOL_PAINTING;
+ _update_button_tool();
if (mb->get_command()) {
tool = TOOL_PICKING;
@@ -1014,12 +1012,14 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
return true;
}
-
- tool = TOOL_PAINTING;
- _update_button_tool();
}
- if (tool == TOOL_PAINTING) {
+ if (tool == TOOL_LINE_PAINT || tool == TOOL_RECTANGLE_PAINT) {
+ selection_active = false;
+ rectangle_begin = over_tile;
+
+ mouse_down = true;
+ } else if (tool == TOOL_PAINTING) {
Vector<int> ids = get_selected_tiles();
if (ids.size() > 0 && ids[0] != TileMap::INVALID_CELL) {
@@ -1050,6 +1050,10 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
paint_undo.clear();
}
} else if (tool == TOOL_LINE_PAINT) {
+ if (!mouse_down) {
+ return true;
+ }
+
Vector<int> ids = get_selected_tiles();
if (ids.size() > 0 && ids[0] != TileMap::INVALID_CELL) {
@@ -1062,8 +1066,17 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
paint_undo.clear();
CanvasItemEditor::get_singleton()->update_viewport();
+
+ mouse_down = false;
+ return true;
}
+
+ mouse_down = false;
} else if (tool == TOOL_RECTANGLE_PAINT) {
+ if (!mouse_down) {
+ return true;
+ }
+
Vector<int> ids = get_selected_tiles();
if (ids.size() > 0 && ids[0] != TileMap::INVALID_CELL) {
@@ -1076,7 +1089,12 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
_finish_undo();
CanvasItemEditor::get_singleton()->update_viewport();
+
+ mouse_down = false;
+ return true;
}
+
+ mouse_down = false;
} else if (tool == TOOL_PASTING) {
Point2 ofs = over_tile - rectangle.position;
Vector<int> ids;
@@ -1141,6 +1159,28 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
if (tool == TOOL_PASTING) {
tool = TOOL_NONE;
+
+ CanvasItemEditor::get_singleton()->update_viewport();
+
+ _update_button_tool();
+ return true;
+ }
+
+ if (tool == TOOL_LINE_PAINT) {
+ tool = TOOL_LINE_ERASE;
+ mouse_down = true;
+ rectangle_begin = over_tile;
+
+ CanvasItemEditor::get_singleton()->update_viewport();
+
+ _update_button_tool();
+ return true;
+ }
+
+ if (tool == TOOL_RECTANGLE_PAINT) {
+ tool = TOOL_RECTANGLE_ERASE;
+ mouse_down = true;
+ rectangle_begin = over_tile;
copydata.clear();
CanvasItemEditor::get_singleton()->update_viewport();
@@ -1155,39 +1195,74 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
Point2 local = node->world_to_map(xform_inv.xform(mb->get_position()));
_start_undo(TTR("Erase TileMap"));
+ tool = TOOL_ERASING;
+ _set_cell(local, invalid_cell);
- if (mb->get_shift()) {
- if (mb->get_command()) {
- tool = TOOL_RECTANGLE_ERASE;
- } else {
- tool = TOOL_LINE_ERASE;
+ _update_button_tool();
+ return true;
+ }
+
+ } else {
+ if (tool == TOOL_LINE_ERASE) {
+ if (!mouse_down) {
+ return true;
+ }
+
+ tool = TOOL_LINE_PAINT;
+ _update_button_tool();
+
+ Vector<int> ids = get_selected_tiles();
+
+ if (ids.size() > 0 && ids[0] != TileMap::INVALID_CELL) {
+ _start_undo(TTR("Line Erase"));
+ for (Map<Point2i, CellOp>::Element *E = paint_undo.front(); E; E = E->next()) {
+ _set_cell(E->key(), invalid_cell, flip_h, flip_v, transpose);
}
+ _finish_undo();
+ paint_undo.clear();
- selection_active = false;
- rectangle_begin = local;
- } else {
- tool = TOOL_ERASING;
+ CanvasItemEditor::get_singleton()->update_viewport();
- _set_cell(local, invalid_cell);
+ mouse_down = false;
+ return true;
}
+ mouse_down = false;
+ } else if (tool == TOOL_RECTANGLE_ERASE) {
+ if (!mouse_down) {
+ return true;
+ }
+
+ tool = TOOL_RECTANGLE_PAINT;
_update_button_tool();
- return true;
- }
- } else {
- if (tool == TOOL_ERASING || tool == TOOL_RECTANGLE_ERASE || tool == TOOL_LINE_ERASE) {
- _finish_undo();
+ Vector<int> ids = get_selected_tiles();
+
+ if (ids.size() > 0 && ids[0] != TileMap::INVALID_CELL) {
+ _start_undo(TTR("Rectangle Erase"));
+ for (int i = rectangle.position.y; i <= rectangle.position.y + rectangle.size.y; i++) {
+ for (int j = rectangle.position.x; j <= rectangle.position.x + rectangle.size.x; j++) {
+ _set_cell(Point2i(j, i), invalid_cell, flip_h, flip_v, transpose);
+ }
+ }
+ _finish_undo();
+ paint_undo.clear();
- if (tool == TOOL_RECTANGLE_ERASE || tool == TOOL_LINE_ERASE) {
CanvasItemEditor::get_singleton()->update_viewport();
+
+ mouse_down = false;
+ return true;
}
- tool = TOOL_NONE;
+ mouse_down = false;
+ tool = TOOL_RECTANGLE_PAINT;
+ }
+ if (tool == TOOL_ERASING) {
+ tool = TOOL_NONE;
_update_button_tool();
- return true;
+ return true;
} else if (tool == TOOL_BUCKET) {
Vector<int> ids;
ids.push_back(node->get_cell(over_tile.x, over_tile.y));
@@ -1278,6 +1353,10 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
Vector<int> tmp_cell;
bool erasing = (tool == TOOL_LINE_ERASE);
+ if (!mouse_down) {
+ return true;
+ }
+
tmp_cell.push_back(0);
if (erasing && paint_undo.size()) {
for (Map<Point2i, CellOp>::Element *E = paint_undo.front(); E; E = E->next()) {
@@ -1308,7 +1387,20 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
Vector<int> tmp_cell;
tmp_cell.push_back(0);
- _select(rectangle_begin, over_tile);
+ Point2i end_tile = over_tile;
+
+ if (!mouse_down) {
+ return true;
+ }
+
+ if (mm->get_shift()) {
+ int size = fmax(ABS(end_tile.x - rectangle_begin.x), ABS(end_tile.y - rectangle_begin.y));
+ int xDirection = MAX(MIN(end_tile.x - rectangle_begin.x, 1), -1);
+ int yDirection = MAX(MIN(end_tile.y - rectangle_begin.y, 1), -1);
+ end_tile = rectangle_begin + Point2i(xDirection * size, yDirection * size);
+ }
+
+ _select(rectangle_begin, end_tile);
if (tool == TOOL_RECTANGLE_ERASE) {
if (paint_undo.size()) {
@@ -1379,6 +1471,20 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
_update_button_tool();
return true;
}
+ if (ED_IS_SHORTCUT("tile_map_editor/line_fill", p_event)) {
+ tool = TOOL_LINE_PAINT;
+ CanvasItemEditor::get_singleton()->update_viewport();
+
+ _update_button_tool();
+ return true;
+ }
+ if (ED_IS_SHORTCUT("tile_map_editor/rectangle_fill", p_event)) {
+ tool = TOOL_RECTANGLE_PAINT;
+ CanvasItemEditor::get_singleton()->update_viewport();
+
+ _update_button_tool();
+ return true;
+ }
if (ED_IS_SHORTCUT("tile_map_editor/bucket_fill", p_event)) {
tool = TOOL_BUCKET;
CanvasItemEditor::get_singleton()->update_viewport();
@@ -1637,6 +1743,10 @@ void TileMapEditor::forward_canvas_draw_over_viewport(Control *p_overlay) {
}
if (tool == TOOL_LINE_PAINT) {
+ if (!mouse_down) {
+ return;
+ }
+
if (paint_undo.empty()) {
return;
}
@@ -1652,6 +1762,10 @@ void TileMapEditor::forward_canvas_draw_over_viewport(Control *p_overlay) {
}
} else if (tool == TOOL_RECTANGLE_PAINT) {
+ if (!mouse_down) {
+ return;
+ }
+
Vector<int> ids = get_selected_tiles();
if (ids.size() == 1 && ids[0] == TileMap::INVALID_CELL) {
@@ -1865,6 +1979,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
tool = TOOL_NONE;
selection_active = false;
mouse_over = false;
+ mouse_down = false;
flip_h = false;
flip_v = false;
@@ -1962,11 +2077,27 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
paint_button = memnew(Button);
paint_button->set_flat(true);
paint_button->set_shortcut(ED_SHORTCUT("tile_map_editor/paint_tile", TTR("Paint Tile"), KEY_P));
- paint_button->set_tooltip(TTR("Shift+LMB: Line Draw\nShift+Ctrl+LMB: Rectangle Paint"));
+ paint_button->set_tooltip(TTR("RMB: Erase"));
paint_button->connect("pressed", callable_mp(this, &TileMapEditor::_button_tool_select), make_binds(TOOL_NONE));
paint_button->set_toggle_mode(true);
toolbar->add_child(paint_button);
+ line_button = memnew(Button);
+ line_button->set_flat(true);
+ line_button->set_shortcut(ED_SHORTCUT("tile_map_editor/line_fill", TTR("Line Fill"), KEY_L));
+ line_button->set_tooltip(TTR("RMB: Erase"));
+ line_button->connect("pressed", callable_mp(this, &TileMapEditor::_button_tool_select), make_binds(TOOL_LINE_PAINT));
+ line_button->set_toggle_mode(true);
+ toolbar->add_child(line_button);
+
+ rectangle_button = memnew(Button);
+ rectangle_button->set_flat(true);
+ rectangle_button->set_shortcut(ED_SHORTCUT("tile_map_editor/rectangle_fill", TTR("Rectangle Fill"), KEY_O));
+ rectangle_button->set_tooltip(TTR("Shift+LMB: Keep 1:1 proporsions\nRMB: Erase"));
+ rectangle_button->connect("pressed", callable_mp(this, &TileMapEditor::_button_tool_select), make_binds(TOOL_RECTANGLE_PAINT));
+ rectangle_button->set_toggle_mode(true);
+ toolbar->add_child(rectangle_button);
+
bucket_fill_button = memnew(Button);
bucket_fill_button->set_flat(true);
bucket_fill_button->set_shortcut(ED_SHORTCUT("tile_map_editor/bucket_fill", TTR("Bucket Fill"), KEY_B));
diff --git a/editor/plugins/tile_map_editor_plugin.h b/editor/plugins/tile_map_editor_plugin.h
index 1d2ecdb61f..135a9bd5a5 100644
--- a/editor/plugins/tile_map_editor_plugin.h
+++ b/editor/plugins/tile_map_editor_plugin.h
@@ -88,6 +88,8 @@ class TileMapEditor : public VBoxContainer {
MenuButton *options;
Button *paint_button;
+ Button *line_button;
+ Button *rectangle_button;
Button *bucket_fill_button;
Button *picker_button;
Button *select_button;
@@ -106,6 +108,7 @@ class TileMapEditor : public VBoxContainer {
bool selection_active;
bool mouse_over;
+ bool mouse_down;
bool flip_h;
bool flip_v;
diff --git a/editor/quick_open.cpp b/editor/quick_open.cpp
index bcef29dfa6..4719fcaae4 100644
--- a/editor/quick_open.cpp
+++ b/editor/quick_open.cpp
@@ -32,21 +32,18 @@
#include "core/os/keyboard.h"
-void EditorQuickOpen::popup_dialog(const StringName &p_base, bool p_enable_multi, bool p_add_dirs, bool p_dontclear) {
- add_directories = p_add_dirs;
- popup_centered_ratio(0.6);
+void EditorQuickOpen::popup_dialog(const StringName &p_base, bool p_enable_multi, bool p_dontclear) {
+ base_type = p_base;
+ search_options->set_select_mode(p_enable_multi ? Tree::SELECT_MULTI : Tree::SELECT_SINGLE);
+ popup_centered_ratio(0.4);
+
if (p_dontclear) {
search_box->select_all();
} else {
search_box->clear();
}
- if (p_enable_multi) {
- search_options->set_select_mode(Tree::SELECT_MULTI);
- } else {
- search_options->set_select_mode(Tree::SELECT_SINGLE);
- }
+
search_box->grab_focus();
- base_type = p_base;
_update_search();
}
@@ -101,7 +98,6 @@ void EditorQuickOpen::_sbox_input(const Ref<InputEvent> &p_ie) {
}
current->select(0);
-
} break;
}
}
@@ -124,61 +120,25 @@ float EditorQuickOpen::_path_cmp(String search, String path) const {
}
void EditorQuickOpen::_parse_fs(EditorFileSystemDirectory *efsd, Vector<Pair<String, Ref<Texture2D>>> &list) {
- if (!add_directories) {
- for (int i = 0; i < efsd->get_subdir_count(); i++) {
- _parse_fs(efsd->get_subdir(i), list);
- }
+ for (int i = 0; i < efsd->get_subdir_count(); i++) {
+ _parse_fs(efsd->get_subdir(i), list);
}
String search_text = search_box->get_text();
- if (add_directories) {
- String path = efsd->get_path();
- if (!path.ends_with("/")) {
- path += "/";
- }
- if (path != "res://") {
- path = path.substr(6, path.length());
- if (search_text.is_subsequence_ofi(path)) {
- Pair<String, Ref<Texture2D>> pair;
- pair.first = path;
- pair.second = search_options->get_theme_icon("folder", "FileDialog");
-
- if (search_text != String() && list.size() > 0) {
- float this_sim = _path_cmp(search_text, path);
- float other_sim = _path_cmp(list[0].first, path);
- int pos = 1;
-
- while (pos < list.size() && this_sim <= other_sim) {
- other_sim = _path_cmp(list[pos++].first, path);
- }
-
- pos = this_sim >= other_sim ? pos - 1 : pos;
- list.insert(pos, pair);
-
- } else {
- list.push_back(pair);
- }
- }
- }
- }
for (int i = 0; i < efsd->get_file_count(); i++) {
String file = efsd->get_file_path(i);
file = file.substr(6, file.length());
- if (ClassDB::is_parent_class(efsd->get_file_type(i), base_type) && (search_text.is_subsequence_ofi(file))) {
+ StringName file_type = efsd->get_file_type(i);
+ if (ClassDB::is_parent_class(file_type, base_type) && search_text.is_subsequence_ofi(file)) {
Pair<String, Ref<Texture2D>> pair;
pair.first = file;
- pair.second = search_options->get_theme_icon((search_options->has_theme_icon(efsd->get_file_type(i), ei) ? efsd->get_file_type(i) : ot), ei);
+ StringName icon_name = search_options->has_theme_icon(file_type, ei) ? file_type : ot;
+ pair.second = search_options->get_theme_icon(icon_name, ei);
list.push_back(pair);
}
}
-
- if (add_directories) {
- for (int i = 0; i < efsd->get_subdir_count(); i++) {
- _parse_fs(efsd->get_subdir(i), list);
- }
- }
}
Vector<Pair<String, Ref<Texture2D>>> EditorQuickOpen::_sort_fs(Vector<Pair<String, Ref<Texture2D>>> &list) {
@@ -250,7 +210,7 @@ void EditorQuickOpen::_confirmed() {
}
void EditorQuickOpen::_theme_changed() {
- search_box->set_right_icon(search_options->get_theme_icon("Search", "EditorIcons"));
+ search_box->set_right_icon(search_options->get_theme_icon("Search", ei));
}
void EditorQuickOpen::_notification(int p_what) {
@@ -277,23 +237,25 @@ void EditorQuickOpen::_bind_methods() {
EditorQuickOpen::EditorQuickOpen() {
VBoxContainer *vbc = memnew(VBoxContainer);
vbc->connect("theme_changed", callable_mp(this, &EditorQuickOpen::_theme_changed));
-
add_child(vbc);
+
search_box = memnew(LineEdit);
- vbc->add_margin_child(TTR("Search:"), search_box);
search_box->connect("text_changed", callable_mp(this, &EditorQuickOpen::_text_changed));
search_box->connect("gui_input", callable_mp(this, &EditorQuickOpen::_sbox_input));
+ vbc->add_margin_child(TTR("Search:"), search_box);
+
search_options = memnew(Tree);
+ search_options->connect("item_activated", callable_mp(this, &EditorQuickOpen::_confirmed));
+ search_options->set_hide_root(true);
+ search_options->set_hide_folding(true);
+ search_options->add_theme_constant_override("draw_guides", 1);
vbc->add_margin_child(TTR("Matches:"), search_options, true);
+
get_ok()->set_text(TTR("Open"));
get_ok()->set_disabled(true);
register_text_enter(search_box);
set_hide_on_ok(false);
- search_options->connect("item_activated", callable_mp(this, &EditorQuickOpen::_confirmed));
- search_options->set_hide_root(true);
- search_options->set_hide_folding(true);
- search_options->add_theme_constant_override("draw_guides", 1);
+
ei = "EditorIcons";
ot = "Object";
- add_directories = false;
}
diff --git a/editor/quick_open.h b/editor/quick_open.h
index e446ed6823..8670bb1ade 100644
--- a/editor/quick_open.h
+++ b/editor/quick_open.h
@@ -35,6 +35,7 @@
#include "editor_file_system.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/tree.h"
+
class EditorQuickOpen : public ConfirmationDialog {
GDCLASS(EditorQuickOpen, ConfirmationDialog);
@@ -43,7 +44,6 @@ class EditorQuickOpen : public ConfirmationDialog {
StringName base_type;
StringName ei;
StringName ot;
- bool add_directories;
void _update_search();
@@ -67,7 +67,7 @@ public:
String get_selected() const;
Vector<String> get_selected_files() const;
- void popup_dialog(const StringName &p_base, bool p_enable_multi = false, bool p_add_dirs = false, bool p_dontclear = false);
+ void popup_dialog(const StringName &p_base, bool p_enable_multi = false, bool p_dontclear = false);
EditorQuickOpen();
};