diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/create_dialog.cpp | 29 | ||||
-rw-r--r-- | editor/create_dialog.h | 3 | ||||
-rw-r--r-- | editor/editor_about.cpp | 3 | ||||
-rw-r--r-- | editor/editor_node.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/baked_lightmap_editor_plugin.cpp | 1 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.h | 4 | ||||
-rw-r--r-- | editor/plugins/curve_editor_plugin.cpp | 23 | ||||
-rw-r--r-- | editor/plugins/tile_set_editor_plugin.cpp | 9 | ||||
-rw-r--r-- | editor/scene_tree_dock.cpp | 3 | ||||
-rw-r--r-- | editor/script_create_dialog.cpp | 16 |
11 files changed, 44 insertions, 51 deletions
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index a601c8cd2b..96c3a27ea7 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -37,7 +37,7 @@ #include "print_string.h" #include "scene/gui/box_container.h" -void CreateDialog::popup_create(bool p_dontclear) { +void CreateDialog::popup_create(bool p_dont_clear, bool p_replace_mode) { recent->clear(); @@ -89,11 +89,12 @@ void CreateDialog::popup_create(bool p_dontclear) { popup_centered_ratio(); } - if (p_dontclear) + if (p_dont_clear) { search_box->select_all(); - else { + } else { search_box->clear(); } + search_box->grab_focus(); _update_search(); @@ -104,8 +105,19 @@ void CreateDialog::popup_create(bool p_dontclear) { if (enable_rl) { search_options->add_constant_override("draw_relationship_lines", 1); search_options->add_color_override("relationship_line_color", rl_color); - } else + } else { search_options->add_constant_override("draw_relationship_lines", 0); + } + + is_replace_mode = p_replace_mode; + + if (p_replace_mode) { + set_title(vformat(TTR("Change %s Type"), base_type)); + get_ok()->set_text(TTR("Change")); + } else { + set_title(vformat(TTR("Create New %s"), base_type)); + get_ok()->set_text(TTR("Create")); + } } void CreateDialog::_text_changed(const String &p_newtext) { @@ -369,7 +381,11 @@ void CreateDialog::_notification(int p_what) { void CreateDialog::set_base_type(const String &p_base) { base_type = p_base; - set_title(vformat(TTR("Create New %s"), p_base)); + if (is_replace_mode) + set_title(vformat(TTR("Change %s Type"), p_base)); + else + set_title(vformat(TTR("Create New %s"), p_base)); + _update_search(); } @@ -624,6 +640,8 @@ void CreateDialog::_bind_methods() { CreateDialog::CreateDialog() { + is_replace_mode = false; + ClassDB::get_class_list(&type_list); type_list.sort_custom<StringName::AlphCompare>(); @@ -678,7 +696,6 @@ CreateDialog::CreateDialog() { search_box->connect("gui_input", this, "_sbox_input"); search_options = memnew(Tree); vbc->add_margin_child(TTR("Matches:"), search_options, true); - get_ok()->set_text(TTR("Create")); get_ok()->set_disabled(true); register_text_enter(search_box); set_hide_on_ok(false); diff --git a/editor/create_dialog.h b/editor/create_dialog.h index 56ba7f8a3e..ed23fb4ae8 100644 --- a/editor/create_dialog.h +++ b/editor/create_dialog.h @@ -52,6 +52,7 @@ class CreateDialog : public ConfirmationDialog { Button *favorite; LineEdit *search_box; Tree *search_options; + bool is_replace_mode; String base_type; String preferred_search_result_type; EditorHelpBit *help_bit; @@ -97,7 +98,7 @@ public: void set_preferred_search_result_type(const String &p_preferred_type); String get_preferred_search_result_type(); - void popup_create(bool p_dontclear); + void popup_create(bool p_dont_clear, bool p_replace_mode = false); CreateDialog(); }; diff --git a/editor/editor_about.cpp b/editor/editor_about.cpp index 1d6d933924..7fa4776141 100644 --- a/editor/editor_about.cpp +++ b/editor/editor_about.cpp @@ -131,7 +131,8 @@ EditorAbout::EditorAbout() { Label *about_text = memnew(Label); about_text->set_v_size_flags(Control::SIZE_SHRINK_CENTER); - about_text->set_text(VERSION_FULL_NAME + hash + String::utf8("\n\xc2\xa9 2007-2018 Juan Linietsky, Ariel Manzur.\n\xc2\xa9 2014-2017 ") + + about_text->set_text(VERSION_FULL_NAME + hash + + String::utf8("\n\xc2\xa9 2007-2018 Juan Linietsky, Ariel Manzur.\n\xc2\xa9 2014-2018 ") + TTR("Godot Engine contributors") + "\n"); hbc->add_child(about_text); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index b308d28dba..b52161813d 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -4423,7 +4423,7 @@ void EditorNode::_dropped_files(const Vector<String> &p_files, int p_screen) { for (int i = 0; i < p_files.size(); i++) { String from = p_files[i]; - if (!ResourceFormatImporter::get_singleton()->can_be_imported(from) && (just_copy.find(from.get_extension().to_lower()) < 0)) { + if (!ResourceFormatImporter::get_singleton()->can_be_imported(from) && (just_copy.find(from.get_extension().to_lower()) != -1)) { continue; } String to = to_path.plus_file(from.get_file()); diff --git a/editor/plugins/baked_lightmap_editor_plugin.cpp b/editor/plugins/baked_lightmap_editor_plugin.cpp index 08f4d06ef7..6849563ae2 100644 --- a/editor/plugins/baked_lightmap_editor_plugin.cpp +++ b/editor/plugins/baked_lightmap_editor_plugin.cpp @@ -20,7 +20,6 @@ void BakedLightmapEditorPlugin::_bake() { case BakedLightmap::BAKE_ERROR_CANT_CREATE_IMAGE: EditorNode::get_singleton()->show_warning(TTR("Failed creating lightmap images, make sure path is writable.")); break; - defaut : {} } } } diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 052817f40a..a52c914096 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -641,7 +641,7 @@ void CanvasItemEditor::_find_canvas_items_at_pos(const Point2 &p_pos, Node *p_no _SelectResult res; res.item = c; - res.z = node ? node->get_z() : 0; + res.z_index = node ? node->get_z_index() : 0; res.has_z = node; r_items.push_back(res); } diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h index f14f1a92a6..0866fe77aa 100644 --- a/editor/plugins/canvas_item_editor_plugin.h +++ b/editor/plugins/canvas_item_editor_plugin.h @@ -252,10 +252,10 @@ class CanvasItemEditor : public VBoxContainer { struct _SelectResult { CanvasItem *item; - float z; + float z_index; bool has_z; _FORCE_INLINE_ bool operator<(const _SelectResult &p_rr) const { - return has_z && p_rr.has_z ? p_rr.z < z : p_rr.has_z; + return has_z && p_rr.has_z ? p_rr.z_index < z_index : p_rr.has_z; } }; diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp index c865ddd4b0..3be68f21af 100644 --- a/editor/plugins/curve_editor_plugin.cpp +++ b/editor/plugins/curve_editor_plugin.cpp @@ -347,7 +347,8 @@ void CurveEditor::open_context_menu(Vector2 pos) { _context_menu->set_item_checked(_context_menu->get_item_index(CONTEXT_LINEAR), is_linear); } else { - _context_menu->add_separator(); + if (_selected_point > 0 || _selected_point + 1 < _curve_ref->get_point_count()) + _context_menu->add_separator(); if (_selected_point > 0) { _context_menu->add_check_item(TTR("Left linear"), CONTEXT_LEFT_LINEAR); @@ -367,6 +368,7 @@ void CurveEditor::open_context_menu(Vector2 pos) { _context_menu->add_submenu_item(TTR("Load preset"), _presets_menu->get_name()); + _context_menu->set_size(Size2(0, 0)); _context_menu->popup(); } @@ -566,7 +568,6 @@ static void plot_curve_accurate(const Curve &curve, float step, T plot_func) { Vector2 prev_pos = a; float len = b.x - a.x; - //float step = 4.f / view_size.x; for (float x = step; x < len; x += step) { pos.x = a.x + x; @@ -694,24 +695,6 @@ void CurveEditor::_draw() { CanvasItemPlotCurve plot_func(*this, line_color, edge_line_color); plot_curve_accurate(curve, 4.f / view_size.x, plot_func); - /*// TEST draw baked curve - { - Vector2 pos = Vector2(0, curve.interpolate_baked(0)); - Vector2 prev_pos = pos; - - float len = 1.0; - float step = 4.f / view_size.x; - - for(float x = step; x < len; x += step) { - pos.x = x; - pos.y = curve.interpolate_baked(x); - draw_line(get_point_view_pos(prev_pos), get_point_view_pos(pos), Color(0,1,0)); - prev_pos = pos; - } - - draw_line(get_point_view_pos(prev_pos), get_point_view_pos(Vector2(1, curve.interpolate_baked(1))), Color(0,1,0)); - }//*/ - // Draw points draw_set_transform_matrix(Transform2D()); diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index eccb11ba12..632684abc3 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -238,11 +238,8 @@ void TileSetEditor::_bind_methods() { TileSetEditor::TileSetEditor(EditorNode *p_editor) { - Panel *panel = memnew(Panel); - panel->set_anchors_and_margins_preset(Control::PRESET_WIDE); - add_child(panel); MenuButton *options = memnew(MenuButton); - panel->add_child(options); + CanvasItemEditor::get_singleton()->add_control_to_menu_panel(options); options->set_position(Point2(1, 1)); options->set_text(TTR("Tile Set")); options->get_popup()->add_item(TTR("Add Item"), MENU_OPTION_ADD_ITEM); @@ -345,7 +342,7 @@ AutotileEditor::AutotileEditor(EditorNode *p_editor) { helper = memnew(AutotileEditorHelper(this)); property_editor->edit(helper); - // Editor + //Editor dragging_point = -1; creating_shape = false; @@ -420,8 +417,6 @@ AutotileEditor::AutotileEditor(EditorNode *p_editor) { p.push_back((int)SHAPE_DELETE); tools[SHAPE_DELETE]->connect("pressed", this, "_on_tool_clicked", p); tool_containers[TOOLBAR_SHAPE]->add_child(tools[SHAPE_DELETE]); - //tools[SHAPE_CREATE_FROM_NOT_BITMASKED] = memnew(ToolButton); - //tool_containers[TOOLBAR_SHAPE]->add_child(tools[SHAPE_CREATE_FROM_NOT_BITMASKED]); tool_containers[TOOLBAR_SHAPE]->add_change_receptor(memnew(VSeparator)); tools[SHAPE_KEEP_INSIDE_TILE] = memnew(ToolButton); tools[SHAPE_KEEP_INSIDE_TILE]->set_toggle_mode(true); diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 7e8a6fcb6d..e7da78a35c 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -307,7 +307,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { } break; case TOOL_REPLACE: { - create_dialog->popup_create(false); + create_dialog->popup_create(false, true); } break; case TOOL_ATTACH_SCRIPT: { @@ -417,7 +417,6 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { if (editor_selection->is_selected(edited_scene)) { current_option = -1; - //accept->get_cancel()->hide(); accept->get_ok()->set_text(TTR("I see..")); accept->set_text(TTR("This operation can't be done on the tree root.")); accept->popup_centered_minsize(); diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index ad6ea2180f..96863a59d2 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -232,7 +232,7 @@ void ScriptCreateDialog::_lang_changed(int l) { String path = file_path->get_text(); String extension = ""; if (path != "") { - if (path.find(".") >= 0) { + if (path.find(".") != -1) { extension = path.get_extension(); } @@ -359,16 +359,14 @@ void ScriptCreateDialog::_path_changed(const String &p_path) { return; } - if (p.find("/") || p.find("\\")) { - DirAccess *d = DirAccess::create(DirAccess::ACCESS_RESOURCES); - if (d->change_dir(p.get_base_dir()) != OK) { - _msg_path_valid(false, TTR("Invalid base path")); - memdelete(d); - _update_dialog(); - return; - } + DirAccess *d = DirAccess::create(DirAccess::ACCESS_RESOURCES); + if (d->change_dir(p.get_base_dir()) != OK) { + _msg_path_valid(false, TTR("Invalid base path")); memdelete(d); + _update_dialog(); + return; } + memdelete(d); /* Does file already exist */ |