diff options
Diffstat (limited to 'editor/plugins')
| -rw-r--r-- | editor/plugins/animation_blend_space_1d_editor.cpp | 25 | ||||
| -rw-r--r-- | editor/plugins/animation_blend_space_1d_editor.h | 2 | ||||
| -rw-r--r-- | editor/plugins/animation_blend_space_2d_editor.cpp | 16 | ||||
| -rw-r--r-- | editor/plugins/animation_blend_space_2d_editor.h | 4 | ||||
| -rw-r--r-- | editor/plugins/mesh_library_editor_plugin.cpp (renamed from editor/plugins/cube_grid_theme_editor_plugin.cpp) | 81 | ||||
| -rw-r--r-- | editor/plugins/mesh_library_editor_plugin.h (renamed from editor/plugins/cube_grid_theme_editor_plugin.h) | 16 | ||||
| -rw-r--r-- | editor/plugins/tile_map_editor_plugin.cpp | 37 | ||||
| -rw-r--r-- | editor/plugins/tile_map_editor_plugin.h | 3 | ||||
| -rw-r--r-- | editor/plugins/tile_set_editor_plugin.cpp | 11 |
9 files changed, 107 insertions, 88 deletions
diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp index 1106464edf..5373015654 100644 --- a/editor/plugins/animation_blend_space_1d_editor.cpp +++ b/editor/plugins/animation_blend_space_1d_editor.cpp @@ -4,11 +4,10 @@ #include "scene/animation/animation_blend_tree.h" StringName AnimationNodeBlendSpace1DEditor::get_blend_position_path() const { - StringName path = AnimationTreeEditor::get_singleton()->get_base_path()+"blend_position"; + StringName path = AnimationTreeEditor::get_singleton()->get_base_path() + "blend_position"; return path; } - void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Ref<InputEvent> &p_event) { Ref<InputEventKey> k = p_event; @@ -55,7 +54,7 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Ref<InputEven continue; int idx = menu->get_item_count(); - menu->add_item(vformat("Add %s", name),idx); + menu->add_item(vformat("Add %s", name), idx); menu->set_item_metadata(idx, E->get()); } @@ -136,7 +135,7 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Ref<InputEven blend_pos *= blend_space->get_max_space() - blend_space->get_min_space(); blend_pos += blend_space->get_min_space(); - AnimationTreeEditor::get_singleton()->get_tree()->set(get_blend_position_path(),blend_pos); + AnimationTreeEditor::get_singleton()->get_tree()->set(get_blend_position_path(), blend_pos); blend_space_draw->update(); } @@ -159,7 +158,7 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Ref<InputEven blend_pos *= blend_space->get_max_space() - blend_space->get_min_space(); blend_pos += blend_space->get_min_space(); - AnimationTreeEditor::get_singleton()->get_tree()->set(get_blend_position_path(),blend_pos); + AnimationTreeEditor::get_singleton()->get_tree()->set(get_blend_position_path(), blend_pos); blend_space_draw->update(); } @@ -258,7 +257,6 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_draw() { float point = AnimationTreeEditor::get_singleton()->get_tree()->get(get_blend_position_path()); - point = (point - blend_space->get_min_space()) / (blend_space->get_max_space() - blend_space->get_min_space()); point *= s.width; @@ -501,8 +499,6 @@ void AnimationNodeBlendSpace1DEditor::_open_editor() { } } - - void AnimationNodeBlendSpace1DEditor::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) { error_panel->add_style_override("panel", get_stylebox("bg", "Tree")); @@ -514,7 +510,6 @@ void AnimationNodeBlendSpace1DEditor::_notification(int p_what) { tool_erase->set_icon(get_icon("Remove", "EditorIcons")); snap->set_icon(get_icon("SnapGrid", "EditorIcons")); open_editor->set_icon(get_icon("Edit", "EditorIcons")); - } if (p_what == NOTIFICATION_PROCESS) { @@ -536,7 +531,7 @@ void AnimationNodeBlendSpace1DEditor::_notification(int p_what) { } } - if (p_what==NOTIFICATION_VISIBILITY_CHANGED) { + if (p_what == NOTIFICATION_VISIBILITY_CHANGED) { set_process(is_visible_in_tree()); } } @@ -561,22 +556,17 @@ void AnimationNodeBlendSpace1DEditor::_bind_methods() { ClassDB::bind_method("_open_editor", &AnimationNodeBlendSpace1DEditor::_open_editor); ClassDB::bind_method("_file_opened", &AnimationNodeBlendSpace1DEditor::_file_opened); - - - } bool AnimationNodeBlendSpace1DEditor::can_edit(const Ref<AnimationNode> &p_node) { - Ref<AnimationNodeBlendSpace1D> b1d=p_node; + Ref<AnimationNodeBlendSpace1D> b1d = p_node; return b1d.is_valid(); } void AnimationNodeBlendSpace1DEditor::edit(const Ref<AnimationNode> &p_node) { - - - blend_space=p_node; + blend_space = p_node; if (!blend_space.is_null()) { _update_space(); @@ -595,7 +585,6 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { Ref<ButtonGroup> bg; bg.instance(); - tool_blend = memnew(ToolButton); tool_blend->set_toggle_mode(true); tool_blend->set_button_group(bg); diff --git a/editor/plugins/animation_blend_space_1d_editor.h b/editor/plugins/animation_blend_space_1d_editor.h index f040f6dcab..278357b9c7 100644 --- a/editor/plugins/animation_blend_space_1d_editor.h +++ b/editor/plugins/animation_blend_space_1d_editor.h @@ -3,13 +3,13 @@ #include "editor/editor_node.h" #include "editor/editor_plugin.h" +#include "editor/plugins/animation_tree_editor_plugin.h" #include "editor/property_editor.h" #include "scene/animation/animation_blend_space_1d.h" #include "scene/gui/button.h" #include "scene/gui/graph_edit.h" #include "scene/gui/popup.h" #include "scene/gui/tree.h" -#include "editor/plugins/animation_tree_editor_plugin.h" class AnimationNodeBlendSpace1DEditor : public AnimationTreeNodeEditorPlugin { diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp index e008971e5c..e5476aaf08 100644 --- a/editor/plugins/animation_blend_space_2d_editor.cpp +++ b/editor/plugins/animation_blend_space_2d_editor.cpp @@ -13,7 +13,7 @@ bool AnimationNodeBlendSpace2DEditor::can_edit(const Ref<AnimationNode> &p_node) { - Ref<AnimationNodeBlendSpace2D> bs2d=p_node; + Ref<AnimationNodeBlendSpace2D> bs2d = p_node; return bs2d.is_valid(); } @@ -27,7 +27,7 @@ void AnimationNodeBlendSpace2DEditor::edit(const Ref<AnimationNode> &p_node) { } StringName AnimationNodeBlendSpace2DEditor::get_blend_position_path() const { - StringName path = AnimationTreeEditor::get_singleton()->get_base_path()+"blend_position"; + StringName path = AnimationTreeEditor::get_singleton()->get_base_path() + "blend_position"; return path; } @@ -73,7 +73,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Ref<InputEven if (name == "Animation") continue; // nope int idx = menu->get_item_count(); - menu->add_item(vformat("Add %s", name),idx); + menu->add_item(vformat("Add %s", name), idx); menu->set_item_metadata(idx, E->get()); } @@ -85,7 +85,6 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Ref<InputEven menu->add_separator(); menu->add_item(TTR("Load.."), MENU_LOAD_FILE); - menu->set_global_position(blend_space_draw->get_global_transform().xform(mb->get_position())); menu->popup(); add_point_pos = (mb->get_position() / blend_space_draw->get_size()); @@ -211,7 +210,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Ref<InputEven blend_pos *= (blend_space->get_max_space() - blend_space->get_min_space()); blend_pos += blend_space->get_min_space(); - AnimationTreeEditor::get_singleton()->get_tree()->set(get_blend_position_path(),blend_pos); + AnimationTreeEditor::get_singleton()->get_tree()->set(get_blend_position_path(), blend_pos); blend_space_draw->update(); } @@ -246,7 +245,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Ref<InputEven blend_pos *= (blend_space->get_max_space() - blend_space->get_min_space()); blend_pos += blend_space->get_min_space(); - AnimationTreeEditor::get_singleton()->get_tree()->set(get_blend_position_path(),blend_pos); + AnimationTreeEditor::get_singleton()->get_tree()->set(get_blend_position_path(), blend_pos); blend_space_draw->update(); } @@ -750,12 +749,11 @@ void AnimationNodeBlendSpace2DEditor::_notification(int p_what) { } } - if (p_what==NOTIFICATION_VISIBILITY_CHANGED) { + if (p_what == NOTIFICATION_VISIBILITY_CHANGED) { set_process(is_visible_in_tree()); } } - void AnimationNodeBlendSpace2DEditor::_open_editor() { if (selected_point >= 0 && selected_point < blend_space->get_blend_point_count()) { @@ -804,7 +802,6 @@ void AnimationNodeBlendSpace2DEditor::_bind_methods() { ClassDB::bind_method("_auto_triangles_toggled", &AnimationNodeBlendSpace2DEditor::_auto_triangles_toggled); ClassDB::bind_method("_file_opened", &AnimationNodeBlendSpace2DEditor::_file_opened); - } AnimationNodeBlendSpace2DEditor *AnimationNodeBlendSpace2DEditor::singleton = NULL; @@ -1019,4 +1016,3 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { dragging_selected = false; dragging_selected_attempt = false; } - diff --git a/editor/plugins/animation_blend_space_2d_editor.h b/editor/plugins/animation_blend_space_2d_editor.h index ae684985f3..0bf1e25d7a 100644 --- a/editor/plugins/animation_blend_space_2d_editor.h +++ b/editor/plugins/animation_blend_space_2d_editor.h @@ -3,13 +3,13 @@ #include "editor/editor_node.h" #include "editor/editor_plugin.h" +#include "editor/plugins/animation_tree_editor_plugin.h" #include "editor/property_editor.h" #include "scene/animation/animation_blend_space_2d.h" #include "scene/gui/button.h" #include "scene/gui/graph_edit.h" #include "scene/gui/popup.h" #include "scene/gui/tree.h" -#include "editor/plugins/animation_tree_editor_plugin.h" /** @author Juan Linietsky <reduzio@gmail.com> */ @@ -20,7 +20,6 @@ class AnimationNodeBlendSpace2DEditor : public AnimationTreeNodeEditorPlugin { Ref<AnimationNodeBlendSpace2D> blend_space; - PanelContainer *panel; ToolButton *tool_blend; ToolButton *tool_select; @@ -119,5 +118,4 @@ public: AnimationNodeBlendSpace2DEditor(); }; - #endif // ANIMATION_BLEND_SPACE_2D_EDITOR_H diff --git a/editor/plugins/cube_grid_theme_editor_plugin.cpp b/editor/plugins/mesh_library_editor_plugin.cpp index 68d5ea5247..99a28be555 100644 --- a/editor/plugins/cube_grid_theme_editor_plugin.cpp +++ b/editor/plugins/mesh_library_editor_plugin.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* cube_grid_theme_editor_plugin.cpp */ +/* mesh_library_editor_plugin.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "cube_grid_theme_editor_plugin.h" +#include "mesh_library_editor_plugin.h" #include "editor/editor_node.h" #include "editor/editor_settings.h" @@ -38,12 +38,13 @@ #include "scene/3d/physics_body.h" #include "scene/main/viewport.h" #include "scene/resources/packed_scene.h" +#include "spatial_editor_plugin.h" -void MeshLibraryEditor::edit(const Ref<MeshLibrary> &p_theme) { +void MeshLibraryEditor::edit(const Ref<MeshLibrary> &p_mesh_library) { - theme = p_theme; - if (theme.is_valid()) - menu->get_popup()->set_item_disabled(menu->get_popup()->get_item_index(MENU_OPTION_UPDATE_FROM_SCENE), !theme->has_meta("_editor_source_scene")); + mesh_library = p_mesh_library; + if (mesh_library.is_valid()) + menu->get_popup()->set_item_disabled(menu->get_popup()->get_item_index(MENU_OPTION_UPDATE_FROM_SCENE), !mesh_library->has_meta("_editor_source_scene")); } void MeshLibraryEditor::_menu_confirm() { @@ -52,10 +53,10 @@ void MeshLibraryEditor::_menu_confirm() { case MENU_OPTION_REMOVE_ITEM: { - theme->remove_item(to_erase); + mesh_library->remove_item(to_erase); } break; case MENU_OPTION_UPDATE_FROM_SCENE: { - String existing = theme->get_meta("_editor_source_scene"); + String existing = mesh_library->get_meta("_editor_source_scene"); ERR_FAIL_COND(existing == ""); _import_scene_cbk(existing); @@ -174,10 +175,10 @@ void MeshLibraryEditor::_import_scene_cbk(const String &p_str) { ERR_FAIL_COND(ps.is_null()); Node *scene = ps->instance(); - _import_scene(scene, theme, option == MENU_OPTION_UPDATE_FROM_SCENE); + _import_scene(scene, mesh_library, option == MENU_OPTION_UPDATE_FROM_SCENE); memdelete(scene); - theme->set_meta("_editor_source_scene", p_str); + mesh_library->set_meta("_editor_source_scene", p_str); menu->get_popup()->set_item_disabled(menu->get_popup()->get_item_index(MENU_OPTION_UPDATE_FROM_SCENE), false); } @@ -194,7 +195,7 @@ void MeshLibraryEditor::_menu_cbk(int p_option) { case MENU_OPTION_ADD_ITEM: { - theme->create_item(theme->get_last_unused_item_id()); + mesh_library->create_item(mesh_library->get_last_unused_item_id()); } break; case MENU_OPTION_REMOVE_ITEM: { @@ -212,7 +213,7 @@ void MeshLibraryEditor::_menu_cbk(int p_option) { } break; case MENU_OPTION_UPDATE_FROM_SCENE: { - cd->set_text("Update from existing scene?:\n" + String(theme->get_meta("_editor_source_scene"))); + cd->set_text("Update from existing scene?:\n" + String(mesh_library->get_meta("_editor_source_scene"))); cd->popup_centered(Size2(500, 60)); } break; } @@ -241,21 +242,20 @@ MeshLibraryEditor::MeshLibraryEditor(EditorNode *p_editor) { add_child(file); file->connect("file_selected", this, "_import_scene_cbk"); - Panel *panel = memnew(Panel); - panel->set_anchors_and_margins_preset(Control::PRESET_WIDE); - add_child(panel); - MenuButton *options = memnew(MenuButton); - panel->add_child(options); - options->set_position(Point2(1, 1)); - options->set_text("Theme"); - options->get_popup()->add_item(TTR("Add Item"), MENU_OPTION_ADD_ITEM); - options->get_popup()->add_item(TTR("Remove Selected Item"), MENU_OPTION_REMOVE_ITEM); - options->get_popup()->add_separator(); - options->get_popup()->add_item(TTR("Import from Scene"), MENU_OPTION_IMPORT_FROM_SCENE); - options->get_popup()->add_item(TTR("Update from Scene"), MENU_OPTION_UPDATE_FROM_SCENE); - options->get_popup()->set_item_disabled(options->get_popup()->get_item_index(MENU_OPTION_UPDATE_FROM_SCENE), true); - options->get_popup()->connect("id_pressed", this, "_menu_cbk"); - menu = options; + menu = memnew(MenuButton); + SpatialEditor::get_singleton()->add_control_to_menu_panel(menu); + menu->set_position(Point2(1, 1)); + menu->set_text("Mesh Library"); + menu->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("MeshLibrary", "EditorIcons")); + menu->get_popup()->add_item(TTR("Add Item"), MENU_OPTION_ADD_ITEM); + menu->get_popup()->add_item(TTR("Remove Selected Item"), MENU_OPTION_REMOVE_ITEM); + menu->get_popup()->add_separator(); + menu->get_popup()->add_item(TTR("Import from Scene"), MENU_OPTION_IMPORT_FROM_SCENE); + menu->get_popup()->add_item(TTR("Update from Scene"), MENU_OPTION_UPDATE_FROM_SCENE); + menu->get_popup()->set_item_disabled(menu->get_popup()->get_item_index(MENU_OPTION_UPDATE_FROM_SCENE), true); + menu->get_popup()->connect("id_pressed", this, "_menu_cbk"); + menu->hide(); + editor = p_editor; cd = memnew(ConfirmationDialog); add_child(cd); @@ -265,10 +265,10 @@ MeshLibraryEditor::MeshLibraryEditor(EditorNode *p_editor) { void MeshLibraryEditorPlugin::edit(Object *p_node) { if (Object::cast_to<MeshLibrary>(p_node)) { - theme_editor->edit(Object::cast_to<MeshLibrary>(p_node)); - theme_editor->show(); + mesh_library_editor->edit(Object::cast_to<MeshLibrary>(p_node)); + mesh_library_editor->show(); } else - theme_editor->hide(); + mesh_library_editor->hide(); } bool MeshLibraryEditorPlugin::handles(Object *p_node) const { @@ -278,19 +278,22 @@ bool MeshLibraryEditorPlugin::handles(Object *p_node) const { void MeshLibraryEditorPlugin::make_visible(bool p_visible) { - if (p_visible) - theme_editor->show(); - else - theme_editor->hide(); + if (p_visible) { + mesh_library_editor->show(); + mesh_library_editor->get_menu_button()->show(); + } else { + mesh_library_editor->hide(); + mesh_library_editor->get_menu_button()->hide(); + } } MeshLibraryEditorPlugin::MeshLibraryEditorPlugin(EditorNode *p_node) { EDITOR_DEF("editors/grid_map/preview_size", 64); - theme_editor = memnew(MeshLibraryEditor(p_node)); + mesh_library_editor = memnew(MeshLibraryEditor(p_node)); - p_node->get_viewport()->add_child(theme_editor); - theme_editor->set_anchors_and_margins_preset(Control::PRESET_TOP_WIDE); - theme_editor->set_end(Point2(0, 22)); - theme_editor->hide(); + p_node->get_viewport()->add_child(mesh_library_editor); + mesh_library_editor->set_anchors_and_margins_preset(Control::PRESET_TOP_WIDE); + mesh_library_editor->set_end(Point2(0, 22)); + mesh_library_editor->hide(); } diff --git a/editor/plugins/cube_grid_theme_editor_plugin.h b/editor/plugins/mesh_library_editor_plugin.h index 36a8f8f203..be33b5324d 100644 --- a/editor/plugins/cube_grid_theme_editor_plugin.h +++ b/editor/plugins/mesh_library_editor_plugin.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* cube_grid_theme_editor_plugin.h */ +/* mesh_library_editor_plugin.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef CUBE_GRID_THEME_EDITOR_PLUGIN_H -#define CUBE_GRID_THEME_EDITOR_PLUGIN_H +#ifndef MESH_LIBRARY_EDITOR_PLUGIN_H +#define MESH_LIBRARY_EDITOR_PLUGIN_H #include "editor/editor_node.h" #include "scene/resources/mesh_library.h" @@ -38,7 +38,7 @@ class MeshLibraryEditor : public Control { GDCLASS(MeshLibraryEditor, Control); - Ref<MeshLibrary> theme; + Ref<MeshLibrary> mesh_library; EditorNode *editor; MenuButton *menu; @@ -65,7 +65,9 @@ protected: static void _bind_methods(); public: - void edit(const Ref<MeshLibrary> &p_theme); + MenuButton *get_menu_button() const { return menu; } + + void edit(const Ref<MeshLibrary> &p_mesh_library); static Error update_library_file(Node *p_base_scene, Ref<MeshLibrary> ml, bool p_merge = true); MeshLibraryEditor(EditorNode *p_editor); @@ -75,7 +77,7 @@ class MeshLibraryEditorPlugin : public EditorPlugin { GDCLASS(MeshLibraryEditorPlugin, EditorPlugin); - MeshLibraryEditor *theme_editor; + MeshLibraryEditor *mesh_library_editor; EditorNode *editor; public: @@ -88,4 +90,4 @@ public: MeshLibraryEditorPlugin(EditorNode *p_node); }; -#endif // CUBE_GRID_THEME_EDITOR_PLUGIN_H +#endif // MESH_LIBRARY_EDITOR_PLUGIN_H diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index 3d14db7d0e..0a421bdffe 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -426,6 +426,9 @@ void TileMapEditor::_update_palette() { Ref<Texture> tex = tileset->tile_get_texture(entries[i].id); if (tex.is_valid()) { + Color color = tileset->tile_get_modulate(entries[i].id); + palette->set_item_icon_modulate(palette->get_item_count() - 1, color); + Rect2 region = tileset->tile_get_region(entries[i].id); if (tileset->tile_get_tile_mode(entries[i].id) == TileSet::AUTO_TILE || tileset->tile_get_tile_mode(entries[i].id) == TileSet::ATLAS_TILE) { @@ -759,10 +762,13 @@ void TileMapEditor::_draw_cell(int p_cell, const Point2i &p_point, bool p_flip_h rect.position = p_xform.xform(rect.position); rect.size *= sc; + Color modulate = node->get_tileset()->tile_get_modulate(p_cell); + modulate.a = 0.5; + if (r.has_no_area()) - canvas_item_editor->draw_texture_rect(t, rect, false, Color(1, 1, 1, 0.5), p_transpose); + canvas_item_editor->draw_texture_rect(t, rect, false, modulate, p_transpose); else - canvas_item_editor->draw_texture_rect_region(t, rect, r, Color(1, 1, 1, 0.5), p_transpose); + canvas_item_editor->draw_texture_rect_region(t, rect, r, modulate, p_transpose); } void TileMapEditor::_draw_fill_preview(int p_cell, const Point2i &p_point, bool p_flip_h, bool p_flip_v, bool p_transpose, const Transform2D &p_xform) { @@ -1903,6 +1909,21 @@ TileMapEditor::~TileMapEditor() { /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// +void TileMapEditorPlugin::_notification(int p_what) { + + if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) { + + switch ((int)EditorSettings::get_singleton()->get("editors/tile_map/editor_side")) { + case 0: { // Left. + CanvasItemEditor::get_singleton()->get_palette_split()->move_child(tile_map_editor, 0); + } break; + case 1: { // Right. + CanvasItemEditor::get_singleton()->get_palette_split()->move_child(tile_map_editor, 1); + } break; + } + } +} + void TileMapEditorPlugin::edit(Object *p_object) { tile_map_editor->edit(Object::cast_to<Node>(p_object)); @@ -1936,11 +1957,19 @@ TileMapEditorPlugin::TileMapEditorPlugin(EditorNode *p_node) { EDITOR_DEF("editors/tile_map/sort_tiles_by_name", true); EDITOR_DEF("editors/tile_map/bucket_fill_preview", true); EDITOR_DEF("editors/tile_map/show_tile_info_on_hover", true); + EDITOR_DEF("editors/tile_map/editor_side", 1); + EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, "editors/tile_map/editor_side", PROPERTY_HINT_ENUM, "Left,Right")); tile_map_editor = memnew(TileMapEditor(p_node)); - add_control_to_container(CONTAINER_CANVAS_EDITOR_SIDE, tile_map_editor); + switch ((int)EditorSettings::get_singleton()->get("editors/tile_map/editor_side")) { + case 0: { // Left. + add_control_to_container(CONTAINER_CANVAS_EDITOR_SIDE_LEFT, tile_map_editor); + } break; + case 1: { // Right. + add_control_to_container(CONTAINER_CANVAS_EDITOR_SIDE_RIGHT, tile_map_editor); + } break; + } tile_map_editor->hide(); - tile_map_editor->set_process(true); } TileMapEditorPlugin::~TileMapEditorPlugin() { diff --git a/editor/plugins/tile_map_editor_plugin.h b/editor/plugins/tile_map_editor_plugin.h index bb76879b02..d72224263a 100644 --- a/editor/plugins/tile_map_editor_plugin.h +++ b/editor/plugins/tile_map_editor_plugin.h @@ -220,6 +220,9 @@ class TileMapEditorPlugin : public EditorPlugin { TileMapEditor *tile_map_editor; +protected: + void _notification(int p_what); + public: virtual bool forward_canvas_gui_input(const Ref<InputEvent> &p_event) { return tile_map_editor->forward_gui_input(p_event); } virtual void forward_draw_over_viewport(Control *p_overlay) { tile_map_editor->forward_draw_over_viewport(p_overlay); } diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index 490ebeca26..55a04a51b3 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -900,12 +900,13 @@ void TileSetEditor::_on_workspace_overlay_draw() { else if (tileset->tile_get_tile_mode(t_id) == TileSet::ATLAS_TILE) c = COLOR_ATLAS; c.a = tile_names_opacity; + String tile_id_name = String::num(t_id, 0) + ": " + tileset->tile_get_name(t_id); Ref<Font> font = get_font("font", "Label"); - region.set_size(font->get_string_size(tileset->tile_get_name(t_id))); + region.set_size(font->get_string_size(tile_id_name)); workspace_overlay->draw_rect(region, c); region.position.y += region.size.y - 2; c = Color(0.1, 0.1, 0.1, tile_names_opacity); - workspace_overlay->draw_string(font, region.position, tileset->tile_get_name(t_id), c); + workspace_overlay->draw_string(font, region.position, tile_id_name, c); } } } @@ -2381,11 +2382,9 @@ TileSetEditorPlugin::TileSetEditorPlugin(EditorNode *p_node) { editor = p_node; tileset_editor = memnew(TileSetEditor(p_node)); - tileset_editor_button = - p_node->add_bottom_panel_item(TTR("Tile Set"), tileset_editor); - tileset_editor_button->set_tooltip(TTR("Tile Set Editor")); - tileset_editor->set_custom_minimum_size(Size2(0, 200) * EDSCALE); tileset_editor->hide(); + + tileset_editor_button = p_node->add_bottom_panel_item(TTR("Tile Set"), tileset_editor); tileset_editor_button->hide(); } |
