diff options
Diffstat (limited to 'scene/resources')
-rw-r--r-- | scene/resources/bit_mask.cpp | 101 | ||||
-rw-r--r-- | scene/resources/default_theme/default_theme.cpp | 1 | ||||
-rw-r--r-- | scene/resources/physics_material.h | 2 | ||||
-rw-r--r-- | scene/resources/texture.cpp | 13 | ||||
-rw-r--r-- | scene/resources/texture.h | 4 |
5 files changed, 65 insertions, 56 deletions
diff --git a/scene/resources/bit_mask.cpp b/scene/resources/bit_mask.cpp index ec1aa7ec46..39206ed043 100644 --- a/scene/resources/bit_mask.cpp +++ b/scene/resources/bit_mask.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "bit_mask.h" + #include "io/image_loader.h" void BitMap::create(const Size2 &p_size) { @@ -189,13 +190,13 @@ Vector<Vector2> BitMap::_march_square(const Rect2i &rect, const Point2i &start) { //square value /* - checking the 2x2 pixel grid, assigning these values to each pixel, if not transparent - +---+---+ - | 1 | 2 | - +---+---+ - | 4 | 8 | <- current pixel (curx,cury) - +---+---+ - */ + checking the 2x2 pixel grid, assigning these values to each pixel, if not transparent + +---+---+ + | 1 | 2 | + +---+---+ + | 4 | 8 | <- current pixel (curx,cury) + +---+---+ + */ //NOTE: due to the way we pick points from texture, rect needs to be smaller, otherwise it goes outside 1 pixel Rect2i fixed_rect = Rect2i(rect.position, rect.size - Size2i(2, 2)); Point2i tl = Point2i(curx - 1, cury - 1); @@ -215,13 +216,13 @@ Vector<Vector2> BitMap::_march_square(const Rect2i &rect, const Point2i &start) case 5: case 13: /* going UP with these cases: - 1 5 13 - +---+---+ +---+---+ +---+---+ - | 1 | | | 1 | | | 1 | | - +---+---+ +---+---+ +---+---+ - | | | | 4 | | | 4 | 8 | - +---+---+ +---+---+ +---+---+ - */ + 1 5 13 + +---+---+ +---+---+ +---+---+ + | 1 | | | 1 | | | 1 | | + +---+---+ +---+---+ +---+---+ + | | | | 4 | | | 4 | 8 | + +---+---+ +---+---+ +---+---+ + */ stepx = 0; stepy = -1; break; @@ -230,13 +231,13 @@ Vector<Vector2> BitMap::_march_square(const Rect2i &rect, const Point2i &start) case 10: case 11: /* going DOWN with these cases: - 8 10 11 - +---+---+ +---+---+ +---+---+ - | | | | | 2 | | 1 | 2 | - +---+---+ +---+---+ +---+---+ - | | 8 | | | 8 | | | 8 | - +---+---+ +---+---+ +---+---+ - */ + 8 10 11 + +---+---+ +---+---+ +---+---+ + | | | | | 2 | | 1 | 2 | + +---+---+ +---+---+ +---+---+ + | | 8 | | | 8 | | | 8 | + +---+---+ +---+---+ +---+---+ + */ stepx = 0; stepy = 1; break; @@ -245,13 +246,13 @@ Vector<Vector2> BitMap::_march_square(const Rect2i &rect, const Point2i &start) case 12: case 14: /* going LEFT with these cases: - 4 12 14 - +---+---+ +---+---+ +---+---+ - | | | | | | | | 2 | - +---+---+ +---+---+ +---+---+ - | 4 | | | 4 | 8 | | 4 | 8 | - +---+---+ +---+---+ +---+---+ - */ + 4 12 14 + +---+---+ +---+---+ +---+---+ + | | | | | | | | 2 | + +---+---+ +---+---+ +---+---+ + | 4 | | | 4 | 8 | | 4 | 8 | + +---+---+ +---+---+ +---+---+ + */ stepx = -1; stepy = 0; break; @@ -260,25 +261,25 @@ Vector<Vector2> BitMap::_march_square(const Rect2i &rect, const Point2i &start) case 3: case 7: /* going RIGHT with these cases: - 2 3 7 - +---+---+ +---+---+ +---+---+ - | | 2 | | 1 | 2 | | 1 | 2 | - +---+---+ +---+---+ +---+---+ - | | | | | | | 4 | | - +---+---+ +---+---+ +---+---+ - */ + 2 3 7 + +---+---+ +---+---+ +---+---+ + | | 2 | | 1 | 2 | | 1 | 2 | + +---+---+ +---+---+ +---+---+ + | | | | | | | 4 | | + +---+---+ +---+---+ +---+---+ + */ stepx = 1; stepy = 0; break; case 9: /* - +---+---+ - | 1 | | - +---+---+ - | | 8 | - +---+---+ - this should normally go UP, but if we already been here, we go down - */ + +---+---+ + | 1 | | + +---+---+ + | | 8 | + +---+---+ + this should normally go UP, but if we already been here, we go down + */ if (case9s.has(Point2i(curx, cury))) { //found, so we go down, and delete from case9s; stepx = 0; @@ -293,14 +294,14 @@ Vector<Vector2> BitMap::_march_square(const Rect2i &rect, const Point2i &start) break; case 6: /* - 6 - +---+---+ - | | 2 | - +---+---+ - | 4 | | - +---+---+ - this normally go RIGHT, but if its coming from UP, it should go LEFT - */ + 6 + +---+---+ + | | 2 | + +---+---+ + | 4 | | + +---+---+ + this normally go RIGHT, but if its coming from UP, it should go LEFT + */ if (case6s.has(Point2i(curx, cury))) { //found, so we go down, and delete from case6s; stepx = -1; diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index 2d05f5e19f..0eee2ae393 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -867,7 +867,6 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const Ref<StyleBoxTexture> ttnc = make_stylebox(full_panel_bg_png, 8, 8, 8, 8); ttnc->set_draw_center(false); - theme->set_stylebox("border", "ReferenceRect", make_stylebox(reference_border_png, 4, 4, 4, 4)); theme->set_stylebox("panelnc", "Panel", ttnc); theme->set_stylebox("panelf", "Panel", tc_sb); diff --git a/scene/resources/physics_material.h b/scene/resources/physics_material.h index dfe48d94cf..c69e44a7da 100644 --- a/scene/resources/physics_material.h +++ b/scene/resources/physics_material.h @@ -37,7 +37,7 @@ class PhysicsMaterial : public Resource { GDCLASS(PhysicsMaterial, Resource); OBJ_SAVE_TYPE(PhysicsMaterial); - RES_BASE_EXTENSION("PhyMat"); + RES_BASE_EXTENSION("phymat"); real_t friction; bool rough; diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index 536c653a0c..96edb17eea 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -214,9 +214,10 @@ Image::Format ImageTexture::get_format() const { return format; } - +#ifndef DISABLE_DEPRECATED Error ImageTexture::load(const String &p_path) { + WARN_DEPRECATED Ref<Image> img; img.instance(); Error err = img->load(p_path); @@ -225,7 +226,7 @@ Error ImageTexture::load(const String &p_path) { } return err; } - +#endif void ImageTexture::set_data(const Ref<Image> &p_image) { ERR_FAIL_COND(p_image.is_null()); @@ -345,7 +346,9 @@ void ImageTexture::_bind_methods() { ClassDB::bind_method(D_METHOD("create", "width", "height", "format", "flags"), &ImageTexture::create, DEFVAL(FLAGS_DEFAULT)); ClassDB::bind_method(D_METHOD("create_from_image", "image", "flags"), &ImageTexture::create_from_image, DEFVAL(FLAGS_DEFAULT)); ClassDB::bind_method(D_METHOD("get_format"), &ImageTexture::get_format); +#ifndef DISABLE_DEPRECATED ClassDB::bind_method(D_METHOD("load", "path"), &ImageTexture::load); +#endif ClassDB::bind_method(D_METHOD("set_data", "image"), &ImageTexture::set_data); ClassDB::bind_method(D_METHOD("set_storage", "mode"), &ImageTexture::set_storage); ClassDB::bind_method(D_METHOD("get_storage"), &ImageTexture::get_storage); @@ -618,7 +621,11 @@ Error StreamTexture::_load_data(const String &p_path, int &tw, int &th, int &fla memdelete(f); - if (bytes != total_size - ofs) { + int expected = total_size - ofs; + if (bytes < expected) { + //this is a compatibility workaround for older format, which saved less mipmaps. It is still recommended the image is reimported. + zeromem(w.ptr() + bytes, (expected - bytes)); + } else if (bytes != expected) { ERR_FAIL_V(ERR_FILE_CORRUPT); } } diff --git a/scene/resources/texture.h b/scene/resources/texture.h index 1c18189b2c..c1331fb3fe 100644 --- a/scene/resources/texture.h +++ b/scene/resources/texture.h @@ -33,9 +33,9 @@ #include "curve.h" #include "io/resource_loader.h" -#include "math_2d.h" #include "os/mutex.h" #include "os/thread_safe.h" +#include "rect2.h" #include "resource.h" #include "scene/resources/color_ramp.h" #include "servers/visual_server.h" @@ -125,7 +125,9 @@ public: void set_flags(uint32_t p_flags); uint32_t get_flags() const; Image::Format get_format() const; +#ifndef DISABLE_DEPRECATED Error load(const String &p_path); +#endif void set_data(const Ref<Image> &p_image); Ref<Image> get_data() const; |