summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/line_builder.h2
-rw-r--r--scene/gui/control.h2
-rw-r--r--scene/gui/reference_rect.cpp18
-rw-r--r--scene/gui/reference_rect.h5
-rw-r--r--scene/main/node.cpp4
-rw-r--r--scene/main/viewport.h2
-rw-r--r--scene/resources/default_theme/default_theme.cpp1
-rw-r--r--scene/resources/material.cpp2
-rw-r--r--scene/resources/texture.cpp13
-rw-r--r--scene/resources/texture.h4
10 files changed, 42 insertions, 11 deletions
diff --git a/scene/2d/line_builder.h b/scene/2d/line_builder.h
index b1c62f84e2..edfdf97c47 100644
--- a/scene/2d/line_builder.h
+++ b/scene/2d/line_builder.h
@@ -33,8 +33,8 @@
#include "color.h"
#include "line_2d.h"
-#include "math_2d.h"
#include "scene/resources/color_ramp.h"
+#include "vector2.h"
class LineBuilder {
public:
diff --git a/scene/gui/control.h b/scene/gui/control.h
index 6bea04345b..c6bd2f097d 100644
--- a/scene/gui/control.h
+++ b/scene/gui/control.h
@@ -31,13 +31,13 @@
#ifndef CONTROL_H
#define CONTROL_H
-#include "math_2d.h"
#include "rid.h"
#include "scene/2d/canvas_item.h"
#include "scene/gui/shortcut.h"
#include "scene/main/node.h"
#include "scene/main/timer.h"
#include "scene/resources/theme.h"
+#include "transform_2d.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
diff --git a/scene/gui/reference_rect.cpp b/scene/gui/reference_rect.cpp
index 5e25f43daf..74e68598f4 100644
--- a/scene/gui/reference_rect.cpp
+++ b/scene/gui/reference_rect.cpp
@@ -39,9 +39,25 @@ void ReferenceRect::_notification(int p_what) {
if (!is_inside_tree())
return;
if (Engine::get_singleton()->is_editor_hint())
- draw_style_box(get_stylebox("border"), Rect2(Point2(), get_size()));
+ draw_rect(Rect2(Point2(), get_size()), border_color, false);
}
}
+void ReferenceRect::set_border_color(const Color &color) {
+ border_color = color;
+}
+
+Color ReferenceRect::get_border_color() const {
+ return border_color;
+}
+
+void ReferenceRect::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("get_border_color"), &ReferenceRect::get_border_color);
+ ClassDB::bind_method(D_METHOD("set_border_color", "color"), &ReferenceRect::set_border_color);
+
+ ADD_PROPERTY(PropertyInfo(Variant::COLOR, "border_color"), "set_border_color", "get_border_color");
+}
+
ReferenceRect::ReferenceRect() {
+ border_color = Color(1, 0, 0);
}
diff --git a/scene/gui/reference_rect.h b/scene/gui/reference_rect.h
index 473e348c85..9fad1a06b0 100644
--- a/scene/gui/reference_rect.h
+++ b/scene/gui/reference_rect.h
@@ -36,12 +36,17 @@
class ReferenceRect : public Control {
GDCLASS(ReferenceRect, Control);
+ Color border_color;
protected:
void _notification(int p_what);
+ static void _bind_methods();
public:
ReferenceRect();
+
+ void set_border_color(const Color &color);
+ Color get_border_color() const;
};
#endif // REFERENCE_RECT_H
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 6144240328..d6a80bfb1a 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -2555,6 +2555,9 @@ void Node::clear_internal_tree_resource_paths() {
String Node::get_configuration_warning() const {
+ if (get_script_instance() && get_script_instance()->has_method("_get_configuration_warning")) {
+ return get_script_instance()->call("_get_configuration_warning");
+ }
return String();
}
@@ -2763,6 +2766,7 @@ void Node::_bind_methods() {
BIND_VMETHOD(MethodInfo("_input", PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent")));
BIND_VMETHOD(MethodInfo("_unhandled_input", PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent")));
BIND_VMETHOD(MethodInfo("_unhandled_key_input", PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEventKey")));
+ BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_configuration_warning"));
//ClassDB::bind_method(D_METHOD("get_child",&Node::get_child,PH("index")));
//ClassDB::bind_method(D_METHOD("get_node",&Node::get_node,PH("path")));
diff --git a/scene/main/viewport.h b/scene/main/viewport.h
index e717d27069..e4ef373c77 100644
--- a/scene/main/viewport.h
+++ b/scene/main/viewport.h
@@ -31,11 +31,11 @@
#ifndef VIEWPORT_H
#define VIEWPORT_H
-#include "math_2d.h"
#include "scene/main/node.h"
#include "scene/resources/texture.h"
#include "scene/resources/world_2d.h"
#include "servers/visual_server.h"
+#include "transform_2d.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
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/material.cpp b/scene/resources/material.cpp
index dc29102492..875b72159a 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -694,8 +694,6 @@ void SpatialMaterial::_update_shader() {
}
code += "\t\tbase_uv=ofs;\n";
- code += "\t\tif(base_uv.x > 1.0 || base_uv.y > 1.0 || base_uv.x < 0.0 || base_uv.y < 0.0)\n";
- code += "\t\t\tdiscard;\n";
if (features[FEATURE_DETAIL] && detail_uv == DETAIL_UV_2) {
code += "\t\tbase_uv2-=ofs;\n";
}
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;