summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/input/input_event.cpp9
-rw-r--r--doc/classes/EditorProperty.xml4
-rw-r--r--doc/classes/NavigationMesh.xml2
-rw-r--r--editor/editor_inspector.cpp35
-rw-r--r--editor/editor_inspector.h6
-rw-r--r--editor/editor_themes.cpp7
-rw-r--r--editor/plugins/tiles/tile_map_editor.cpp13
-rw-r--r--editor/plugins/tiles/tile_map_editor.h1
-rw-r--r--editor/plugins/tiles/tile_set_atlas_source_editor.cpp4
-rw-r--r--editor/plugins/tiles/tile_set_editor.cpp9
-rw-r--r--editor/plugins/tiles/tile_set_editor.h1
-rw-r--r--editor/plugins/tiles/tiles_editor_plugin.cpp244
-rw-r--r--editor/plugins/tiles/tiles_editor_plugin.h52
-rw-r--r--modules/mono/mono_gd/gd_mono_utils.cpp2
-rw-r--r--scene/resources/navigation_mesh.h2
15 files changed, 153 insertions, 238 deletions
diff --git a/core/input/input_event.cpp b/core/input/input_event.cpp
index 1d2b5f19ee..c6448b1e44 100644
--- a/core/input/input_event.cpp
+++ b/core/input/input_event.cpp
@@ -452,8 +452,13 @@ bool InputEventKey::is_match(const Ref<InputEvent> &p_event, bool p_exact_match)
return false;
}
- return keycode == key->keycode &&
- (!p_exact_match || get_modifiers_mask() == key->get_modifiers_mask());
+ if (keycode == 0) {
+ return physical_keycode == key->physical_keycode &&
+ (!p_exact_match || get_modifiers_mask() == key->get_modifiers_mask());
+ } else {
+ return keycode == key->keycode &&
+ (!p_exact_match || get_modifiers_mask() == key->get_modifiers_mask());
+ }
}
void InputEventKey::_bind_methods() {
diff --git a/doc/classes/EditorProperty.xml b/doc/classes/EditorProperty.xml
index 6af6507606..5f342e6dc2 100644
--- a/doc/classes/EditorProperty.xml
+++ b/doc/classes/EditorProperty.xml
@@ -73,8 +73,8 @@
<member name="deletable" type="bool" setter="set_deletable" getter="is_deletable" default="false">
Used by the inspector, set to [code]true[/code] when the property can be deleted by the user.
</member>
- <member name="draw_red" type="bool" setter="set_draw_red" getter="is_draw_red" default="false">
- Used by the inspector, set to [code]true[/code] when the property must draw with error color. This is used for editable children's properties.
+ <member name="draw_warning" type="bool" setter="set_draw_warning" getter="is_draw_warning" default="false">
+ Used by the inspector, set to [code]true[/code] when the property is drawn with the editor theme's warning color. This is used for editable children's properties.
</member>
<member name="keying" type="bool" setter="set_keying" getter="is_keying" default="false">
Used by the inspector, set to [code]true[/code] when the property can add keys for animation.
diff --git a/doc/classes/NavigationMesh.xml b/doc/classes/NavigationMesh.xml
index e476949360..b100a20963 100644
--- a/doc/classes/NavigationMesh.xml
+++ b/doc/classes/NavigationMesh.xml
@@ -84,7 +84,7 @@
<member name="agent/max_slope" type="float" setter="set_agent_max_slope" getter="get_agent_max_slope" default="45.0">
The maximum slope that is considered walkable, in degrees.
</member>
- <member name="agent/radius" type="float" setter="set_agent_radius" getter="get_agent_radius" default="0.6">
+ <member name="agent/radius" type="float" setter="set_agent_radius" getter="get_agent_radius" default="1.0">
The distance to erode/shrink the walkable area of the heightfield away from obstructions.
[b]Note:[/b] While baking, this value will be rounded up to the nearest multiple of [member cell/size].
</member>
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index 4d0f27c5d4..9f049a0e58 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -245,13 +245,15 @@ void EditorProperty::_notification(int p_what) {
}
Color color;
- if (draw_red) {
- color = get_theme_color(is_read_only() ? SNAME("readonly_error_color") : SNAME("error_color"));
+ if (draw_warning) {
+ color = get_theme_color(is_read_only() ? SNAME("readonly_warning_color") : SNAME("warning_color"));
} else {
color = get_theme_color(is_read_only() ? SNAME("readonly_color") : SNAME("property_color"));
}
if (label.find(".") != -1) {
- color.a = 0.5; //this should be un-hacked honestly, as it's used for editor overrides
+ // FIXME: Move this to the project settings editor, as this is only used
+ // for project settings feature tag overrides.
+ color.a = 0.5;
}
int ofs = get_theme_constant(SNAME("font_offset"));
@@ -625,8 +627,8 @@ bool EditorProperty::is_checked() const {
return checked;
}
-void EditorProperty::set_draw_red(bool p_draw_red) {
- draw_red = p_draw_red;
+void EditorProperty::set_draw_warning(bool p_draw_warning) {
+ draw_warning = p_draw_warning;
update();
}
@@ -650,8 +652,8 @@ bool EditorProperty::is_keying() const {
return keying;
}
-bool EditorProperty::is_draw_red() const {
- return draw_red;
+bool EditorProperty::is_draw_warning() const {
+ return draw_warning;
}
void EditorProperty::_focusable_focused(int p_index) {
@@ -969,8 +971,8 @@ void EditorProperty::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_checked", "checked"), &EditorProperty::set_checked);
ClassDB::bind_method(D_METHOD("is_checked"), &EditorProperty::is_checked);
- ClassDB::bind_method(D_METHOD("set_draw_red", "draw_red"), &EditorProperty::set_draw_red);
- ClassDB::bind_method(D_METHOD("is_draw_red"), &EditorProperty::is_draw_red);
+ ClassDB::bind_method(D_METHOD("set_draw_warning", "draw_warning"), &EditorProperty::set_draw_warning);
+ ClassDB::bind_method(D_METHOD("is_draw_warning"), &EditorProperty::is_draw_warning);
ClassDB::bind_method(D_METHOD("set_keying", "keying"), &EditorProperty::set_keying);
ClassDB::bind_method(D_METHOD("is_keying"), &EditorProperty::is_keying);
@@ -993,7 +995,7 @@ void EditorProperty::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "read_only"), "set_read_only", "is_read_only");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "checkable"), "set_checkable", "is_checkable");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "checked"), "set_checked", "is_checked");
- ADD_PROPERTY(PropertyInfo(Variant::BOOL, "draw_red"), "set_draw_red", "is_draw_red");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "draw_warning"), "set_draw_warning", "is_draw_warning");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "keying"), "set_keying", "is_keying");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "deletable"), "set_deletable", "is_deletable");
ADD_SIGNAL(MethodInfo("property_changed", PropertyInfo(Variant::STRING_NAME, "property"), PropertyInfo(Variant::NIL, "value", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NIL_IS_VARIANT)));
@@ -1018,7 +1020,7 @@ EditorProperty::EditorProperty() {
read_only = false;
checkable = false;
checked = false;
- draw_red = false;
+ draw_warning = false;
keying = false;
deletable = false;
keying_hover = false;
@@ -2393,14 +2395,15 @@ void EditorInspector::update_tree() {
valid_plugins.push_back(inspector_plugins[i]);
}
- // Decide if properties should be drawn in red.
- bool draw_red = false;
+ // Decide if properties should be drawn with the warning color (yellow).
+ bool draw_warning = false;
if (is_inside_tree()) {
Node *nod = Object::cast_to<Node>(object);
Node *es = EditorNode::get_singleton()->get_edited_scene();
if (nod && es != nod && nod->get_owner() != es) {
- // Draw in red edited nodes that are not in the currently edited scene.
- draw_red = true;
+ // Draw in warning color edited nodes that are not in the currently edited scene,
+ // as changes may be lost in the future.
+ draw_warning = true;
}
}
@@ -2855,7 +2858,7 @@ void EditorInspector::update_tree() {
editor_property_map[prop].push_back(ep);
}
}
- ep->set_draw_red(draw_red);
+ ep->set_draw_warning(draw_warning);
ep->set_use_folding(use_folding);
ep->set_checkable(checkable);
ep->set_checked(checked);
diff --git a/editor/editor_inspector.h b/editor/editor_inspector.h
index b71efe8f19..06af8566ff 100644
--- a/editor/editor_inspector.h
+++ b/editor/editor_inspector.h
@@ -74,7 +74,7 @@ private:
bool read_only;
bool checkable;
bool checked;
- bool draw_red;
+ bool draw_warning;
bool keying;
bool deletable;
@@ -150,8 +150,8 @@ public:
void set_checked(bool p_checked);
bool is_checked() const;
- void set_draw_red(bool p_draw_red);
- bool is_draw_red() const;
+ void set_draw_warning(bool p_draw_warning);
+ bool is_draw_warning() const;
void set_keying(bool p_keying);
bool is_keying() const;
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 2d4db48f2a..134f2ce202 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -431,7 +431,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
Color error_color = Color(1, 0.47, 0.42);
Color property_color = font_color.lerp(Color(0.5, 0.5, 0.5), 0.5);
Color readonly_color = property_color.lerp(dark_theme ? Color(0, 0, 0) : Color(1, 1, 1), 0.5);
- Color readonly_error_color = error_color.lerp(dark_theme ? Color(0, 0, 0) : Color(1, 1, 1), 0.5);
+ Color readonly_warning_color = error_color.lerp(dark_theme ? Color(0, 0, 0) : Color(1, 1, 1), 0.5);
if (!dark_theme) {
// Darken some colors to be readable on a light background
@@ -445,7 +445,6 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_color("error_color", "Editor", error_color);
theme->set_color("property_color", "Editor", property_color);
theme->set_color("readonly_color", "Editor", readonly_color);
- theme->set_color("readonly_error_color", "EditorProperty", readonly_error_color);
if (!dark_theme) {
theme->set_color("vulkan_color", "Editor", Color::hex(0xad1128ff));
@@ -819,10 +818,10 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("bg_selected", "EditorProperty", style_property_bg);
theme->set_stylebox("bg", "EditorProperty", Ref<StyleBoxEmpty>(memnew(StyleBoxEmpty)));
theme->set_constant("vseparation", "EditorProperty", (extra_spacing + default_margin_size) * EDSCALE);
- theme->set_color("error_color", "EditorProperty", error_color);
+ theme->set_color("warning_color", "EditorProperty", warning_color);
theme->set_color("property_color", "EditorProperty", property_color);
theme->set_color("readonly_color", "EditorProperty", readonly_color);
- theme->set_color("readonly_error_color", "EditorProperty", readonly_error_color);
+ theme->set_color("readonly_warning_color", "EditorProperty", readonly_warning_color);
Color inspector_section_color = font_color.lerp(Color(0.5, 0.5, 0.5), 0.35);
theme->set_color("font_color", "EditorInspectorSection", inspector_section_color);
diff --git a/editor/plugins/tiles/tile_map_editor.cpp b/editor/plugins/tiles/tile_map_editor.cpp
index 5df4f40b55..8c8e39aa4f 100644
--- a/editor/plugins/tiles/tile_map_editor.cpp
+++ b/editor/plugins/tiles/tile_map_editor.cpp
@@ -194,7 +194,7 @@ void TileMapEditorTilesPlugin::_update_tile_set_sources_list() {
}
// Synchronize
- TilesEditor::get_singleton()->set_sources_lists_current(sources_list->get_current());
+ TilesEditorPlugin::get_singleton()->set_sources_lists_current(sources_list->get_current());
}
void TileMapEditorTilesPlugin::_update_source_display() {
@@ -304,7 +304,7 @@ void TileMapEditorTilesPlugin::_update_patterns_list() {
for (int i = 0; i < tile_set->get_patterns_count(); i++) {
int id = patterns_item_list->add_item("");
patterns_item_list->set_item_metadata(id, tile_set->get_pattern(i));
- TilesEditor::get_singleton()->queue_pattern_preview(tile_set, tile_set->get_pattern(i), callable_mp(this, &TileMapEditorTilesPlugin::_pattern_preview_done));
+ TilesEditorPlugin::get_singleton()->queue_pattern_preview(tile_set, tile_set->get_pattern(i), callable_mp(this, &TileMapEditorTilesPlugin::_pattern_preview_done));
}
// Update the label visibility.
@@ -336,7 +336,7 @@ void TileMapEditorTilesPlugin::_update_atlas_view() {
ERR_FAIL_COND(!atlas_source);
tile_atlas_view->set_atlas_source(*tile_map->get_tileset(), atlas_source, source_id);
- TilesEditor::get_singleton()->synchronize_atlas_view(tile_atlas_view);
+ TilesEditorPlugin::get_singleton()->synchronize_atlas_view(tile_atlas_view);
tile_atlas_control->update();
}
@@ -2116,8 +2116,8 @@ TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() {
sources_list->set_texture_filter(CanvasItem::TEXTURE_FILTER_NEAREST);
sources_list->connect("item_selected", callable_mp(this, &TileMapEditorTilesPlugin::_update_fix_selected_and_hovered).unbind(1));
sources_list->connect("item_selected", callable_mp(this, &TileMapEditorTilesPlugin::_update_source_display).unbind(1));
- sources_list->connect("item_selected", callable_mp(TilesEditor::get_singleton(), &TilesEditor::set_sources_lists_current));
- sources_list->connect("visibility_changed", callable_mp(TilesEditor::get_singleton(), &TilesEditor::synchronize_sources_list), varray(sources_list));
+ sources_list->connect("item_selected", callable_mp(TilesEditorPlugin::get_singleton(), &TilesEditorPlugin::set_sources_lists_current));
+ sources_list->connect("visibility_changed", callable_mp(TilesEditorPlugin::get_singleton(), &TilesEditorPlugin::synchronize_sources_list), varray(sources_list));
atlas_sources_split_container->add_child(sources_list);
// Tile atlas source.
@@ -2126,7 +2126,7 @@ TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() {
tile_atlas_view->set_v_size_flags(Control::SIZE_EXPAND_FILL);
tile_atlas_view->set_texture_grid_visible(false);
tile_atlas_view->set_tile_shape_grid_visible(false);
- tile_atlas_view->connect("transform_changed", callable_mp(TilesEditor::get_singleton(), &TilesEditor::set_atlas_view_transform));
+ tile_atlas_view->connect("transform_changed", callable_mp(TilesEditorPlugin::get_singleton(), &TilesEditorPlugin::set_atlas_view_transform));
atlas_sources_split_container->add_child(tile_atlas_view);
tile_atlas_control = memnew(Control);
@@ -4065,6 +4065,7 @@ TileMapEditor::TileMapEditor() {
// --- TileMap toolbar ---
tile_map_toolbar = memnew(HBoxContainer);
tile_map_toolbar->set_h_size_flags(SIZE_EXPAND_FILL);
+ add_child(tile_map_toolbar);
// Tabs.
tile_map_toolbar->add_child(tabs_bar);
diff --git a/editor/plugins/tiles/tile_map_editor.h b/editor/plugins/tiles/tile_map_editor.h
index 54bac160a3..b3641d49ab 100644
--- a/editor/plugins/tiles/tile_map_editor.h
+++ b/editor/plugins/tiles/tile_map_editor.h
@@ -380,7 +380,6 @@ public:
void forward_canvas_draw_over_viewport(Control *p_overlay);
void edit(TileMap *p_tile_map);
- Control *get_toolbar() { return tile_map_toolbar; };
TileMapEditor();
~TileMapEditor();
diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
index 157d28da4f..c8892bceaa 100644
--- a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
+++ b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
@@ -924,7 +924,7 @@ void TileSetAtlasSourceEditor::_update_atlas_view() {
tile_atlas_view->update();
// Synchronize atlas view.
- TilesEditor::get_singleton()->synchronize_atlas_view(tile_atlas_view);
+ TilesEditorPlugin::get_singleton()->synchronize_atlas_view(tile_atlas_view);
}
void TileSetAtlasSourceEditor::_update_toolbar() {
@@ -2476,7 +2476,7 @@ TileSetAtlasSourceEditor::TileSetAtlasSourceEditor() {
tile_atlas_view = memnew(TileAtlasView);
tile_atlas_view->set_h_size_flags(SIZE_EXPAND_FILL);
tile_atlas_view->set_v_size_flags(SIZE_EXPAND_FILL);
- tile_atlas_view->connect("transform_changed", callable_mp(TilesEditor::get_singleton(), &TilesEditor::set_atlas_view_transform));
+ tile_atlas_view->connect("transform_changed", callable_mp(TilesEditorPlugin::get_singleton(), &TilesEditorPlugin::set_atlas_view_transform));
tile_atlas_view->connect("transform_changed", callable_mp(this, &TileSetAtlasSourceEditor::_tile_atlas_view_transform_changed).unbind(2));
right_panel->add_child(tile_atlas_view);
diff --git a/editor/plugins/tiles/tile_set_editor.cpp b/editor/plugins/tiles/tile_set_editor.cpp
index 44f5ba29de..f2ee0c24da 100644
--- a/editor/plugins/tiles/tile_set_editor.cpp
+++ b/editor/plugins/tiles/tile_set_editor.cpp
@@ -209,7 +209,7 @@ void TileSetEditor::_update_sources_list(int force_selected_id) {
_source_selected(sources_list->get_current());
// Synchronize the lists.
- TilesEditor::get_singleton()->set_sources_lists_current(sources_list->get_current());
+ TilesEditorPlugin::get_singleton()->set_sources_lists_current(sources_list->get_current());
}
void TileSetEditor::_source_selected(int p_source_index) {
@@ -370,7 +370,7 @@ void TileSetEditor::_update_patterns_list() {
for (int i = 0; i < tile_set->get_patterns_count(); i++) {
int id = patterns_item_list->add_item("");
patterns_item_list->set_item_metadata(id, tile_set->get_pattern(i));
- TilesEditor::get_singleton()->queue_pattern_preview(tile_set, tile_set->get_pattern(i), callable_mp(this, &TileSetEditor::_pattern_preview_done));
+ TilesEditorPlugin::get_singleton()->queue_pattern_preview(tile_set, tile_set->get_pattern(i), callable_mp(this, &TileSetEditor::_pattern_preview_done));
}
// Update the label visibility.
@@ -652,6 +652,7 @@ TileSetEditor::TileSetEditor() {
tile_set_toolbar = memnew(HBoxContainer);
tile_set_toolbar->set_h_size_flags(SIZE_EXPAND_FILL);
tile_set_toolbar->add_child(tabs_bar);
+ add_child(tile_set_toolbar);
//// Tiles ////
// Split container.
@@ -674,8 +675,8 @@ TileSetEditor::TileSetEditor() {
sources_list->set_h_size_flags(SIZE_EXPAND_FILL);
sources_list->set_v_size_flags(SIZE_EXPAND_FILL);
sources_list->connect("item_selected", callable_mp(this, &TileSetEditor::_source_selected));
- sources_list->connect("item_selected", callable_mp(TilesEditor::get_singleton(), &TilesEditor::set_sources_lists_current));
- sources_list->connect("visibility_changed", callable_mp(TilesEditor::get_singleton(), &TilesEditor::synchronize_sources_list), varray(sources_list));
+ sources_list->connect("item_selected", callable_mp(TilesEditorPlugin::get_singleton(), &TilesEditorPlugin::set_sources_lists_current));
+ sources_list->connect("visibility_changed", callable_mp(TilesEditorPlugin::get_singleton(), &TilesEditorPlugin::synchronize_sources_list), varray(sources_list));
sources_list->set_texture_filter(CanvasItem::TEXTURE_FILTER_NEAREST);
sources_list->set_drag_forwarding(this);
split_container_left_side->add_child(sources_list);
diff --git a/editor/plugins/tiles/tile_set_editor.h b/editor/plugins/tiles/tile_set_editor.h
index 1f26560588..c9c7a3bb73 100644
--- a/editor/plugins/tiles/tile_set_editor.h
+++ b/editor/plugins/tiles/tile_set_editor.h
@@ -97,7 +97,6 @@ public:
_FORCE_INLINE_ static TileSetEditor *get_singleton() { return singleton; }
void edit(Ref<TileSet> p_tile_set);
- Control *get_toolbar() { return tile_set_toolbar; };
void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
diff --git a/editor/plugins/tiles/tiles_editor_plugin.cpp b/editor/plugins/tiles/tiles_editor_plugin.cpp
index cc1b80fa8e..f1918073fb 100644
--- a/editor/plugins/tiles/tiles_editor_plugin.cpp
+++ b/editor/plugins/tiles/tiles_editor_plugin.cpp
@@ -45,37 +45,18 @@
#include "tile_set_editor.h"
-TilesEditor *TilesEditor::singleton = nullptr;
+TilesEditorPlugin *TilesEditorPlugin::singleton = nullptr;
-void TilesEditor::_notification(int p_what) {
- switch (p_what) {
- case NOTIFICATION_ENTER_TREE:
- case NOTIFICATION_THEME_CHANGED: {
- tileset_tilemap_switch_button->set_icon(get_theme_icon(SNAME("TileSet"), SNAME("EditorIcons")));
- } break;
- case NOTIFICATION_INTERNAL_PROCESS: {
- if (tile_map_changed_needs_update) {
- TileMap *tile_map = Object::cast_to<TileMap>(ObjectDB::get_instance(tile_map_id));
- if (tile_map) {
- tile_set = tile_map->get_tileset();
- }
- _update_switch_button();
- _update_editors();
- }
- } break;
- }
-}
-
-void TilesEditor::_pattern_preview_done(const Variant &p_udata) {
+void TilesEditorPlugin::_pattern_preview_done(const Variant &p_udata) {
pattern_preview_done.set();
}
-void TilesEditor::_thread_func(void *ud) {
- TilesEditor *te = (TilesEditor *)ud;
+void TilesEditorPlugin::_thread_func(void *ud) {
+ TilesEditorPlugin *te = (TilesEditorPlugin *)ud;
te->_thread();
}
-void TilesEditor::_thread() {
+void TilesEditorPlugin::_thread() {
pattern_thread_exited.clear();
while (!pattern_thread_exit.is_set()) {
pattern_preview_sem.wait();
@@ -132,7 +113,7 @@ void TilesEditor::_thread() {
EditorNode::get_singleton()->add_child(viewport);
pattern_preview_done.clear();
- RS::get_singleton()->request_frame_drawn_callback(const_cast<TilesEditor *>(this), "_pattern_preview_done", Variant());
+ RS::get_singleton()->request_frame_drawn_callback(const_cast<TilesEditorPlugin *>(this), "_pattern_preview_done", Variant());
while (!pattern_preview_done.is_set()) {
OS::get_singleton()->delay_usec(10);
@@ -159,65 +140,73 @@ void TilesEditor::_thread() {
pattern_thread_exited.set();
}
-void TilesEditor::_tile_map_changed() {
+void TilesEditorPlugin::_tile_map_changed() {
tile_map_changed_needs_update = true;
}
-void TilesEditor::_update_switch_button() {
- // Force the buttons status if needed.
+void TilesEditorPlugin::_update_editors() {
+ // If tile_map is not edited, we change the edited only if we are not editing a tile_set.
+ tileset_editor->edit(tile_set);
TileMap *tile_map = Object::cast_to<TileMap>(ObjectDB::get_instance(tile_map_id));
- if (tile_map && !tile_set.is_valid()) {
- tileset_tilemap_switch_button->set_pressed(false);
- } else if (!tile_map && tile_set.is_valid()) {
- tileset_tilemap_switch_button->set_pressed(true);
+ if (tile_map) {
+ tilemap_editor->edit(tile_map);
+ } else {
+ tilemap_editor->edit(nullptr);
}
+
+ // Update the viewport.
+ CanvasItemEditor::get_singleton()->update_viewport();
}
-void TilesEditor::_update_editors() {
- // Set editors visibility.
- tilemap_toolbar->set_visible(!tileset_tilemap_switch_button->is_pressed());
- tilemap_editor->set_visible(!tileset_tilemap_switch_button->is_pressed());
- tileset_toolbar->set_visible(tileset_tilemap_switch_button->is_pressed());
- tileset_editor->set_visible(tileset_tilemap_switch_button->is_pressed());
-
- // Enable/disable the switch button.
- if (!tileset_tilemap_switch_button->is_pressed()) {
- if (!tile_set.is_valid()) {
- tileset_tilemap_switch_button->set_disabled(true);
- tileset_tilemap_switch_button->set_tooltip(TTR("This TileMap has no assigned TileSet, assign a TileSet to this TileMap to edit it."));
- } else {
- tileset_tilemap_switch_button->set_disabled(false);
- tileset_tilemap_switch_button->set_tooltip(TTR("Switch between TileSet/TileMap editor."));
- }
- } else {
+void TilesEditorPlugin::_notification(int p_what) {
+ switch (p_what) {
+ case NOTIFICATION_INTERNAL_PROCESS: {
+ if (tile_map_changed_needs_update) {
+ TileMap *tile_map = Object::cast_to<TileMap>(ObjectDB::get_instance(tile_map_id));
+ if (tile_map) {
+ tile_set = tile_map->get_tileset();
+ }
+ _update_editors();
+ tile_map_changed_needs_update = false;
+ }
+ } break;
+ }
+}
+
+void TilesEditorPlugin::make_visible(bool p_visible) {
+ if (p_visible) {
+ // Disable and hide invalid editors.
TileMap *tile_map = Object::cast_to<TileMap>(ObjectDB::get_instance(tile_map_id));
- if (!tile_map) {
- tileset_tilemap_switch_button->set_disabled(true);
- tileset_tilemap_switch_button->set_tooltip(TTR("You are editing a TileSet resource. Select a TileMap node to paint."));
+ tileset_editor_button->set_visible(tile_set.is_valid());
+ tilemap_editor_button->set_visible(tile_map);
+ if (tile_map) {
+ editor_node->make_bottom_panel_item_visible(tilemap_editor);
} else {
- tileset_tilemap_switch_button->set_disabled(false);
- tileset_tilemap_switch_button->set_tooltip(TTR("Switch between TileSet/TileMap editor."));
+ editor_node->make_bottom_panel_item_visible(tileset_editor);
}
- }
- // If tile_map is not edited, we change the edited only if we are not editing a tile_set.
- TileMap *tile_map = Object::cast_to<TileMap>(ObjectDB::get_instance(tile_map_id));
- if (tile_map) {
- tilemap_editor->edit(tile_map);
} else {
- tilemap_editor->edit(nullptr);
+ tileset_editor_button->hide();
+ tilemap_editor_button->hide();
+ editor_node->hide_bottom_panel();
}
- tileset_editor->edit(tile_set);
+}
- // Update the viewport
- CanvasItemEditor::get_singleton()->update_viewport();
+void TilesEditorPlugin::queue_pattern_preview(Ref<TileSet> p_tile_set, Ref<TileMapPattern> p_pattern, Callable p_callback) {
+ ERR_FAIL_COND(!p_tile_set.is_valid());
+ ERR_FAIL_COND(!p_pattern.is_valid());
+ {
+ MutexLock lock(pattern_preview_mutex);
+ pattern_preview_queue.push_back({ p_tile_set, p_pattern, p_callback });
+ }
+ pattern_preview_sem.post();
}
-void TilesEditor::set_sources_lists_current(int p_current) {
+void TilesEditorPlugin::set_sources_lists_current(int p_current) {
atlas_sources_lists_current = p_current;
}
-void TilesEditor::synchronize_sources_list(Object *p_current) {
+void TilesEditorPlugin::synchronize_sources_list(Object *p_current) {
ItemList *item_list = Object::cast_to<ItemList>(p_current);
ERR_FAIL_COND(!item_list);
@@ -231,12 +220,12 @@ void TilesEditor::synchronize_sources_list(Object *p_current) {
}
}
-void TilesEditor::set_atlas_view_transform(float p_zoom, Vector2 p_scroll) {
+void TilesEditorPlugin::set_atlas_view_transform(float p_zoom, Vector2 p_scroll) {
atlas_view_zoom = p_zoom;
atlas_view_scroll = p_scroll;
}
-void TilesEditor::synchronize_atlas_view(Object *p_current) {
+void TilesEditorPlugin::synchronize_atlas_view(Object *p_current) {
TileAtlasView *tile_atlas_view = Object::cast_to<TileAtlasView>(p_current);
ERR_FAIL_COND(!tile_atlas_view);
@@ -245,21 +234,11 @@ void TilesEditor::synchronize_atlas_view(Object *p_current) {
}
}
-void TilesEditor::queue_pattern_preview(Ref<TileSet> p_tile_set, Ref<TileMapPattern> p_pattern, Callable p_callback) {
- ERR_FAIL_COND(!p_tile_set.is_valid());
- ERR_FAIL_COND(!p_pattern.is_valid());
- {
- MutexLock lock(pattern_preview_mutex);
- pattern_preview_queue.push_back({ p_tile_set, p_pattern, p_callback });
- }
- pattern_preview_sem.post();
-}
-
-void TilesEditor::edit(Object *p_object) {
+void TilesEditorPlugin::edit(Object *p_object) {
// Disconnect to changes.
TileMap *tile_map = Object::cast_to<TileMap>(ObjectDB::get_instance(tile_map_id));
if (tile_map) {
- tile_map->disconnect("changed", callable_mp(this, &TilesEditor::_tile_map_changed));
+ tile_map->disconnect("changed", callable_mp(this, &TilesEditorPlugin::_tile_map_changed));
}
// Update edited objects.
@@ -269,84 +248,72 @@ void TilesEditor::edit(Object *p_object) {
tile_map_id = p_object->get_instance_id();
tile_map = Object::cast_to<TileMap>(ObjectDB::get_instance(tile_map_id));
tile_set = tile_map->get_tileset();
+ editor_node->make_bottom_panel_item_visible(tilemap_editor);
} else if (p_object->is_class("TileSet")) {
tile_set = Ref<TileSet>(p_object);
if (tile_map) {
- if (tile_map->get_tileset() != tile_set) {
+ if (tile_map->get_tileset() != tile_set || !tile_map->is_inside_tree()) {
tile_map = nullptr;
+ tile_map_id = ObjectID();
}
}
- }
-
- // Update pressed status button.
- if (p_object->is_class("TileMap")) {
- tileset_tilemap_switch_button->set_pressed(false);
- } else if (p_object->is_class("TileSet")) {
- tileset_tilemap_switch_button->set_pressed(true);
+ editor_node->make_bottom_panel_item_visible(tileset_editor);
}
}
// Update the editors.
- _update_switch_button();
_update_editors();
// Add change listener.
if (tile_map) {
- tile_map->connect("changed", callable_mp(this, &TilesEditor::_tile_map_changed));
+ tile_map->connect("changed", callable_mp(this, &TilesEditorPlugin::_tile_map_changed));
}
}
-void TilesEditor::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_pattern_preview_done", "pattern"), &TilesEditor::_pattern_preview_done);
+bool TilesEditorPlugin::handles(Object *p_object) const {
+ return p_object->is_class("TileMap") || p_object->is_class("TileSet");
+}
+
+void TilesEditorPlugin::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("_pattern_preview_done", "pattern"), &TilesEditorPlugin::_pattern_preview_done);
}
-TilesEditor::TilesEditor(EditorNode *p_editor) {
+TilesEditorPlugin::TilesEditorPlugin(EditorNode *p_node) {
set_process_internal(true);
// Update the singleton.
singleton = this;
- // Toolbar.
- HBoxContainer *toolbar = memnew(HBoxContainer);
- toolbar->set_h_size_flags(SIZE_EXPAND_FILL);
- add_child(toolbar);
-
- // Switch button.
- tileset_tilemap_switch_button = memnew(Button);
- tileset_tilemap_switch_button->set_flat(true);
- tileset_tilemap_switch_button->set_toggle_mode(true);
- tileset_tilemap_switch_button->connect("toggled", callable_mp(this, &TilesEditor::_update_editors).unbind(1));
- toolbar->add_child(tileset_tilemap_switch_button);
-
- // Tilemap editor.
- tilemap_editor = memnew(TileMapEditor);
- tilemap_editor->set_h_size_flags(SIZE_EXPAND_FILL);
- tilemap_editor->set_v_size_flags(SIZE_EXPAND_FILL);
- tilemap_editor->hide();
- add_child(tilemap_editor);
-
- tilemap_toolbar = tilemap_editor->get_toolbar();
- toolbar->add_child(tilemap_toolbar);
+ editor_node = p_node;
// Tileset editor.
tileset_editor = memnew(TileSetEditor);
- tileset_editor->set_h_size_flags(SIZE_EXPAND_FILL);
- tileset_editor->set_v_size_flags(SIZE_EXPAND_FILL);
+ tileset_editor->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+ tileset_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
+ tileset_editor->set_custom_minimum_size(Size2(0, 200) * EDSCALE);
tileset_editor->hide();
- add_child(tileset_editor);
- tileset_toolbar = tileset_editor->get_toolbar();
- toolbar->add_child(tileset_toolbar);
+ // Tilemap editor.
+ tilemap_editor = memnew(TileMapEditor);
+ tilemap_editor->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+ tilemap_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
+ tilemap_editor->set_custom_minimum_size(Size2(0, 200) * EDSCALE);
+ tilemap_editor->hide();
// Pattern preview generation thread.
pattern_preview_thread.start(_thread_func, this);
+ // Bottom buttons.
+ tileset_editor_button = p_node->add_bottom_panel_item(TTR("TileSet"), tileset_editor);
+ tileset_editor_button->hide();
+ tilemap_editor_button = p_node->add_bottom_panel_item(TTR("TileMap"), tilemap_editor);
+ tilemap_editor_button->hide();
+
// Initialization.
- _update_switch_button();
_update_editors();
}
-TilesEditor::~TilesEditor() {
+TilesEditorPlugin::~TilesEditorPlugin() {
if (pattern_preview_thread.is_started()) {
pattern_thread_exit.set();
pattern_preview_sem.post();
@@ -357,40 +324,3 @@ TilesEditor::~TilesEditor() {
pattern_preview_thread.wait_to_finish();
}
}
-
-///////////////////////////////////////////////////////////////
-
-void TilesEditorPlugin::_notification(int p_what) {
-}
-
-void TilesEditorPlugin::make_visible(bool p_visible) {
- if (p_visible) {
- tiles_editor_button->show();
- editor_node->make_bottom_panel_item_visible(tiles_editor);
- } else {
- editor_node->hide_bottom_panel();
- tiles_editor_button->hide();
- }
-}
-
-void TilesEditorPlugin::edit(Object *p_object) {
- tiles_editor->edit(p_object);
-}
-
-bool TilesEditorPlugin::handles(Object *p_object) const {
- return p_object->is_class("TileMap") || p_object->is_class("TileSet");
-}
-
-TilesEditorPlugin::TilesEditorPlugin(EditorNode *p_node) {
- editor_node = p_node;
-
- tiles_editor = memnew(TilesEditor(p_node));
- tiles_editor->set_custom_minimum_size(Size2(0, 200) * EDSCALE);
- tiles_editor->hide();
-
- tiles_editor_button = p_node->add_bottom_panel_item(TTR("Tiles"), tiles_editor);
- tiles_editor_button->hide();
-}
-
-TilesEditorPlugin::~TilesEditorPlugin() {
-}
diff --git a/editor/plugins/tiles/tiles_editor_plugin.h b/editor/plugins/tiles/tiles_editor_plugin.h
index c77fd76d1c..dd52bdc31a 100644
--- a/editor/plugins/tiles/tiles_editor_plugin.h
+++ b/editor/plugins/tiles/tiles_editor_plugin.h
@@ -38,25 +38,24 @@
#include "tile_map_editor.h"
#include "tile_set_editor.h"
-class TilesEditor : public VBoxContainer {
- GDCLASS(TilesEditor, VBoxContainer);
+class TilesEditorPlugin : public EditorPlugin {
+ GDCLASS(TilesEditorPlugin, EditorPlugin);
- static TilesEditor *singleton;
+ static TilesEditorPlugin *singleton;
private:
+ EditorNode *editor_node;
+
bool tile_map_changed_needs_update = false;
ObjectID tile_map_id;
Ref<TileSet> tile_set;
- Button *tileset_tilemap_switch_button;
-
- Control *tilemap_toolbar;
+ Button *tilemap_editor_button;
TileMapEditor *tilemap_editor;
- Control *tileset_toolbar;
+ Button *tileset_editor_button;
TileSetEditor *tileset_editor;
- void _update_switch_button();
void _update_editors();
// For synchronization.
@@ -64,6 +63,8 @@ private:
float atlas_view_zoom = 1.0;
Vector2 atlas_view_scroll = Vector2();
+ void _tile_map_changed();
+
// Patterns preview generation.
struct QueueItem {
Ref<TileSet> tile_set;
@@ -81,17 +82,18 @@ private:
static void _thread_func(void *ud);
void _thread();
- void _tile_map_changed();
-
protected:
void _notification(int p_what);
static void _bind_methods();
public:
- _FORCE_INLINE_ static TilesEditor *get_singleton() { return singleton; }
+ _FORCE_INLINE_ static TilesEditorPlugin *get_singleton() { return singleton; }
+
+ virtual bool forward_canvas_gui_input(const Ref<InputEvent> &p_event) override { return tilemap_editor->forward_canvas_gui_input(p_event); }
+ virtual void forward_canvas_draw_over_viewport(Control *p_overlay) override { tilemap_editor->forward_canvas_draw_over_viewport(p_overlay); }
- bool forward_canvas_gui_input(const Ref<InputEvent> &p_event) { return tilemap_editor->forward_canvas_gui_input(p_event); }
- void forward_canvas_draw_over_viewport(Control *p_overlay) { tilemap_editor->forward_canvas_draw_over_viewport(p_overlay); }
+ // Pattern preview API.
+ void queue_pattern_preview(Ref<TileSet> p_tile_set, Ref<TileMapPattern> p_pattern, Callable p_callback);
// To synchronize the atlas sources lists.
void set_sources_lists_current(int p_current);
@@ -100,30 +102,6 @@ public:
void set_atlas_view_transform(float p_zoom, Vector2 p_scroll);
void synchronize_atlas_view(Object *p_current);
- // Pattern preview API.
- void queue_pattern_preview(Ref<TileSet> p_tile_set, Ref<TileMapPattern> p_pattern, Callable p_callback);
-
- void edit(Object *p_object);
-
- TilesEditor(EditorNode *p_editor);
- ~TilesEditor();
-};
-
-class TilesEditorPlugin : public EditorPlugin {
- GDCLASS(TilesEditorPlugin, EditorPlugin);
-
-private:
- EditorNode *editor_node;
- TilesEditor *tiles_editor;
- Button *tiles_editor_button;
-
-protected:
- void _notification(int p_what);
-
-public:
- virtual bool forward_canvas_gui_input(const Ref<InputEvent> &p_event) override { return tiles_editor->forward_canvas_gui_input(p_event); }
- virtual void forward_canvas_draw_over_viewport(Control *p_overlay) override { tiles_editor->forward_canvas_draw_over_viewport(p_overlay); }
-
virtual void edit(Object *p_object) override;
virtual bool handles(Object *p_object) const override;
virtual void make_visible(bool p_visible) override;
diff --git a/modules/mono/mono_gd/gd_mono_utils.cpp b/modules/mono/mono_gd/gd_mono_utils.cpp
index 13939bd014..09aa9ad948 100644
--- a/modules/mono/mono_gd/gd_mono_utils.cpp
+++ b/modules/mono/mono_gd/gd_mono_utils.cpp
@@ -450,7 +450,7 @@ void debug_send_unhandled_exception_error(MonoException *p_exc) {
int line = si.size() ? si[0].line : __LINE__;
String error_msg = "Unhandled exception";
- EngineDebugger::get_script_debugger()->send_error(func, file, line, error_msg, exc_msg, ERR_HANDLER_ERROR, si);
+ EngineDebugger::get_script_debugger()->send_error(func, file, line, error_msg, exc_msg, true, ERR_HANDLER_ERROR, si);
#endif
}
diff --git a/scene/resources/navigation_mesh.h b/scene/resources/navigation_mesh.h
index 1cdf7a07ed..009239838f 100644
--- a/scene/resources/navigation_mesh.h
+++ b/scene/resources/navigation_mesh.h
@@ -85,7 +85,7 @@ protected:
float cell_size = 0.3f;
float cell_height = 0.2f;
float agent_height = 2.0f;
- float agent_radius = 0.6f;
+ float agent_radius = 1.0f;
float agent_max_climb = 0.9f;
float agent_max_slope = 45.0f;
float region_min_size = 8.0f;