summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/debugger/editor_profiler.cpp2
-rw-r--r--editor/debugger/editor_visual_profiler.cpp2
-rw-r--r--editor/editor_node.cpp8
-rw-r--r--editor/editor_plugin.cpp3
-rw-r--r--editor/editor_resource_picker.cpp2
-rw-r--r--editor/editor_resource_preview.cpp6
-rw-r--r--editor/editor_run_native.cpp4
-rw-r--r--editor/editor_themes.cpp9
-rw-r--r--editor/import/resource_importer_texture_atlas.cpp12
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp2
-rw-r--r--editor/plugins/asset_library_editor_plugin.cpp11
-rw-r--r--editor/plugins/bit_map_editor_plugin.cpp6
-rw-r--r--editor/plugins/curve_editor_plugin.cpp6
-rw-r--r--editor/plugins/editor_preview_plugins.cpp56
-rw-r--r--editor/plugins/gpu_particles_2d_editor_plugin.cpp17
-rw-r--r--editor/plugins/gpu_particles_3d_editor_plugin.cpp12
-rw-r--r--editor/plugins/tiles/atlas_merging_dialog.cpp6
-rw-r--r--editor/plugins/tiles/tiles_editor_plugin.cpp5
-rw-r--r--editor/project_manager.cpp4
19 files changed, 38 insertions, 135 deletions
diff --git a/editor/debugger/editor_profiler.cpp b/editor/debugger/editor_profiler.cpp
index 1b1cdbd9ef..28b5d4be15 100644
--- a/editor/debugger/editor_profiler.cpp
+++ b/editor/debugger/editor_profiler.cpp
@@ -312,7 +312,7 @@ void EditorProfiler::_update_plot() {
if (graph_texture.is_null()) {
graph_texture.instantiate();
}
- graph_texture->create_from_image(img);
+ graph_texture->set_image(img);
}
graph_texture->update(img);
diff --git a/editor/debugger/editor_visual_profiler.cpp b/editor/debugger/editor_visual_profiler.cpp
index 59482db674..ee67cbdaea 100644
--- a/editor/debugger/editor_visual_profiler.cpp
+++ b/editor/debugger/editor_visual_profiler.cpp
@@ -306,7 +306,7 @@ void EditorVisualProfiler::_update_plot() {
if (graph_texture.is_null()) {
graph_texture.instantiate();
}
- graph_texture->create_from_image(img);
+ graph_texture->set_image(img);
}
graph_texture->update(img);
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index da8bf39f62..64665833df 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -4043,10 +4043,8 @@ Ref<ImageTexture> EditorNode::_load_custom_class_icon(const String &p_path) cons
Ref<Image> img = memnew(Image);
Error err = ImageLoader::load_image(p_path, img);
if (err == OK) {
- Ref<ImageTexture> icon = memnew(ImageTexture);
img->resize(16 * EDSCALE, 16 * EDSCALE, Image::INTERPOLATE_LANCZOS);
- icon->create_from_image(img);
- return icon;
+ return ImageTexture::create_from_image(img);
}
}
return nullptr;
@@ -5393,9 +5391,7 @@ Variant EditorNode::drag_resource(const Ref<Resource> &p_res, Control *p_from) {
Ref<Image> img = texture->get_image();
img = img->duplicate();
img->resize(48, 48); // meh
- Ref<ImageTexture> resized_pic = Ref<ImageTexture>(memnew(ImageTexture));
- resized_pic->create_from_image(img);
- preview = resized_pic;
+ preview = ImageTexture::create_from_image(img);
}
drag_preview->set_texture(preview);
diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp
index 639846861b..d9c2a42114 100644
--- a/editor/editor_plugin.cpp
+++ b/editor/editor_plugin.cpp
@@ -133,8 +133,7 @@ Vector<Ref<Texture2D>> EditorInterface::make_mesh_previews(const Vector<Ref<Mesh
Main::iteration();
Ref<Image> img = RS::get_singleton()->texture_2d_get(viewport_texture);
ERR_CONTINUE(!img.is_valid() || img->is_empty());
- Ref<ImageTexture> it(memnew(ImageTexture));
- it->create_from_image(img);
+ Ref<ImageTexture> it = ImageTexture::create_from_image(img);
RS::get_singleton()->free(inst);
diff --git a/editor/editor_resource_picker.cpp b/editor/editor_resource_picker.cpp
index 77d627ab9c..16ebecb8be 100644
--- a/editor/editor_resource_picker.cpp
+++ b/editor/editor_resource_picker.cpp
@@ -678,7 +678,7 @@ void EditorResourcePicker::drop_data_fw(const Point2 &p_point, const Variant &p_
if (!texture.is_valid()) {
texture.instantiate();
}
- texture->create_from_image(dropped_resource);
+ texture->set_image(dropped_resource);
dropped_resource = texture;
break;
}
diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp
index dffb378408..b84e654d42 100644
--- a/editor/editor_resource_preview.cpp
+++ b/editor/editor_resource_preview.cpp
@@ -184,7 +184,7 @@ void EditorResourcePreview::_generate_preview(Ref<ImageTexture> &r_texture, Ref<
small_image = small_image->duplicate();
small_image->resize(small_thumbnail_size, small_thumbnail_size, Image::INTERPOLATE_CUBIC);
r_small_texture.instantiate();
- r_small_texture->create_from_image(small_image);
+ r_small_texture->set_image(small_image);
}
break;
@@ -300,14 +300,14 @@ void EditorResourcePreview::_iterate() {
cache_valid = false;
} else {
texture.instantiate();
- texture->create_from_image(img);
+ texture->set_image(img);
if (has_small_texture) {
if (small_img->load(cache_base + "_small.png") != OK) {
cache_valid = false;
} else {
small_texture.instantiate();
- small_texture->create_from_image(small_img);
+ small_texture->set_image(small_img);
}
}
}
diff --git a/editor/editor_run_native.cpp b/editor/editor_run_native.cpp
index 6ce9e5fa6f..854885c707 100644
--- a/editor/editor_run_native.cpp
+++ b/editor/editor_run_native.cpp
@@ -49,9 +49,7 @@ void EditorRunNative::_notification(int p_what) {
im->clear_mipmaps();
if (!im->is_empty()) {
im->resize(16 * EDSCALE, 16 * EDSCALE);
- Ref<ImageTexture> small_icon;
- small_icon.instantiate();
- small_icon->create_from_image(im);
+ Ref<ImageTexture> small_icon = ImageTexture::create_from_image(im);
MenuButton *mb = memnew(MenuButton);
mb->get_popup()->connect("id_pressed", callable_mp(this, &EditorRunNative::run_native), varray(i));
mb->connect("pressed", callable_mp(this, &EditorRunNative::run_native), varray(-1, i));
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 82c1d278b7..13109478e4 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -97,7 +97,6 @@ static Ref<Texture2D> flip_icon(Ref<Texture2D> p_texture, bool p_flip_y = false,
return p_texture;
}
- Ref<ImageTexture> texture(memnew(ImageTexture));
Ref<Image> img = p_texture->get_image();
ERR_FAIL_NULL_V(img, Ref<Texture2D>());
img = img->duplicate();
@@ -109,14 +108,12 @@ static Ref<Texture2D> flip_icon(Ref<Texture2D> p_texture, bool p_flip_y = false,
img->flip_x();
}
- texture->create_from_image(img);
- return texture;
+ return ImageTexture::create_from_image(img);
}
#ifdef MODULE_SVG_ENABLED
// See also `generate_icon()` in `scene/resources/default_theme.cpp`.
static Ref<ImageTexture> editor_generate_icon(int p_index, bool p_convert_color, float p_scale = EDSCALE, float p_saturation = 1.0, Dictionary p_convert_colors = Dictionary()) {
- Ref<ImageTexture> icon = memnew(ImageTexture);
Ref<Image> img = memnew(Image);
// Upsample icon generation only if the editor scale isn't an integer multiplier.
@@ -129,9 +126,9 @@ static Ref<ImageTexture> editor_generate_icon(int p_index, bool p_convert_color,
if (p_saturation != 1.0) {
img->adjust_bcs(1.0, 1.0, p_saturation);
}
- icon->create_from_image(img); // in this case filter really helps
- return icon;
+ // In this case filter really helps.
+ return ImageTexture::create_from_image(img);
}
#endif
diff --git a/editor/import/resource_importer_texture_atlas.cpp b/editor/import/resource_importer_texture_atlas.cpp
index e5fe99890e..28653dac3e 100644
--- a/editor/import/resource_importer_texture_atlas.cpp
+++ b/editor/import/resource_importer_texture_atlas.cpp
@@ -88,13 +88,7 @@ Error ResourceImporterTextureAtlas::import(const String &p_source_file, const St
//use an xpm because it's size independent, the editor images are vector and size dependent
//it's a simple hack
Ref<Image> broken = memnew(Image((const char **)atlas_import_failed_xpm));
- Ref<ImageTexture> broken_texture;
- broken_texture.instantiate();
- broken_texture->create_from_image(broken);
-
- String target_file = p_save_path + ".tex";
-
- ResourceSaver::save(target_file, broken_texture);
+ ResourceSaver::save(p_save_path + ".tex", ImageTexture::create_from_image(broken));
return OK;
}
@@ -308,9 +302,7 @@ Error ResourceImporterTextureAtlas::import_group_file(const String &p_group_file
Ref<Texture2D> cache;
cache = ResourceCache::get_ref(p_group_file);
if (!cache.is_valid()) {
- Ref<ImageTexture> res_cache;
- res_cache.instantiate();
- res_cache->create_from_image(new_atlas);
+ Ref<ImageTexture> res_cache = ImageTexture::create_from_image(new_atlas);
res_cache->set_path(p_group_file);
cache = res_cache;
}
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index e5ca5d66e8..8d1755d260 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -135,7 +135,7 @@ void AnimationPlayerEditor::_notification(int p_what) {
autoplay_reset_img->blit_rect(autoplay_img, Rect2(Point2(), icon_size), Point2());
autoplay_reset_img->blit_rect(reset_img, Rect2(Point2(), icon_size), Point2(icon_size.x, 0));
autoplay_reset_icon.instantiate();
- autoplay_reset_icon->create_from_image(autoplay_reset_img);
+ autoplay_reset_icon->set_image(autoplay_reset_img);
}
stop->set_icon(get_theme_icon(SNAME("Stop"), SNAME("EditorIcons")));
diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp
index 57c7f34018..12ab9e3b61 100644
--- a/editor/plugins/asset_library_editor_plugin.cpp
+++ b/editor/plugins/asset_library_editor_plugin.cpp
@@ -165,14 +165,9 @@ void EditorAssetLibraryItemDescription::set_image(int p_type, int p_index, const
// Overlay and thumbnail need the same format for `blend_rect` to work.
thumbnail->convert(Image::FORMAT_RGBA8);
-
thumbnail->blend_rect(overlay, overlay->get_used_rect(), overlay_pos);
+ preview_images[i].button->set_icon(ImageTexture::create_from_image(thumbnail));
- Ref<ImageTexture> tex;
- tex.instantiate();
- tex->create_from_image(thumbnail);
-
- preview_images[i].button->set_icon(tex);
// Make it clearer that clicking it will open an external link
preview_images[i].button->set_default_cursor_shape(Control::CURSOR_POINTING_HAND);
} else {
@@ -790,9 +785,7 @@ void EditorAssetLibrary::_image_update(bool use_cache, bool final, const PackedB
} break;
}
- Ref<ImageTexture> tex;
- tex.instantiate();
- tex->create_from_image(image);
+ Ref<ImageTexture> tex = ImageTexture::create_from_image(image);
obj->call("set_image", image_queue[p_queue_id].image_type, image_queue[p_queue_id].image_index, tex);
image_set = true;
diff --git a/editor/plugins/bit_map_editor_plugin.cpp b/editor/plugins/bit_map_editor_plugin.cpp
index 9003c4480b..657c5a36b6 100644
--- a/editor/plugins/bit_map_editor_plugin.cpp
+++ b/editor/plugins/bit_map_editor_plugin.cpp
@@ -33,11 +33,7 @@
#include "editor/editor_scale.h"
void BitMapEditor::setup(const Ref<BitMap> &p_bitmap) {
- Ref<ImageTexture> texture;
- texture.instantiate();
- texture->create_from_image(p_bitmap->convert_to_image());
- texture_rect->set_texture(texture);
-
+ texture_rect->set_texture(ImageTexture::create_from_image(p_bitmap->convert_to_image()));
size_label->set_text(vformat(String::utf8("%s×%s"), p_bitmap->get_size().width, p_bitmap->get_size().height));
}
diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp
index 654c92c532..66e58339ed 100644
--- a/editor/plugins/curve_editor_plugin.cpp
+++ b/editor/plugins/curve_editor_plugin.cpp
@@ -841,9 +841,5 @@ Ref<Texture2D> CurvePreviewGenerator::generate(const Ref<Resource> &p_from, cons
prev_y = y;
}
-
- Ref<ImageTexture> ptex = Ref<ImageTexture>(memnew(ImageTexture));
-
- ptex->create_from_image(img_ref);
- return ptex;
+ return ImageTexture::create_from_image(img_ref);
}
diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp
index a00ed1e49a..478f4264e5 100644
--- a/editor/plugins/editor_preview_plugins.cpp
+++ b/editor/plugins/editor_preview_plugins.cpp
@@ -127,13 +127,9 @@ Ref<Texture2D> EditorTexturePreviewPlugin::generate(const Ref<Resource> &p_from,
}
Vector2i new_size_i(MAX(1, (int)new_size.x), MAX(1, (int)new_size.y));
img->resize(new_size_i.x, new_size_i.y, Image::INTERPOLATE_CUBIC);
-
post_process_preview(img);
- Ref<ImageTexture> ptex = Ref<ImageTexture>(memnew(ImageTexture));
-
- ptex->create_from_image(img);
- return ptex;
+ return ImageTexture::create_from_image(img);
}
EditorTexturePreviewPlugin::EditorTexturePreviewPlugin() {
@@ -171,14 +167,9 @@ Ref<Texture2D> EditorImagePreviewPlugin::generate(const Ref<Resource> &p_from, c
new_size = Vector2(new_size.x * p_size.y / new_size.y, p_size.y);
}
img->resize(new_size.x, new_size.y, Image::INTERPOLATE_CUBIC);
-
post_process_preview(img);
- Ref<ImageTexture> ptex;
- ptex.instantiate();
-
- ptex->create_from_image(img);
- return ptex;
+ return ImageTexture::create_from_image(img);
}
EditorImagePreviewPlugin::EditorImagePreviewPlugin() {
@@ -239,13 +230,9 @@ Ref<Texture2D> EditorBitmapPreviewPlugin::generate(const Ref<Resource> &p_from,
new_size = Vector2(new_size.x * p_size.y / new_size.y, p_size.y);
}
img->resize(new_size.x, new_size.y, Image::INTERPOLATE_CUBIC);
-
post_process_preview(img);
- Ref<ImageTexture> ptex = Ref<ImageTexture>(memnew(ImageTexture));
-
- ptex->create_from_image(img);
- return ptex;
+ return ImageTexture::create_from_image(img);
}
bool EditorBitmapPreviewPlugin::generate_small_preview_automatically() const {
@@ -282,11 +269,8 @@ Ref<Texture2D> EditorPackedScenePreviewPlugin::generate_from_path(const String &
img.instantiate();
Error err = img->load(path);
if (err == OK) {
- Ref<ImageTexture> ptex = Ref<ImageTexture>(memnew(ImageTexture));
-
post_process_preview(img);
- ptex->create_from_image(img);
- return ptex;
+ return ImageTexture::create_from_image(img);
} else {
return Ref<Texture2D>();
@@ -336,9 +320,7 @@ Ref<Texture2D> EditorMaterialPreviewPlugin::generate(const Ref<Resource> &p_from
int thumbnail_size = MAX(p_size.x, p_size.y);
img->resize(thumbnail_size, thumbnail_size, Image::INTERPOLATE_CUBIC);
post_process_preview(img);
- Ref<ImageTexture> ptex = Ref<ImageTexture>(memnew(ImageTexture));
- ptex->create_from_image(img);
- return ptex;
+ return ImageTexture::create_from_image(img);
}
return Ref<Texture2D>();
@@ -591,13 +573,8 @@ Ref<Texture2D> EditorScriptPreviewPlugin::generate(const Ref<Resource> &p_from,
}
}
}
-
post_process_preview(img);
-
- Ref<ImageTexture> ptex = Ref<ImageTexture>(memnew(ImageTexture));
-
- ptex->create_from_image(img);
- return ptex;
+ return ImageTexture::create_from_image(img);
}
EditorScriptPreviewPlugin::EditorScriptPreviewPlugin() {
@@ -676,12 +653,10 @@ Ref<Texture2D> EditorAudioStreamPreviewPlugin::generate(const Ref<Resource> &p_f
//post_process_preview(img);
- Ref<ImageTexture> ptex = Ref<ImageTexture>(memnew(ImageTexture));
Ref<Image> image;
image.instantiate();
image->create(w, h, false, Image::FORMAT_RGB8, img);
- ptex->create_from_image(image);
- return ptex;
+ return ImageTexture::create_from_image(image);
}
EditorAudioStreamPreviewPlugin::EditorAudioStreamPreviewPlugin() {
@@ -746,12 +721,9 @@ Ref<Texture2D> EditorMeshPreviewPlugin::generate(const Ref<Resource> &p_from, co
new_size = Vector2(new_size.x * p_size.y / new_size.y, p_size.y);
}
img->resize(new_size.x, new_size.y, Image::INTERPOLATE_CUBIC);
-
post_process_preview(img);
- Ref<ImageTexture> ptex = Ref<ImageTexture>(memnew(ImageTexture));
- ptex->create_from_image(img);
- return ptex;
+ return ImageTexture::create_from_image(img);
}
EditorMeshPreviewPlugin::EditorMeshPreviewPlugin() {
@@ -859,13 +831,9 @@ Ref<Texture2D> EditorFontPreviewPlugin::generate_from_path(const String &p_path,
new_size = Vector2(new_size.x * p_size.y / new_size.y, p_size.y);
}
img->resize(new_size.x, new_size.y, Image::INTERPOLATE_CUBIC);
-
post_process_preview(img);
- Ref<ImageTexture> ptex = Ref<ImageTexture>(memnew(ImageTexture));
- ptex->create_from_image(img);
-
- return ptex;
+ return ImageTexture::create_from_image(img);
}
Ref<Texture2D> EditorFontPreviewPlugin::generate(const Ref<Resource> &p_from, const Size2 &p_size) const {
@@ -915,11 +883,7 @@ Ref<Texture2D> EditorGradientPreviewPlugin::generate(const Ref<Resource> &p_from
ptex.instantiate();
ptex->set_width(p_size.width * GRADIENT_PREVIEW_TEXTURE_SCALE_FACTOR * EDSCALE);
ptex->set_gradient(gradient);
-
- Ref<ImageTexture> itex;
- itex.instantiate();
- itex->create_from_image(ptex->get_image());
- return itex;
+ return ImageTexture::create_from_image(ptex->get_image());
}
return Ref<Texture2D>();
}
diff --git a/editor/plugins/gpu_particles_2d_editor_plugin.cpp b/editor/plugins/gpu_particles_2d_editor_plugin.cpp
index 72caa15e9c..a255c12ed4 100644
--- a/editor/plugins/gpu_particles_2d_editor_plugin.cpp
+++ b/editor/plugins/gpu_particles_2d_editor_plugin.cpp
@@ -299,12 +299,7 @@ void GPUParticles2DEditorPlugin::_generate_emission_mask() {
img.instantiate();
img->create(w, h, false, Image::FORMAT_RGF, texdata);
-
- Ref<ImageTexture> imgt;
- imgt.instantiate();
- imgt->create_from_image(img);
-
- pm->set_emission_point_texture(imgt);
+ pm->set_emission_point_texture(ImageTexture::create_from_image(img));
pm->set_emission_point_count(vpc);
if (capture_colors) {
@@ -320,10 +315,7 @@ void GPUParticles2DEditorPlugin::_generate_emission_mask() {
img.instantiate();
img->create(w, h, false, Image::FORMAT_RGBA8, colordata);
-
- imgt.instantiate();
- imgt->create_from_image(img);
- pm->set_emission_color_texture(imgt);
+ pm->set_emission_color_texture(ImageTexture::create_from_image(img));
}
if (valid_normals.size()) {
@@ -343,10 +335,7 @@ void GPUParticles2DEditorPlugin::_generate_emission_mask() {
img.instantiate();
img->create(w, h, false, Image::FORMAT_RGF, normdata);
-
- imgt.instantiate();
- imgt->create_from_image(img);
- pm->set_emission_normal_texture(imgt);
+ pm->set_emission_normal_texture(ImageTexture::create_from_image(img));
} else {
pm->set_emission_shape(ParticlesMaterial::EMISSION_SHAPE_POINTS);
diff --git a/editor/plugins/gpu_particles_3d_editor_plugin.cpp b/editor/plugins/gpu_particles_3d_editor_plugin.cpp
index fa971679e6..5461fda58b 100644
--- a/editor/plugins/gpu_particles_3d_editor_plugin.cpp
+++ b/editor/plugins/gpu_particles_3d_editor_plugin.cpp
@@ -363,10 +363,7 @@ void GPUParticles3DEditor::_generate_emission_points() {
}
Ref<Image> image = memnew(Image(w, h, false, Image::FORMAT_RGBF, point_img));
-
- Ref<ImageTexture> tex;
- tex.instantiate();
- tex->create_from_image(image);
+ Ref<ImageTexture> tex = ImageTexture::create_from_image(image);
Ref<ParticlesMaterial> material = node->get_process_material();
ERR_FAIL_COND(material.is_null());
@@ -392,12 +389,7 @@ void GPUParticles3DEditor::_generate_emission_points() {
}
Ref<Image> image2 = memnew(Image(w, h, false, Image::FORMAT_RGBF, point_img2));
-
- Ref<ImageTexture> tex2;
- tex2.instantiate();
- tex2->create_from_image(image2);
-
- material->set_emission_normal_texture(tex2);
+ material->set_emission_normal_texture(ImageTexture::create_from_image(image2));
} else {
material->set_emission_shape(ParticlesMaterial::EMISSION_SHAPE_POINTS);
material->set_emission_point_count(point_count);
diff --git a/editor/plugins/tiles/atlas_merging_dialog.cpp b/editor/plugins/tiles/atlas_merging_dialog.cpp
index e37878ff98..02fe65378d 100644
--- a/editor/plugins/tiles/atlas_merging_dialog.cpp
+++ b/editor/plugins/tiles/atlas_merging_dialog.cpp
@@ -116,12 +116,8 @@ void AtlasMergingDialog::_generate_merged(Vector<Ref<TileSetAtlasSource>> p_atla
}
}
- Ref<ImageTexture> output_image_texture;
- output_image_texture.instantiate();
- output_image_texture->create_from_image(output_image);
-
merged->set_name(p_atlas_sources[0]->get_name());
- merged->set_texture(output_image_texture);
+ merged->set_texture(ImageTexture::create_from_image(output_image));
merged->set_texture_region_size(new_texture_region_size);
}
}
diff --git a/editor/plugins/tiles/tiles_editor_plugin.cpp b/editor/plugins/tiles/tiles_editor_plugin.cpp
index 543304346e..419d0ffcfc 100644
--- a/editor/plugins/tiles/tiles_editor_plugin.cpp
+++ b/editor/plugins/tiles/tiles_editor_plugin.cpp
@@ -121,12 +121,9 @@ void TilesEditorPlugin::_thread() {
pattern_preview_done.wait();
Ref<Image> image = viewport->get_texture()->get_image();
- Ref<ImageTexture> image_texture;
- image_texture.instantiate();
- image_texture->create_from_image(image);
// Find the index for the given pattern. TODO: optimize.
- Variant args[] = { item.pattern, image_texture };
+ Variant args[] = { item.pattern, ImageTexture::create_from_image(image) };
const Variant *args_ptr[] = { &args[0], &args[1] };
Variant r;
Callable::CallError error;
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index e81dfdd1cd..d1aa1ceae6 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -1167,9 +1167,7 @@ void ProjectList::load_project_icon(int p_index) {
Error err = img->load(item.icon.replace_first("res://", item.path + "/"));
if (err == OK) {
img->resize(default_icon->get_width(), default_icon->get_height(), Image::INTERPOLATE_LANCZOS);
- Ref<ImageTexture> it = memnew(ImageTexture);
- it->create_from_image(img);
- icon = it;
+ icon = ImageTexture::create_from_image(img);
}
}
if (icon.is_null()) {