diff options
Diffstat (limited to 'scene/resources')
-rw-r--r-- | scene/resources/dynamic_font.cpp | 1 | ||||
-rw-r--r-- | scene/resources/mesh.cpp | 1 | ||||
-rw-r--r-- | scene/resources/segment_shape_2d.cpp | 6 | ||||
-rw-r--r-- | scene/resources/texture.cpp | 1 | ||||
-rw-r--r-- | scene/resources/theme.cpp | 15 | ||||
-rw-r--r-- | scene/resources/visual_shader.cpp | 12 | ||||
-rw-r--r-- | scene/resources/visual_shader_nodes.cpp | 1 |
7 files changed, 31 insertions, 6 deletions
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); |