diff options
Diffstat (limited to 'scene/resources')
-rw-r--r-- | scene/resources/camera_effects.cpp | 2 | ||||
-rw-r--r-- | scene/resources/camera_effects.h | 5 | ||||
-rw-r--r-- | scene/resources/convex_polygon_shape_2d.cpp | 4 | ||||
-rw-r--r-- | scene/resources/navigation_mesh.cpp | 2 | ||||
-rw-r--r-- | scene/resources/style_box.cpp | 7 | ||||
-rw-r--r-- | scene/resources/style_box.h | 1 | ||||
-rw-r--r-- | scene/resources/texture.cpp | 2 |
7 files changed, 16 insertions, 7 deletions
diff --git a/scene/resources/camera_effects.cpp b/scene/resources/camera_effects.cpp index 00312fc7b2..34c6bc05bc 100644 --- a/scene/resources/camera_effects.cpp +++ b/scene/resources/camera_effects.cpp @@ -145,7 +145,6 @@ void CameraEffects::_update_override_exposure() { // Private methods, constructor and destructor -#ifdef TOOLS_ENABLED void CameraEffects::_validate_property(PropertyInfo &property) const { if ((!dof_blur_far_enabled && (property.name == "dof_blur_far_distance" || property.name == "dof_blur_far_transition")) || (!dof_blur_near_enabled && (property.name == "dof_blur_near_distance" || property.name == "dof_blur_near_transition")) || @@ -153,7 +152,6 @@ void CameraEffects::_validate_property(PropertyInfo &property) const { property.usage = PROPERTY_USAGE_NOEDITOR; } } -#endif void CameraEffects::_bind_methods() { // DOF blur diff --git a/scene/resources/camera_effects.h b/scene/resources/camera_effects.h index 51fb2b6cf7..b9338f4806 100644 --- a/scene/resources/camera_effects.h +++ b/scene/resources/camera_effects.h @@ -57,12 +57,9 @@ private: float override_exposure = 1.0; void _update_override_exposure(); -#ifdef TOOLS_ENABLED - void _validate_property(PropertyInfo &property) const override; -#endif - protected: static void _bind_methods(); + void _validate_property(PropertyInfo &property) const override; public: virtual RID get_rid() const override; diff --git a/scene/resources/convex_polygon_shape_2d.cpp b/scene/resources/convex_polygon_shape_2d.cpp index d331f83daf..6e56f6e7fc 100644 --- a/scene/resources/convex_polygon_shape_2d.cpp +++ b/scene/resources/convex_polygon_shape_2d.cpp @@ -72,6 +72,10 @@ void ConvexPolygonShape2D::_bind_methods() { } void ConvexPolygonShape2D::draw(const RID &p_to_rid, const Color &p_color) { + if (points.size() < 3) { + return; + } + Vector<Color> col; col.push_back(p_color); RenderingServer::get_singleton()->canvas_item_add_polygon(p_to_rid, points, col); diff --git a/scene/resources/navigation_mesh.cpp b/scene/resources/navigation_mesh.cpp index 84f3c23f77..8c12f59a00 100644 --- a/scene/resources/navigation_mesh.cpp +++ b/scene/resources/navigation_mesh.cpp @@ -31,6 +31,8 @@ #include "navigation_mesh.h" void NavigationMesh::create_from_mesh(const Ref<Mesh> &p_mesh) { + ERR_FAIL_COND(p_mesh.is_null()); + vertices = Vector<Vector3>(); clear_polygons(); diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp index 9b80224c3f..2159f1bc97 100644 --- a/scene/resources/style_box.cpp +++ b/scene/resources/style_box.cpp @@ -460,6 +460,7 @@ Point2 StyleBoxFlat::get_shadow_offset() const { void StyleBoxFlat::set_anti_aliased(const bool &p_anti_aliased) { anti_aliased = p_anti_aliased; emit_changed(); + notify_property_list_changed(); } bool StyleBoxFlat::is_anti_aliased() const { @@ -781,6 +782,12 @@ float StyleBoxFlat::get_style_margin(Side p_side) const { return border_width[p_side]; } +void StyleBoxFlat::_validate_property(PropertyInfo &property) const { + if (!anti_aliased && property.name == "anti_aliasing_size") { + property.usage = PROPERTY_USAGE_NOEDITOR; + } +} + void StyleBoxFlat::_bind_methods() { ClassDB::bind_method(D_METHOD("set_bg_color", "color"), &StyleBoxFlat::set_bg_color); ClassDB::bind_method(D_METHOD("get_bg_color"), &StyleBoxFlat::get_bg_color); diff --git a/scene/resources/style_box.h b/scene/resources/style_box.h index 8a273afbfd..dd5c873a00 100644 --- a/scene/resources/style_box.h +++ b/scene/resources/style_box.h @@ -159,6 +159,7 @@ class StyleBoxFlat : public StyleBox { protected: virtual float get_style_margin(Side p_side) const override; static void _bind_methods(); + void _validate_property(PropertyInfo &property) const override; public: //Color diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index 8cccf81659..d2bb1338d8 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -151,7 +151,7 @@ void ImageTexture::_reload_hook(const RID &p_hook) { } void ImageTexture::create_from_image(const Ref<Image> &p_image) { - ERR_FAIL_COND_MSG(p_image.is_null(), "Invalid image"); + ERR_FAIL_COND_MSG(p_image.is_null() || p_image->is_empty(), "Invalid image"); w = p_image->get_width(); h = p_image->get_height(); format = p_image->get_format(); |