diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_export.cpp | 5 | ||||
-rw-r--r-- | editor/editor_export.h | 3 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/tile_map_editor_plugin.cpp | 49 | ||||
-rw-r--r-- | editor/project_export.cpp | 12 | ||||
-rw-r--r-- | editor/project_export.h | 1 |
6 files changed, 61 insertions, 11 deletions
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index 6497b99610..e20744e424 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -75,11 +75,14 @@ bool EditorExportPreset::_get(const StringName &p_name, Variant &r_ret) const { return false; } + void EditorExportPreset::_get_property_list(List<PropertyInfo> *p_list) const { for (const List<PropertyInfo>::Element *E = properties.front(); E; E = E->next()) { - p_list->push_back(E->get()); + if (platform->get_option_visibility(E->get().name, values)) { + p_list->push_back(E->get()); + } } } diff --git a/editor/editor_export.h b/editor/editor_export.h index 1c9f5b3354..966c3cb63b 100644 --- a/editor/editor_export.h +++ b/editor/editor_export.h @@ -76,6 +76,7 @@ protected: public: Ref<EditorExportPlatform> get_platform() const; + bool has(const StringName &p_property) const { return values.has(p_property); } Vector<String> get_files_to_export() const; @@ -170,6 +171,8 @@ public: virtual Ref<EditorExportPreset> create_preset(); virtual void get_export_options(List<ExportOption> *r_options) = 0; + virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const { return true; } + virtual String get_name() const = 0; virtual Ref<Texture> get_logo() const = 0; diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 3221208019..b07112855c 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -1534,7 +1534,7 @@ void CanvasItemEditor::_viewport_gui_input(const InputEvent &p_event) { dto = dto - (drag == DRAG_ALL || drag == DRAG_NODE_2D ? drag_from - drag_point_from : Vector2(0, 0)); - if (uniform && drag == DRAG_ALL) { + if (uniform && (drag == DRAG_ALL || drag == DRAG_NODE_2D)) { if (ABS(dto.x - drag_point_from.x) > ABS(dto.y - drag_point_from.y)) { dto.y = drag_point_from.y; } else { diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index 8cda9848bd..b80ce35d03 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -190,6 +190,19 @@ void TileMapEditor::_sbox_input(const InputEvent &p_ie) { } } +// Implementation detail of TileMapEditor::_update_palette(); +// in modern C++ this could have been inside its body +namespace { +struct _PaletteEntry { + int id; + String name; + + bool operator<(const _PaletteEntry &p_rhs) const { + return name < p_rhs.name; + } +}; +} + void TileMapEditor::_update_palette() { if (!node) @@ -212,6 +225,8 @@ void TileMapEditor::_update_palette() { min_size *= EDSCALE; int hseparation = EDITOR_DEF("editors/tile_map/palette_item_hseparation", 8); bool show_tile_names = bool(EDITOR_DEF("editors/tile_map/show_tile_names", true)); + bool show_tile_ids = bool(EDITOR_DEF("editors/tile_map/show_tile_ids", false)); + bool sort_by_name = bool(EDITOR_DEF("editors/tile_map/sort_tiles_by_name", true)); palette->add_constant_override("hseparation", hseparation * EDSCALE); palette->add_constant_override("vseparation", 8 * EDSCALE); @@ -221,12 +236,20 @@ void TileMapEditor::_update_palette() { String filter = search_box->get_text().strip_edges(); + Vector<_PaletteEntry> entries; + for (List<int>::Element *E = tiles.front(); E; E = E->next()) { - String name; + String name = tileset->tile_get_name(E->get()); - if (tileset->tile_get_name(E->get()) != "") { - name = itos(E->get()) + " - " + tileset->tile_get_name(E->get()); + if (name != "") { + if (show_tile_ids) { + if (sort_by_name) { + name = name + " - " + itos(E->get()); + } else { + name = itos(E->get()) + " - " + name; + } + } } else { name = "#" + itos(E->get()); } @@ -234,16 +257,26 @@ void TileMapEditor::_update_palette() { if (filter != "" && !filter.is_subsequence_ofi(name)) continue; + const _PaletteEntry entry = { E->get(), name }; + entries.push_back(entry); + } + + if (sort_by_name) { + entries.sort(); + } + + for (int i = 0; i < entries.size(); i++) { + if (show_tile_names) { - palette->add_item(name); + palette->add_item(entries[i].name); } else { palette->add_item(String()); } - Ref<Texture> tex = tileset->tile_get_texture(E->get()); + Ref<Texture> tex = tileset->tile_get_texture(entries[i].id); if (tex.is_valid()) { - Rect2 region = tileset->tile_get_region(E->get()); + Rect2 region = tileset->tile_get_region(entries[i].id); if (!region.has_no_area()) palette->set_item_icon_region(palette->get_item_count() - 1, region); @@ -251,7 +284,7 @@ void TileMapEditor::_update_palette() { palette->set_item_icon(palette->get_item_count() - 1, tex); } - palette->set_item_metadata(palette->get_item_count() - 1, E->get()); + palette->set_item_metadata(palette->get_item_count() - 1, entries[i].id); } palette->set_same_column_width(true); @@ -1563,6 +1596,8 @@ TileMapEditorPlugin::TileMapEditorPlugin(EditorNode *p_node) { EDITOR_DEF("editors/tile_map/preview_size", 64); EDITOR_DEF("editors/tile_map/palette_item_hseparation", 8); EDITOR_DEF("editors/tile_map/show_tile_names", true); + EDITOR_DEF("editors/tile_map/show_tile_ids", false); + EDITOR_DEF("editors/tile_map/sort_tiles_by_name", true); EDITOR_DEF("editors/tile_map/bucket_fill_preview", true); tile_map_editor = memnew(TileMapEditor(p_node)); diff --git a/editor/project_export.cpp b/editor/project_export.cpp index 015031a1ee..12c6ea6c51 100644 --- a/editor/project_export.cpp +++ b/editor/project_export.cpp @@ -229,12 +229,12 @@ void ProjectExportDialog::_edit_preset(int p_index) { if (needs_templates) export_templates_error->show(); - get_ok()->set_disabled(true); + export_button->set_disabled(true); } else { export_error->show(); export_templates_error->hide(); - get_ok()->set_disabled(false); + export_button->set_disabled(false); } updating = false; @@ -313,6 +313,12 @@ void ProjectExportDialog::_patch_deleted() { } } +void ProjectExportDialog::_update_parameters(const String &p_edited_property) { + + _edit_preset(presets->get_current()); + parameters->update_tree(); +} + void ProjectExportDialog::_runnable_pressed() { if (updating) @@ -676,6 +682,7 @@ void ProjectExportDialog::_bind_methods() { ClassDB::bind_method("_add_preset", &ProjectExportDialog::_add_preset); ClassDB::bind_method("_edit_preset", &ProjectExportDialog::_edit_preset); + ClassDB::bind_method("_update_parameters", &ProjectExportDialog::_update_parameters); ClassDB::bind_method("_runnable_pressed", &ProjectExportDialog::_runnable_pressed); ClassDB::bind_method("_name_changed", &ProjectExportDialog::_name_changed); ClassDB::bind_method("_delete_preset", &ProjectExportDialog::_delete_preset); @@ -753,6 +760,7 @@ ProjectExportDialog::ProjectExportDialog() { parameters->hide_top_label(); parameters->set_v_size_flags(SIZE_EXPAND_FILL); parameters->set_hide_script(true); + parameters->connect("property_edited", this, "_update_parameters"); VBoxContainer *resources_vb = memnew(VBoxContainer); sections->add_child(resources_vb); diff --git a/editor/project_export.h b/editor/project_export.h index 0dc59a09e2..485222ef03 100644 --- a/editor/project_export.h +++ b/editor/project_export.h @@ -97,6 +97,7 @@ private: void _patch_deleted(); void _runnable_pressed(); + void _update_parameters(const String &p_edited_property); void _name_changed(const String &p_string); void _add_preset(int p_platform); void _edit_preset(int p_index); |