diff options
| author | Juan Linietsky | 2017-05-17 07:36:47 -0300 |
|---|---|---|
| committer | Juan Linietsky | 2017-05-17 07:37:45 -0300 |
| commit | 98a329670227c726a5d7a196e5cba8dbdd54301b (patch) | |
| tree | 7346f7a3e38eb35b784ac1a68a227d07cc8881b4 /editor/plugins | |
| parent | d801ff2b3db2de105c1b36a74ce116e360143d4e (diff) | |
| download | godot-98a329670227c726a5d7a196e5cba8dbdd54301b.tar.gz godot-98a329670227c726a5d7a196e5cba8dbdd54301b.tar.zst godot-98a329670227c726a5d7a196e5cba8dbdd54301b.zip | |
Removal of Image from Variant, converted to a Resource.
Diffstat (limited to 'editor/plugins')
| -rw-r--r-- | editor/plugins/baked_light_baker.h | 2 | ||||
| -rw-r--r-- | editor/plugins/gradient_texture_editor_plugin.cpp | 3 | ||||
| -rw-r--r-- | editor/plugins/particles_2d_editor_plugin.cpp | 15 | ||||
| -rw-r--r-- | editor/plugins/particles_editor_plugin.cpp | 4 | ||||
| -rw-r--r-- | editor/plugins/spatial_editor_plugin.h | 2 | ||||
| -rw-r--r-- | editor/plugins/texture_region_editor_plugin.cpp | 9 |
6 files changed, 19 insertions, 16 deletions
diff --git a/editor/plugins/baked_light_baker.h b/editor/plugins/baked_light_baker.h index 5f32e236c..123812fc0 100644 --- a/editor/plugins/baked_light_baker.h +++ b/editor/plugins/baked_light_baker.h @@ -31,7 +31,7 @@ #define BAKED_LIGHT_BAKER_H #include "os/thread.h" -#include "scene/3d/baked_light_instance.h" + #include "scene/3d/light.h" #include "scene/3d/mesh_instance.h" diff --git a/editor/plugins/gradient_texture_editor_plugin.cpp b/editor/plugins/gradient_texture_editor_plugin.cpp index 41dd64d93..005633a10 100644 --- a/editor/plugins/gradient_texture_editor_plugin.cpp +++ b/editor/plugins/gradient_texture_editor_plugin.cpp @@ -48,7 +48,8 @@ GradientTextureEdit::GradientTextureEdit() { add_child(popup); checker = Ref<ImageTexture>(memnew(ImageTexture)); - checker->create_from_image(Image(checker_bg_png), ImageTexture::FLAG_REPEAT); + Ref<Image> checker_bg = memnew(Image(checker_bg_png)); + checker->create_from_image(checker_bg, ImageTexture::FLAG_REPEAT); } int GradientTextureEdit::_get_point_from_pos(int x) { diff --git a/editor/plugins/particles_2d_editor_plugin.cpp b/editor/plugins/particles_2d_editor_plugin.cpp index 35743ce0b..c6c85d8be 100644 --- a/editor/plugins/particles_2d_editor_plugin.cpp +++ b/editor/plugins/particles_2d_editor_plugin.cpp @@ -64,17 +64,18 @@ void Particles2DEditorPlugin::_file_selected(const String &p_file) { int epc = epoints->get_value(); - Image img; - Error err = ImageLoader::load_image(p_file, &img); + Ref<Image> img; + img.instance(); + Error err = ImageLoader::load_image(p_file, img); ERR_EXPLAIN(TTR("Error loading image:") + " " + p_file); ERR_FAIL_COND(err != OK); - img.convert(Image::FORMAT_LA8); - ERR_FAIL_COND(img.get_format() != Image::FORMAT_LA8); - Size2i s = Size2(img.get_width(), img.get_height()); + img->convert(Image::FORMAT_LA8); + ERR_FAIL_COND(img->get_format() != Image::FORMAT_LA8); + Size2i s = Size2(img->get_width(), img->get_height()); ERR_FAIL_COND(s.width == 0 || s.height == 0); - PoolVector<uint8_t> data = img.get_data(); + PoolVector<uint8_t> data = img->get_data(); PoolVector<uint8_t>::Read r = data.read(); Vector<Point2i> valid_positions; @@ -98,7 +99,7 @@ void Particles2DEditorPlugin::_file_selected(const String &p_file) { epoints.resize(epc); PoolVector<Point2>::Write w = epoints.write(); - Size2 extents = Size2(img.get_width() * 0.5, img.get_height() * 0.5); + Size2 extents = Size2(img->get_width() * 0.5, img->get_height() * 0.5); for (int i = 0; i < epc; i++) { diff --git a/editor/plugins/particles_editor_plugin.cpp b/editor/plugins/particles_editor_plugin.cpp index 4c84e831c..dc2da80b0 100644 --- a/editor/plugins/particles_editor_plugin.cpp +++ b/editor/plugins/particles_editor_plugin.cpp @@ -329,7 +329,7 @@ void ParticlesEditor::_generate_emission_points() { copymem(iw.ptr(), r.ptr(), point_count * sizeof(float) * 3); } - Image image(w, h, false, Image::FORMAT_RGBF, point_img); + Ref<Image> image = memnew(Image(w, h, false, Image::FORMAT_RGBF, point_img)); Ref<ImageTexture> tex; tex.instance(); @@ -354,7 +354,7 @@ void ParticlesEditor::_generate_emission_points() { copymem(iw.ptr(), r.ptr(), point_count * sizeof(float) * 3); } - Image image2(w, h, false, Image::FORMAT_RGBF, point_img2); + Ref<Image> image2 = memnew(Image(w, h, false, Image::FORMAT_RGBF, point_img2)); Ref<ImageTexture> tex2; tex2.instance(); diff --git a/editor/plugins/spatial_editor_plugin.h b/editor/plugins/spatial_editor_plugin.h index 01435028a..3e46724ef 100644 --- a/editor/plugins/spatial_editor_plugin.h +++ b/editor/plugins/spatial_editor_plugin.h @@ -428,7 +428,7 @@ private: ViewportContainer *settings_light_base; Viewport *settings_light_vp; ColorPickerButton *settings_ambient_color; - Image settings_light_dir_image; + Ref<Image> settings_light_dir_image; void _xform_dialog_action(); void _menu_item_pressed(int p_option); diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp index 4c49b467d..89995edf0 100644 --- a/editor/plugins/texture_region_editor_plugin.cpp +++ b/editor/plugins/texture_region_editor_plugin.cpp @@ -678,12 +678,13 @@ void TextureRegionEditor::_edit_region() { } autoslice_cache.clear(); - Image i; - if (i.load(texture->get_path()) == OK) { + Ref<Image> i; + i.instance(); + if (i->load(texture->get_path()) == OK) { BitMap bm; bm.create_from_image_alpha(i); - for (int y = 0; y < i.get_height(); y++) { - for (int x = 0; x < i.get_width(); x++) { + for (int y = 0; y < i->get_height(); y++) { + for (int x = 0; x < i->get_width(); x++) { if (bm.get_bit(Point2(x, y))) { bool found = false; for (List<Rect2>::Element *E = autoslice_cache.front(); E; E = E->next()) { |
