summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/collision_polygon_2d.cpp4
-rw-r--r--scene/2d/collision_shape_2d.cpp4
-rw-r--r--scene/2d/ray_cast_2d.cpp4
-rw-r--r--scene/3d/voxel_light_baker.cpp8
-rw-r--r--scene/animation/tween.cpp12
-rw-r--r--scene/animation/tween.h25
-rw-r--r--scene/gui/button.cpp7
-rw-r--r--scene/gui/popup_menu.cpp16
-rw-r--r--scene/gui/rich_text_effect.cpp13
-rw-r--r--scene/gui/rich_text_effect.h2
-rw-r--r--scene/gui/rich_text_label.cpp3
-rw-r--r--scene/gui/spin_box.cpp4
-rw-r--r--scene/gui/text_edit.cpp2
-rw-r--r--scene/gui/text_edit.h59
-rw-r--r--scene/main/scene_tree.cpp2
-rw-r--r--scene/resources/dynamic_font.cpp1
-rw-r--r--scene/resources/mesh.cpp1
-rw-r--r--scene/resources/segment_shape_2d.cpp6
-rw-r--r--scene/resources/texture.cpp1
-rw-r--r--scene/resources/theme.cpp15
-rw-r--r--scene/resources/visual_shader.cpp12
-rw-r--r--scene/resources/visual_shader_nodes.cpp1
22 files changed, 143 insertions, 59 deletions
diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp
index bb144dda96..766a8a6de4 100644
--- a/scene/2d/collision_polygon_2d.cpp
+++ b/scene/2d/collision_polygon_2d.cpp
@@ -169,8 +169,8 @@ void CollisionPolygon2D::_notification(int p_what) {
Vector<Vector2> pts;
float tsize = 8;
pts.push_back(line_to + (Vector2(0, tsize)));
- pts.push_back(line_to + (Vector2(0.707 * tsize, 0)));
- pts.push_back(line_to + (Vector2(-0.707 * tsize, 0)));
+ pts.push_back(line_to + (Vector2(Math_SQRT12 * tsize, 0)));
+ pts.push_back(line_to + (Vector2(-Math_SQRT12 * tsize, 0)));
Vector<Color> cols;
for (int i = 0; i < 3; i++)
cols.push_back(dcol);
diff --git a/scene/2d/collision_shape_2d.cpp b/scene/2d/collision_shape_2d.cpp
index f79d79d039..d9c1d69b53 100644
--- a/scene/2d/collision_shape_2d.cpp
+++ b/scene/2d/collision_shape_2d.cpp
@@ -134,8 +134,8 @@ void CollisionShape2D::_notification(int p_what) {
Vector<Vector2> pts;
float tsize = 8;
pts.push_back(line_to + (Vector2(0, tsize)));
- pts.push_back(line_to + (Vector2(0.707 * tsize, 0)));
- pts.push_back(line_to + (Vector2(-0.707 * tsize, 0)));
+ pts.push_back(line_to + (Vector2(Math_SQRT12 * tsize, 0)));
+ pts.push_back(line_to + (Vector2(-Math_SQRT12 * tsize, 0)));
Vector<Color> cols;
for (int i = 0; i < 3; i++)
cols.push_back(draw_col);
diff --git a/scene/2d/ray_cast_2d.cpp b/scene/2d/ray_cast_2d.cpp
index bf8d008bb2..4f6f410bdc 100644
--- a/scene/2d/ray_cast_2d.cpp
+++ b/scene/2d/ray_cast_2d.cpp
@@ -180,8 +180,8 @@ void RayCast2D::_notification(int p_what) {
Vector<Vector2> pts;
float tsize = 8;
pts.push_back(xf.xform(Vector2(tsize, 0)));
- pts.push_back(xf.xform(Vector2(0, 0.707 * tsize)));
- pts.push_back(xf.xform(Vector2(0, -0.707 * tsize)));
+ pts.push_back(xf.xform(Vector2(0, Math_SQRT12 * tsize)));
+ pts.push_back(xf.xform(Vector2(0, -Math_SQRT12 * tsize)));
Vector<Color> cols;
for (int i = 0; i < 3; i++)
cols.push_back(draw_col);
diff --git a/scene/3d/voxel_light_baker.cpp b/scene/3d/voxel_light_baker.cpp
index 8e09930aed..3235953730 100644
--- a/scene/3d/voxel_light_baker.cpp
+++ b/scene/3d/voxel_light_baker.cpp
@@ -1594,10 +1594,10 @@ Vector3 VoxelLightBaker::_compute_pixel_light_at_pos(const Vector3 &p_pos, const
case BAKE_QUALITY_LOW: {
//default quality
static const Vector3 dirs[4] = {
- Vector3(0.707107, 0, 0.707107),
- Vector3(0, 0.707107, 0.707107),
- Vector3(-0.707107, 0, 0.707107),
- Vector3(0, -0.707107, 0.707107)
+ Vector3(Math_SQRT12, 0, Math_SQRT12),
+ Vector3(0, Math_SQRT12, Math_SQRT12),
+ Vector3(-Math_SQRT12, 0, Math_SQRT12),
+ Vector3(0, -Math_SQRT12, Math_SQRT12)
};
static const float weights[4] = { 0.25, 0.25, 0.25, 0.25 };
diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp
index ce3f2b3b1a..72e8ae1b26 100644
--- a/scene/animation/tween.cpp
+++ b/scene/animation/tween.cpp
@@ -239,14 +239,14 @@ void Tween::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_runtime"), &Tween::get_runtime);
// Bind interpolation and follow methods
- ClassDB::bind_method(D_METHOD("interpolate_property", "object", "property", "initial_val", "final_val", "duration", "trans_type", "ease_type", "delay"), &Tween::interpolate_property, DEFVAL(0));
- ClassDB::bind_method(D_METHOD("interpolate_method", "object", "method", "initial_val", "final_val", "duration", "trans_type", "ease_type", "delay"), &Tween::interpolate_method, DEFVAL(0));
+ ClassDB::bind_method(D_METHOD("interpolate_property", "object", "property", "initial_val", "final_val", "duration", "trans_type", "ease_type", "delay"), &Tween::interpolate_property, DEFVAL(TRANS_LINEAR), DEFVAL(EASE_IN_OUT), DEFVAL(0));
+ ClassDB::bind_method(D_METHOD("interpolate_method", "object", "method", "initial_val", "final_val", "duration", "trans_type", "ease_type", "delay"), &Tween::interpolate_method, DEFVAL(TRANS_LINEAR), DEFVAL(EASE_IN_OUT), DEFVAL(0));
ClassDB::bind_method(D_METHOD("interpolate_callback", "object", "duration", "callback", "arg1", "arg2", "arg3", "arg4", "arg5"), &Tween::interpolate_callback, DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Variant()));
ClassDB::bind_method(D_METHOD("interpolate_deferred_callback", "object", "duration", "callback", "arg1", "arg2", "arg3", "arg4", "arg5"), &Tween::interpolate_deferred_callback, DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Variant()), DEFVAL(Variant()));
- ClassDB::bind_method(D_METHOD("follow_property", "object", "property", "initial_val", "target", "target_property", "duration", "trans_type", "ease_type", "delay"), &Tween::follow_property, DEFVAL(0));
- ClassDB::bind_method(D_METHOD("follow_method", "object", "method", "initial_val", "target", "target_method", "duration", "trans_type", "ease_type", "delay"), &Tween::follow_method, DEFVAL(0));
- ClassDB::bind_method(D_METHOD("targeting_property", "object", "property", "initial", "initial_val", "final_val", "duration", "trans_type", "ease_type", "delay"), &Tween::targeting_property, DEFVAL(0));
- ClassDB::bind_method(D_METHOD("targeting_method", "object", "method", "initial", "initial_method", "final_val", "duration", "trans_type", "ease_type", "delay"), &Tween::targeting_method, DEFVAL(0));
+ ClassDB::bind_method(D_METHOD("follow_property", "object", "property", "initial_val", "target", "target_property", "duration", "trans_type", "ease_type", "delay"), &Tween::follow_property, DEFVAL(TRANS_LINEAR), DEFVAL(EASE_IN_OUT), DEFVAL(0));
+ ClassDB::bind_method(D_METHOD("follow_method", "object", "method", "initial_val", "target", "target_method", "duration", "trans_type", "ease_type", "delay"), &Tween::follow_method, DEFVAL(TRANS_LINEAR), DEFVAL(EASE_IN_OUT), DEFVAL(0));
+ ClassDB::bind_method(D_METHOD("targeting_property", "object", "property", "initial", "initial_val", "final_val", "duration", "trans_type", "ease_type", "delay"), &Tween::targeting_property, DEFVAL(TRANS_LINEAR), DEFVAL(EASE_IN_OUT), DEFVAL(0));
+ ClassDB::bind_method(D_METHOD("targeting_method", "object", "method", "initial", "initial_method", "final_val", "duration", "trans_type", "ease_type", "delay"), &Tween::targeting_method, DEFVAL(TRANS_LINEAR), DEFVAL(EASE_IN_OUT), DEFVAL(0));
// Add the Tween signals
ADD_SIGNAL(MethodInfo("tween_started", PropertyInfo(Variant::OBJECT, "object"), PropertyInfo(Variant::NODE_PATH, "key")));
diff --git a/scene/animation/tween.h b/scene/animation/tween.h
index 574238f5c9..f301d8d76b 100644
--- a/scene/animation/tween.h
+++ b/scene/animation/tween.h
@@ -101,6 +101,12 @@ private:
int args;
Variant arg[5];
int uid;
+ InterpolateData() {
+ active = false;
+ finish = false;
+ call_deferred = false;
+ uid = 0;
+ }
};
String autoplay;
@@ -173,21 +179,14 @@ public:
real_t tell() const;
real_t get_runtime() const;
- bool interpolate_property(Object *p_object, NodePath p_property, Variant p_initial_val, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0);
-
- bool interpolate_method(Object *p_object, StringName p_method, Variant p_initial_val, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0);
-
+ bool interpolate_property(Object *p_object, NodePath p_property, Variant p_initial_val, Variant p_final_val, real_t p_duration, TransitionType p_trans_type = TRANS_LINEAR, EaseType p_ease_type = EASE_IN_OUT, real_t p_delay = 0);
+ bool interpolate_method(Object *p_object, StringName p_method, Variant p_initial_val, Variant p_final_val, real_t p_duration, TransitionType p_trans_type = TRANS_LINEAR, EaseType p_ease_type = EASE_IN_OUT, real_t p_delay = 0);
bool interpolate_callback(Object *p_object, real_t p_duration, String p_callback, VARIANT_ARG_DECLARE);
-
bool interpolate_deferred_callback(Object *p_object, real_t p_duration, String p_callback, VARIANT_ARG_DECLARE);
-
- bool follow_property(Object *p_object, NodePath p_property, Variant p_initial_val, Object *p_target, NodePath p_target_property, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0);
-
- bool follow_method(Object *p_object, StringName p_method, Variant p_initial_val, Object *p_target, StringName p_target_method, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0);
-
- bool targeting_property(Object *p_object, NodePath p_property, Object *p_initial, NodePath p_initial_property, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0);
-
- bool targeting_method(Object *p_object, StringName p_method, Object *p_initial, StringName p_initial_method, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay = 0);
+ bool follow_property(Object *p_object, NodePath p_property, Variant p_initial_val, Object *p_target, NodePath p_target_property, real_t p_duration, TransitionType p_trans_type = TRANS_LINEAR, EaseType p_ease_type = EASE_IN_OUT, real_t p_delay = 0);
+ bool follow_method(Object *p_object, StringName p_method, Variant p_initial_val, Object *p_target, StringName p_target_method, real_t p_duration, TransitionType p_trans_type = TRANS_LINEAR, EaseType p_ease_type = EASE_IN_OUT, real_t p_delay = 0);
+ bool targeting_property(Object *p_object, NodePath p_property, Object *p_initial, NodePath p_initial_property, Variant p_final_val, real_t p_duration, TransitionType p_trans_type = TRANS_LINEAR, EaseType p_ease_type = EASE_IN_OUT, real_t p_delay = 0);
+ bool targeting_method(Object *p_object, StringName p_method, Object *p_initial, StringName p_initial_method, Variant p_final_val, real_t p_duration, TransitionType p_trans_type = TRANS_LINEAR, EaseType p_ease_type = EASE_IN_OUT, real_t p_delay = 0);
Tween();
~Tween();
diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp
index ca4c255855..a68462f4d4 100644
--- a/scene/gui/button.cpp
+++ b/scene/gui/button.cpp
@@ -190,6 +190,13 @@ void Button::_notification(int p_what) {
Point2 icon_ofs = !_icon.is_null() ? Point2(icon_region.size.width + get_constant("hseparation"), 0) : Point2();
int text_clip = size.width - style->get_minimum_size().width - icon_ofs.width;
+ if (_internal_margin[MARGIN_LEFT] > 0) {
+ text_clip -= _internal_margin[MARGIN_LEFT] + get_constant("hseparation");
+ }
+ if (_internal_margin[MARGIN_RIGHT] > 0) {
+ text_clip -= _internal_margin[MARGIN_RIGHT] + get_constant("hseparation");
+ }
+
Point2 text_ofs = (size - style->get_minimum_size() - icon_ofs - font->get_string_size(xl_text) - Point2(_internal_margin[MARGIN_RIGHT] - _internal_margin[MARGIN_LEFT], 0)) / 2.0;
switch (align) {
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index 08faaf7d45..5561bce714 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -191,16 +191,20 @@ void PopupMenu::_submenu_timeout() {
void PopupMenu::_scroll(float p_factor, const Point2 &p_over) {
- const float global_y = get_global_position().y;
-
int vseparation = get_constant("vseparation");
Ref<Font> font = get_font("font");
float dy = (vseparation + font->get_height()) * 3 * p_factor * get_global_transform().get_scale().y;
- if (dy > 0 && global_y < 0)
- dy = MIN(dy, -global_y - 1);
- else if (dy < 0 && global_y + get_size().y * get_global_transform().get_scale().y > get_viewport_rect().size.y)
- dy = -MIN(-dy, global_y + get_size().y * get_global_transform().get_scale().y - get_viewport_rect().size.y - 1);
+ if (dy > 0) {
+ const float global_top = get_global_position().y;
+ const float limit = global_top < 0 ? -global_top : 0;
+ dy = MIN(dy, limit);
+ } else if (dy < 0) {
+ const float global_bottom = get_global_position().y + get_size().y * get_global_transform().get_scale().y;
+ const float viewport_height = get_viewport_rect().size.y;
+ const float limit = global_bottom > viewport_height ? global_bottom - viewport_height : 0;
+ dy = -MIN(-dy, limit);
+ }
set_position(get_position() + Vector2(0, dy));
Ref<InputEventMouseMotion> ie;
diff --git a/scene/gui/rich_text_effect.cpp b/scene/gui/rich_text_effect.cpp
index f9e0be5b31..ab2f8d2172 100644
--- a/scene/gui/rich_text_effect.cpp
+++ b/scene/gui/rich_text_effect.cpp
@@ -89,8 +89,6 @@ void CharFXTransform::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_character"), &CharFXTransform::get_character);
ClassDB::bind_method(D_METHOD("set_character", "character"), &CharFXTransform::set_character);
- ClassDB::bind_method(D_METHOD("get_value_or", "key", "default_value"), &CharFXTransform::get_value_or);
-
ADD_PROPERTY(PropertyInfo(Variant::INT, "relative_index"), "set_relative_index", "get_relative_index");
ADD_PROPERTY(PropertyInfo(Variant::INT, "absolute_index"), "set_absolute_index", "get_absolute_index");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "elapsed_time"), "set_elapsed_time", "get_elapsed_time");
@@ -101,17 +99,6 @@ void CharFXTransform::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "character"), "set_character", "get_character");
}
-Variant CharFXTransform::get_value_or(String p_key, Variant p_default_value) {
- if (!this->environment.has(p_key))
- return p_default_value;
-
- Variant r = environment[p_key];
- if (r.get_type() != p_default_value.get_type())
- return p_default_value;
-
- return r;
-}
-
CharFXTransform::CharFXTransform() {
relative_index = 0;
absolute_index = 0;
diff --git a/scene/gui/rich_text_effect.h b/scene/gui/rich_text_effect.h
index 4330cebfe6..9e0065b199 100644
--- a/scene/gui/rich_text_effect.h
+++ b/scene/gui/rich_text_effect.h
@@ -82,8 +82,6 @@ public:
void set_character(int p_char) { character = (CharType)p_char; }
Dictionary get_environment() { return environment; }
void set_environment(Dictionary p_environment) { environment = p_environment; }
-
- Variant get_value_or(String p_key, Variant p_default_value);
};
#endif // RICH_TEXT_EFFECT_H
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 0331046492..abca865ae0 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -1701,6 +1701,9 @@ bool RichTextLabel::remove_line(const int p_line) {
if (!was_newline) {
current_frame->lines.remove(p_line);
+ if (current_frame->lines.size() == 0) {
+ current_frame->lines.resize(1);
+ }
}
if (p_line == 0 && current->subitems.size() > 0)
diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp
index bf067898e6..de25d6a63d 100644
--- a/scene/gui/spin_box.cpp
+++ b/scene/gui/spin_box.cpp
@@ -211,6 +211,10 @@ void SpinBox::_notification(int p_what) {
_adjust_width_for_icon(get_icon("updown"));
_value_changed(0);
+ } else if (p_what == NOTIFICATION_THEME_CHANGED) {
+
+ call_deferred("minimum_size_changed");
+ get_line_edit()->call_deferred("minimum_size_changed");
}
}
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 2558a930b6..bf3ec9b05b 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -4438,7 +4438,6 @@ int TextEdit::get_line_wrap_index_at_col(int p_line, int p_column) const {
}
void TextEdit::cursor_set_column(int p_col, bool p_adjust_viewport) {
-
if (p_col < 0)
p_col = 0;
@@ -7141,6 +7140,7 @@ TextEdit::TextEdit() {
max_chars = 0;
clear();
wrap_enabled = false;
+ wrap_at = 0;
wrap_right_offset = 10;
set_focus_mode(FOCUS_ALL);
syntax_highlighter = NULL;
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index 594366de7d..4f11e9bb50 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -69,6 +69,10 @@ public:
int region;
bool end;
+ ColorRegionInfo() {
+ region = 0;
+ end = false;
+ }
};
struct Line {
@@ -84,6 +88,16 @@ public:
Ref<Texture> info_icon;
String info;
String data;
+ Line() {
+ width_cache = 0;
+ marked = false;
+ breakpoint = false;
+ bookmark = false;
+ hidden = false;
+ safe = false;
+ has_info = false;
+ wrap_amount_cache = 0;
+ }
};
private:
@@ -143,6 +157,14 @@ private:
int last_fit_x;
int line, column; ///< cursor
int x_ofs, line_ofs, wrap_ofs;
+ Cursor() {
+ last_fit_x = 0;
+ line = 0;
+ column = 0; ///< cursor
+ x_ofs = 0;
+ line_ofs = 0;
+ wrap_ofs = 0;
+ }
} cursor;
struct Selection {
@@ -167,7 +189,21 @@ private:
int to_line, to_column;
bool shiftclick_left;
-
+ Selection() {
+ selecting_mode = MODE_NONE;
+ selecting_line = 0;
+ selecting_column = 0;
+ selected_word_beg = 0;
+ selected_word_end = 0;
+ selected_word_origin = 0;
+ selecting_text = false;
+ active = false;
+ from_line = 0;
+ from_column = 0;
+ to_line = 0;
+ to_column = 0;
+ shiftclick_left = false;
+ }
} selection;
struct Cache {
@@ -219,6 +255,16 @@ private:
int fold_gutter_width;
int info_gutter_width;
int minimap_width;
+ Cache() {
+
+ row_height = 0;
+ line_spacing = 0;
+ line_number_w = 0;
+ breakpoint_gutter_width = 0;
+ fold_gutter_width = 0;
+ info_gutter_width = 0;
+ minimap_width = 0;
+ }
} cache;
Map<int, int> color_region_cache;
@@ -240,6 +286,17 @@ private:
uint32_t version;
bool chain_forward;
bool chain_backward;
+ TextOperation() {
+ type = TYPE_NONE;
+ from_line = 0;
+ from_column = 0;
+ to_line = 0;
+ to_column = 0;
+ prev_version = 0;
+ version = 0;
+ chain_forward = false;
+ chain_backward = false;
+ }
};
String ime_text;
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index 3a6fff45c5..48f6a0cc95 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -423,7 +423,7 @@ void SceneTree::input_event(const Ref<InputEvent> &p_event) {
input_handled = false;
- Ref<InputEvent> ev = p_event;
+ const Ref<InputEvent> &ev = p_event;
MainLoop::input_event(ev);
diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp
index 99a2881d58..7524571956 100644
--- a/scene/resources/dynamic_font.cpp
+++ b/scene/resources/dynamic_font.cpp
@@ -657,6 +657,7 @@ void DynamicFont::_reload_cache() {
if (!data.is_valid()) {
data_at_size.unref();
outline_data_at_size.unref();
+ fallbacks.resize(0);
fallback_data_at_size.resize(0);
fallback_outline_data_at_size.resize(0);
return;
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index 4afb07cb6f..0d94d4dbf4 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -483,6 +483,7 @@ void Mesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_lightmap_size_hint", "size"), &Mesh::set_lightmap_size_hint);
ClassDB::bind_method(D_METHOD("get_lightmap_size_hint"), &Mesh::get_lightmap_size_hint);
+ ClassDB::bind_method(D_METHOD("get_aabb"), &Mesh::get_aabb);
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "lightmap_size_hint"), "set_lightmap_size_hint", "get_lightmap_size_hint");
diff --git a/scene/resources/segment_shape_2d.cpp b/scene/resources/segment_shape_2d.cpp
index 62c5f9bab3..cc6ec93d74 100644
--- a/scene/resources/segment_shape_2d.cpp
+++ b/scene/resources/segment_shape_2d.cpp
@@ -120,8 +120,8 @@ void RayShape2D::draw(const RID &p_to_rid, const Color &p_color) {
Vector<Vector2> pts;
float tsize = 4;
pts.push_back(tip + Vector2(0, tsize));
- pts.push_back(tip + Vector2(0.707 * tsize, 0));
- pts.push_back(tip + Vector2(-0.707 * tsize, 0));
+ pts.push_back(tip + Vector2(Math_SQRT12 * tsize, 0));
+ pts.push_back(tip + Vector2(-Math_SQRT12 * tsize, 0));
Vector<Color> cols;
for (int i = 0; i < 3; i++)
cols.push_back(p_color);
@@ -134,7 +134,7 @@ Rect2 RayShape2D::get_rect() const {
Rect2 rect;
rect.position = Vector2();
rect.expand_to(Vector2(0, length));
- rect = rect.grow(0.707 * 4);
+ rect = rect.grow(Math_SQRT12 * 4);
return rect;
}
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index 593c399f62..b21546af2f 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -1333,6 +1333,7 @@ void LargeTexture::set_piece_offset(int p_idx, const Point2 &p_offset) {
void LargeTexture::set_piece_texture(int p_idx, const Ref<Texture> &p_texture) {
ERR_FAIL_COND(p_texture == this);
+ ERR_FAIL_COND(p_texture.is_null());
ERR_FAIL_INDEX(p_idx, pieces.size());
pieces.write[p_idx].texture = p_texture;
};
diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp
index c897365b21..bf9079c9f4 100644
--- a/scene/resources/theme.cpp
+++ b/scene/resources/theme.cpp
@@ -720,7 +720,10 @@ void Theme::clear() {
while ((K = icon_map.next(K))) {
const StringName *L = NULL;
while ((L = icon_map[*K].next(L))) {
- icon_map[*K][*L]->disconnect("changed", this, "_emit_theme_changed");
+ Ref<Texture> icon = icon_map[*K][*L];
+ if (icon.is_valid()) {
+ icon->disconnect("changed", this, "_emit_theme_changed");
+ }
}
}
}
@@ -730,7 +733,10 @@ void Theme::clear() {
while ((K = style_map.next(K))) {
const StringName *L = NULL;
while ((L = style_map[*K].next(L))) {
- style_map[*K][*L]->disconnect("changed", this, "_emit_theme_changed");
+ Ref<StyleBox> style = style_map[*K][*L];
+ if (style.is_valid()) {
+ style->disconnect("changed", this, "_emit_theme_changed");
+ }
}
}
}
@@ -740,7 +746,10 @@ void Theme::clear() {
while ((K = font_map.next(K))) {
const StringName *L = NULL;
while ((L = font_map[*K].next(L))) {
- font_map[*K][*L]->disconnect("changed", this, "_emit_theme_changed");
+ Ref<Font> font = font_map[*K][*L];
+ if (font.is_valid()) {
+ font->disconnect("changed", this, "_emit_theme_changed");
+ }
}
}
}
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index 9f99732714..797de1d863 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -2259,6 +2259,8 @@ void VisualShaderNodeGroupBase::set_input_port_type(int p_id, int p_type) {
int index = 0;
for (int i = 0; i < inputs_strings.size(); i++) {
Vector<String> arr = inputs_strings[i].split(",");
+ ERR_FAIL_COND(arr.size() != 3);
+
if (arr[0].to_int() == p_id) {
index += arr[0].size();
count = arr[1].size() - 1;
@@ -2292,6 +2294,8 @@ void VisualShaderNodeGroupBase::set_input_port_name(int p_id, const String &p_na
int index = 0;
for (int i = 0; i < inputs_strings.size(); i++) {
Vector<String> arr = inputs_strings[i].split(",");
+ ERR_FAIL_COND(arr.size() != 3);
+
if (arr[0].to_int() == p_id) {
index += arr[0].size() + arr[1].size();
count = arr[2].size() - 1;
@@ -2325,6 +2329,8 @@ void VisualShaderNodeGroupBase::set_output_port_type(int p_id, int p_type) {
int index = 0;
for (int i = 0; i < output_strings.size(); i++) {
Vector<String> arr = output_strings[i].split(",");
+ ERR_FAIL_COND(arr.size() != 3);
+
if (arr[0].to_int() == p_id) {
index += arr[0].size();
count = arr[1].size() - 1;
@@ -2358,6 +2364,8 @@ void VisualShaderNodeGroupBase::set_output_port_name(int p_id, const String &p_n
int index = 0;
for (int i = 0; i < output_strings.size(); i++) {
Vector<String> arr = output_strings[i].split(",");
+ ERR_FAIL_COND(arr.size() != 3);
+
if (arr[0].to_int() == p_id) {
index += arr[0].size() + arr[1].size();
count = arr[2].size() - 1;
@@ -2405,6 +2413,8 @@ void VisualShaderNodeGroupBase::_apply_port_changes() {
for (int i = 0; i < inputs_strings.size(); i++) {
Vector<String> arr = inputs_strings[i].split(",");
+ ERR_FAIL_COND(arr.size() != 3);
+
Port port;
port.type = (PortType)arr[1].to_int();
port.name = arr[2];
@@ -2412,6 +2422,8 @@ void VisualShaderNodeGroupBase::_apply_port_changes() {
}
for (int i = 0; i < outputs_strings.size(); i++) {
Vector<String> arr = outputs_strings[i].split(",");
+ ERR_FAIL_COND(arr.size() != 3);
+
Port port;
port.type = (PortType)arr[1].to_int();
port.name = arr[2];
diff --git a/scene/resources/visual_shader_nodes.cpp b/scene/resources/visual_shader_nodes.cpp
index a94fdd9d7b..6e4b5d9af0 100644
--- a/scene/resources/visual_shader_nodes.cpp
+++ b/scene/resources/visual_shader_nodes.cpp
@@ -715,6 +715,7 @@ void VisualShaderNodeTexture::_bind_methods() {
BIND_ENUM_CONSTANT(SOURCE_2D_TEXTURE);
BIND_ENUM_CONSTANT(SOURCE_2D_NORMAL);
BIND_ENUM_CONSTANT(SOURCE_DEPTH);
+ BIND_ENUM_CONSTANT(SOURCE_PORT);
BIND_ENUM_CONSTANT(TYPE_DATA);
BIND_ENUM_CONSTANT(TYPE_COLOR);
BIND_ENUM_CONSTANT(TYPE_NORMALMAP);