summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/3d/arvr_nodes.h2
-rw-r--r--scene/3d/camera.cpp2
-rw-r--r--scene/3d/camera.h2
-rw-r--r--scene/3d/particles.cpp7
-rw-r--r--scene/gui/button.cpp8
-rw-r--r--scene/gui/range.cpp1
-rw-r--r--scene/gui/text_edit.cpp2
-rw-r--r--scene/gui/tree.cpp1
-rw-r--r--scene/resources/texture.cpp9
-rw-r--r--scene/resources/theme.cpp49
-rw-r--r--scene/resources/tile_set.cpp45
11 files changed, 95 insertions, 33 deletions
diff --git a/scene/3d/arvr_nodes.h b/scene/3d/arvr_nodes.h
index 8e735f7110..b647df70aa 100644
--- a/scene/3d/arvr_nodes.h
+++ b/scene/3d/arvr_nodes.h
@@ -55,7 +55,7 @@ public:
virtual Vector3 project_local_ray_normal(const Point2 &p_pos) const;
virtual Point2 unproject_position(const Vector3 &p_pos) const;
- virtual Vector3 project_position(const Point2 &p_point, float p_z_depth = 0) const;
+ virtual Vector3 project_position(const Point2 &p_point, float p_z_depth) const;
virtual Vector<Plane> get_frustum() const;
ARVRCamera();
diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp
index 9797b5f3ab..4d9bb69778 100644
--- a/scene/3d/camera.cpp
+++ b/scene/3d/camera.cpp
@@ -486,7 +486,7 @@ void Camera::_bind_methods() {
ClassDB::bind_method(D_METHOD("project_ray_origin", "screen_point"), &Camera::project_ray_origin);
ClassDB::bind_method(D_METHOD("unproject_position", "world_point"), &Camera::unproject_position);
ClassDB::bind_method(D_METHOD("is_position_behind", "world_point"), &Camera::is_position_behind);
- ClassDB::bind_method(D_METHOD("project_position", "screen_point", "z_depth"), &Camera::project_position, DEFVAL(0));
+ ClassDB::bind_method(D_METHOD("project_position", "screen_point", "z_depth"), &Camera::project_position);
ClassDB::bind_method(D_METHOD("set_perspective", "fov", "z_near", "z_far"), &Camera::set_perspective);
ClassDB::bind_method(D_METHOD("set_orthogonal", "size", "z_near", "z_far"), &Camera::set_orthogonal);
ClassDB::bind_method(D_METHOD("set_frustum", "size", "offset", "z_near", "z_far"), &Camera::set_frustum);
diff --git a/scene/3d/camera.h b/scene/3d/camera.h
index 22223880c1..d81e097fc5 100644
--- a/scene/3d/camera.h
+++ b/scene/3d/camera.h
@@ -142,7 +142,7 @@ public:
virtual Vector3 project_local_ray_normal(const Point2 &p_pos) const;
virtual Point2 unproject_position(const Vector3 &p_pos) const;
bool is_position_behind(const Vector3 &p_pos) const;
- virtual Vector3 project_position(const Point2 &p_point, float p_z_depth = 0) const;
+ virtual Vector3 project_position(const Point2 &p_point, float p_z_depth) const;
Vector<Vector3> get_near_plane_points() const;
diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp
index 241eb7d1ca..06b5613eb8 100644
--- a/scene/3d/particles.cpp
+++ b/scene/3d/particles.cpp
@@ -331,6 +331,13 @@ void Particles::_notification(int p_what) {
set_process_internal(false);
}
}
+
+ if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
+ // make sure particles are updated before rendering occurs if they were active before
+ if (is_visible_in_tree() && !VS::get_singleton()->particles_is_inactive(particles)) {
+ VS::get_singleton()->particles_request_process(particles);
+ }
+ }
}
void Particles::_bind_methods() {
diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp
index 6b3e89af6c..ca4c255855 100644
--- a/scene/gui/button.cpp
+++ b/scene/gui/button.cpp
@@ -174,17 +174,17 @@ void Button::_notification(int p_what) {
_size.width -= get_constant("hseparation") + icon_ofs_region;
if (!clip_text)
_size.width -= get_font("font")->get_string_size(xl_text).width;
- float icon_width = icon->get_width() * _size.height / icon->get_height();
+ float icon_width = _icon->get_width() * _size.height / _icon->get_height();
float icon_height = _size.height;
if (icon_width > _size.width) {
icon_width = _size.width;
- icon_height = icon->get_height() * icon_width / icon->get_width();
+ icon_height = _icon->get_height() * icon_width / _icon->get_width();
}
icon_region = Rect2(style->get_offset() + Point2(icon_ofs_region, (_size.height - icon_height) / 2), Size2(icon_width, icon_height));
} else {
- icon_region = Rect2(style->get_offset() + Point2(icon_ofs_region, Math::floor((valign - _icon->get_height()) / 2.0)), icon->get_size());
+ icon_region = Rect2(style->get_offset() + Point2(icon_ofs_region, Math::floor((valign - _icon->get_height()) / 2.0)), _icon->get_size());
}
}
@@ -221,7 +221,7 @@ void Button::_notification(int p_what) {
font->draw(ci, text_ofs.floor(), xl_text, color, clip_text ? text_clip : -1);
if (!_icon.is_null() && icon_region.size.width > 0) {
- draw_texture_rect_region(_icon, icon_region, Rect2(Point2(), icon->get_size()), color_icon);
+ draw_texture_rect_region(_icon, icon_region, Rect2(Point2(), _icon->get_size()), color_icon);
}
} break;
}
diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp
index ed5dd77f53..9c016b5a50 100644
--- a/scene/gui/range.cpp
+++ b/scene/gui/range.cpp
@@ -213,6 +213,7 @@ void Range::unshare() {
nshared->val = shared->val;
nshared->step = shared->step;
nshared->page = shared->page;
+ nshared->exp_ratio = shared->exp_ratio;
nshared->allow_greater = shared->allow_greater;
nshared->allow_lesser = shared->allow_lesser;
_unref_shared();
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index c818633f48..8ddc31745e 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -4585,7 +4585,7 @@ void TextEdit::_scroll_moved(double p_to_val) {
int v_scroll_i = floor(get_v_scroll());
int sc = 0;
int n_line;
- for (n_line = 0; n_line < text.size() - 1; n_line++) {
+ for (n_line = 0; n_line < text.size(); n_line++) {
if (!is_line_hidden(n_line)) {
sc++;
sc += times_line_wraps(n_line);
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 2c38676c83..a44b42a467 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -4049,6 +4049,7 @@ Tree::Tree() {
drop_mode_section = 0;
single_select_defer = NULL;
+ scrolling = false;
allow_rmb_select = false;
force_edit_checkbox_only_on_checkbox = false;
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index c2e2f85723..593c399f62 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -2369,16 +2369,20 @@ RES ResourceFormatLoaderTextureLayered::load(const String &p_path, const String
if (header[0] == 'G' && header[1] == 'D' && header[2] == '3' && header[3] == 'T') {
if (tex3d.is_null()) {
+ f->close();
memdelete(f);
ERR_FAIL_COND_V(tex3d.is_null(), RES())
}
} else if (header[0] == 'G' && header[1] == 'D' && header[2] == 'A' && header[3] == 'T') {
if (texarr.is_null()) {
+ f->close();
memdelete(f);
ERR_FAIL_COND_V(texarr.is_null(), RES())
}
} else {
+ f->close();
+ memdelete(f);
ERR_FAIL_V_MSG(RES(), "Unrecognized layered texture file format '" + String((const char *)header) + "'.");
}
@@ -2418,6 +2422,7 @@ RES ResourceFormatLoaderTextureLayered::load(const String &p_path, const String
if (r_error) {
*r_error = ERR_FILE_CORRUPT;
}
+ f->close();
memdelete(f);
ERR_FAIL_V(RES());
}
@@ -2453,6 +2458,7 @@ RES ResourceFormatLoaderTextureLayered::load(const String &p_path, const String
if (r_error) {
*r_error = ERR_FILE_CORRUPT;
}
+ f->close();
memdelete(f);
ERR_FAIL_V(RES());
}
@@ -2473,8 +2479,9 @@ RES ResourceFormatLoaderTextureLayered::load(const String &p_path, const String
if (bytes != total_size) {
if (r_error) {
*r_error = ERR_FILE_CORRUPT;
- memdelete(f);
}
+ f->close();
+ memdelete(f);
ERR_FAIL_V(RES());
}
}
diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp
index f1429a7d7b..c897365b21 100644
--- a/scene/resources/theme.cpp
+++ b/scene/resources/theme.cpp
@@ -44,8 +44,11 @@ PoolVector<String> Theme::_get_icon_list(const String &p_type) const {
get_icon_list(p_type, &il);
ilret.resize(il.size());
- for (List<StringName>::Element *E = il.front(); E; E = E->next()) {
- ilret.push_back(E->get());
+
+ int i = 0;
+ PoolVector<String>::Write w = ilret.write();
+ for (List<StringName>::Element *E = il.front(); E; E = E->next(), i++) {
+ w[i] = E->get();
}
return ilret;
}
@@ -57,8 +60,11 @@ PoolVector<String> Theme::_get_stylebox_list(const String &p_type) const {
get_stylebox_list(p_type, &il);
ilret.resize(il.size());
- for (List<StringName>::Element *E = il.front(); E; E = E->next()) {
- ilret.push_back(E->get());
+
+ int i = 0;
+ PoolVector<String>::Write w = ilret.write();
+ for (List<StringName>::Element *E = il.front(); E; E = E->next(), i++) {
+ w[i] = E->get();
}
return ilret;
}
@@ -70,8 +76,11 @@ PoolVector<String> Theme::_get_stylebox_types(void) const {
get_stylebox_types(&il);
ilret.resize(il.size());
- for (List<StringName>::Element *E = il.front(); E; E = E->next()) {
- ilret.push_back(E->get());
+
+ int i = 0;
+ PoolVector<String>::Write w = ilret.write();
+ for (List<StringName>::Element *E = il.front(); E; E = E->next(), i++) {
+ w[i] = E->get();
}
return ilret;
}
@@ -83,8 +92,11 @@ PoolVector<String> Theme::_get_font_list(const String &p_type) const {
get_font_list(p_type, &il);
ilret.resize(il.size());
- for (List<StringName>::Element *E = il.front(); E; E = E->next()) {
- ilret.push_back(E->get());
+
+ int i = 0;
+ PoolVector<String>::Write w = ilret.write();
+ for (List<StringName>::Element *E = il.front(); E; E = E->next(), i++) {
+ w[i] = E->get();
}
return ilret;
}
@@ -96,8 +108,11 @@ PoolVector<String> Theme::_get_color_list(const String &p_type) const {
get_color_list(p_type, &il);
ilret.resize(il.size());
- for (List<StringName>::Element *E = il.front(); E; E = E->next()) {
- ilret.push_back(E->get());
+
+ int i = 0;
+ PoolVector<String>::Write w = ilret.write();
+ for (List<StringName>::Element *E = il.front(); E; E = E->next(), i++) {
+ w[i] = E->get();
}
return ilret;
}
@@ -109,8 +124,11 @@ PoolVector<String> Theme::_get_constant_list(const String &p_type) const {
get_constant_list(p_type, &il);
ilret.resize(il.size());
- for (List<StringName>::Element *E = il.front(); E; E = E->next()) {
- ilret.push_back(E->get());
+
+ int i = 0;
+ PoolVector<String>::Write w = ilret.write();
+ for (List<StringName>::Element *E = il.front(); E; E = E->next(), i++) {
+ w[i] = E->get();
}
return ilret;
}
@@ -122,8 +140,11 @@ PoolVector<String> Theme::_get_type_list(const String &p_type) const {
get_type_list(&il);
ilret.resize(il.size());
- for (List<StringName>::Element *E = il.front(); E; E = E->next()) {
- ilret.push_back(E->get());
+
+ int i = 0;
+ PoolVector<String>::Write w = ilret.write();
+ for (List<StringName>::Element *E = il.front(); E; E = E->next(), i++) {
+ w[i] = E->get();
}
return ilret;
}
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp
index 24122a8d99..16a95e65a8 100644
--- a/scene/resources/tile_set.cpp
+++ b/scene/resources/tile_set.cpp
@@ -148,20 +148,45 @@ bool TileSet::_set(const StringName &p_name, const Variant &p_value) {
}
}
} else if (what == "shape")
- for (int i = 0; i < tile_get_shape_count(id); i++)
- tile_set_shape(id, i, p_value);
+ if (tile_get_shape_count(id) > 0) {
+ for (int i = 0; i < tile_get_shape_count(id); i++) {
+ tile_set_shape(id, i, p_value);
+ }
+ } else {
+ tile_set_shape(id, 0, p_value);
+ }
else if (what == "shape_offset")
- for (int i = 0; i < tile_get_shape_count(id); i++)
- tile_set_shape_offset(id, i, p_value);
+ if (tile_get_shape_count(id) > 0) {
+ for (int i = 0; i < tile_get_shape_count(id); i++) {
+ tile_set_shape_offset(id, i, p_value);
+ }
+ } else {
+ tile_set_shape_offset(id, 0, p_value);
+ }
else if (what == "shape_transform")
- for (int i = 0; i < tile_get_shape_count(id); i++)
- tile_set_shape_transform(id, i, p_value);
+ if (tile_get_shape_count(id) > 0) {
+ for (int i = 0; i < tile_get_shape_count(id); i++) {
+ tile_set_shape_transform(id, i, p_value);
+ }
+ } else {
+ tile_set_shape_transform(id, 0, p_value);
+ }
else if (what == "shape_one_way")
- for (int i = 0; i < tile_get_shape_count(id); i++)
- tile_set_shape_one_way(id, i, p_value);
+ if (tile_get_shape_count(id) > 0) {
+ for (int i = 0; i < tile_get_shape_count(id); i++) {
+ tile_set_shape_one_way(id, i, p_value);
+ }
+ } else {
+ tile_set_shape_one_way(id, 0, p_value);
+ }
else if (what == "shape_one_way_margin")
- for (int i = 0; i < tile_get_shape_count(id); i++)
- tile_set_shape_one_way_margin(id, i, p_value);
+ if (tile_get_shape_count(id) > 0) {
+ for (int i = 0; i < tile_get_shape_count(id); i++) {
+ tile_set_shape_one_way_margin(id, i, p_value);
+ }
+ } else {
+ tile_set_shape_one_way_margin(id, 0, p_value);
+ }
else if (what == "shapes")
_tile_set_shapes(id, p_value);
else if (what == "occluder")