diff options
-rw-r--r-- | doc/classes/LineEdit.xml | 7 | ||||
-rw-r--r-- | editor/export_template_manager.cpp | 18 | ||||
-rw-r--r-- | editor/export_template_manager.h | 2 | ||||
-rw-r--r-- | editor/import/resource_importer_scene.cpp | 6 | ||||
-rw-r--r-- | editor/plugins/tile_set_editor_plugin.cpp | 6 | ||||
-rw-r--r-- | editor/scene_tree_dock.cpp | 12 | ||||
-rw-r--r-- | editor/scene_tree_dock.h | 1 | ||||
-rw-r--r-- | scene/3d/baked_lightmap.cpp | 6 | ||||
-rw-r--r-- | scene/3d/baked_lightmap.h | 2 | ||||
-rw-r--r-- | scene/gui/line_edit.cpp | 33 | ||||
-rw-r--r-- | scene/gui/line_edit.h | 5 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 10 | ||||
-rw-r--r-- | scene/gui/text_edit.h | 2 |
13 files changed, 59 insertions, 51 deletions
diff --git a/doc/classes/LineEdit.xml b/doc/classes/LineEdit.xml index 9a03d4e0c1..4434a7b7e2 100644 --- a/doc/classes/LineEdit.xml +++ b/doc/classes/LineEdit.xml @@ -27,6 +27,13 @@ Erases the [LineEdit] text. </description> </method> + <method name="deselect"> + <return type="void"> + </return> + <description> + Clears the current selection. + </description> + </method> <method name="get_cursor_position" qualifiers="const"> <return type="int"> </return> diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp index cdb7256329..3eaa6e44fd 100644 --- a/editor/export_template_manager.cpp +++ b/editor/export_template_manager.cpp @@ -176,7 +176,7 @@ void ExportTemplateManager::_uninstall_template_confirm() { _update_template_list(); } -void ExportTemplateManager::_install_from_file(const String &p_file) { +void ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_progress) { FileAccess *fa = NULL; zlib_filefunc_def io = zipio_create_io_from_file(&fa); @@ -259,7 +259,10 @@ void ExportTemplateManager::_install_from_file(const String &p_file) { ret = unzGoToFirstFile(pkg); - EditorProgress p("ltask", TTR("Extracting Export Templates"), fc); + EditorProgress *p = NULL; + if (p_use_progress) { + p = memnew(EditorProgress("ltask", TTR("Extracting Export Templates"), fc)); + } fc = 0; @@ -288,8 +291,9 @@ void ExportTemplateManager::_install_from_file(const String &p_file) { */ file = file.get_file(); - - p.step(TTR("Importing:") + " " + file, fc); + if (p) { + p->step(TTR("Importing:") + " " + file, fc); + } FileAccess *f = FileAccess::open(template_path.plus_file(file), FileAccess::WRITE); @@ -302,6 +306,10 @@ void ExportTemplateManager::_install_from_file(const String &p_file) { fc++; } + if (p) { + memdelete(p); + } + unzClose(pkg); _update_template_list(); @@ -405,7 +413,7 @@ void ExportTemplateManager::_http_download_templates_completed(int p_status, int memdelete(f); template_list_state->set_text(TTR("Download Complete.")); template_downloader->hide(); - _install_from_file(path); + _install_from_file(path, false); } } } break; diff --git a/editor/export_template_manager.h b/editor/export_template_manager.h index 644c6b466b..36093da66a 100644 --- a/editor/export_template_manager.h +++ b/editor/export_template_manager.h @@ -69,7 +69,7 @@ class ExportTemplateManager : public ConfirmationDialog { void _uninstall_template_confirm(); virtual void ok_pressed(); - void _install_from_file(const String &p_file); + void _install_from_file(const String &p_file, bool p_use_progress = true); void _http_download_mirror_completed(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data); void _http_download_templates_completed(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data); diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp index 77820bf6a0..b6e4729352 100644 --- a/editor/import/resource_importer_scene.cpp +++ b/editor/import/resource_importer_scene.cpp @@ -1037,6 +1037,7 @@ void ResourceImporterScene::get_import_options(List<ImportOption> *r_options, in bool scenes_out = p_preset == PRESET_MULTIPLE_SCENES || p_preset == PRESET_MULTIPLE_SCENES_AND_MATERIALS; bool animations_out = p_preset == PRESET_SEPARATE_ANIMATIONS || p_preset == PRESET_SEPARATE_MESHES_AND_ANIMATIONS || p_preset == PRESET_SEPARATE_MATERIALS_AND_ANIMATIONS || p_preset == PRESET_SEPARATE_MESHES_MATERIALS_AND_ANIMATIONS; + r_options->push_back(ImportOption(PropertyInfo(Variant::REAL, "nodes/root_scale", PROPERTY_HINT_RANGE, "0.001,1000,0.001"), 1.0)); r_options->push_back(ImportOption(PropertyInfo(Variant::STRING, "nodes/custom_script", PROPERTY_HINT_FILE, script_ext_hint), "")); r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "nodes/storage", PROPERTY_HINT_ENUM, "Single Scene,Instanced Sub-Scenes"), scenes_out ? 1 : 0)); r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "materials/location", PROPERTY_HINT_ENUM, "Node,Mesh"), (meshes_out || materials_out) ? 1 : 0)); @@ -1209,6 +1210,11 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p } } + if (Object::cast_to<Spatial>(scene)) { + float root_scale = p_options["nodes/root_scale"]; + Object::cast_to<Spatial>(scene)->scale(Vector3(root_scale, root_scale, root_scale)); + } + scene->set_name(p_options["nodes/root_name"]); err = OK; diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index ae726b69ef..5eb3435e24 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -1435,13 +1435,13 @@ bool AutotileEditorHelper::_get(const StringName &p_name, Variant &r_ret) const return false; String name = p_name.operator String(); + bool v = false; if (name == "bitmask_mode") { - r_ret = tile_set->get(String::num(autotile_editor->get_current_tile(), 0) + "/autotile/bitmask_mode"); + r_ret = tile_set->get(String::num(autotile_editor->get_current_tile(), 0) + "/autotile/bitmask_mode", &v); } else if (name.left(7) == "layout/") { - bool v; r_ret = tile_set->get(String::num(autotile_editor->get_current_tile(), 0) + "/autotile" + name.right(6), &v); - return v; } + return v; } void AutotileEditorHelper::_get_property_list(List<PropertyInfo> *p_list) const { diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 4d5d467857..6fbca5c904 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -1699,12 +1699,11 @@ void SceneTreeDock::_add_children_to_popup(Object *p_obj, int p_depth) { icon = get_icon("Object", "EditorIcons"); if (menu->get_item_count() == 0) { - menu->add_item(TTR("Sub-Resources:")); - menu->set_item_disabled(0, true); + menu->add_submenu_item(TTR("Sub-Resources:"), "Sub-Resources"); } - int index = menu->get_item_count(); - menu->add_icon_item(icon, E->get().name.capitalize(), EDIT_SUBRESOURCE_BASE + subresources.size()); - menu->set_item_h_offset(index, p_depth * 10 * EDSCALE); + int index = menu_subresources->get_item_count(); + menu_subresources->add_icon_item(icon, E->get().name.capitalize(), EDIT_SUBRESOURCE_BASE + subresources.size()); + menu_subresources->set_item_h_offset(index, p_depth * 10 * EDSCALE); subresources.push_back(obj->get_instance_id()); _add_children_to_popup(obj, p_depth + 1); @@ -2049,6 +2048,9 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel menu = memnew(PopupMenu); add_child(menu); menu->connect("id_pressed", this, "_tool_selected"); + menu_subresources = memnew(PopupMenu); + menu_subresources->set_name("Sub-Resources"); + menu->add_child(menu_subresources); first_enter = true; restore_script_editor_on_drag = false; diff --git a/editor/scene_tree_dock.h b/editor/scene_tree_dock.h index 41d5bda180..6a281bb7e8 100644 --- a/editor/scene_tree_dock.h +++ b/editor/scene_tree_dock.h @@ -119,6 +119,7 @@ class SceneTreeDock : public VBoxContainer { TextureRect *filter_icon; PopupMenu *menu; + PopupMenu *menu_subresources; ConfirmationDialog *clear_inherit_confirm; bool first_enter; diff --git a/scene/3d/baked_lightmap.cpp b/scene/3d/baked_lightmap.cpp index 99d14e7f74..7afac94e71 100644 --- a/scene/3d/baked_lightmap.cpp +++ b/scene/3d/baked_lightmap.cpp @@ -298,7 +298,7 @@ BakedLightmap::BakeError BakedLightmap::bake(Node *p_from_node, bool p_create_vi Ref<BakedLightmapData> new_light_data; new_light_data.instance(); - static const int subdiv_value[SUBDIV_MAX] = { 8, 9, 10, 11, 12, 13 }; + static const int subdiv_value[SUBDIV_MAX] = { 8, 9, 10, 11 }; VoxelLightBaker baker; @@ -678,7 +678,7 @@ void BakedLightmap::_bind_methods() { ClassDB::bind_method(D_METHOD("debug_bake"), &BakedLightmap::_debug_bake); ClassDB::set_method_flags(get_class_static(), _scs_create("debug_bake"), METHOD_FLAGS_DEFAULT | METHOD_FLAG_EDITOR); - ADD_PROPERTY(PropertyInfo(Variant::INT, "bake_subdiv", PROPERTY_HINT_ENUM, "128,256,512,1024,2048,4096"), "set_bake_subdiv", "get_bake_subdiv"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "bake_subdiv", PROPERTY_HINT_ENUM, "128,256,512,1024"), "set_bake_subdiv", "get_bake_subdiv"); ADD_PROPERTY(PropertyInfo(Variant::INT, "capture_subdiv", PROPERTY_HINT_ENUM, "128,256,512"), "set_capture_subdiv", "get_capture_subdiv"); ADD_PROPERTY(PropertyInfo(Variant::INT, "bake_quality", PROPERTY_HINT_ENUM, "Low,Medium,High"), "set_bake_quality", "get_bake_quality"); ADD_PROPERTY(PropertyInfo(Variant::INT, "bake_mode", PROPERTY_HINT_ENUM, "ConeTrace,RayTrace"), "set_bake_mode", "get_bake_mode"); @@ -693,8 +693,6 @@ void BakedLightmap::_bind_methods() { BIND_ENUM_CONSTANT(SUBDIV_256); BIND_ENUM_CONSTANT(SUBDIV_512); BIND_ENUM_CONSTANT(SUBDIV_1024); - BIND_ENUM_CONSTANT(SUBDIV_2048); - BIND_ENUM_CONSTANT(SUBDIV_4096); BIND_ENUM_CONSTANT(SUBDIV_MAX); BIND_ENUM_CONSTANT(BAKE_QUALITY_LOW); diff --git a/scene/3d/baked_lightmap.h b/scene/3d/baked_lightmap.h index 5595ec1e61..f63749a0b4 100644 --- a/scene/3d/baked_lightmap.h +++ b/scene/3d/baked_lightmap.h @@ -64,8 +64,6 @@ public: SUBDIV_256, SUBDIV_512, SUBDIV_1024, - SUBDIV_2048, - SUBDIV_4096, SUBDIV_MAX }; diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 85ae6d6241..cebbb2193d 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -85,7 +85,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) { if ((cursor_pos < selection.begin) || (cursor_pos > selection.end) || !selection.enabled) { - selection_clear(); + deselect(); selection.cursor_start = cursor_pos; selection.creating = true; } else if (selection.enabled) { @@ -99,7 +99,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) { } else { if ((!selection.creating) && (!selection.doubleclick)) { - selection_clear(); + deselect(); } selection.creating = false; selection.doubleclick = false; @@ -175,7 +175,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) { if (editable) { - selection_clear(); + deselect(); text = text.substr(cursor_pos, text.length() - cursor_pos); Ref<Font> font = get_font("font"); @@ -204,7 +204,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) { if (editable) { - selection_clear(); + deselect(); text = text.substr(0, cursor_pos); _text_changed(); } @@ -827,7 +827,7 @@ void LineEdit::shift_selection_check_pre(bool p_shift) { selection.cursor_start = cursor_pos; } if (!p_shift) - selection_clear(); + deselect(); } void LineEdit::shift_selection_check_post(bool p_shift) { @@ -880,13 +880,6 @@ void LineEdit::set_cursor_at_pixel_pos(int p_x) { } set_cursor_position(ofs); - - /* - int new_cursor_pos=p_x; - int charwidth=draw_area->get_font_char_width(' ',0); - new_cursor_pos=( ( (new_cursor_pos-2)+ (charwidth/2) ) /charwidth ); - if (new_cursor_pos>(int)text.length()) new_cursor_pos=text.length(); - set_cursor_position(window_pos+new_cursor_pos); */ } bool LineEdit::cursor_get_blink_enabled() const { @@ -941,11 +934,6 @@ void LineEdit::delete_char() { set_cursor_position(get_cursor_position() - 1); - if (cursor_pos == window_pos) { - - //set_window_pos(cursor_pos-get_window_length()); - } - _text_changed(); } @@ -1143,7 +1131,7 @@ Size2 LineEdit::get_minimum_size() const { /* selection */ -void LineEdit::selection_clear() { +void LineEdit::deselect() { selection.begin = 0; selection.end = 0; @@ -1159,7 +1147,7 @@ void LineEdit::selection_delete() { if (selection.enabled) delete_text(selection.begin, selection.end); - selection_clear(); + deselect(); } void LineEdit::set_max_length(int p_max_length) { @@ -1224,7 +1212,7 @@ bool LineEdit::is_secret() const { void LineEdit::select(int p_from, int p_to) { if (p_from == 0 && p_to == 0) { - selection_clear(); + deselect(); return; } @@ -1383,7 +1371,9 @@ void LineEdit::_bind_methods() { ClassDB::bind_method(D_METHOD("_gui_input"), &LineEdit::_gui_input); ClassDB::bind_method(D_METHOD("clear"), &LineEdit::clear); + ClassDB::bind_method(D_METHOD("select", "from", "to"), &LineEdit::select, DEFVAL(0), DEFVAL(-1)); ClassDB::bind_method(D_METHOD("select_all"), &LineEdit::select_all); + ClassDB::bind_method(D_METHOD("deselect"), &LineEdit::deselect); ClassDB::bind_method(D_METHOD("set_text", "text"), &LineEdit::set_text); ClassDB::bind_method(D_METHOD("get_text"), &LineEdit::get_text); ClassDB::bind_method(D_METHOD("set_placeholder", "text"), &LineEdit::set_placeholder); @@ -1405,7 +1395,6 @@ void LineEdit::_bind_methods() { ClassDB::bind_method(D_METHOD("is_editable"), &LineEdit::is_editable); ClassDB::bind_method(D_METHOD("set_secret", "enabled"), &LineEdit::set_secret); ClassDB::bind_method(D_METHOD("is_secret"), &LineEdit::is_secret); - ClassDB::bind_method(D_METHOD("select", "from", "to"), &LineEdit::select, DEFVAL(0), DEFVAL(-1)); ClassDB::bind_method(D_METHOD("menu_option", "option"), &LineEdit::menu_option); ClassDB::bind_method(D_METHOD("get_menu"), &LineEdit::get_menu); ClassDB::bind_method(D_METHOD("set_context_menu_enabled", "enable"), &LineEdit::set_context_menu_enabled); @@ -1457,7 +1446,7 @@ LineEdit::LineEdit() { pass = false; placeholder_alpha = 0.6; - selection_clear(); + deselect(); set_focus_mode(FOCUS_ALL); editable = true; set_default_cursor_shape(CURSOR_IBEAM); diff --git a/scene/gui/line_edit.h b/scene/gui/line_edit.h index c3a299c2f5..5ca4ca15df 100644 --- a/scene/gui/line_edit.h +++ b/scene/gui/line_edit.h @@ -119,7 +119,6 @@ private: void shift_selection_check_pre(bool); void shift_selection_check_post(bool); - void selection_clear(); void selection_fill_at_cursor(); void selection_delete(); void set_window_pos(int p_pos); @@ -155,7 +154,9 @@ public: bool is_context_menu_enabled(); PopupMenu *get_menu() const; + void select(int p_from = 0, int p_to = -1); void select_all(); + void deselect(); void delete_char(); void delete_text(int p_from_column, int p_to_column); @@ -190,8 +191,6 @@ public: void set_secret(bool p_secret); bool is_secret() const; - void select(int p_from = 0, int p_to = -1); - virtual Size2 get_minimum_size() const; void set_expand_to_text_length(bool p_enabled); diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 83aee5ca30..07f1bdf8e5 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -4084,7 +4084,7 @@ void TextEdit::cut() { backspace_at_cursor(); update(); cursor_set_line(cursor.line + 1); - cut_copy_line = true; + cut_copy_line = clipboard; } else { @@ -4098,7 +4098,7 @@ void TextEdit::cut() { selection.active = false; selection.selecting_mode = Selection::MODE_NONE; update(); - cut_copy_line = false; + cut_copy_line = ""; } } @@ -4107,11 +4107,11 @@ void TextEdit::copy() { if (!selection.active) { String clipboard = _base_get_text(cursor.line, 0, cursor.line, text[cursor.line].length()); OS::get_singleton()->set_clipboard(clipboard); - cut_copy_line = true; + cut_copy_line = clipboard; } else { String clipboard = _base_get_text(selection.from_line, selection.from_column, selection.to_line, selection.to_column); OS::get_singleton()->set_clipboard(clipboard); - cut_copy_line = false; + cut_copy_line = ""; } } @@ -4127,7 +4127,7 @@ void TextEdit::paste() { cursor_set_line(selection.from_line); cursor_set_column(selection.from_column); - } else if (cut_copy_line) { + } else if (!cut_copy_line.empty() && cut_copy_line == clipboard) { cursor_set_column(0); String ins = "\n"; diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h index edef28cc25..836d5c7388 100644 --- a/scene/gui/text_edit.h +++ b/scene/gui/text_edit.h @@ -270,7 +270,7 @@ class TextEdit : public Control { bool brace_matching_enabled; bool highlight_current_line; bool auto_indent; - bool cut_copy_line; + String cut_copy_line; bool insert_mode; bool select_identifiers_enabled; |