summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/animated_sprite.cpp2
-rw-r--r--scene/2d/camera_2d.cpp18
-rw-r--r--scene/2d/canvas_item.cpp55
-rw-r--r--scene/2d/canvas_item.h2
-rw-r--r--scene/2d/collision_object_2d.cpp2
-rw-r--r--scene/2d/light_2d.cpp2
-rw-r--r--scene/2d/light_occluder_2d.cpp2
-rw-r--r--scene/2d/path_2d.cpp2
-rw-r--r--scene/2d/physics_body_2d.cpp2
-rw-r--r--scene/2d/polygon_2d.cpp2
-rw-r--r--scene/2d/remote_transform_2d.cpp7
-rw-r--r--scene/2d/remote_transform_2d.h2
-rw-r--r--scene/2d/skeleton_2d.cpp4
-rw-r--r--scene/2d/tile_map.cpp16
-rw-r--r--scene/2d/tile_map.h7
-rw-r--r--scene/2d/visibility_notifier_2d.cpp2
-rw-r--r--scene/3d/arvr_nodes.cpp2
-rw-r--r--scene/3d/collision_object.cpp2
-rw-r--r--scene/3d/collision_shape.cpp2
-rw-r--r--scene/3d/light.cpp19
-rw-r--r--scene/3d/light.h2
-rw-r--r--scene/3d/path.cpp2
-rw-r--r--scene/3d/physics_body.cpp2
-rw-r--r--scene/3d/remote_transform.cpp9
-rw-r--r--scene/3d/remote_transform.h2
-rw-r--r--scene/3d/sprite_3d.cpp2
-rw-r--r--scene/3d/world_environment.cpp2
-rw-r--r--scene/animation/animation_tree.cpp12
-rw-r--r--scene/gui/container.cpp4
-rw-r--r--scene/gui/control.cpp2
-rw-r--r--scene/gui/popup.cpp2
-rw-r--r--scene/gui/range.cpp4
-rw-r--r--scene/gui/rich_text_label.cpp32
-rw-r--r--scene/gui/scroll_container.cpp2
-rw-r--r--scene/gui/spin_box.cpp2
-rw-r--r--scene/gui/spin_box.h2
-rw-r--r--scene/gui/text_edit.cpp42
-rw-r--r--scene/gui/text_edit.h1
-rw-r--r--scene/gui/tree.cpp33
-rw-r--r--scene/gui/tree.h4
-rw-r--r--scene/main/http_request.cpp37
-rw-r--r--scene/main/http_request.h13
-rw-r--r--scene/main/node.cpp14
-rw-r--r--scene/main/node.h2
-rw-r--r--scene/main/scene_tree.cpp2
-rw-r--r--scene/main/scene_tree.h2
-rw-r--r--scene/main/viewport.cpp3
-rw-r--r--scene/resources/animation.cpp2
-rw-r--r--scene/resources/animation.h2
-rw-r--r--scene/resources/default_theme/default_theme.cpp36
-rw-r--r--scene/resources/surface_tool.cpp2
-rw-r--r--scene/resources/surface_tool.h2
52 files changed, 261 insertions, 171 deletions
diff --git a/scene/2d/animated_sprite.cpp b/scene/2d/animated_sprite.cpp
index b7ace804ef..c7f622dee3 100644
--- a/scene/2d/animated_sprite.cpp
+++ b/scene/2d/animated_sprite.cpp
@@ -663,7 +663,7 @@ StringName AnimatedSprite::get_animation() const {
String AnimatedSprite::get_configuration_warning() const {
if (frames.is_null()) {
- return TTR("A SpriteFrames resource must be created or set in the 'Frames' property in order for AnimatedSprite to display frames.");
+ return TTR("A SpriteFrames resource must be created or set in the \"Frames\" property in order for AnimatedSprite to display frames.");
}
return String();
diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp
index a0d74dd283..6011941142 100644
--- a/scene/2d/camera_2d.cpp
+++ b/scene/2d/camera_2d.cpp
@@ -140,9 +140,6 @@ Transform2D Camera2D::get_camera_transform() {
Point2 screen_offset = (anchor_mode == ANCHOR_MODE_DRAG_CENTER ? (screen_size * 0.5 * zoom) : Point2());
Rect2 screen_rect(-screen_offset + camera_pos, screen_size * zoom);
- if (offset != Vector2())
- screen_rect.position += offset;
-
if (limit_smoothing_enabled) {
if (screen_rect.position.x < limit[MARGIN_LEFT])
camera_pos.x -= screen_rect.position.x - limit[MARGIN_LEFT];
@@ -193,21 +190,8 @@ Transform2D Camera2D::get_camera_transform() {
if (screen_rect.position.y < limit[MARGIN_TOP])
screen_rect.position.y = limit[MARGIN_TOP];
- if (offset != Vector2()) {
-
+ if (offset != Vector2())
screen_rect.position += offset;
- if (screen_rect.position.x + screen_rect.size.x > limit[MARGIN_RIGHT])
- screen_rect.position.x = limit[MARGIN_RIGHT] - screen_rect.size.x;
-
- if (screen_rect.position.y + screen_rect.size.y > limit[MARGIN_BOTTOM])
- screen_rect.position.y = limit[MARGIN_BOTTOM] - screen_rect.size.y;
-
- if (screen_rect.position.x < limit[MARGIN_LEFT])
- screen_rect.position.x = limit[MARGIN_LEFT];
-
- if (screen_rect.position.y < limit[MARGIN_TOP])
- screen_rect.position.y = limit[MARGIN_TOP];
- }
camera_screen_center = screen_rect.position + screen_rect.size * 0.5;
diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp
index 23f6404e3e..7368efd21a 100644
--- a/scene/2d/canvas_item.cpp
+++ b/scene/2d/canvas_item.cpp
@@ -759,7 +759,7 @@ void CanvasItem::draw_multiline_colors(const Vector<Point2> &p_points, const Vec
VisualServer::get_singleton()->canvas_item_add_multiline(canvas_item, p_points, p_colors, p_width, p_antialiased);
}
-void CanvasItem::draw_rect(const Rect2 &p_rect, const Color &p_color, bool p_filled) {
+void CanvasItem::draw_rect(const Rect2 &p_rect, const Color &p_color, bool p_filled, float p_width, bool p_antialiased) {
if (!drawing) {
ERR_EXPLAIN("Drawing is only allowed inside NOTIFICATION_DRAW, _draw() function or 'draw' signal.");
@@ -767,13 +767,53 @@ void CanvasItem::draw_rect(const Rect2 &p_rect, const Color &p_color, bool p_fil
}
if (p_filled) {
+ if (p_width != 1.0) {
+ WARN_PRINT("The draw_rect() \"width\" argument has no effect when \"filled\" is \"true\".");
+ }
+
+ if (p_antialiased) {
+ WARN_PRINT("The draw_rect() \"antialiased\" argument has no effect when \"filled\" is \"true\".");
+ }
VisualServer::get_singleton()->canvas_item_add_rect(canvas_item, p_rect, p_color);
} else {
- VisualServer::get_singleton()->canvas_item_add_line(canvas_item, p_rect.position, p_rect.position + Size2(p_rect.size.width, 0), p_color);
- VisualServer::get_singleton()->canvas_item_add_line(canvas_item, p_rect.position, p_rect.position + Size2(0, p_rect.size.height), p_color);
- VisualServer::get_singleton()->canvas_item_add_line(canvas_item, p_rect.position + Point2(0, p_rect.size.height), p_rect.position + p_rect.size, p_color);
- VisualServer::get_singleton()->canvas_item_add_line(canvas_item, p_rect.position + Point2(p_rect.size.width, 0), p_rect.position + p_rect.size, p_color);
+ // Thick lines are offset depending on their width to avoid partial overlapping.
+ // Thin lines don't require an offset, so don't apply one in this case
+ float offset;
+ if (p_width >= 2) {
+ offset = p_width / 2.0;
+ } else {
+ offset = 0.0;
+ }
+
+ VisualServer::get_singleton()->canvas_item_add_line(
+ canvas_item,
+ p_rect.position + Point2(-offset, 0),
+ p_rect.position + Size2(p_rect.size.width + offset, 0),
+ p_color,
+ p_width,
+ p_antialiased);
+ VisualServer::get_singleton()->canvas_item_add_line(
+ canvas_item,
+ p_rect.position + Point2(0, offset),
+ p_rect.position + Size2(0, p_rect.size.height - offset),
+ p_color,
+ p_width,
+ p_antialiased);
+ VisualServer::get_singleton()->canvas_item_add_line(
+ canvas_item,
+ p_rect.position + Point2(-offset, p_rect.size.height),
+ p_rect.position + Size2(p_rect.size.width + offset, p_rect.size.height),
+ p_color,
+ p_width,
+ p_antialiased);
+ VisualServer::get_singleton()->canvas_item_add_line(
+ canvas_item,
+ p_rect.position + Point2(p_rect.size.width, offset),
+ p_rect.position + Size2(p_rect.size.width, p_rect.size.height - offset),
+ p_color,
+ p_width,
+ p_antialiased);
}
}
@@ -928,6 +968,9 @@ float CanvasItem::draw_char(const Ref<Font> &p_font, const Point2 &p_pos, const
ERR_FAIL_COND_V(p_char.length() != 1, 0);
ERR_FAIL_COND_V(p_font.is_null(), 0);
+ if (p_font->has_outline()) {
+ p_font->draw_char(canvas_item, p_pos, p_char[0], p_next.c_str()[0], Color(1, 1, 1), true);
+ }
return p_font->draw_char(canvas_item, p_pos, p_char[0], p_next.c_str()[0], p_modulate);
}
@@ -1158,7 +1201,7 @@ void CanvasItem::_bind_methods() {
ClassDB::bind_method(D_METHOD("draw_polyline_colors", "points", "colors", "width", "antialiased"), &CanvasItem::draw_polyline_colors, DEFVAL(1.0), DEFVAL(false));
ClassDB::bind_method(D_METHOD("draw_multiline", "points", "color", "width", "antialiased"), &CanvasItem::draw_multiline, DEFVAL(1.0), DEFVAL(false));
ClassDB::bind_method(D_METHOD("draw_multiline_colors", "points", "colors", "width", "antialiased"), &CanvasItem::draw_multiline_colors, DEFVAL(1.0), DEFVAL(false));
- ClassDB::bind_method(D_METHOD("draw_rect", "rect", "color", "filled"), &CanvasItem::draw_rect, DEFVAL(true));
+ ClassDB::bind_method(D_METHOD("draw_rect", "rect", "color", "filled", "width", "antialiased"), &CanvasItem::draw_rect, DEFVAL(true), DEFVAL(1.0), DEFVAL(false));
ClassDB::bind_method(D_METHOD("draw_circle", "position", "radius", "color"), &CanvasItem::draw_circle);
ClassDB::bind_method(D_METHOD("draw_texture", "texture", "position", "modulate", "normal_map"), &CanvasItem::draw_texture, DEFVAL(Color(1, 1, 1, 1)), DEFVAL(Variant()));
ClassDB::bind_method(D_METHOD("draw_texture_rect", "texture", "rect", "tile", "modulate", "transpose", "normal_map"), &CanvasItem::draw_texture_rect, DEFVAL(Color(1, 1, 1)), DEFVAL(false), DEFVAL(Variant()));
diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h
index 2604eb04e4..9c6799a441 100644
--- a/scene/2d/canvas_item.h
+++ b/scene/2d/canvas_item.h
@@ -307,7 +307,7 @@ public:
void draw_polyline_colors(const Vector<Point2> &p_points, const Vector<Color> &p_colors, float p_width = 1.0, bool p_antialiased = false);
void draw_multiline(const Vector<Point2> &p_points, const Color &p_color, float p_width = 1.0, bool p_antialiased = false);
void draw_multiline_colors(const Vector<Point2> &p_points, const Vector<Color> &p_colors, float p_width = 1.0, bool p_antialiased = false);
- void draw_rect(const Rect2 &p_rect, const Color &p_color, bool p_filled = true);
+ void draw_rect(const Rect2 &p_rect, const Color &p_color, bool p_filled = true, float p_width = 1.0, bool p_antialiased = false);
void draw_circle(const Point2 &p_pos, float p_radius, const Color &p_color);
void draw_texture(const Ref<Texture> &p_texture, const Point2 &p_pos, const Color &p_modulate = Color(1, 1, 1, 1), const Ref<Texture> &p_normal_map = Ref<Texture>());
void draw_texture_rect(const Ref<Texture> &p_texture, const Rect2 &p_rect, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, const Ref<Texture> &p_normal_map = Ref<Texture>());
diff --git a/scene/2d/collision_object_2d.cpp b/scene/2d/collision_object_2d.cpp
index 36c88e395a..202c7c9cf2 100644
--- a/scene/2d/collision_object_2d.cpp
+++ b/scene/2d/collision_object_2d.cpp
@@ -389,7 +389,7 @@ String CollisionObject2D::get_configuration_warning() const {
if (shapes.empty()) {
if (!warning.empty()) {
- warning += "\n";
+ warning += "\n\n";
}
warning += TTR("This node has no shape, so it can't collide or interact with other objects.\nConsider adding a CollisionShape2D or CollisionPolygon2D as a child to define its shape.");
}
diff --git a/scene/2d/light_2d.cpp b/scene/2d/light_2d.cpp
index 7f01ff8806..7b3eab175a 100644
--- a/scene/2d/light_2d.cpp
+++ b/scene/2d/light_2d.cpp
@@ -347,7 +347,7 @@ void Light2D::_notification(int p_what) {
String Light2D::get_configuration_warning() const {
if (!texture.is_valid()) {
- return TTR("A texture with the shape of the light must be supplied to the 'texture' property.");
+ return TTR("A texture with the shape of the light must be supplied to the \"Texture\" property.");
}
return String();
diff --git a/scene/2d/light_occluder_2d.cpp b/scene/2d/light_occluder_2d.cpp
index 3a3f90ac4b..313b23b9d4 100644
--- a/scene/2d/light_occluder_2d.cpp
+++ b/scene/2d/light_occluder_2d.cpp
@@ -268,7 +268,7 @@ String LightOccluder2D::get_configuration_warning() const {
}
if (occluder_polygon.is_valid() && occluder_polygon->get_polygon().size() == 0) {
- return TTR("The occluder polygon for this occluder is empty. Please draw a polygon!");
+ return TTR("The occluder polygon for this occluder is empty. Please draw a polygon.");
}
return String();
diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp
index e062067248..f2f53d4354 100644
--- a/scene/2d/path_2d.cpp
+++ b/scene/2d/path_2d.cpp
@@ -58,7 +58,7 @@ Rect2 Path2D::_edit_get_rect() const {
}
bool Path2D::_edit_use_rect() const {
- return true;
+ return curve.is_valid() && curve->get_point_count() != 0;
}
bool Path2D::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const {
diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp
index 95acf13fad..39b3375f09 100644
--- a/scene/2d/physics_body_2d.cpp
+++ b/scene/2d/physics_body_2d.cpp
@@ -963,7 +963,7 @@ String RigidBody2D::get_configuration_warning() const {
if ((get_mode() == MODE_RIGID || get_mode() == MODE_CHARACTER) && (ABS(t.elements[0].length() - 1.0) > 0.05 || ABS(t.elements[1].length() - 1.0) > 0.05)) {
if (warning != String()) {
- warning += "\n";
+ warning += "\n\n";
}
warning += TTR("Size changes to RigidBody2D (in character or rigid modes) will be overridden by the physics engine when running.\nChange the size in children collision shapes instead.");
}
diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp
index f6f1bad581..32a0b732c0 100644
--- a/scene/2d/polygon_2d.cpp
+++ b/scene/2d/polygon_2d.cpp
@@ -76,7 +76,7 @@ Rect2 Polygon2D::_edit_get_rect() const {
}
bool Polygon2D::_edit_use_rect() const {
- return true;
+ return polygon.size() > 0;
}
bool Polygon2D::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const {
diff --git a/scene/2d/remote_transform_2d.cpp b/scene/2d/remote_transform_2d.cpp
index 1c38a91877..fe8cc5a5fc 100644
--- a/scene/2d/remote_transform_2d.cpp
+++ b/scene/2d/remote_transform_2d.cpp
@@ -110,7 +110,7 @@ void RemoteTransform2D::_notification(int p_what) {
switch (p_what) {
- case NOTIFICATION_READY: {
+ case NOTIFICATION_ENTER_TREE: {
_update_cache();
@@ -180,6 +180,10 @@ bool RemoteTransform2D::get_update_scale() const {
return update_remote_scale;
}
+void RemoteTransform2D::force_update_cache() {
+ _update_cache();
+}
+
String RemoteTransform2D::get_configuration_warning() const {
if (!has_node(remote_node) || !Object::cast_to<Node2D>(get_node(remote_node))) {
@@ -193,6 +197,7 @@ void RemoteTransform2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_remote_node", "path"), &RemoteTransform2D::set_remote_node);
ClassDB::bind_method(D_METHOD("get_remote_node"), &RemoteTransform2D::get_remote_node);
+ ClassDB::bind_method(D_METHOD("force_update_cache"), &RemoteTransform2D::force_update_cache);
ClassDB::bind_method(D_METHOD("set_use_global_coordinates", "use_global_coordinates"), &RemoteTransform2D::set_use_global_coordinates);
ClassDB::bind_method(D_METHOD("get_use_global_coordinates"), &RemoteTransform2D::get_use_global_coordinates);
diff --git a/scene/2d/remote_transform_2d.h b/scene/2d/remote_transform_2d.h
index 16a5417592..e85fe33fc6 100644
--- a/scene/2d/remote_transform_2d.h
+++ b/scene/2d/remote_transform_2d.h
@@ -69,6 +69,8 @@ public:
void set_update_scale(const bool p_update);
bool get_update_scale() const;
+ void force_update_cache();
+
virtual String get_configuration_warning() const;
RemoteTransform2D();
diff --git a/scene/2d/skeleton_2d.cpp b/scene/2d/skeleton_2d.cpp
index aa15255384..bf43fca864 100644
--- a/scene/2d/skeleton_2d.cpp
+++ b/scene/2d/skeleton_2d.cpp
@@ -137,7 +137,7 @@ String Bone2D::get_configuration_warning() const {
String warning = Node2D::get_configuration_warning();
if (!skeleton) {
if (warning != String()) {
- warning += "\n";
+ warning += "\n\n";
}
if (parent_bone) {
warning += TTR("This Bone2D chain should end at a Skeleton2D node.");
@@ -148,7 +148,7 @@ String Bone2D::get_configuration_warning() const {
if (rest == Transform2D(0, 0, 0, 0, 0, 0)) {
if (warning != String()) {
- warning += "\n";
+ warning += "\n\n";
}
warning += TTR("This bone lacks a proper REST pose. Go to the Skeleton2D node and set one.");
}
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index 0a6d630428..c79cd80e2e 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -861,7 +861,7 @@ void TileMap::set_cell(int p_x, int p_y, int p_tile, bool p_flip_x, bool p_flip_
if (!E && p_tile == INVALID_CELL)
return; //nothing to do
- PosKey qk(p_x / _get_quadrant_size(), p_y / _get_quadrant_size());
+ PosKey qk = pk.to_quadrant(_get_quadrant_size());
if (p_tile == INVALID_CELL) {
//erase existing
tile_map.erase(pk);
@@ -1020,7 +1020,7 @@ void TileMap::update_cell_bitmask(int p_x, int p_y) {
E->get().autotile_coord_x = (int)coord.x;
E->get().autotile_coord_y = (int)coord.y;
- PosKey qk(p_x / _get_quadrant_size(), p_y / _get_quadrant_size());
+ PosKey qk = p.to_quadrant(_get_quadrant_size());
Map<PosKey, Quadrant>::Element *Q = quadrant_map.find(qk);
_make_quadrant_dirty(Q);
@@ -1117,7 +1117,7 @@ void TileMap::set_cell_autotile_coord(int p_x, int p_y, const Vector2 &p_coord)
c.autotile_coord_y = p_coord.y;
tile_map[pk] = c;
- PosKey qk(p_x / _get_quadrant_size(), p_y / _get_quadrant_size());
+ PosKey qk = pk.to_quadrant(_get_quadrant_size());
Map<PosKey, Quadrant>::Element *Q = quadrant_map.find(qk);
if (!Q)
@@ -1144,7 +1144,7 @@ void TileMap::_recreate_quadrants() {
for (Map<PosKey, Cell>::Element *E = tile_map.front(); E; E = E->next()) {
- PosKey qk(E->key().x / _get_quadrant_size(), E->key().y / _get_quadrant_size());
+ PosKey qk = PosKey(E->key().x, E->key().y).to_quadrant(_get_quadrant_size());
Map<PosKey, Quadrant>::Element *Q = quadrant_map.find(qk);
if (!Q) {
@@ -1281,7 +1281,11 @@ PoolVector<int> TileMap::_get_tile_data() const {
}
Rect2 TileMap::_edit_get_rect() const {
- const_cast<TileMap *>(this)->update_dirty_quadrants();
+ if (pending_update) {
+ const_cast<TileMap *>(this)->update_dirty_quadrants();
+ } else {
+ const_cast<TileMap *>(this)->_recompute_rect_cache();
+ }
return rect_cache;
}
@@ -1776,7 +1780,7 @@ String TileMap::get_configuration_warning() const {
if (use_parent && !collision_parent) {
if (!warning.empty()) {
- warning += "\n";
+ warning += "\n\n";
}
return TTR("TileMap with Use Parent on needs a parent CollisionObject2D to give shapes to. Please use it as a child of Area2D, StaticBody2D, RigidBody2D, KinematicBody2D, etc. to give them a shape.");
}
diff --git a/scene/2d/tile_map.h b/scene/2d/tile_map.h
index 6c9648ff32..e30b7eff83 100644
--- a/scene/2d/tile_map.h
+++ b/scene/2d/tile_map.h
@@ -94,6 +94,13 @@ private:
bool operator==(const PosKey &p_k) const { return (y == p_k.y && x == p_k.x); }
+ PosKey to_quadrant(const int &p_quadrant_size) const {
+ // rounding down, instead of simply rounding towards zero (truncating)
+ return PosKey(
+ x > 0 ? x / p_quadrant_size : (x - (p_quadrant_size - 1)) / p_quadrant_size,
+ y > 0 ? y / p_quadrant_size : (y - (p_quadrant_size - 1)) / p_quadrant_size);
+ }
+
PosKey(int16_t p_x, int16_t p_y) {
x = p_x;
y = p_y;
diff --git a/scene/2d/visibility_notifier_2d.cpp b/scene/2d/visibility_notifier_2d.cpp
index 1cf037daf2..a1d074e6cd 100644
--- a/scene/2d/visibility_notifier_2d.cpp
+++ b/scene/2d/visibility_notifier_2d.cpp
@@ -327,7 +327,7 @@ void VisibilityEnabler2D::_node_removed(Node *p_node) {
String VisibilityEnabler2D::get_configuration_warning() const {
#ifdef TOOLS_ENABLED
if (is_inside_tree() && get_parent() && (get_parent()->get_filename() == String() && get_parent() != get_tree()->get_edited_scene_root())) {
- return TTR("VisibilityEnable2D works best when used with the edited scene root directly as parent.");
+ return TTR("VisibilityEnabler2D works best when used with the edited scene root directly as parent.");
}
#endif
return String();
diff --git a/scene/3d/arvr_nodes.cpp b/scene/3d/arvr_nodes.cpp
index dfa8fce9be..263a2d8de6 100644
--- a/scene/3d/arvr_nodes.cpp
+++ b/scene/3d/arvr_nodes.cpp
@@ -61,7 +61,7 @@ String ARVRCamera::get_configuration_warning() const {
// must be child node of ARVROrigin!
ARVROrigin *origin = Object::cast_to<ARVROrigin>(get_parent());
if (origin == NULL) {
- return TTR("ARVRCamera must have an ARVROrigin node as its parent");
+ return TTR("ARVRCamera must have an ARVROrigin node as its parent.");
};
return String();
diff --git a/scene/3d/collision_object.cpp b/scene/3d/collision_object.cpp
index fc46cf5bdb..9d3e2983c4 100644
--- a/scene/3d/collision_object.cpp
+++ b/scene/3d/collision_object.cpp
@@ -371,7 +371,7 @@ String CollisionObject::get_configuration_warning() const {
if (shapes.empty()) {
if (warning == String()) {
- warning += "\n";
+ warning += "\n\n";
}
warning += TTR("This node has no shape, so it can't collide or interact with other objects.\nConsider adding a CollisionShape or CollisionPolygon as a child to define its shape.");
}
diff --git a/scene/3d/collision_shape.cpp b/scene/3d/collision_shape.cpp
index 219ea56681..2b030641eb 100644
--- a/scene/3d/collision_shape.cpp
+++ b/scene/3d/collision_shape.cpp
@@ -120,7 +120,7 @@ String CollisionShape::get_configuration_warning() const {
}
if (!shape.is_valid()) {
- return TTR("A shape must be provided for CollisionShape to function. Please create a shape resource for it!");
+ return TTR("A shape must be provided for CollisionShape to function. Please create a shape resource for it.");
}
if (shape->is_class("PlaneShape")) {
diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp
index 2e64872616..4ef945ab8d 100644
--- a/scene/3d/light.cpp
+++ b/scene/3d/light.cpp
@@ -51,6 +51,7 @@ void Light::set_param(Param p_param, float p_value) {
if (p_param == PARAM_SPOT_ANGLE) {
_change_notify("spot_angle");
+ update_configuration_warning();
} else if (p_param == PARAM_RANGE) {
_change_notify("omni_range");
_change_notify("spot_range");
@@ -68,6 +69,10 @@ void Light::set_shadow(bool p_enable) {
shadow = p_enable;
VS::get_singleton()->light_set_shadow(light, p_enable);
+
+ if (type == VisualServer::LIGHT_SPOT) {
+ update_configuration_warning();
+ }
}
bool Light::has_shadow() const {
@@ -465,6 +470,20 @@ OmniLight::OmniLight() :
set_shadow_detail(SHADOW_DETAIL_HORIZONTAL);
}
+String SpotLight::get_configuration_warning() const {
+ String warning = Light::get_configuration_warning();
+
+ if (has_shadow() && get_param(PARAM_SPOT_ANGLE) >= 90.0) {
+ if (warning != String()) {
+ warning += "\n\n";
+ }
+
+ warning += TTR("A SpotLight with an angle wider than 90 degrees cannot cast shadows.");
+ }
+
+ return warning;
+}
+
void SpotLight::_bind_methods() {
ADD_GROUP("Spot", "spot_");
diff --git a/scene/3d/light.h b/scene/3d/light.h
index ddd5bc6b3a..5d365758b5 100644
--- a/scene/3d/light.h
+++ b/scene/3d/light.h
@@ -221,6 +221,8 @@ protected:
static void _bind_methods();
public:
+ virtual String get_configuration_warning() const;
+
SpotLight() :
Light(VisualServer::LIGHT_SPOT) {}
};
diff --git a/scene/3d/path.cpp b/scene/3d/path.cpp
index 84078911cb..d55c795d38 100644
--- a/scene/3d/path.cpp
+++ b/scene/3d/path.cpp
@@ -270,7 +270,7 @@ String PathFollow::get_configuration_warning() const {
} else {
Path *path = Object::cast_to<Path>(get_parent());
if (path->get_curve().is_valid() && !path->get_curve()->is_up_vector_enabled() && rotation_mode == ROTATION_ORIENTED) {
- return TTR("PathFollow ROTATION_ORIENTED requires \"Up Vector\" enabled in its parent Path's Curve resource.");
+ return TTR("PathFollow's ROTATION_ORIENTED requires \"Up Vector\" to be enabled in its parent Path's Curve resource.");
}
}
diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp
index d3aad7000d..2f8b2ecc5c 100644
--- a/scene/3d/physics_body.cpp
+++ b/scene/3d/physics_body.cpp
@@ -934,7 +934,7 @@ String RigidBody::get_configuration_warning() const {
if ((get_mode() == MODE_RIGID || get_mode() == MODE_CHARACTER) && (ABS(t.basis.get_axis(0).length() - 1.0) > 0.05 || ABS(t.basis.get_axis(1).length() - 1.0) > 0.05 || ABS(t.basis.get_axis(2).length() - 1.0) > 0.05)) {
if (warning != String()) {
- warning += "\n";
+ warning += "\n\n";
}
warning += TTR("Size changes to RigidBody (in character or rigid modes) will be overridden by the physics engine when running.\nChange the size in children collision shapes instead.");
}
diff --git a/scene/3d/remote_transform.cpp b/scene/3d/remote_transform.cpp
index add77e0272..76b0b0c92f 100644
--- a/scene/3d/remote_transform.cpp
+++ b/scene/3d/remote_transform.cpp
@@ -105,7 +105,7 @@ void RemoteTransform::_notification(int p_what) {
switch (p_what) {
- case NOTIFICATION_READY: {
+ case NOTIFICATION_ENTER_TREE: {
_update_cache();
@@ -174,10 +174,14 @@ bool RemoteTransform::get_update_scale() const {
return update_remote_scale;
}
+void RemoteTransform::force_update_cache() {
+ _update_cache();
+}
+
String RemoteTransform::get_configuration_warning() const {
if (!has_node(remote_node) || !Object::cast_to<Spatial>(get_node(remote_node))) {
- return TTR("Path property must point to a valid Spatial node to work.");
+ return TTR("The \"Remote Path\" property must point to a valid Spatial or Spatial-derived node to work.");
}
return String();
@@ -187,6 +191,7 @@ void RemoteTransform::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_remote_node", "path"), &RemoteTransform::set_remote_node);
ClassDB::bind_method(D_METHOD("get_remote_node"), &RemoteTransform::get_remote_node);
+ ClassDB::bind_method(D_METHOD("force_update_cache"), &RemoteTransform::force_update_cache);
ClassDB::bind_method(D_METHOD("set_use_global_coordinates", "use_global_coordinates"), &RemoteTransform::set_use_global_coordinates);
ClassDB::bind_method(D_METHOD("get_use_global_coordinates"), &RemoteTransform::get_use_global_coordinates);
diff --git a/scene/3d/remote_transform.h b/scene/3d/remote_transform.h
index b737a4f858..07e01284e5 100644
--- a/scene/3d/remote_transform.h
+++ b/scene/3d/remote_transform.h
@@ -68,6 +68,8 @@ public:
void set_update_scale(const bool p_update);
bool get_update_scale() const;
+ void force_update_cache();
+
virtual String get_configuration_warning() const;
RemoteTransform();
diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp
index d0f8799a64..67c79d8b5a 100644
--- a/scene/3d/sprite_3d.cpp
+++ b/scene/3d/sprite_3d.cpp
@@ -1061,7 +1061,7 @@ StringName AnimatedSprite3D::get_animation() const {
String AnimatedSprite3D::get_configuration_warning() const {
if (frames.is_null()) {
- return TTR("A SpriteFrames resource must be created or set in the 'Frames' property in order for AnimatedSprite3D to display frames.");
+ return TTR("A SpriteFrames resource must be created or set in the \"Frames\" property in order for AnimatedSprite3D to display frames.");
}
return String();
diff --git a/scene/3d/world_environment.cpp b/scene/3d/world_environment.cpp
index 3cd43cbf5b..8d46b4161d 100644
--- a/scene/3d/world_environment.cpp
+++ b/scene/3d/world_environment.cpp
@@ -80,7 +80,7 @@ Ref<Environment> WorldEnvironment::get_environment() const {
String WorldEnvironment::get_configuration_warning() const {
if (!environment.is_valid()) {
- return TTR("WorldEnvironment needs an Environment resource.");
+ return TTR("WorldEnvironment requires its \"Environment\" property to contain an Environment to have a visible effect.");
}
if (/*!is_visible_in_tree() ||*/ !is_inside_tree())
diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp
index 54f0fdc26a..6745b57cff 100644
--- a/scene/animation/animation_tree.cpp
+++ b/scene/animation/animation_tree.cpp
@@ -1342,15 +1342,15 @@ String AnimationTree::get_configuration_warning() const {
if (!root.is_valid()) {
if (warning != String()) {
- warning += "\n";
+ warning += "\n\n";
}
- warning += TTR("A root AnimationNode for the graph is not set.");
+ warning += TTR("No root AnimationNode for the graph is set.");
}
if (!has_node(animation_player)) {
if (warning != String()) {
- warning += "\n";
+ warning += "\n\n";
}
warning += TTR("Path to an AnimationPlayer node containing animations is not set.");
@@ -1361,7 +1361,7 @@ String AnimationTree::get_configuration_warning() const {
if (!player) {
if (warning != String()) {
- warning += "\n";
+ warning += "\n\n";
}
warning += TTR("Path set for AnimationPlayer does not lead to an AnimationPlayer node.");
@@ -1370,10 +1370,10 @@ String AnimationTree::get_configuration_warning() const {
if (!player->has_node(player->get_root())) {
if (warning != String()) {
- warning += "\n";
+ warning += "\n\n";
}
- warning += TTR("AnimationPlayer root is not a valid node.");
+ warning += TTR("The AnimationPlayer root node is not a valid node.");
return warning;
}
diff --git a/scene/gui/container.cpp b/scene/gui/container.cpp
index c9cf5f8308..449076f863 100644
--- a/scene/gui/container.cpp
+++ b/scene/gui/container.cpp
@@ -175,9 +175,9 @@ String Container::get_configuration_warning() const {
if (get_class() == "Container" && get_script().is_null()) {
if (warning != String()) {
- warning += "\n";
+ warning += "\n\n";
}
- warning += TTR("Container by itself serves no purpose unless a script configures its children placement behavior.\nIf you don't intend to add a script, then please use a plain 'Control' node instead.");
+ warning += TTR("Container by itself serves no purpose unless a script configures its children placement behavior.\nIf you don't intend to add a script, use a plain Control node instead.");
}
return warning;
}
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index eccd42cb9f..26be17f6c1 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -2711,7 +2711,7 @@ String Control::get_configuration_warning() const {
if (data.mouse_filter == MOUSE_FILTER_IGNORE && data.tooltip != "") {
if (warning != String()) {
- warning += "\n";
+ warning += "\n\n";
}
warning += TTR("The Hint Tooltip won't be displayed as the control's Mouse Filter is set to \"Ignore\". To solve this, set the Mouse Filter to \"Stop\" or \"Pass\".");
}
diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp
index 9e996e5519..3e003af396 100644
--- a/scene/gui/popup.cpp
+++ b/scene/gui/popup.cpp
@@ -234,7 +234,7 @@ Popup::Popup() {
String Popup::get_configuration_warning() const {
if (is_visible_in_tree()) {
- return TTR("Popups will hide by default unless you call popup() or any of the popup*() functions. Making them visible for editing is fine though, but they will hide upon running.");
+ return TTR("Popups will hide by default unless you call popup() or any of the popup*() functions. Making them visible for editing is fine, but they will hide upon running.");
}
return String();
diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp
index d00acaf08a..e709bac377 100644
--- a/scene/gui/range.cpp
+++ b/scene/gui/range.cpp
@@ -35,9 +35,9 @@ String Range::get_configuration_warning() const {
if (shared->exp_ratio && shared->min <= 0) {
if (warning != String()) {
- warning += "\n";
+ warning += "\n\n";
}
- warning += TTR("If exp_edit is true min_value must be > 0.");
+ warning += TTR("If \"Exp Edit\" is enabled, \"Min Value\" must be greater than 0.");
}
return warning;
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 5b91299de6..d6c0981ebc 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -1942,37 +1942,37 @@ Error RichTextLabel::append_bbcode(const String &p_bbcode) {
if (col.begins_with("#"))
color = Color::html(col);
else if (col == "aqua")
- color = Color::html("#00FFFF");
+ color = Color(0, 1, 1);
else if (col == "black")
- color = Color::html("#000000");
+ color = Color(0, 0, 0);
else if (col == "blue")
- color = Color::html("#0000FF");
+ color = Color(0, 0, 1);
else if (col == "fuchsia")
- color = Color::html("#FF00FF");
+ color = Color(1, 0, 1);
else if (col == "gray" || col == "grey")
- color = Color::html("#808080");
+ color = Color(0.5, 0.5, 0.5);
else if (col == "green")
- color = Color::html("#008000");
+ color = Color(0, 0.5, 0);
else if (col == "lime")
- color = Color::html("#00FF00");
+ color = Color(0, 1, 0);
else if (col == "maroon")
- color = Color::html("#800000");
+ color = Color(0.5, 0, 0);
else if (col == "navy")
- color = Color::html("#000080");
+ color = Color(0, 0, 0.5);
else if (col == "olive")
- color = Color::html("#808000");
+ color = Color(0.5, 0.5, 0);
else if (col == "purple")
- color = Color::html("#800080");
+ color = Color(0.5, 0, 0.5);
else if (col == "red")
- color = Color::html("#FF0000");
+ color = Color(1, 0, 0);
else if (col == "silver")
- color = Color::html("#C0C0C0");
+ color = Color(0.75, 0.75, 0.75);
else if (col == "teal")
- color = Color::html("#008008");
+ color = Color(0, 0.5, 0.5);
else if (col == "white")
- color = Color::html("#FFFFFF");
+ color = Color(1, 1, 1);
else if (col == "yellow")
- color = Color::html("#FFFF00");
+ color = Color(1, 1, 0);
else
color = base_color;
diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp
index d83ae47671..461281a4ed 100644
--- a/scene/gui/scroll_container.cpp
+++ b/scene/gui/scroll_container.cpp
@@ -486,7 +486,7 @@ String ScrollContainer::get_configuration_warning() const {
}
if (found != 1)
- return TTR("ScrollContainer is intended to work with a single child control.\nUse a container as child (VBox,HBox,etc), or a Control and set the custom minimum size manually.");
+ return TTR("ScrollContainer is intended to work with a single child control.\nUse a container as child (VBox, HBox, etc.), or a Control and set the custom minimum size manually.");
else
return "";
}
diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp
index e778af3ceb..279253889c 100644
--- a/scene/gui/spin_box.cpp
+++ b/scene/gui/spin_box.cpp
@@ -173,7 +173,7 @@ void SpinBox::_line_edit_focus_exit() {
_text_entered(line_edit->get_text());
}
-inline void SpinBox::_adjust_width_for_icon(const Ref<Texture> icon) {
+inline void SpinBox::_adjust_width_for_icon(const Ref<Texture> &icon) {
int w = icon->get_width();
if (w != last_w) {
diff --git a/scene/gui/spin_box.h b/scene/gui/spin_box.h
index 49dc6d950c..9cf977d2d6 100644
--- a/scene/gui/spin_box.h
+++ b/scene/gui/spin_box.h
@@ -62,7 +62,7 @@ class SpinBox : public Range {
void _line_edit_focus_exit();
- inline void _adjust_width_for_icon(const Ref<Texture> icon);
+ inline void _adjust_width_for_icon(const Ref<Texture> &icon);
protected:
void _gui_input(const Ref<InputEvent> &p_event);
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index a7b4e08553..ff0c723141 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -683,7 +683,7 @@ void TextEdit::_notification(int p_what) {
}
if (line_length_guideline) {
- int x = xmargin_beg + cache.font->get_char_size('0').width * line_length_guideline_col - cursor.x_ofs;
+ int x = xmargin_beg + (int)cache.font->get_char_size('0').width * line_length_guideline_col - cursor.x_ofs;
if (x > xmargin_beg && x < xmargin_end) {
VisualServer::get_singleton()->canvas_item_add_line(ci, Point2(x, 0), Point2(x, size.height), cache.line_length_guideline_color);
}
@@ -3287,28 +3287,6 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
} break;
- case KEY_U: {
- if (!k->get_command() || k->get_shift()) {
- scancode_handled = false;
- break;
- } else {
- if (selection.active) {
- int ini = selection.from_line;
- int end = selection.to_line;
-
- for (int i = ini; i <= end; i++) {
- _uncomment_line(i);
- }
- } else {
- _uncomment_line(cursor.line);
- if (cursor.column >= get_line(cursor.line).length()) {
- cursor.column = MAX(0, get_line(cursor.line).length() - 1);
- }
- }
- update();
- }
- } break;
-
default: {
scancode_handled = false;
@@ -3367,24 +3345,6 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
}
}
-void TextEdit::_uncomment_line(int p_line) {
- String line_text = get_line(p_line);
- for (int i = 0; i < line_text.length(); i++) {
- if (line_text[i] == '#') {
- _remove_text(p_line, i, p_line, i + 1);
- if (p_line == selection.to_line && selection.to_column > line_text.length() - 1) {
- selection.to_column -= 1;
- if (selection.to_column >= selection.from_column) {
- selection.active = false;
- }
- }
- return;
- } else if (line_text[i] != '\t' && line_text[i] != ' ') {
- return;
- }
- }
-}
-
void TextEdit::_scroll_up(real_t p_delta) {
if (scrolling && smooth_scroll_enabled && SGN(target_v_scroll - v_scroll->get_value()) != SGN(-p_delta))
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index 9fb8e03288..b47dac0902 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -395,7 +395,6 @@ private:
void _update_selection_mode_word();
void _update_selection_mode_line();
- void _uncomment_line(int p_line);
void _scroll_up(real_t p_delta);
void _scroll_down(real_t p_delta);
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 8624baa005..4005505830 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -571,21 +571,7 @@ int TreeItem::get_button_by_id(int p_column, int p_id) const {
return -1;
}
-void TreeItem::set_disable_button(int p_column, int p_idx, bool p_disabled) {
- ERR_FAIL_INDEX(p_column, cells.size());
- ERR_FAIL_INDEX(p_idx, cells[p_column].buttons.size());
-
- cells.write[p_column].buttons.write[p_idx].disabled = p_disabled;
- _changed_notify(p_column);
-}
-bool TreeItem::is_button_disabled(int p_column, int p_idx) const {
-
- ERR_FAIL_INDEX_V(p_column, cells.size(), false);
- ERR_FAIL_INDEX_V(p_idx, cells[p_column].buttons.size(), false);
-
- return cells[p_column].buttons[p_idx].disabled;
-}
void TreeItem::set_button(int p_column, int p_idx, const Ref<Texture> &p_button) {
ERR_FAIL_COND(p_button.is_null());
@@ -603,6 +589,23 @@ void TreeItem::set_button_color(int p_column, int p_idx, const Color &p_color) {
_changed_notify(p_column);
}
+void TreeItem::set_button_disabled(int p_column, int p_idx, bool p_disabled) {
+
+ ERR_FAIL_INDEX(p_column, cells.size());
+ ERR_FAIL_INDEX(p_idx, cells[p_column].buttons.size());
+
+ cells.write[p_column].buttons.write[p_idx].disabled = p_disabled;
+ _changed_notify(p_column);
+}
+
+bool TreeItem::is_button_disabled(int p_column, int p_idx) const {
+
+ ERR_FAIL_INDEX_V(p_column, cells.size(), false);
+ ERR_FAIL_INDEX_V(p_idx, cells[p_column].buttons.size(), false);
+
+ return cells[p_column].buttons[p_idx].disabled;
+}
+
void TreeItem::set_editable(int p_column, bool p_editable) {
ERR_FAIL_INDEX(p_column, cells.size());
@@ -792,8 +795,8 @@ void TreeItem::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_button", "column", "button_idx"), &TreeItem::get_button);
ClassDB::bind_method(D_METHOD("set_button", "column", "button_idx", "button"), &TreeItem::set_button);
ClassDB::bind_method(D_METHOD("erase_button", "column", "button_idx"), &TreeItem::erase_button);
+ ClassDB::bind_method(D_METHOD("set_button_disabled", "column", "button_idx", "disabled"), &TreeItem::set_button_disabled);
ClassDB::bind_method(D_METHOD("is_button_disabled", "column", "button_idx"), &TreeItem::is_button_disabled);
- ClassDB::bind_method(D_METHOD("set_disable_button", "column", "button_idx", "disabled"), &TreeItem::set_disable_button);
ClassDB::bind_method(D_METHOD("set_expand_right", "column", "enable"), &TreeItem::set_expand_right);
ClassDB::bind_method(D_METHOD("get_expand_right", "column"), &TreeItem::get_expand_right);
diff --git a/scene/gui/tree.h b/scene/gui/tree.h
index 6e5e2c1eba..b6cdab766f 100644
--- a/scene/gui/tree.h
+++ b/scene/gui/tree.h
@@ -209,10 +209,10 @@ public:
int get_button_id(int p_column, int p_idx) const;
void erase_button(int p_column, int p_idx);
int get_button_by_id(int p_column, int p_id) const;
- bool is_button_disabled(int p_column, int p_idx) const;
void set_button(int p_column, int p_idx, const Ref<Texture> &p_button);
void set_button_color(int p_column, int p_idx, const Color &p_color);
- void set_disable_button(int p_column, int p_idx, bool p_disabled);
+ void set_button_disabled(int p_column, int p_idx, bool p_disabled);
+ bool is_button_disabled(int p_column, int p_idx) const;
/* range works for mode number or mode combo */
diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp
index 88b942ee45..05bd911014 100644
--- a/scene/main/http_request.cpp
+++ b/scene/main/http_request.cpp
@@ -96,6 +96,11 @@ Error HTTPRequest::request(const String &p_url, const Vector<String> &p_custom_h
ERR_FAIL_V(ERR_BUSY);
}
+ if (timeout > 0) {
+ timer->stop();
+ timer->start(timeout);
+ }
+
method = p_method;
Error err = _parse_url(p_url);
@@ -153,6 +158,8 @@ void HTTPRequest::_thread_func(void *p_userdata) {
void HTTPRequest::cancel_request() {
+ timer->stop();
+
if (!requesting)
return;
@@ -479,6 +486,23 @@ int HTTPRequest::get_body_size() const {
return body_len;
}
+void HTTPRequest::set_timeout(int p_timeout) {
+
+ ERR_FAIL_COND(p_timeout < 0);
+ timeout = p_timeout;
+}
+
+int HTTPRequest::get_timeout() {
+
+ return timeout;
+}
+
+void HTTPRequest::_timeout() {
+
+ cancel_request();
+ call_deferred("_request_done", RESULT_TIMEOUT, 0, PoolStringArray(), PoolByteArray());
+}
+
void HTTPRequest::_bind_methods() {
ClassDB::bind_method(D_METHOD("request", "url", "custom_headers", "ssl_validate_domain", "method", "request_data"), &HTTPRequest::request, DEFVAL(PoolStringArray()), DEFVAL(true), DEFVAL(HTTPClient::METHOD_GET), DEFVAL(String()));
@@ -504,10 +528,16 @@ void HTTPRequest::_bind_methods() {
ClassDB::bind_method(D_METHOD("_redirect_request"), &HTTPRequest::_redirect_request);
ClassDB::bind_method(D_METHOD("_request_done"), &HTTPRequest::_request_done);
+ ClassDB::bind_method(D_METHOD("set_timeout", "timeout"), &HTTPRequest::set_timeout);
+ ClassDB::bind_method(D_METHOD("get_timeout"), &HTTPRequest::get_timeout);
+
+ ClassDB::bind_method(D_METHOD("_timeout"), &HTTPRequest::_timeout);
+
ADD_PROPERTY(PropertyInfo(Variant::STRING, "download_file", PROPERTY_HINT_FILE), "set_download_file", "get_download_file");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_threads"), "set_use_threads", "is_using_threads");
ADD_PROPERTY(PropertyInfo(Variant::INT, "body_size_limit", PROPERTY_HINT_RANGE, "-1,2000000000"), "set_body_size_limit", "get_body_size_limit");
ADD_PROPERTY(PropertyInfo(Variant::INT, "max_redirects", PROPERTY_HINT_RANGE, "-1,64"), "set_max_redirects", "get_max_redirects");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "timeout", PROPERTY_HINT_RANGE, "0,86400"), "set_timeout", "get_timeout");
ADD_SIGNAL(MethodInfo("request_completed", PropertyInfo(Variant::INT, "result"), PropertyInfo(Variant::INT, "response_code"), PropertyInfo(Variant::POOL_STRING_ARRAY, "headers"), PropertyInfo(Variant::POOL_BYTE_ARRAY, "body")));
@@ -524,6 +554,7 @@ void HTTPRequest::_bind_methods() {
BIND_ENUM_CONSTANT(RESULT_DOWNLOAD_FILE_CANT_OPEN);
BIND_ENUM_CONSTANT(RESULT_DOWNLOAD_FILE_WRITE_ERROR);
BIND_ENUM_CONSTANT(RESULT_REDIRECT_LIMIT_REACHED);
+ BIND_ENUM_CONSTANT(RESULT_TIMEOUT);
}
HTTPRequest::HTTPRequest() {
@@ -546,6 +577,12 @@ HTTPRequest::HTTPRequest() {
downloaded = 0;
body_size_limit = -1;
file = NULL;
+
+ timer = memnew(Timer);
+ timer->set_one_shot(true);
+ timer->connect("timeout", this, "_timeout");
+ add_child(timer);
+ timeout = 0;
}
HTTPRequest::~HTTPRequest() {
diff --git a/scene/main/http_request.h b/scene/main/http_request.h
index 2e58d579ba..f1f91235a6 100644
--- a/scene/main/http_request.h
+++ b/scene/main/http_request.h
@@ -35,6 +35,7 @@
#include "core/os/file_access.h"
#include "core/os/thread.h"
#include "node.h"
+#include "scene/main/timer.h"
class HTTPRequest : public Node {
@@ -53,7 +54,8 @@ public:
RESULT_REQUEST_FAILED,
RESULT_DOWNLOAD_FILE_CANT_OPEN,
RESULT_DOWNLOAD_FILE_WRITE_ERROR,
- RESULT_REDIRECT_LIMIT_REACHED
+ RESULT_REDIRECT_LIMIT_REACHED,
+ RESULT_TIMEOUT
};
@@ -92,6 +94,8 @@ private:
int max_redirects;
+ int timeout;
+
void _redirect_request(const String &p_new_url);
bool _handle_response(bool *ret_value);
@@ -128,6 +132,13 @@ public:
void set_max_redirects(int p_max);
int get_max_redirects() const;
+ Timer *timer;
+
+ void set_timeout(int p_timeout);
+ int get_timeout();
+
+ void _timeout();
+
int get_downloaded_bytes() const;
int get_body_size() const;
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 5888760973..06d6f0871c 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -1759,7 +1759,7 @@ bool Node::has_persistent_groups() const {
return false;
}
-void Node::_print_tree_pretty(const String prefix, const bool last) {
+void Node::_print_tree_pretty(const String &prefix, const bool last) {
String new_prefix = last ? String::utf8(" ┖╴") : String::utf8(" ┠╴");
print_line(prefix + new_prefix + String(get_name()));
@@ -2487,7 +2487,7 @@ bool Node::has_node_and_resource(const NodePath &p_path) const {
Vector<StringName> leftover_path;
Node *node = get_node_and_resource(p_path, res, leftover_path, false);
- return (node && res.is_valid());
+ return node;
}
Array Node::_get_node_and_resource(const NodePath &p_path) {
@@ -2525,9 +2525,15 @@ Node *Node::get_node_and_resource(const NodePath &p_path, RES &r_res, Vector<Str
int j = 0;
// If not p_last_is_property, we shouldn't consider the last one as part of the resource
for (; j < p_path.get_subname_count() - (int)p_last_is_property; j++) {
- RES new_res = j == 0 ? node->get(p_path.get_subname(j)) : r_res->get(p_path.get_subname(j));
+ Variant new_res_v = j == 0 ? node->get(p_path.get_subname(j)) : r_res->get(p_path.get_subname(j));
+
+ if (new_res_v.get_type() == Variant::NIL) { // Found nothing on that path
+ return NULL;
+ }
+
+ RES new_res = new_res_v;
- if (new_res.is_null()) {
+ if (new_res.is_null()) { // No longer a resource, assume property
break;
}
diff --git a/scene/main/node.h b/scene/main/node.h
index 9b9ca06455..982bfcd620 100644
--- a/scene/main/node.h
+++ b/scene/main/node.h
@@ -152,7 +152,7 @@ private:
Ref<MultiplayerAPI> multiplayer;
- void _print_tree_pretty(const String prefix, const bool last);
+ void _print_tree_pretty(const String &prefix, const bool last);
void _print_tree(const Node *p_node);
Node *_get_child_by_name(const StringName &p_name) const;
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index 0940a59a82..5eeaff6411 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -1249,7 +1249,7 @@ void SceneTree::_update_root_rect() {
}
}
-void SceneTree::set_screen_stretch(StretchMode p_mode, StretchAspect p_aspect, const Size2 p_minsize, real_t p_shrink) {
+void SceneTree::set_screen_stretch(StretchMode p_mode, StretchAspect p_aspect, const Size2 &p_minsize, real_t p_shrink) {
stretch_mode = p_mode;
stretch_aspect = p_aspect;
diff --git a/scene/main/scene_tree.h b/scene/main/scene_tree.h
index 0bcb724929..98f2fe5e35 100644
--- a/scene/main/scene_tree.h
+++ b/scene/main/scene_tree.h
@@ -386,7 +386,7 @@ public:
void get_nodes_in_group(const StringName &p_group, List<Node *> *p_list);
bool has_group(const StringName &p_identifier) const;
- void set_screen_stretch(StretchMode p_mode, StretchAspect p_aspect, const Size2 p_minsize, real_t p_shrink = 1);
+ void set_screen_stretch(StretchMode p_mode, StretchAspect p_aspect, const Size2 &p_minsize, real_t p_shrink = 1);
void set_use_font_oversampling(bool p_oversampling);
bool is_using_font_oversampling() const;
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 334c49f7cc..24c8ee31b2 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -1431,6 +1431,7 @@ void Viewport::_gui_show_tooltip() {
Control *which = NULL;
String tooltip = _gui_get_tooltip(gui.tooltip, gui.tooltip->get_global_transform().xform_inv(gui.tooltip_pos), &which);
+ tooltip = tooltip.strip_edges();
if (tooltip.length() == 0)
return; // bye
@@ -1460,7 +1461,7 @@ void Viewport::_gui_show_tooltip() {
gui.tooltip_label->set_anchor_and_margin(MARGIN_TOP, Control::ANCHOR_BEGIN, ttp->get_margin(MARGIN_TOP));
gui.tooltip_label->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, -ttp->get_margin(MARGIN_RIGHT));
gui.tooltip_label->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_END, -ttp->get_margin(MARGIN_BOTTOM));
- gui.tooltip_label->set_text(tooltip.strip_edges());
+ gui.tooltip_label->set_text(tooltip);
}
rp->add_child(gui.tooltip_popup);
diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp
index af2a8c931f..64051fe304 100644
--- a/scene/resources/animation.cpp
+++ b/scene/resources/animation.cpp
@@ -863,7 +863,7 @@ Error Animation::transform_track_get_key(int p_track, int p_key, Vector3 *r_loc,
return OK;
}
-int Animation::transform_track_insert_key(int p_track, float p_time, const Vector3 p_loc, const Quat &p_rot, const Vector3 &p_scale) {
+int Animation::transform_track_insert_key(int p_track, float p_time, const Vector3 &p_loc, const Quat &p_rot, const Vector3 &p_scale) {
ERR_FAIL_INDEX_V(p_track, tracks.size(), -1);
Track *t = tracks[p_track];
diff --git a/scene/resources/animation.h b/scene/resources/animation.h
index 59f2ae24c7..6fff77d746 100644
--- a/scene/resources/animation.h
+++ b/scene/resources/animation.h
@@ -314,7 +314,7 @@ public:
float track_get_key_time(int p_track, int p_key_idx) const;
float track_get_key_transition(int p_track, int p_key_idx) const;
- int transform_track_insert_key(int p_track, float p_time, const Vector3 p_loc, const Quat &p_rot = Quat(), const Vector3 &p_scale = Vector3());
+ int transform_track_insert_key(int p_track, float p_time, const Vector3 &p_loc, const Quat &p_rot = Quat(), const Vector3 &p_scale = Vector3());
Error transform_track_get_key(int p_track, int p_key, Vector3 *r_loc, Quat *r_rot, Vector3 *r_scale) const;
void track_set_interpolation_type(int p_track, InterpolationType p_interp);
InterpolationType track_get_interpolation_type(int p_track) const;
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp
index cf6ce3a5ef..fb0fb4f8e3 100644
--- a/scene/resources/default_theme/default_theme.cpp
+++ b/scene/resources/default_theme/default_theme.cpp
@@ -177,13 +177,13 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
// Font Colors
- Color control_font_color = Color::html("e0e0e0");
- Color control_font_color_lower = Color::html("a0a0a0");
- Color control_font_color_low = Color::html("b0b0b0");
- Color control_font_color_hover = Color::html("f0f0f0");
+ Color control_font_color = Color(0.88, 0.88, 0.88);
+ Color control_font_color_lower = Color(0.63, 0.63, 0.63);
+ Color control_font_color_low = Color(0.69, 0.69, 0.69);
+ Color control_font_color_hover = Color(0.94, 0.94, 0.94);
Color control_font_color_disabled = Color(0.9, 0.9, 0.9, 0.2);
- Color control_font_color_pressed = Color::html("ffffff");
- Color font_color_selection = Color::html("7d7d7d");
+ Color control_font_color_pressed = Color(1, 1, 1);
+ Color font_color_selection = Color(0.49, 0.49, 0.49);
// Panel
@@ -432,12 +432,12 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_font("font", "TextEdit", default_font);
- theme->set_color("background_color", "TextEdit", Color(0, 0, 0, 0));
- theme->set_color("completion_background_color", "TextEdit", Color::html("2C2A32"));
- theme->set_color("completion_selected_color", "TextEdit", Color::html("434244"));
- theme->set_color("completion_existing_color", "TextEdit", Color::html("21dfdfdf"));
+ theme->set_color("background_color", "TextEdit", Color(0, 0, 0));
+ theme->set_color("completion_background_color", "TextEdit", Color(0.17, 0.16, 0.2));
+ theme->set_color("completion_selected_color", "TextEdit", Color(0.26, 0.26, 0.27));
+ theme->set_color("completion_existing_color", "TextEdit", Color(0.87, 0.87, 0.87, 0.13));
theme->set_color("completion_scroll_color", "TextEdit", control_font_color_pressed);
- theme->set_color("completion_font_color", "TextEdit", Color::html("aaaaaa"));
+ theme->set_color("completion_font_color", "TextEdit", Color(0.67, 0.67, 0.67));
theme->set_color("font_color", "TextEdit", control_font_color);
theme->set_color("font_color_selected", "TextEdit", Color(0, 0, 0));
theme->set_color("font_color_readonly", "TextEdit", Color(control_font_color.r, control_font_color.g, control_font_color.b, 0.5f));
@@ -449,14 +449,14 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_color("code_folding_color", "TextEdit", Color(0.8, 0.8, 0.8, 0.8));
theme->set_color("current_line_color", "TextEdit", Color(0.25, 0.25, 0.26, 0.8));
theme->set_color("caret_color", "TextEdit", control_font_color);
- theme->set_color("caret_background_color", "TextEdit", Color::html("000000"));
+ theme->set_color("caret_background_color", "TextEdit", Color(0, 0, 0));
theme->set_color("symbol_color", "TextEdit", control_font_color_hover);
theme->set_color("brace_mismatch_color", "TextEdit", Color(1, 0.2, 0.2));
- theme->set_color("line_number_color", "TextEdit", Color::html("66aaaaaa"));
- theme->set_color("safe_line_number_color", "TextEdit", Color::html("99aac8aa"));
- theme->set_color("function_color", "TextEdit", Color::html("66a2ce"));
- theme->set_color("member_variable_color", "TextEdit", Color::html("e64e59"));
- theme->set_color("number_color", "TextEdit", Color::html("EB9532"));
+ theme->set_color("line_number_color", "TextEdit", Color(0.67, 0.67, 0.67, 0.4));
+ theme->set_color("safe_line_number_color", "TextEdit", Color(0.67, 0.78, 0.67, 0.6));
+ theme->set_color("function_color", "TextEdit", Color(0.4, 0.64, 0.81));
+ theme->set_color("member_variable_color", "TextEdit", Color(0.9, 0.31, 0.35));
+ theme->set_color("number_color", "TextEdit", Color(0.92, 0.58, 0.2));
theme->set_color("word_highlighted_color", "TextEdit", Color(0.8, 0.9, 0.9, 0.15));
theme->set_constant("completion_lines", "TextEdit", 7);
@@ -651,7 +651,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_color("cursor_color", "Tree", Color(0, 0, 0));
theme->set_color("guide_color", "Tree", Color(0, 0, 0, 0.1));
theme->set_color("drop_position_color", "Tree", Color(1, 0.3, 0.2));
- theme->set_color("relationship_line_color", "Tree", Color::html("464646"));
+ theme->set_color("relationship_line_color", "Tree", Color(0.27, 0.27, 0.27));
theme->set_color("custom_button_font_highlight", "Tree", control_font_color_hover);
theme->set_constant("hseparation", "Tree", 4 * scale);
diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp
index 2588e41951..b294991248 100644
--- a/scene/resources/surface_tool.cpp
+++ b/scene/resources/surface_tool.cpp
@@ -769,7 +769,7 @@ void SurfaceTool::create_from(const Ref<Mesh> &p_existing, int p_surface) {
material = p_existing->surface_get_material(p_surface);
}
-void SurfaceTool::create_from_blend_shape(const Ref<Mesh> &p_existing, int p_surface, const String p_blend_shape_name) {
+void SurfaceTool::create_from_blend_shape(const Ref<Mesh> &p_existing, int p_surface, const String &p_blend_shape_name) {
clear();
primitive = p_existing->surface_get_primitive_type(p_surface);
Array arr = p_existing->surface_get_blend_shape_arrays(p_surface);
diff --git a/scene/resources/surface_tool.h b/scene/resources/surface_tool.h
index c4c71dca13..e3aec6ce0e 100644
--- a/scene/resources/surface_tool.h
+++ b/scene/resources/surface_tool.h
@@ -136,7 +136,7 @@ public:
static Vector<Vertex> create_vertex_array_from_triangle_arrays(const Array &p_arrays);
Array commit_to_arrays();
void create_from(const Ref<Mesh> &p_existing, int p_surface);
- void create_from_blend_shape(const Ref<Mesh> &p_existing, int p_surface, const String p_blend_shape_name);
+ void create_from_blend_shape(const Ref<Mesh> &p_existing, int p_surface, const String &p_blend_shape_name);
void append_from(const Ref<Mesh> &p_existing, int p_surface, const Transform &p_xform);
Ref<ArrayMesh> commit(const Ref<ArrayMesh> &p_existing = Ref<ArrayMesh>(), uint32_t p_flags = Mesh::ARRAY_COMPRESS_DEFAULT);