diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/2d/polygon_2d.cpp | 2 | ||||
-rw-r--r-- | scene/3d/ray_cast_3d.cpp | 4 | ||||
-rw-r--r-- | scene/3d/ray_cast_3d.h | 4 | ||||
-rw-r--r-- | scene/animation/tween.cpp | 25 | ||||
-rw-r--r-- | scene/animation/tween.h | 5 | ||||
-rw-r--r-- | scene/gui/button.cpp | 6 | ||||
-rw-r--r-- | scene/gui/graph_node.cpp | 6 | ||||
-rw-r--r-- | scene/gui/label.cpp | 6 | ||||
-rw-r--r-- | scene/gui/line_edit.cpp | 6 | ||||
-rw-r--r-- | scene/gui/line_edit.h | 2 | ||||
-rw-r--r-- | scene/gui/link_button.cpp | 6 | ||||
-rw-r--r-- | scene/gui/rich_text_label.cpp | 9 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 12 | ||||
-rw-r--r-- | scene/gui/text_edit.h | 2 | ||||
-rw-r--r-- | scene/gui/texture_rect.cpp | 22 | ||||
-rw-r--r-- | scene/gui/texture_rect.h | 9 | ||||
-rw-r--r-- | scene/gui/tree.cpp | 2 | ||||
-rw-r--r-- | scene/main/scene_tree.cpp | 2 | ||||
-rw-r--r-- | scene/main/viewport.cpp | 12 | ||||
-rw-r--r-- | scene/resources/default_theme/default_theme.cpp | 2 | ||||
-rw-r--r-- | scene/resources/font.cpp | 121 | ||||
-rw-r--r-- | scene/resources/font.h | 3 | ||||
-rw-r--r-- | scene/resources/visual_shader.cpp | 2 |
23 files changed, 110 insertions, 160 deletions
diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp index 5451d95be9..1f4dec6864 100644 --- a/scene/2d/polygon_2d.cpp +++ b/scene/2d/polygon_2d.cpp @@ -662,7 +662,7 @@ void Polygon2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR2_ARRAY, "uv"), "set_uv", "get_uv"); ADD_PROPERTY(PropertyInfo(Variant::PACKED_COLOR_ARRAY, "vertex_colors"), "set_vertex_colors", "get_vertex_colors"); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "polygons"), "set_polygons", "get_polygons"); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "bones", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR), "_set_bones", "_get_bones"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "bones", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR), "_set_bones", "_get_bones"); ADD_PROPERTY(PropertyInfo(Variant::INT, "internal_vertex_count", PROPERTY_HINT_RANGE, "0,1000"), "set_internal_vertex_count", "get_internal_vertex_count"); } diff --git a/scene/3d/ray_cast_3d.cpp b/scene/3d/ray_cast_3d.cpp index d2ba6809b3..3bb65d07a0 100644 --- a/scene/3d/ray_cast_3d.cpp +++ b/scene/3d/ray_cast_3d.cpp @@ -355,7 +355,7 @@ void RayCast3D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "debug_shape_thickness", PROPERTY_HINT_RANGE, "1,5"), "set_debug_shape_thickness", "get_debug_shape_thickness"); } -float RayCast3D::get_debug_shape_thickness() const { +int RayCast3D::get_debug_shape_thickness() const { return debug_shape_thickness; } @@ -384,7 +384,7 @@ void RayCast3D::_update_debug_shape_vertices() { } } -void RayCast3D::set_debug_shape_thickness(const float p_debug_shape_thickness) { +void RayCast3D::set_debug_shape_thickness(const int p_debug_shape_thickness) { debug_shape_thickness = p_debug_shape_thickness; update_gizmos(); diff --git a/scene/3d/ray_cast_3d.h b/scene/3d/ray_cast_3d.h index a580afe8db..a53e2c83fc 100644 --- a/scene/3d/ray_cast_3d.h +++ b/scene/3d/ray_cast_3d.h @@ -105,8 +105,8 @@ public: Ref<StandardMaterial3D> get_debug_material(); - float get_debug_shape_thickness() const; - void set_debug_shape_thickness(const float p_debug_thickness); + int get_debug_shape_thickness() const; + void set_debug_shape_thickness(const int p_debug_thickness); void force_raycast_update(); bool is_colliding() const; diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp index 2e6a123016..a37c6f5355 100644 --- a/scene/animation/tween.cpp +++ b/scene/animation/tween.cpp @@ -260,10 +260,8 @@ bool Tween::step(float p_delta) { } if (is_bound) { - Object *bound_instance = ObjectDB::get_instance(bound_node); - if (bound_instance) { - Node *bound_node = Object::cast_to<Node>(bound_instance); - // This can't by anything else than Node, so we can omit checking if casting succeeded. + Node *bound_node = get_bound_node(); + if (bound_node) { if (!bound_node->is_inside_tree()) { return true; } @@ -320,16 +318,23 @@ bool Tween::step(float p_delta) { return true; } -bool Tween::should_pause() { +bool Tween::can_process(bool p_tree_paused) const { if (is_bound && pause_mode == TWEEN_PAUSE_BOUND) { - Object *bound_instance = ObjectDB::get_instance(bound_node); - if (bound_instance) { - Node *bound_node = Object::cast_to<Node>(bound_instance); - return !bound_node->can_process(); + Node *bound_node = get_bound_node(); + if (bound_node) { + return bound_node->can_process(); } } - return pause_mode != TWEEN_PAUSE_PROCESS; + return !p_tree_paused || pause_mode == TWEEN_PAUSE_PROCESS; +} + +Node *Tween::get_bound_node() const { + if (is_bound) { + return Object::cast_to<Node>(ObjectDB::get_instance(bound_node)); + } else { + return nullptr; + } } real_t Tween::run_equation(TransitionType p_trans_type, EaseType p_ease_type, real_t p_time, real_t p_initial, real_t p_delta, real_t p_duration) { diff --git a/scene/animation/tween.h b/scene/animation/tween.h index 7ecdb64f0d..5b0745b2b3 100644 --- a/scene/animation/tween.h +++ b/scene/animation/tween.h @@ -97,7 +97,7 @@ public: private: TweenProcessMode process_mode = TweenProcessMode::TWEEN_PROCESS_IDLE; - TweenPauseMode pause_mode = TweenPauseMode::TWEEN_PAUSE_STOP; + TweenPauseMode pause_mode = TweenPauseMode::TWEEN_PAUSE_BOUND; TransitionType default_transition = TransitionType::TRANS_LINEAR; EaseType default_ease = EaseType::EASE_IN_OUT; ObjectID bound_node; @@ -164,7 +164,8 @@ public: Variant calculate_delta_value(Variant p_intial_val, Variant p_final_val); bool step(float p_delta); - bool should_pause(); + bool can_process(bool p_tree_paused) const; + Node *get_bound_node() const; Tween() {} }; diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp index dc030d6f3d..046b9c18c7 100644 --- a/scene/gui/button.cpp +++ b/scene/gui/button.cpp @@ -499,7 +499,7 @@ bool Button::_set(const StringName &p_name, const Variant &p_value) { if (str.begins_with("opentype_features/")) { String name = str.get_slicec('/', 1); int32_t tag = TS->name_to_tag(name); - double value = p_value; + int value = p_value; if (value == -1) { if (opentype_features.has(tag)) { opentype_features.erase(tag); @@ -507,7 +507,7 @@ bool Button::_set(const StringName &p_name, const Variant &p_value) { update(); } } else { - if ((double)opentype_features[tag] != value) { + if (!opentype_features.has(tag) || (int)opentype_features[tag] != value) { opentype_features[tag] = value; _shape(); update(); @@ -539,7 +539,7 @@ bool Button::_get(const StringName &p_name, Variant &r_ret) const { void Button::_get_property_list(List<PropertyInfo> *p_list) const { for (const Variant *ftr = opentype_features.next(nullptr); ftr != nullptr; ftr = opentype_features.next(ftr)) { String name = TS->tag_to_name(*ftr); - p_list->push_back(PropertyInfo(Variant::FLOAT, "opentype_features/" + name)); + p_list->push_back(PropertyInfo(Variant::INT, "opentype_features/" + name)); } p_list->push_back(PropertyInfo(Variant::NIL, "opentype_features/_new", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR)); } diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp index 1a270ff942..d6569e3de4 100644 --- a/scene/gui/graph_node.cpp +++ b/scene/gui/graph_node.cpp @@ -46,7 +46,7 @@ bool GraphNode::_set(const StringName &p_name, const Variant &p_value) { if (str.begins_with("opentype_features/")) { String name = str.get_slicec('/', 1); int32_t tag = TS->name_to_tag(name); - double value = p_value; + int value = p_value; if (value == -1) { if (opentype_features.has(tag)) { opentype_features.erase(tag); @@ -54,7 +54,7 @@ bool GraphNode::_set(const StringName &p_name, const Variant &p_value) { update(); } } else { - if ((double)opentype_features[tag] != value) { + if (!opentype_features.has(tag) || (int)opentype_features[tag] != value) { opentype_features[tag] = value; _shape(); update(); @@ -153,7 +153,7 @@ bool GraphNode::_get(const StringName &p_name, Variant &r_ret) const { void GraphNode::_get_property_list(List<PropertyInfo> *p_list) const { for (const Variant *ftr = opentype_features.next(nullptr); ftr != nullptr; ftr = opentype_features.next(ftr)) { String name = TS->tag_to_name(*ftr); - p_list->push_back(PropertyInfo(Variant::FLOAT, "opentype_features/" + name)); + p_list->push_back(PropertyInfo(Variant::INT, "opentype_features/" + name)); } p_list->push_back(PropertyInfo(Variant::NIL, "opentype_features/_new", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR)); diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index 54c4835ccf..edd206a1ca 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -811,7 +811,7 @@ bool Label::_set(const StringName &p_name, const Variant &p_value) { if (str.begins_with("opentype_features/")) { String name = str.get_slicec('/', 1); int32_t tag = TS->name_to_tag(name); - double value = p_value; + int value = p_value; if (value == -1) { if (opentype_features.has(tag)) { opentype_features.erase(tag); @@ -819,7 +819,7 @@ bool Label::_set(const StringName &p_name, const Variant &p_value) { update(); } } else { - if ((double)opentype_features[tag] != value) { + if (!opentype_features.has(tag) || (int)opentype_features[tag] != value) { opentype_features[tag] = value; dirty = true; update(); @@ -851,7 +851,7 @@ bool Label::_get(const StringName &p_name, Variant &r_ret) const { void Label::_get_property_list(List<PropertyInfo> *p_list) const { for (const Variant *ftr = opentype_features.next(nullptr); ftr != nullptr; ftr = opentype_features.next(ftr)) { String name = TS->tag_to_name(*ftr); - p_list->push_back(PropertyInfo(Variant::FLOAT, "opentype_features/" + name)); + p_list->push_back(PropertyInfo(Variant::INT, "opentype_features/" + name)); } p_list->push_back(PropertyInfo(Variant::NIL, "opentype_features/_new", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR)); } diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index f000f64caf..ec18101d2f 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -2164,7 +2164,7 @@ bool LineEdit::_set(const StringName &p_name, const Variant &p_value) { if (str.begins_with("opentype_features/")) { String name = str.get_slicec('/', 1); int32_t tag = TS->name_to_tag(name); - double value = p_value; + int value = p_value; if (value == -1) { if (opentype_features.has(tag)) { opentype_features.erase(tag); @@ -2172,7 +2172,7 @@ bool LineEdit::_set(const StringName &p_name, const Variant &p_value) { update(); } } else { - if ((double)opentype_features[tag] != value) { + if (!opentype_features.has(tag) || (int)opentype_features[tag] != value) { opentype_features[tag] = value; _shape(); update(); @@ -2204,7 +2204,7 @@ bool LineEdit::_get(const StringName &p_name, Variant &r_ret) const { void LineEdit::_get_property_list(List<PropertyInfo> *p_list) const { for (const Variant *ftr = opentype_features.next(nullptr); ftr != nullptr; ftr = opentype_features.next(ftr)) { String name = TS->tag_to_name(*ftr); - p_list->push_back(PropertyInfo(Variant::FLOAT, "opentype_features/" + name)); + p_list->push_back(PropertyInfo(Variant::INT, "opentype_features/" + name)); } p_list->push_back(PropertyInfo(Variant::NIL, "opentype_features/_new", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR)); } diff --git a/scene/gui/line_edit.h b/scene/gui/line_edit.h index 029ff07d13..0c313f71c2 100644 --- a/scene/gui/line_edit.h +++ b/scene/gui/line_edit.h @@ -97,7 +97,7 @@ private: PopupMenu *menu_dir = nullptr; PopupMenu *menu_ctl = nullptr; - bool caret_mid_grapheme_enabled = false; + bool caret_mid_grapheme_enabled = true; int caret_column = 0; int scroll_offset = 0; diff --git a/scene/gui/link_button.cpp b/scene/gui/link_button.cpp index 1890e461e9..67ffa2c7ed 100644 --- a/scene/gui/link_button.cpp +++ b/scene/gui/link_button.cpp @@ -240,7 +240,7 @@ bool LinkButton::_set(const StringName &p_name, const Variant &p_value) { if (str.begins_with("opentype_features/")) { String name = str.get_slicec('/', 1); int32_t tag = TS->name_to_tag(name); - double value = p_value; + int value = p_value; if (value == -1) { if (opentype_features.has(tag)) { opentype_features.erase(tag); @@ -248,7 +248,7 @@ bool LinkButton::_set(const StringName &p_name, const Variant &p_value) { update(); } } else { - if ((double)opentype_features[tag] != value) { + if (!opentype_features.has(tag) || (int)opentype_features[tag] != value) { opentype_features[tag] = value; _shape(); update(); @@ -280,7 +280,7 @@ bool LinkButton::_get(const StringName &p_name, Variant &r_ret) const { void LinkButton::_get_property_list(List<PropertyInfo> *p_list) const { for (const Variant *ftr = opentype_features.next(nullptr); ftr != nullptr; ftr = opentype_features.next(ftr)) { String name = TS->tag_to_name(*ftr); - p_list->push_back(PropertyInfo(Variant::FLOAT, "opentype_features/" + name)); + p_list->push_back(PropertyInfo(Variant::INT, "opentype_features/" + name)); } p_list->push_back(PropertyInfo(Variant::NIL, "opentype_features/_new", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR)); } diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 348a0324f4..863555120d 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -1005,7 +1005,8 @@ int RichTextLabel::_draw_line(ItemFrame *p_frame, int p_line, const Vector2 &p_o float y_off = TS->shaped_text_get_underline_position(rid); float underline_width = TS->shaped_text_get_underline_thickness(rid) * get_theme_default_base_scale(); draw_line(p_ofs + Vector2(off.x, off.y + y_off), p_ofs + Vector2(off.x + glyphs[i].advance * glyphs[i].repeat, off.y + y_off), uc, underline_width); - } else if (_find_strikethrough(it)) { + } + if (_find_strikethrough(it)) { Color uc = font_color; uc.a *= 0.5; float y_off = -TS->shaped_text_get_ascent(rid) + TS->shaped_text_get_size(rid).y / 2; @@ -3065,6 +3066,12 @@ void RichTextLabel::append_text(const String &p_bbcode) { push_strikethrough(); pos = brk_end + 1; tag_stack.push_front(tag); + } else if (tag == "lb") { + add_text("["); + pos = brk_end + 1; + } else if (tag == "rb") { + add_text("]"); + pos = brk_end + 1; } else if (tag == "lrm") { add_text(String::chr(0x200E)); pos = brk_end + 1; diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 817a4453a8..8df77daafb 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -1135,7 +1135,7 @@ void TextEdit::_notification(int p_what) { int first_visible_char = TS->shaped_text_get_range(rid).y; int last_visible_char = TS->shaped_text_get_range(rid).x; - int char_ofs = 0; + float char_ofs = 0; if (outline_size > 0 && outline_color.a > 0) { for (int j = 0; j < gl_size; j++) { for (int k = 0; k < glyphs[j].repeat; k++) { @@ -1170,7 +1170,7 @@ void TextEdit::_notification(int p_what) { } } - int char_pos = char_ofs + char_margin + ofs_x; + float char_pos = char_ofs + char_margin + ofs_x; if (char_pos >= xmargin_beg) { if (highlight_matching_braces_enabled) { if ((brace_open_match_line == line && brace_open_match_column == glyphs[j].start) || @@ -5228,7 +5228,7 @@ bool TextEdit::_set(const StringName &p_name, const Variant &p_value) { if (str.begins_with("opentype_features/")) { String name = str.get_slicec('/', 1); int32_t tag = TS->name_to_tag(name); - double value = p_value; + int value = p_value; if (value == -1) { if (opentype_features.has(tag)) { opentype_features.erase(tag); @@ -5237,7 +5237,7 @@ bool TextEdit::_set(const StringName &p_name, const Variant &p_value) { update(); } } else { - if ((double)opentype_features[tag] != value) { + if (!opentype_features.has(tag) || (int)opentype_features[tag] != value) { opentype_features[tag] = value; text.set_font_features(opentype_features); text.invalidate_all(); @@ -5270,7 +5270,7 @@ bool TextEdit::_get(const StringName &p_name, Variant &r_ret) const { void TextEdit::_get_property_list(List<PropertyInfo> *p_list) const { for (const Variant *ftr = opentype_features.next(nullptr); ftr != nullptr; ftr = opentype_features.next(ftr)) { String name = TS->tag_to_name(*ftr); - p_list->push_back(PropertyInfo(Variant::FLOAT, "opentype_features/" + name)); + p_list->push_back(PropertyInfo(Variant::INT, "opentype_features/" + name)); } p_list->push_back(PropertyInfo(Variant::NIL, "opentype_features/_new", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR)); } @@ -5949,6 +5949,7 @@ void TextEdit::_update_scrollbars() { caret.line_ofs = 0; caret.wrap_ofs = 0; v_scroll->set_value(0); + v_scroll->set_max(0); v_scroll->hide(); } @@ -5966,6 +5967,7 @@ void TextEdit::_update_scrollbars() { } else { caret.x_ofs = 0; h_scroll->set_value(0); + h_scroll->set_max(0); h_scroll->hide(); } diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h index d51ac8dffc..57b48b5f52 100644 --- a/scene/gui/text_edit.h +++ b/scene/gui/text_edit.h @@ -374,7 +374,7 @@ private: bool move_caret_on_right_click = true; - bool caret_mid_grapheme_enabled = false; + bool caret_mid_grapheme_enabled = true; bool drag_action = false; bool drag_caret_force_displayed = false; diff --git a/scene/gui/texture_rect.cpp b/scene/gui/texture_rect.cpp index ebf5ce597e..a8cdeb44f5 100644 --- a/scene/gui/texture_rect.cpp +++ b/scene/gui/texture_rect.cpp @@ -44,9 +44,6 @@ void TextureRect::_notification(int p_what) { bool tile = false; switch (stretch_mode) { - case STRETCH_SCALE_ON_EXPAND: { - size = expand ? get_size() : texture->get_size(); - } break; case STRETCH_SCALE: { size = get_size(); } break; @@ -114,7 +111,7 @@ void TextureRect::_notification(int p_what) { } Size2 TextureRect::get_minimum_size() const { - if (!expand && !texture.is_null()) { + if (!ignore_texture_size && !texture.is_null()) { return texture->get_size(); } else { return Size2(); @@ -124,8 +121,8 @@ Size2 TextureRect::get_minimum_size() const { void TextureRect::_bind_methods() { ClassDB::bind_method(D_METHOD("set_texture", "texture"), &TextureRect::set_texture); ClassDB::bind_method(D_METHOD("get_texture"), &TextureRect::get_texture); - ClassDB::bind_method(D_METHOD("set_expand", "enable"), &TextureRect::set_expand); - ClassDB::bind_method(D_METHOD("has_expand"), &TextureRect::has_expand); + ClassDB::bind_method(D_METHOD("set_ignore_texture_size", "ignore"), &TextureRect::set_ignore_texture_size); + ClassDB::bind_method(D_METHOD("get_ignore_texture_size"), &TextureRect::get_ignore_texture_size); ClassDB::bind_method(D_METHOD("set_flip_h", "enable"), &TextureRect::set_flip_h); ClassDB::bind_method(D_METHOD("is_flipped_h"), &TextureRect::is_flipped_h); ClassDB::bind_method(D_METHOD("set_flip_v", "enable"), &TextureRect::set_flip_v); @@ -134,12 +131,11 @@ void TextureRect::_bind_methods() { ClassDB::bind_method(D_METHOD("get_stretch_mode"), &TextureRect::get_stretch_mode); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_texture", "get_texture"); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "expand"), "set_expand", "has_expand"); - ADD_PROPERTY(PropertyInfo(Variant::INT, "stretch_mode", PROPERTY_HINT_ENUM, "Scale On Expand (Compat),Scale,Tile,Keep,Keep Centered,Keep Aspect,Keep Aspect Centered,Keep Aspect Covered"), "set_stretch_mode", "get_stretch_mode"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "ignore_texture_size"), "set_ignore_texture_size", "get_ignore_texture_size"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "stretch_mode", PROPERTY_HINT_ENUM, "Scale,Tile,Keep,Keep Centered,Keep Aspect,Keep Aspect Centered,Keep Aspect Covered"), "set_stretch_mode", "get_stretch_mode"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "flip_h"), "set_flip_h", "is_flipped_h"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "flip_v"), "set_flip_v", "is_flipped_v"); - BIND_ENUM_CONSTANT(STRETCH_SCALE_ON_EXPAND); BIND_ENUM_CONSTANT(STRETCH_SCALE); BIND_ENUM_CONSTANT(STRETCH_TILE); BIND_ENUM_CONSTANT(STRETCH_KEEP); @@ -179,14 +175,14 @@ Ref<Texture2D> TextureRect::get_texture() const { return texture; } -void TextureRect::set_expand(bool p_expand) { - expand = p_expand; +void TextureRect::set_ignore_texture_size(bool p_ignore) { + ignore_texture_size = p_ignore; update(); update_minimum_size(); } -bool TextureRect::has_expand() const { - return expand; +bool TextureRect::get_ignore_texture_size() const { + return ignore_texture_size; } void TextureRect::set_stretch_mode(StretchMode p_mode) { diff --git a/scene/gui/texture_rect.h b/scene/gui/texture_rect.h index ede5b7b480..7d667b25a8 100644 --- a/scene/gui/texture_rect.h +++ b/scene/gui/texture_rect.h @@ -38,7 +38,6 @@ class TextureRect : public Control { public: enum StretchMode { - STRETCH_SCALE_ON_EXPAND, //default, for backwards compatibility STRETCH_SCALE, STRETCH_TILE, STRETCH_KEEP, @@ -49,11 +48,11 @@ public: }; private: - bool expand = false; + bool ignore_texture_size = false; bool hflip = false; bool vflip = false; Ref<Texture2D> texture; - StretchMode stretch_mode = STRETCH_SCALE_ON_EXPAND; + StretchMode stretch_mode = STRETCH_SCALE; void _texture_changed(); @@ -66,8 +65,8 @@ public: void set_texture(const Ref<Texture2D> &p_tex); Ref<Texture2D> get_texture() const; - void set_expand(bool p_expand); - bool has_expand() const; + void set_ignore_texture_size(bool p_ignore); + bool get_ignore_texture_size() const; void set_stretch_mode(StretchMode p_mode); StretchMode get_stretch_mode() const; diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 73d39aee8a..e46de43f1e 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -3171,7 +3171,7 @@ void Tree::gui_input(const Ref<InputEvent> &p_event) { if (drag_touching && !drag_touching_deaccel) { drag_accum -= mm->get_relative().y; v_scroll->set_value(drag_from + drag_accum); - drag_speed = -mm->get_speed().y; + drag_speed = -mm->get_velocity().y; } } diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 9e4908a23d..cafa4a43fd 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -535,7 +535,7 @@ void SceneTree::process_tweens(float p_delta, bool p_physics) { for (List<Ref<Tween>>::Element *E = tweens.front(); E;) { List<Ref<Tween>>::Element *N = E->next(); // Don't process if paused or process mode doesn't match. - if ((paused && E->get()->should_pause()) || (p_physics == (E->get()->get_process_mode() == Tween::TWEEN_PROCESS_IDLE))) { + if (!E->get()->can_process(paused) || (p_physics == (E->get()->get_process_mode() == Tween::TWEEN_PROCESS_IDLE))) { if (E == L) { break; } diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index abbd7ba5a0..4ad250ff54 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1699,13 +1699,13 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) { if (over) { Transform2D localizer = over->get_global_transform_with_canvas().affine_inverse(); Size2 pos = localizer.xform(mpos); - Vector2 speed = localizer.basis_xform(mm->get_speed()); + Vector2 velocity = localizer.basis_xform(mm->get_velocity()); Vector2 rel = localizer.basis_xform(mm->get_relative()); mm = mm->xformed_by(Transform2D()); // Make a copy. mm->set_global_position(mpos); - mm->set_speed(speed); + mm->set_velocity(velocity); mm->set_relative(rel); if (mm->get_button_mask() == MouseButton::NONE) { @@ -1955,12 +1955,12 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) { if (over->can_process()) { Transform2D localizer = over->get_global_transform_with_canvas().affine_inverse(); Size2 pos = localizer.xform(drag_event->get_position()); - Vector2 speed = localizer.basis_xform(drag_event->get_speed()); + Vector2 velocity = localizer.basis_xform(drag_event->get_velocity()); Vector2 rel = localizer.basis_xform(drag_event->get_relative()); drag_event = drag_event->xformed_by(Transform2D()); // Make a copy. - drag_event->set_speed(speed); + drag_event->set_velocity(velocity); drag_event->set_relative(rel); drag_event->set_position(pos); @@ -3954,8 +3954,8 @@ void SubViewport::_bind_methods() { ClassDB::bind_method(D_METHOD("set_clear_mode", "mode"), &SubViewport::set_clear_mode); ClassDB::bind_method(D_METHOD("get_clear_mode"), &SubViewport::get_clear_mode); - ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "size"), "set_size", "get_size"); - ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "size_2d_override"), "set_size_2d_override", "get_size_2d_override"); + ADD_PROPERTY(PropertyInfo(Variant::VECTOR2I, "size"), "set_size", "get_size"); + ADD_PROPERTY(PropertyInfo(Variant::VECTOR2I, "size_2d_override"), "set_size_2d_override", "get_size_2d_override"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "size_2d_override_stretch"), "set_size_2d_override_stretch", "is_size_2d_override_stretch_enabled"); ADD_GROUP("Render Target", "render_target_"); ADD_PROPERTY(PropertyInfo(Variant::INT, "render_target_clear_mode", PROPERTY_HINT_ENUM, "Always,Never,Next Frame"), "set_clear_mode", "get_clear_mode"); diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index 549bd3ba12..93c7eb43a1 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -994,7 +994,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const // Visual Node Ports theme->set_constant("port_grab_distance_horizontal", "GraphEdit", 24 * scale); - theme->set_constant("port_grab_distance_vertical", "GraphEdit", 6 * scale); + theme->set_constant("port_grab_distance_vertical", "GraphEdit", 26 * scale); theme->set_stylebox("bg", "GraphEditMinimap", make_flat_stylebox(Color(0.24, 0.24, 0.24), 0, 0, 0, 0)); Ref<StyleBoxFlat> style_minimap_camera = make_flat_stylebox(Color(0.65, 0.65, 0.65, 0.2), 0, 0, 0, 0); diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp index 9bd98237ff..d9e0c301de 100644 --- a/scene/resources/font.cpp +++ b/scene/resources/font.cpp @@ -184,6 +184,9 @@ void FontData::_bind_methods() { ClassDB::bind_method(D_METHOD("remove_script_support_override", "script"), &FontData::remove_script_support_override); ClassDB::bind_method(D_METHOD("get_script_support_overrides"), &FontData::get_script_support_overrides); + ClassDB::bind_method(D_METHOD("set_opentype_feature_overrides", "overrides"), &FontData::set_opentype_feature_overrides); + ClassDB::bind_method(D_METHOD("get_opentype_feature_overrides"), &FontData::get_opentype_feature_overrides); + ClassDB::bind_method(D_METHOD("has_char", "char"), &FontData::has_char); ClassDB::bind_method(D_METHOD("get_supported_chars"), &FontData::get_supported_chars); @@ -191,49 +194,25 @@ void FontData::_bind_methods() { ClassDB::bind_method(D_METHOD("get_supported_feature_list"), &FontData::get_supported_feature_list); ClassDB::bind_method(D_METHOD("get_supported_variation_list"), &FontData::get_supported_variation_list); + + ADD_PROPERTY(PropertyInfo(Variant::PACKED_BYTE_ARRAY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE), "set_data", "get_data"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "antialiased", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE), "set_antialiased", "is_antialiased"); + ADD_PROPERTY(PropertyInfo(Variant::STRING, "font_name", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE), "set_font_name", "get_font_name"); + ADD_PROPERTY(PropertyInfo(Variant::STRING, "style_name", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE), "set_font_style_name", "get_font_style_name"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "font_style", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE), "set_font_style", "get_font_style"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "multichannel_signed_distance_field", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE), "set_multichannel_signed_distance_field", "is_multichannel_signed_distance_field"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "msdf_pixel_range", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE), "set_msdf_pixel_range", "get_msdf_pixel_range"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "msdf_size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE), "set_msdf_size", "get_msdf_size"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "force_autohinter", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE), "set_force_autohinter", "is_force_autohinter"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "hinting", PROPERTY_HINT_ENUM, "None,Light,Normal", PROPERTY_USAGE_STORAGE), "set_hinting", "get_hinting"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "oversampling", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE), "set_oversampling", "get_oversampling"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "fixed_size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE), "set_fixed_size", "get_fixed_size"); + ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "opentype_feature_overrides", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE), "set_opentype_feature_overrides", "get_opentype_feature_overrides"); } bool FontData::_set(const StringName &p_name, const Variant &p_value) { Vector<String> tokens = p_name.operator String().split("/"); - if (tokens.size() == 1) { - if (tokens[0] == "data") { - set_data(p_value); - return true; - } else if (tokens[0] == "antialiased") { - set_antialiased(p_value); - return true; - } else if (tokens[0] == "font_name") { - set_font_name(p_value); - return true; - } else if (tokens[0] == "style_name") { - set_font_style_name(p_value); - return true; - } else if (tokens[0] == "font_style") { - set_font_style(p_value); - return true; - } else if (tokens[0] == "multichannel_signed_distance_field") { - set_multichannel_signed_distance_field(p_value); - return true; - } else if (tokens[0] == "msdf_pixel_range") { - set_msdf_pixel_range(p_value); - return true; - } else if (tokens[0] == "msdf_size") { - set_msdf_size(p_value); - return true; - } else if (tokens[0] == "fixed_size") { - set_fixed_size(p_value); - return true; - } else if (tokens[0] == "hinting") { - set_hinting((TextServer::Hinting)p_value.operator int()); - return true; - } else if (tokens[0] == "force_autohinter") { - set_force_autohinter(p_value); - return true; - } else if (tokens[0] == "oversampling") { - set_oversampling(p_value); - return true; - } - } else if (tokens.size() == 2 && tokens[0] == "language_support_override") { + if (tokens.size() == 2 && tokens[0] == "language_support_override") { String lang = tokens[1]; set_language_support_override(lang, p_value); return true; @@ -309,45 +288,7 @@ bool FontData::_set(const StringName &p_name, const Variant &p_value) { bool FontData::_get(const StringName &p_name, Variant &r_ret) const { Vector<String> tokens = p_name.operator String().split("/"); - if (tokens.size() == 1) { - if (tokens[0] == "data") { - r_ret = get_data(); - return true; - } else if (tokens[0] == "antialiased") { - r_ret = is_antialiased(); - return true; - } else if (tokens[0] == "font_name") { - r_ret = get_font_name(); - return true; - } else if (tokens[0] == "style_name") { - r_ret = get_font_style_name(); - return true; - } else if (tokens[0] == "font_style") { - r_ret = get_font_style(); - return true; - } else if (tokens[0] == "multichannel_signed_distance_field") { - r_ret = is_multichannel_signed_distance_field(); - return true; - } else if (tokens[0] == "msdf_pixel_range") { - r_ret = get_msdf_pixel_range(); - return true; - } else if (tokens[0] == "msdf_size") { - r_ret = get_msdf_size(); - return true; - } else if (tokens[0] == "fixed_size") { - r_ret = get_fixed_size(); - return true; - } else if (tokens[0] == "hinting") { - r_ret = get_hinting(); - return true; - } else if (tokens[0] == "force_autohinter") { - r_ret = is_force_autohinter(); - return true; - } else if (tokens[0] == "oversampling") { - r_ret = get_oversampling(); - return true; - } - } else if (tokens.size() == 2 && tokens[0] == "language_support_override") { + if (tokens.size() == 2 && tokens[0] == "language_support_override") { String lang = tokens[1]; r_ret = get_language_support_override(lang); return true; @@ -422,20 +363,6 @@ bool FontData::_get(const StringName &p_name, Variant &r_ret) const { } void FontData::_get_property_list(List<PropertyInfo> *p_list) const { - p_list->push_back(PropertyInfo(Variant::PACKED_BYTE_ARRAY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE)); - - p_list->push_back(PropertyInfo(Variant::STRING, "font_name", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE)); - p_list->push_back(PropertyInfo(Variant::STRING, "style_name", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE)); - p_list->push_back(PropertyInfo(Variant::INT, "font_style", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE)); - p_list->push_back(PropertyInfo(Variant::BOOL, "antialiased", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE)); - p_list->push_back(PropertyInfo(Variant::BOOL, "multichannel_signed_distance_field", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE)); - p_list->push_back(PropertyInfo(Variant::INT, "msdf_pixel_range", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE)); - p_list->push_back(PropertyInfo(Variant::INT, "msdf_size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE)); - p_list->push_back(PropertyInfo(Variant::INT, "fixed_size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE)); - p_list->push_back(PropertyInfo(Variant::INT, "hinting", PROPERTY_HINT_ENUM, "None,Light,Normal", PROPERTY_USAGE_STORAGE)); - p_list->push_back(PropertyInfo(Variant::BOOL, "force_autohinter", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE)); - p_list->push_back(PropertyInfo(Variant::FLOAT, "oversampling", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE)); - Vector<String> lang_over = get_language_support_overrides(); for (int i = 0; i < lang_over.size(); i++) { p_list->push_back(PropertyInfo(Variant::BOOL, "language_support_override/" + lang_over[i], PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE)); @@ -1077,6 +1004,16 @@ Vector<String> FontData::get_script_support_overrides() const { return TS->font_get_script_support_overrides(cache[0]); } +void FontData::set_opentype_feature_overrides(const Dictionary &p_overrides) { + _ensure_rid(0); + TS->font_set_opentype_feature_overrides(cache[0], p_overrides); +} + +Dictionary FontData::get_opentype_feature_overrides() const { + _ensure_rid(0); + return TS->font_get_opentype_feature_overrides(cache[0]); +} + bool FontData::has_char(char32_t p_char) const { _ensure_rid(0); return TS->font_has_char(cache[0], p_char); diff --git a/scene/resources/font.h b/scene/resources/font.h index 9c3672bd69..1b4ecc73ce 100644 --- a/scene/resources/font.h +++ b/scene/resources/font.h @@ -198,6 +198,9 @@ public: virtual void remove_script_support_override(const String &p_script); virtual Vector<String> get_script_support_overrides() const; + virtual void set_opentype_feature_overrides(const Dictionary &p_overrides); + virtual Dictionary get_opentype_feature_overrides() const; + // Base font properties. virtual bool has_char(char32_t p_char) const; virtual String get_supported_chars() const; diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp index 57b73c1234..ece1ba1972 100644 --- a/scene/resources/visual_shader.cpp +++ b/scene/resources/visual_shader.cpp @@ -2015,7 +2015,7 @@ void VisualShader::_bind_methods() { ClassDB::bind_method(D_METHOD("_update_shader"), &VisualShader::_update_shader); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "graph_offset", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR), "set_graph_offset", "get_graph_offset"); - ADD_PROPERTY(PropertyInfo(Variant::STRING, "engine_version", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR), "set_engine_version", "get_engine_version"); + ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "engine_version", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR), "set_engine_version", "get_engine_version"); ADD_PROPERTY_DEFAULT("code", ""); // Inherited from Shader, prevents showing default code as override in docs. |