summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/plugins/script_editor_plugin.cpp22
-rw-r--r--editor/plugins/tile_map_editor_plugin.cpp30
-rw-r--r--editor/plugins/tile_map_editor_plugin.h3
-rw-r--r--editor/plugins/tile_set_editor_plugin.cpp1
4 files changed, 50 insertions, 6 deletions
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 839c9483d7..641c387c64 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -388,6 +388,14 @@ void ScriptEditor::_save_history() {
void ScriptEditor::_go_to_tab(int p_idx) {
+ ScriptEditorBase *current = _get_current_editor();
+ if (current) {
+ if (current->is_unsaved()) {
+
+ current->apply_code();
+ }
+ }
+
Control *c = Object::cast_to<Control>(tab_container->get_child(p_idx));
if (!c)
return;
@@ -1733,7 +1741,19 @@ void ScriptEditor::_update_script_names() {
Ref<Texture> icon = se->get_icon();
String path = se->get_edited_resource()->get_path();
bool built_in = !path.is_resource_file();
- String name = built_in ? path.get_file() : se->get_name();
+ String name;
+
+ if (built_in) {
+
+ name = path.get_file();
+ String resource_name = se->get_edited_resource()->get_name();
+ if (resource_name != "") {
+ name = name.substr(0, name.find("::", 0) + 2) + resource_name;
+ }
+ } else {
+
+ name = se->get_name();
+ }
_ScriptEditorItemData sd;
sd.icon = icon;
diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp
index 772e47ac3a..4ef2d17128 100644
--- a/editor/plugins/tile_map_editor_plugin.cpp
+++ b/editor/plugins/tile_map_editor_plugin.cpp
@@ -325,6 +325,12 @@ void TileMapEditor::_set_cell(const Point2i &p_pos, Vector<int> p_values, bool p
if (manual_autotile || (p_value != -1 && node->get_tileset()->tile_get_tile_mode(p_value) == TileSet::ATLAS_TILE)) {
if (current != -1) {
node->set_cell_autotile_coord(p_pos.x, p_pos.y, position);
+
+ } else if (tool != TOOL_PASTING && node->get_tileset()->tile_get_tile_mode(p_value) == TileSet::ATLAS_TILE && priority_atlastile) {
+
+ // BIND_CENTER is used to indicate that bitmask should not update for this tile cell
+ node->get_tileset()->autotile_set_bitmask(p_value, Vector2(p_pos.x, p_pos.y), TileSet::BIND_CENTER);
+ node->update_cell_bitmask(p_pos.x, p_pos.y);
}
} else {
// manually placing tiles should not update bitmasks
@@ -339,6 +345,11 @@ void TileMapEditor::_manual_toggled(bool p_enabled) {
_update_palette();
}
+void TileMapEditor::_priority_toggled(bool p_enabled) {
+ priority_atlastile = p_enabled;
+ _update_palette();
+}
+
void TileMapEditor::_text_entered(const String &p_text) {
canvas_item_editor_viewport->grab_focus();
@@ -497,7 +508,8 @@ void TileMapEditor::_update_palette() {
}
if (sel_tile != TileMap::INVALID_CELL) {
- if ((manual_autotile && tileset->tile_get_tile_mode(sel_tile) == TileSet::AUTO_TILE) || tileset->tile_get_tile_mode(sel_tile) == TileSet::ATLAS_TILE) {
+ if ((manual_autotile && tileset->tile_get_tile_mode(sel_tile) == TileSet::AUTO_TILE) ||
+ (!priority_atlastile && tileset->tile_get_tile_mode(sel_tile) == TileSet::ATLAS_TILE)) {
const Map<Vector2, uint32_t> &tiles2 = tileset->autotile_get_bitmask_map(sel_tile);
@@ -541,8 +553,10 @@ void TileMapEditor::_update_palette() {
if (sel_tile != TileMap::INVALID_CELL && tileset->tile_get_tile_mode(sel_tile) == TileSet::AUTO_TILE) {
manual_button->show();
+ priority_button->hide();
} else {
manual_button->hide();
+ priority_button->show();
}
}
@@ -686,7 +700,8 @@ void TileMapEditor::_fill_points(const PoolVector<Vector2> p_points, const Dicti
_set_cell(pr[i], ids, xf, yf, tr);
node->make_bitmask_area_dirty(pr[i]);
}
- node->update_dirty_bitmask();
+ if (!manual_autotile)
+ node->update_dirty_bitmask();
}
void TileMapEditor::_erase_points(const PoolVector<Vector2> p_points) {
@@ -745,7 +760,7 @@ void TileMapEditor::_draw_cell(Control *p_viewport, int p_cell, const Point2i &p
if (node->get_tileset()->tile_get_tile_mode(p_cell) == TileSet::AUTO_TILE || node->get_tileset()->tile_get_tile_mode(p_cell) == TileSet::ATLAS_TILE) {
Vector2 offset;
int selected = manual_palette->get_current();
- if ((manual_autotile || node->get_tileset()->tile_get_tile_mode(p_cell) == TileSet::ATLAS_TILE) && selected != -1) {
+ if ((manual_autotile || (node->get_tileset()->tile_get_tile_mode(p_cell) == TileSet::ATLAS_TILE && !priority_atlastile)) && selected != -1) {
offset = manual_palette->get_item_metadata(selected);
} else {
if (tool != TOOL_PASTING) {
@@ -1713,6 +1728,7 @@ void TileMapEditor::_icon_size_changed(float p_value) {
void TileMapEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_manual_toggled"), &TileMapEditor::_manual_toggled);
+ ClassDB::bind_method(D_METHOD("_priority_toggled"), &TileMapEditor::_priority_toggled);
ClassDB::bind_method(D_METHOD("_text_entered"), &TileMapEditor::_text_entered);
ClassDB::bind_method(D_METHOD("_text_changed"), &TileMapEditor::_text_changed);
ClassDB::bind_method(D_METHOD("_sbox_input"), &TileMapEditor::_sbox_input);
@@ -1816,6 +1832,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
node = NULL;
manual_autotile = false;
+ priority_atlastile = false;
manual_position = Vector2(0, 0);
canvas_item_editor_viewport = NULL;
editor = p_editor;
@@ -1846,10 +1863,15 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
add_child(tool_hb);
manual_button = memnew(CheckBox);
- manual_button->set_text("Disable Autotile");
+ manual_button->set_text(TTR("Disable Autotile"));
manual_button->connect("toggled", this, "_manual_toggled");
add_child(manual_button);
+ priority_button = memnew(CheckBox);
+ priority_button->set_text(TTR("Enable Priority"));
+ priority_button->connect("toggled", this, "_priority_toggled");
+ add_child(priority_button);
+
search_box = memnew(LineEdit);
search_box->set_h_size_flags(SIZE_EXPAND_FILL);
search_box->connect("text_entered", this, "_text_entered");
diff --git a/editor/plugins/tile_map_editor_plugin.h b/editor/plugins/tile_map_editor_plugin.h
index fcdada1111..3f0abd1e6e 100644
--- a/editor/plugins/tile_map_editor_plugin.h
+++ b/editor/plugins/tile_map_editor_plugin.h
@@ -74,6 +74,7 @@ class TileMapEditor : public VBoxContainer {
TileMap *node;
bool manual_autotile;
+ bool priority_atlastile;
Vector2 manual_position;
EditorNode *editor;
@@ -103,6 +104,7 @@ class TileMapEditor : public VBoxContainer {
ToolButton *clear_transform_button;
CheckBox *manual_button;
+ CheckBox *priority_button;
Tool tool;
Tool last_tool;
@@ -183,6 +185,7 @@ class TileMapEditor : public VBoxContainer {
void set_selected_tiles(Vector<int> p_tile);
void _manual_toggled(bool p_enabled);
+ void _priority_toggled(bool p_enabled);
void _text_entered(const String &p_text);
void _text_changed(const String &p_text);
void _sbox_input(const Ref<InputEvent> &p_ie);
diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp
index a00be3c0ce..4b225fddf5 100644
--- a/editor/plugins/tile_set_editor_plugin.cpp
+++ b/editor/plugins/tile_set_editor_plugin.cpp
@@ -3104,7 +3104,6 @@ void TileSetEditor::update_workspace_tile_mode() {
_select_edited_shape_coord();
tool_editmode[EDITMODE_BITMASK]->hide();
- tool_editmode[EDITMODE_PRIORITY]->hide();
}
_on_edit_mode_changed(edit_mode);
}