diff options
Diffstat (limited to 'tools/editor')
-rw-r--r-- | tools/editor/asset_library_editor_plugin.cpp | 66 | ||||
-rw-r--r-- | tools/editor/asset_library_editor_plugin.h | 13 | ||||
-rw-r--r-- | tools/editor/editor_file_dialog.cpp | 89 | ||||
-rw-r--r-- | tools/editor/editor_import_export.cpp | 2 | ||||
-rw-r--r-- | tools/editor/editor_node.cpp | 5 | ||||
-rw-r--r-- | tools/editor/editor_settings.cpp | 2 | ||||
-rw-r--r-- | tools/editor/io_plugins/editor_font_import_plugin.cpp | 26 | ||||
-rw-r--r-- | tools/editor/io_plugins/editor_texture_import_plugin.cpp | 13 | ||||
-rw-r--r-- | tools/editor/plugins/editor_preview_plugins.cpp | 10 | ||||
-rw-r--r-- | tools/editor/plugins/mesh_instance_editor_plugin.cpp | 6 | ||||
-rw-r--r-- | tools/editor/plugins/sample_editor_plugin.cpp | 14 | ||||
-rw-r--r-- | tools/editor/plugins/spatial_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | tools/editor/scene_tree_dock.cpp | 12 |
13 files changed, 206 insertions, 54 deletions
diff --git a/tools/editor/asset_library_editor_plugin.cpp b/tools/editor/asset_library_editor_plugin.cpp index c571310ded..a2448921d7 100644 --- a/tools/editor/asset_library_editor_plugin.cpp +++ b/tools/editor/asset_library_editor_plugin.cpp @@ -227,11 +227,12 @@ void EditorAssetLibraryItemDescription::_preview_click(int p_id) { } } -void EditorAssetLibraryItemDescription::configure(const String& p_title,int p_asset_id,const String& p_category,int p_category_id,const String& p_author,int p_author_id,int p_rating,const String& p_cost,int p_version,const String& p_version_string,const String& p_description,const String& p_download_url,const String& p_browse_url) { +void EditorAssetLibraryItemDescription::configure(const String& p_title,int p_asset_id,const String& p_category,int p_category_id,const String& p_author,int p_author_id,int p_rating,const String& p_cost,int p_version,const String& p_version_string,const String& p_description,const String& p_download_url,const String& p_browse_url,const String& p_sha256_hash) { asset_id=p_asset_id; title=p_title; download_url=p_download_url; + sha256=p_sha256_hash; item->configure(p_title,p_asset_id,p_category,p_category_id,p_author,p_author_id,p_rating,p_cost); description->clear(); description->add_text("Version: "+p_version_string+"\n"); @@ -358,9 +359,12 @@ void EditorAssetLibraryItemDownload::_http_download_completed(int p_status, int if (p_code!=200) { error_text=("Request failed, return code: "+itos(p_code)); status->set_text("Failed: "+itos(p_code)); - } else { - - //all good + } else if(sha256 != "") { + String download_sha256 = FileAccess::get_sha256(download->get_download_file()); + if(sha256 != download_sha256) { + error_text="Bad download hash, assuming file has been tampered with.\nExpected: " + sha256 + "\nGot: " + download_sha256; + status->set_text("Failed sha256 hash check"); + } } } break; @@ -384,15 +388,15 @@ void EditorAssetLibraryItemDownload::_http_download_completed(int p_status, int } -void EditorAssetLibraryItemDownload::configure(const String& p_title,int p_asset_id,const Ref<Texture>& p_preview, const String& p_download_url) { +void EditorAssetLibraryItemDownload::configure(const String& p_title,int p_asset_id,const Ref<Texture>& p_preview, const String& p_download_url, const String& p_sha256_hash) { title->set_text(p_title); icon->set_texture(p_preview); asset_id=p_asset_id; if (!p_preview.is_valid()) icon->set_texture(get_icon("GodotAssetDefault","EditorIcons")); - host=p_download_url; + sha256=p_sha256_hash; asset_installer->connect("confirmed",this,"_close"); dismiss->set_normal_texture( get_icon("Close","EditorIcons")); _make_request(); @@ -604,7 +608,7 @@ void EditorAssetLibrary::_install_asset() { EditorAssetLibraryItemDownload * download = memnew( EditorAssetLibraryItemDownload ); downloads_hb->add_child(download); - download->configure(description->get_title(),description->get_asset_id(),description->get_preview_icon(),description->get_download_url()); + download->configure(description->get_title(),description->get_asset_id(),description->get_preview_icon(),description->get_download_url(),description->get_sha256()); } @@ -624,6 +628,12 @@ const char* EditorAssetLibrary::sort_text[SORT_MAX]={ "Updated" }; +const char* EditorAssetLibrary::support_key[SUPPORT_MAX]={ + "official", + "community", + "testing" +}; + void EditorAssetLibrary::_select_author(int p_id) { @@ -832,14 +842,43 @@ void EditorAssetLibrary::_request_image(ObjectID p_for,String p_image_url,ImageT void EditorAssetLibrary::_repository_changed(int p_repository_id) { host=repository->get_item_metadata(p_repository_id); print_line(".." + host); - _api_request("configure", REQUESTING_CONFIG); + if(templates_only) { + _api_request("configure", REQUESTING_CONFIG, "?type=project"); + } else { + _api_request("configure", REQUESTING_CONFIG); + } +} + +void EditorAssetLibrary::_support_toggled(int p_support) { + support->get_popup()->set_item_checked(p_support, !support->get_popup()->is_item_checked(p_support)); + _search(); +} + +void EditorAssetLibrary::_rerun_search(int p_ignore) { + _search(); } void EditorAssetLibrary::_search(int p_page) { String args; - args=String()+"?sort="+sort_key[sort->get_selected()]; + if(templates_only) { + args += "?type=project&"; + } else { + args += "?"; + } + args+=String()+"sort="+sort_key[sort->get_selected()]; + + + String support_list; + for(int i = 0; i < SUPPORT_MAX; i++) { + if(support->get_popup()->is_item_checked(i)) { + support_list += String(support_key[i]) + "+"; + } + } + if(support_list != String()) { + args += "&support=" + support_list.substr(0, support_list.length() - 1); + } if (categories->get_selected()>0) { @@ -1134,6 +1173,7 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const ERR_FAIL_COND(!r.has("cost")); ERR_FAIL_COND(!r.has("description")); ERR_FAIL_COND(!r.has("download_url")); + ERR_FAIL_COND(!r.has("download_hash")); ERR_FAIL_COND(!r.has("browse_url")); if (description) { @@ -1145,7 +1185,7 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const description->popup_centered_minsize(); description->connect("confirmed",this,"_install_asset"); - description->configure(r["title"],r["asset_id"],category_map[r["category_id"]],r["category_id"],r["author"],r["author_id"],r["rating"],r["cost"],r["version"],r["version_string"],r["description"],r["download_url"],r["browse_url"]); + description->configure(r["title"],r["asset_id"],category_map[r["category_id"]],r["category_id"],r["author"],r["author_id"],r["rating"],r["cost"],r["version"],r["version_string"],r["description"],r["download_url"],r["browse_url"], r["download_hash"]); /*item->connect("asset_selected",this,"_select_asset"); item->connect("author_selected",this,"_select_author"); item->connect("category_selected",this,"_category_selected");*/ @@ -1231,6 +1271,8 @@ void EditorAssetLibrary::_bind_methods() { ObjectTypeDB::bind_method("_asset_open",&EditorAssetLibrary::_asset_open); ObjectTypeDB::bind_method("_asset_file_selected",&EditorAssetLibrary::_asset_file_selected); ObjectTypeDB::bind_method("_repository_changed",&EditorAssetLibrary::_repository_changed); + ObjectTypeDB::bind_method("_support_toggled",&EditorAssetLibrary::_support_toggled); + ObjectTypeDB::bind_method("_rerun_search",&EditorAssetLibrary::_rerun_search); } @@ -1298,9 +1340,11 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { search_hb2->add_child(sort); sort->set_h_size_flags(SIZE_EXPAND_FILL); + sort->connect("item_selected", this, "_rerun_search"); reverse = memnew( ToolButton ); reverse->set_toggle_mode(true); + reverse->connect("toggled", this, "_rerun_search"); //reverse->set_text(TTR("Reverse")); search_hb2->add_child(reverse); @@ -1314,6 +1358,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { search_hb2->add_child(categories); categories->set_h_size_flags(SIZE_EXPAND_FILL); //search_hb2->add_spacer(); + categories->connect("item_selected", this, "_rerun_search"); search_hb2->add_child(memnew(VSeparator)); @@ -1340,6 +1385,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { support->get_popup()->add_check_item(TTR("Testing"),SUPPORT_TESTING); support->get_popup()->set_item_checked(SUPPORT_OFFICIAL,true); support->get_popup()->set_item_checked(SUPPORT_COMMUNITY,true); + support->get_popup()->connect("item_pressed",this,"_support_toggled"); ///////// diff --git a/tools/editor/asset_library_editor_plugin.h b/tools/editor/asset_library_editor_plugin.h index 6a6e29338f..89663aa00b 100644 --- a/tools/editor/asset_library_editor_plugin.h +++ b/tools/editor/asset_library_editor_plugin.h @@ -111,6 +111,7 @@ class EditorAssetLibraryItemDescription : public ConfirmationDialog { int asset_id; String download_url; String title; + String sha256; Ref<Texture> icon; void _link_click(const String& p_url); @@ -120,13 +121,14 @@ protected: static void _bind_methods(); public: - void configure(const String& p_title,int p_asset_id,const String& p_category,int p_category_id,const String& p_author,int p_author_id,int p_rating,const String& p_cost,int p_version,const String& p_version_string,const String& p_description,const String& p_download_url,const String& p_browse_url); + void configure(const String& p_title,int p_asset_id,const String& p_category,int p_category_id,const String& p_author,int p_author_id,int p_rating,const String& p_cost,int p_version,const String& p_version_string,const String& p_description,const String& p_download_url,const String& p_browse_url,const String& p_sha256_hash); void add_preview(int p_id, bool p_video,const String& p_url); String get_title() { return title; } Ref<Texture> get_preview_icon() { return icon; } String get_download_url() { return download_url; } int get_asset_id() { return asset_id; } + String get_sha256() { return sha256; } EditorAssetLibraryItemDescription(); }; @@ -146,6 +148,7 @@ class EditorAssetLibraryItemDownload : public PanelContainer { AcceptDialog *download_error; HTTPRequest *download; String host; + String sha256; Label *status; int prev_status; @@ -166,7 +169,7 @@ protected: public: int get_asset_id() { return asset_id; } - void configure(const String& p_title,int p_asset_id,const Ref<Texture>& p_preview, const String& p_download_url); + void configure(const String& p_title,int p_asset_id,const Ref<Texture>& p_preview, const String& p_download_url, const String& p_sha256_hash); EditorAssetLibraryItemDownload(); }; @@ -210,7 +213,8 @@ class EditorAssetLibrary : public PanelContainer { enum Support { SUPPORT_OFFICIAL, SUPPORT_COMMUNITY, - SUPPORT_TESTING + SUPPORT_TESTING, + SUPPORT_MAX }; enum SortOrder { @@ -225,6 +229,7 @@ class EditorAssetLibrary : public PanelContainer { static const char* sort_key[SORT_MAX]; static const char* sort_text[SORT_MAX]; + static const char* support_key[SUPPORT_MAX]; ///MainListing @@ -288,11 +293,13 @@ class EditorAssetLibrary : public PanelContainer { void _manage_plugins(); void _search(int p_page=0); + void _rerun_search(int p_ignore); void _api_request(const String& p_request, RequestType p_request_type, const String &p_arguments=""); void _http_request_completed(int p_status, int p_code, const StringArray& headers, const ByteArray& p_data); void _http_download_completed(int p_status, int p_code, const StringArray& headers, const ByteArray& p_data); void _repository_changed(int p_repository_id); + void _support_toggled(int p_support); friend class EditorAssetLibraryItemDescription; friend class EditorAssetLibraryItem; diff --git a/tools/editor/editor_file_dialog.cpp b/tools/editor/editor_file_dialog.cpp index 97feaa80a5..a55c835787 100644 --- a/tools/editor/editor_file_dialog.cpp +++ b/tools/editor/editor_file_dialog.cpp @@ -98,35 +98,64 @@ void EditorFileDialog::_unhandled_input(const InputEvent& p_event) { if (p_event.type==InputEvent::KEY && is_window_modal_on_top()) { - const InputEventKey &k=p_event.key; + if (p_event.key.pressed) { - if (k.pressed) { + bool handled=false; - bool handled=true; - - switch (k.scancode) { - - case KEY_H: { - - if (k.mod.command) { - - bool show=!show_hidden_files; - set_show_hidden_files(show); - EditorSettings::get_singleton()->set("file_dialog/show_hidden_files",show); - } else { - handled=false; - } - - } break; - case KEY_F5: { - - invalidate(); - } break; - default: { handled=false; } + if (ED_IS_SHORTCUT("file_dialog/go_back", p_event)) { + _go_back(); + handled=true; + } + if (ED_IS_SHORTCUT("file_dialog/go_forward", p_event)) { + _go_forward(); + handled=true; + } + if (ED_IS_SHORTCUT("file_dialog/go_up", p_event)) { + _go_up(); + handled=true; + } + if (ED_IS_SHORTCUT("file_dialog/refresh", p_event)) { + invalidate(); + handled=true; + } + if (ED_IS_SHORTCUT("file_dialog/toggle_hidden_files", p_event)) { + bool show=!show_hidden_files; + set_show_hidden_files(show); + EditorSettings::get_singleton()->set("file_dialog/show_hidden_files",show); + handled=true; + } + if (ED_IS_SHORTCUT("file_dialog/toggle_favorite", p_event)) { + _favorite_toggled(favorite->is_pressed()); + handled=true; + } + if (ED_IS_SHORTCUT("file_dialog/toggle_mode", p_event)) { + if (mode_thumbnails->is_pressed()) { + set_display_mode(DISPLAY_LIST); + } else { + set_display_mode(DISPLAY_THUMBNAILS); + } + handled=true; + } + if (ED_IS_SHORTCUT("file_dialog/create_folder", p_event)) { + _make_dir(); + handled=true; + } + if (ED_IS_SHORTCUT("file_dialog/focus_path", p_event)) { + dir->grab_focus(); + handled=true; + } + if (ED_IS_SHORTCUT("file_dialog/mode_favorite_up", p_event)) { + _favorite_move_up(); + handled=true; + } + if (ED_IS_SHORTCUT("file_dialog/mode_favorite_down", p_event)) { + _favorite_move_down(); + handled=true; } - if (handled) + if (handled) { accept_event(); + } } } } @@ -1261,6 +1290,18 @@ EditorFileDialog::EditorFileDialog() { mode=MODE_SAVE_FILE; set_title(TTR("Save a File")); + ED_SHORTCUT("file_dialog/go_back", TTR("Go Back"), KEY_MASK_ALT|KEY_LEFT); + ED_SHORTCUT("file_dialog/go_forward", TTR("Go Forward"), KEY_MASK_ALT|KEY_RIGHT); + ED_SHORTCUT("file_dialog/go_up", TTR("Go Up"), KEY_MASK_ALT|KEY_UP); + ED_SHORTCUT("file_dialog/refresh", TTR("Refresh"), KEY_MASK_CMD|KEY_F5); // ctrl + f5 else it launches the game as well.. + ED_SHORTCUT("file_dialog/toggle_hidden_files", TTR("Toggle Hidden Files"), KEY_MASK_CMD|KEY_H); + ED_SHORTCUT("file_dialog/toggle_favorite", TTR("Toggle Favorite"), KEY_MASK_ALT|KEY_F); + ED_SHORTCUT("file_dialog/toggle_mode", TTR("Toggle Mode"), KEY_MASK_ALT|KEY_V); + ED_SHORTCUT("file_dialog/create_folder", TTR("Create Folder"), KEY_MASK_CMD|KEY_N); + ED_SHORTCUT("file_dialog/focus_path", TTR("Focus Path"), KEY_MASK_CMD|KEY_D); + ED_SHORTCUT("file_dialog/mode_favorite_up", TTR("Mode Favorite Up"), KEY_MASK_CMD|KEY_UP); + ED_SHORTCUT("file_dialog/mode_favorite_down", TTR("Mode Favorite Down"), KEY_MASK_CMD|KEY_DOWN); + HBoxContainer *pathhb = memnew( HBoxContainer ); dir_prev = memnew( ToolButton ); diff --git a/tools/editor/editor_import_export.cpp b/tools/editor/editor_import_export.cpp index f9b9c0b41c..357d139c04 100644 --- a/tools/editor/editor_import_export.cpp +++ b/tools/editor/editor_import_export.cpp @@ -861,9 +861,11 @@ Error EditorExportPlatform::export_project_files(EditorExportSaveFunction p_func Ref<ResourceImportMetadata> imd = memnew( ResourceImportMetadata ); //imd->set_editor(); + for (List<StringName>::Element *F=atlas_images.front();F;F=F->next()) { imd->add_source(EditorImportPlugin::validate_source_path(F->get()),FileAccess::get_md5(F->get())); + } diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 5a3e3069e4..0f8ddafb20 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -2952,6 +2952,9 @@ void EditorNode::remove_editor_plugin(EditorPlugin *p_editor) { //singleton->main_editor_tabs->add_tab(p_editor->get_name()); singleton->editor_table.erase(p_editor); } + p_editor->make_visible(false); + p_editor->clear(); + singleton->editor_plugins_over->get_plugins_list().erase(p_editor); singleton->remove_child(p_editor); singleton->editor_data.remove_editor_plugin( p_editor ); @@ -3004,7 +3007,7 @@ void EditorNode::set_addon_plugin_enabled(const String& p_addon,bool p_enabled) if (!p_enabled) { EditorPlugin *addon = plugin_addons[p_addon]; - editor_data.remove_editor_plugin( addon ); + remove_editor_plugin(addon); memdelete(addon); //bye plugin_addons.erase(p_addon); _update_addon_config(); diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp index 853c457b6c..457aecba4a 100644 --- a/tools/editor/editor_settings.cpp +++ b/tools/editor/editor_settings.cpp @@ -583,7 +583,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { set("3d_editor/zoom_modifier",4); hints["3d_editor/zoom_modifier"]=PropertyInfo(Variant::INT,"3d_editor/zoom_modifier",PROPERTY_HINT_ENUM,"None,Shift,Alt,Meta,Ctrl"); set("3d_editor/emulate_numpad",false); - set("3d_editor/trackpad_hint", false); + set("3d_editor/emulate_3_button_mouse", false); set("2d_editor/bone_width",5); set("2d_editor/bone_color1",Color(1.0,1.0,1.0,0.9)); diff --git a/tools/editor/io_plugins/editor_font_import_plugin.cpp b/tools/editor/io_plugins/editor_font_import_plugin.cpp index 97ccb766c0..70bc44ba7d 100644 --- a/tools/editor/io_plugins/editor_font_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_font_import_plugin.cpp @@ -102,6 +102,7 @@ public: bool disable_filter; bool round_advance; + bool premultiply_alpha; @@ -167,6 +168,8 @@ public: round_advance=p_value; else if (n=="advanced/disable_filter") disable_filter=p_value; + else if (n=="advanced/premultiply_alpha") + premultiply_alpha=p_value; else return false; @@ -235,6 +238,8 @@ public: r_ret=round_advance; else if (n=="advanced/disable_filter") r_ret=disable_filter; + else if (n=="advanced/premultiply_alpha") + r_ret=premultiply_alpha; else return false; @@ -297,6 +302,7 @@ public: p_list->push_back(PropertyInfo(Variant::BOOL,"advanced/round_advance")); p_list->push_back(PropertyInfo(Variant::BOOL,"advanced/disable_filter")); + p_list->push_back(PropertyInfo(Variant::BOOL,"advanced/premultiply_alpha")); } @@ -336,6 +342,7 @@ public: font_mode=FONT_BITMAP; round_advance=true; disable_filter=false; + premultiply_alpha=false; } @@ -368,6 +375,7 @@ public: round_advance=true; disable_filter=false; + premultiply_alpha=false; } @@ -1542,12 +1550,30 @@ Ref<BitmapFont> EditorFontImportPlugin::generate_font(const Ref<ResourceImportMe } + if (from->has_option("advanced/premultiply_alpha") && bool(from->get_option("advanced/premultiply_alpha"))) { + + DVector<uint8_t> data = atlas.get_data(); + int dl = data.size(); + { + DVector<uint8_t>::Write w = data.write(); + + for(int i=0;i<dl;i+=4) { + + w[i+0]= uint8_t(int(w[i+0])*int(w[i+3])/255); + w[i+1]= uint8_t(int(w[i+1])*int(w[i+3])/255); + w[i+2]= uint8_t(int(w[i+2])*int(w[i+3])/255); + } + } + + atlas=Image(res_size.x,res_size.y,0,Image::FORMAT_RGBA,data); + } if (from->has_option("color/monochrome") && bool(from->get_option("color/monochrome"))) { atlas.convert(Image::FORMAT_GRAYSCALE_ALPHA); } + if (0) { //debug the texture Ref<ImageTexture> atlast = memnew( ImageTexture ); diff --git a/tools/editor/io_plugins/editor_texture_import_plugin.cpp b/tools/editor/io_plugins/editor_texture_import_plugin.cpp index 1fa7a50515..16ea803da4 100644 --- a/tools/editor/io_plugins/editor_texture_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_texture_import_plugin.cpp @@ -1312,21 +1312,30 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Ref<Resourc ERR_CONTINUE( !source_map.has(i) ); for (List<int>::Element *E=source_map[i].front();E;E=E->next()) { - String apath = p_path.get_base_dir().plus_file(from->get_source_path(E->get()).get_file().basename()+".atex"); + String apath; + String spath = from->get_source_path(E->get()).get_file(); + + if (p_external) { + apath = p_path.get_base_dir().plus_file(spath.basename()+"."+from->get_source_path(E->get()).md5_text()+".atex"); + } else { + apath = p_path.get_base_dir().plus_file(spath.basename()+".atex"); + } Ref<AtlasTexture> at; if (ResourceCache::has(apath)) { + at = Ref<AtlasTexture>( ResourceCache::get(apath)->cast_to<AtlasTexture>() ); } else { at = Ref<AtlasTexture>( memnew( AtlasTexture ) ); + } at->set_region(region); at->set_margin(margin); at->set_path(apath); atlases[E->get()]=at; - print_line("Atlas Tex: "+apath); + } } if (ResourceCache::has(p_path)) { diff --git a/tools/editor/plugins/editor_preview_plugins.cpp b/tools/editor/plugins/editor_preview_plugins.cpp index f5470451ba..a057e6c2a1 100644 --- a/tools/editor/plugins/editor_preview_plugins.cpp +++ b/tools/editor/plugins/editor_preview_plugins.cpp @@ -669,7 +669,7 @@ Ref<Texture> EditorSamplePreviewPlugin::generate(const RES& p_from) { for(int j=0;j<h;j++) { float v = (j/(float)h) * 2.0 - 1.0; - uint8_t* imgofs = &imgw[(j*w+i)*3]; + uint8_t* imgofs = &imgw[(uint64_t(j)*w+i)*3]; if (v>min[0] && v<max[0]) { imgofs[0]=255; imgofs[1]=150; @@ -687,8 +687,8 @@ Ref<Texture> EditorSamplePreviewPlugin::generate(const RES& p_from) { float max[2]={-1e10,-1e10}; float min[2]={1e10,1e10}; int c=stereo?2:1; - int from = i*len/w; - int to = (i+1)*len/w; + int from = uint64_t(i)*len/w; + int to = (uint64_t(i)+1)*len/w; if (to>=len) to=len-1; @@ -699,7 +699,7 @@ Ref<Texture> EditorSamplePreviewPlugin::generate(const RES& p_from) { for(int k=from;k<=to;k++) { - float v = src[k*c+j]/32768.0; + float v = src[uint64_t(k)*c+j]/32768.0; if (v>max[j]) max[j]=v; if (v<min[j]) @@ -715,7 +715,7 @@ Ref<Texture> EditorSamplePreviewPlugin::generate(const RES& p_from) { for(int k=from;k<=to;k++) { - float v = src[k*c+j]/128.0; + float v = src[uint64_t(k)*c+j]/128.0; if (v>max[j]) max[j]=v; if (v<min[j]) diff --git a/tools/editor/plugins/mesh_instance_editor_plugin.cpp b/tools/editor/plugins/mesh_instance_editor_plugin.cpp index f604e4c57c..c952feb1da 100644 --- a/tools/editor/plugins/mesh_instance_editor_plugin.cpp +++ b/tools/editor/plugins/mesh_instance_editor_plugin.cpp @@ -183,6 +183,12 @@ void MeshInstanceEditor::_create_outline_mesh() { return; } + if (mesh->get_surface_count() == 0) { + err_dialog->set_text(TTR("Mesh has not surface to create outlines from!")); + err_dialog->popup_centered_minsize(); + return; + } + Ref<Mesh> mesho = mesh->create_outline(outline_size->get_val()); if (mesho.is_null()) { diff --git a/tools/editor/plugins/sample_editor_plugin.cpp b/tools/editor/plugins/sample_editor_plugin.cpp index a3891a648b..b094184a29 100644 --- a/tools/editor/plugins/sample_editor_plugin.cpp +++ b/tools/editor/plugins/sample_editor_plugin.cpp @@ -211,7 +211,7 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag for(int j=0;j<h;j++) { float v = (j/(float)h) * 2.0 - 1.0; - uint8_t* imgofs = &imgw[(j*w+i)*3]; + uint8_t* imgofs = &imgw[(uint64_t(j)*w+i)*3]; if (v>min[0] && v<max[0]) { imgofs[0]=255; imgofs[1]=150; @@ -229,8 +229,8 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag float max[2]={-1e10,-1e10}; float min[2]={1e10,1e10}; int c=stereo?2:1; - int from = i*len/w; - int to = (i+1)*len/w; + int from = uint64_t(i)*len/w; + int to = (uint64_t(i)+1)*len/w; if (to>=len) to=len-1; @@ -241,7 +241,7 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag for(int k=from;k<=to;k++) { - float v = src[k*c+j]/32768.0; + float v = src[uint64_t(k)*c+j]/32768.0; if (v>max[j]) max[j]=v; if (v<min[j]) @@ -257,7 +257,7 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag for(int k=from;k<=to;k++) { - float v = src[k*c+j]/128.0; + float v = src[uint64_t(k)*c+j]/128.0; if (v>max[j]) max[j]=v; if (v<min[j]) @@ -270,7 +270,7 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag if (!stereo) { for(int j=0;j<h;j++) { float v = (j/(float)h) * 2.0 - 1.0; - uint8_t* imgofs = &imgw[(j*w+i)*3]; + uint8_t* imgofs = &imgw[(uint64_t(j)*w+i)*3]; if (v>min[0] && v<max[0]) { imgofs[0]=255; imgofs[1]=150; @@ -297,7 +297,7 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag v = ((j-(h/2))/(float)(h/2)) * 2.0 - 1.0; } - uint8_t* imgofs = &imgw[(j*w+i)*3]; + uint8_t* imgofs = &imgw[(uint64_t(j)*w+i)*3]; if (v>min[half] && v<max[half]) { imgofs[0]=255; imgofs[1]=150; diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index fdb654571a..8d72178f23 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -1580,7 +1580,7 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) { nav_mode = NAVIGATION_PAN; } - } else if (EditorSettings::get_singleton()->get("3d_editor/trackpad_hint")) { + } else if (EditorSettings::get_singleton()->get("3d_editor/emulate_3_button_mouse")) { // Handle trackpad (no external mouse) use case int mod = 0; if (m.mod.shift) diff --git a/tools/editor/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp index 69d6d97980..30ffdf6664 100644 --- a/tools/editor/scene_tree_dock.cpp +++ b/tools/editor/scene_tree_dock.cpp @@ -1388,6 +1388,13 @@ void SceneTreeDock::_create() { } String newname=n->get_name(); + + List<Node*> to_erase; + for(int i=0;i<n->get_child_count();i++) { + if (n->get_child(i)->get_owner()==NULL && n->is_owned_by_parent()) { + to_erase.push_back(n->get_child(i)); + } + } n->replace_by(newnode,true); if (n==edited_scene) { @@ -1408,6 +1415,11 @@ void SceneTreeDock::_create() { memdelete(n); + while(to_erase.front()) { + memdelete(to_erase.front()->get()); + to_erase.pop_front(); + } + } |