diff options
-rw-r--r-- | editor/editor_node.cpp | 3 | ||||
-rw-r--r-- | editor/editor_resource_preview.cpp | 1 | ||||
-rw-r--r-- | editor/plugins/asset_library_editor_plugin.cpp | 1 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 19 | ||||
-rw-r--r-- | editor/plugins/editor_preview_plugins.cpp | 4 | ||||
-rw-r--r-- | platform/javascript/os_javascript.cpp | 5 |
6 files changed, 31 insertions, 2 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 0ff0bca7ee..fe4369eb0f 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -952,6 +952,9 @@ void EditorNode::_save_scene_with_preview(String p_file, int p_idx) { } if (img.is_valid()) { + + img = img->duplicate(); + save.step(TTR("Creating Thumbnail"), 2); save.step(TTR("Creating Thumbnail"), 3); diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp index 368efbc48f..f77f31db80 100644 --- a/editor/editor_resource_preview.cpp +++ b/editor/editor_resource_preview.cpp @@ -159,6 +159,7 @@ void EditorResourcePreview::_generate_preview(Ref<ImageTexture> &r_texture, Ref< small_thumbnail_size *= EDSCALE; Ref<Image> small_image = r_texture->get_data(); + small_image = small_image->duplicate(); small_image->resize(small_thumbnail_size, small_thumbnail_size, Image::INTERPOLATE_CUBIC); r_small_texture.instance(); r_small_texture->create_from_image(small_image); diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index a42765df6b..c68023ee9b 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -174,6 +174,7 @@ void EditorAssetLibraryItemDescription::set_image(int p_type, int p_index, const if (preview_images[i].is_video) { Ref<Image> overlay = get_icon("PlayOverlay", "EditorIcons")->get_data(); Ref<Image> thumbnail = p_image->get_data(); + thumbnail = thumbnail->duplicate(); Point2 overlay_pos = Point2((thumbnail->get_width() - overlay->get_width()) / 2, (thumbnail->get_height() - overlay->get_height()) / 2); thumbnail->lock(); diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 2913c4ce56..b4618a4eb6 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -3277,7 +3277,24 @@ void CanvasItemEditor::_notification(int p_what) { pivot_button->set_disabled(nb_having_pivot == 0); // Show / Hide the layout button - presets_menu->set_visible(nb_control > 0 && nb_control == selection.size()); + if (nb_control > 0 && nb_control == selection.size()) { + presets_menu->set_visible(true); + presets_menu->set_tooltip(TTR("Presets for the anchors and margins values of a Control node.")); + + // Disable if the selected node is child of a container + presets_menu->set_disabled(false); + for (List<CanvasItem *>::Element *E = selection.front(); E; E = E->next()) { + Control *control = Object::cast_to<Control>(E->get()); + if (!control || Object::cast_to<Container>(control->get_parent())) { + presets_menu->set_disabled(true); + presets_menu->set_tooltip(TTR("A child of a container gets its anchors and margins values overriden by its parent.")); + break; + } + } + + } else { + presets_menu->set_visible(false); + } // Update the viewport if bones changes for (Map<BoneKey, BoneList>::Element *E = bone_list.front(); E; E = E->next()) { diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp index 8464dfd0aa..4556b11708 100644 --- a/editor/plugins/editor_preview_plugins.cpp +++ b/editor/plugins/editor_preview_plugins.cpp @@ -99,12 +99,14 @@ Ref<Texture> EditorTexturePreviewPlugin::generate(const RES &p_from, const Size2 } else { Ref<Texture> tex = p_from; img = tex->get_data(); + if (img.is_valid()) { + img = img->duplicate(); + } } if (img.is_null() || img->empty()) return Ref<Texture>(); - img = img->duplicate(); img->clear_mipmaps(); if (img->is_compressed()) { diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp index d7ba454051..e820d07a2a 100644 --- a/platform/javascript/os_javascript.cpp +++ b/platform/javascript/os_javascript.cpp @@ -442,6 +442,9 @@ void OS_JavaScript::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_s if (texture.is_valid()) { image = texture->get_data(); + if (image.is_valid()) { + image->duplicate(); + } } if (!image.is_valid() && atlas_texture.is_valid()) { @@ -468,6 +471,8 @@ void OS_JavaScript::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_s ERR_FAIL_COND(!image.is_valid()); + image = image->duplicate(); + if (atlas_texture.is_valid()) image->crop_from_point( atlas_rect.position.x, |