diff options
38 files changed, 212 insertions, 134 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 4c8dcc20ea..25a67af342 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -686,6 +686,10 @@ int _OS::get_exit_code() const { void _OS::set_exit_code(int p_code) { + if (p_code < 0 || p_code > 125) { + WARN_PRINT("For portability reasons, the exit code should be set between 0 and 125 (inclusive)."); + } + OS::get_singleton()->set_exit_code(p_code); } diff --git a/core/math/expression.cpp b/core/math/expression.cpp index 46f81ce5c3..568893e905 100644 --- a/core/math/expression.cpp +++ b/core/math/expression.cpp @@ -98,6 +98,7 @@ const char *Expression::func_name[Expression::FUNC_MAX] = { "typeof", "type_exists", "char", + "ord", "str", "print", "printerr", @@ -164,6 +165,7 @@ int Expression::get_func_argument_count(BuiltinFunc p_func) { case OBJ_WEAKREF: case TYPE_OF: case TEXT_CHAR: + case TEXT_ORD: case TEXT_STR: case TEXT_PRINT: case TEXT_PRINTERR: @@ -676,6 +678,32 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant *r_return = String(result); } break; + case TEXT_ORD: { + + if (p_inputs[0]->get_type() != Variant::STRING) { + + r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.argument = 0; + r_error.expected = Variant::STRING; + + return; + } + + String str = *p_inputs[0]; + + if (str.length() != 1) { + + r_error_str = RTR("Expected a string of length 1 (a character)."); + r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.argument = 0; + r_error.expected = Variant::STRING; + + return; + } + + *r_return = str.get(0); + + } break; case TEXT_STR: { String str = *p_inputs[0]; diff --git a/core/math/expression.h b/core/math/expression.h index 833220592c..aac27276d7 100644 --- a/core/math/expression.h +++ b/core/math/expression.h @@ -97,6 +97,7 @@ public: TYPE_OF, TYPE_EXISTS, TEXT_CHAR, + TEXT_ORD, TEXT_STR, TEXT_PRINT, TEXT_PRINTERR, diff --git a/doc/classes/Area.xml b/doc/classes/Area.xml index 6bd1382488..4b0858935d 100644 --- a/doc/classes/Area.xml +++ b/doc/classes/Area.xml @@ -166,7 +166,7 @@ <argument index="3" name="self_shape" type="int"> </argument> <description> - Emitted when another area enters, reporting which areas overlapped. + Emitted when another area enters, reporting which areas overlapped. [code]shape_owner_get_owner(shape_find_owner(shape))[/code] returns the parent object of the owner of the [code]shape[/code]. </description> </signal> <signal name="area_shape_exited"> diff --git a/doc/classes/Area2D.xml b/doc/classes/Area2D.xml index 9a5870c73d..be3acee9ef 100644 --- a/doc/classes/Area2D.xml +++ b/doc/classes/Area2D.xml @@ -155,7 +155,7 @@ <argument index="3" name="self_shape" type="int"> </argument> <description> - Emitted when another area enters, reporting which shapes overlapped. + Emitted when another area enters, reporting which shapes overlapped. [code]shape_owner_get_owner(shape_find_owner(shape))[/code] returns the parent object of the owner of the [code]shape[/code]. </description> </signal> <signal name="area_shape_exited"> diff --git a/doc/classes/BitmapFont.xml b/doc/classes/BitmapFont.xml index 16a28978d5..5b7c3def63 100644 --- a/doc/classes/BitmapFont.xml +++ b/doc/classes/BitmapFont.xml @@ -1,7 +1,8 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="BitmapFont" inherits="Font" category="Core" version="3.2"> <brief_description> - Renders text using [code]*.fnt[/code] fonts. + Renders text using fonts under the [url=https://www.angelcode.com/products/bmfont/]BMFont[/url] format. + Handles files with the [code].fnt[/code] extension </brief_description> <description> Renders text using [code]*.fnt[/code] fonts containing texture atlases. Supports distance fields. For using vector font files like TTF directly, see [DynamicFont]. diff --git a/doc/classes/HTTPRequest.xml b/doc/classes/HTTPRequest.xml index 2fed423a32..748ed504c3 100644 --- a/doc/classes/HTTPRequest.xml +++ b/doc/classes/HTTPRequest.xml @@ -6,6 +6,27 @@ <description> A node with the ability to send HTTP requests. Uses [HTTPClient] internally. Can be used to make HTTP requests, i.e. download or upload files or web content via HTTP. + [b]Example of contacting a REST API and printing one of its returned fields:[/b] + [codeblock] + func _ready(): + # Create an HTTP request node and connect its completion signal. + var http_request = HTTPRequest.new() + add_child(http_request) + http_request.connect("request_completed", self, "_http_request_completed") + + # Perform the HTTP request. The URL below returns some JSON as of writing. + var error = http_request.request("https://httpbin.org/get") + if error != OK: + push_error("An error occurred in the HTTP request.") + + + # Called when the HTTP request is completed. + func _http_request_completed(result, response_code, headers, body): + var response = parse_json(body.get_string_from_utf8()) + + # Will print the user agent string used by the HTTPRequest node (as recognized by httpbin.org). + print(response.headers["User-Agent"]) + [/codeblock] [b]Example of loading and displaying an image using HTTPRequest:[/b] [codeblock] func _ready(): diff --git a/doc/classes/InputEvent.xml b/doc/classes/InputEvent.xml index d412ce09e2..ccb5c5400a 100644 --- a/doc/classes/InputEvent.xml +++ b/doc/classes/InputEvent.xml @@ -111,6 +111,7 @@ <members> <member name="device" type="int" setter="set_device" getter="get_device" default="0"> The event's device ID. + [b]Note:[/b] This device ID will always be [code]-1[/code] for emulated mouse input from a touchscreen. This can be used to distinguish emulated mouse input from physical mouse input. </member> </members> <constants> diff --git a/doc/classes/KinematicCollision.xml b/doc/classes/KinematicCollision.xml index 44447c8fc8..46e4176e9f 100644 --- a/doc/classes/KinematicCollision.xml +++ b/doc/classes/KinematicCollision.xml @@ -16,7 +16,7 @@ The colliding body. </member> <member name="collider_id" type="int" setter="" getter="get_collider_id" default="0"> - The colliding body's unique [RID]. + The colliding body's unique instance ID. See [method Object.get_instance_id]. </member> <member name="collider_metadata" type="Variant" setter="" getter="get_collider_metadata"> The colliding body's metadata. See [Object]. diff --git a/doc/classes/KinematicCollision2D.xml b/doc/classes/KinematicCollision2D.xml index 51c2277fb2..4c9337f82d 100644 --- a/doc/classes/KinematicCollision2D.xml +++ b/doc/classes/KinematicCollision2D.xml @@ -16,7 +16,7 @@ The colliding body. </member> <member name="collider_id" type="int" setter="" getter="get_collider_id" default="0"> - The colliding body's unique [RID]. + The colliding body's unique instance ID. See [method Object.get_instance_id]. </member> <member name="collider_metadata" type="Variant" setter="" getter="get_collider_metadata"> The colliding body's metadata. See [Object]. diff --git a/doc/classes/Light2D.xml b/doc/classes/Light2D.xml index 5bb90daaf4..cdc0270269 100644 --- a/doc/classes/Light2D.xml +++ b/doc/classes/Light2D.xml @@ -68,7 +68,7 @@ Smooth shadow gradient length. </member> <member name="shadow_item_cull_mask" type="int" setter="set_item_shadow_cull_mask" getter="get_item_shadow_cull_mask" default="1"> - The shadow mask. Used with [LightOccluder2D] to cast shadows. Only occluders with a matching shadow mask will cast shadows. + The shadow mask. Used with [LightOccluder2D] to cast shadows. Only occluders with a matching light mask will cast shadows. </member> <member name="texture" type="Texture" setter="set_texture" getter="get_texture"> [Texture] used for the Light2D's appearance. diff --git a/doc/classes/Node2D.xml b/doc/classes/Node2D.xml index 29c4680685..67e9597781 100644 --- a/doc/classes/Node2D.xml +++ b/doc/classes/Node2D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="Node2D" inherits="CanvasItem" category="Core" version="3.2"> <brief_description> - A 2D game object, parent of all 2D-related nodes. Has a position, rotation, scale and Z index. + A 2D game object, inherited by all 2D-related nodes. Has a position, rotation, scale, and Z index. </brief_description> <description> - A 2D game object, with a position, rotation and scale. All 2D physics nodes and sprites inherit from Node2D. Use Node2D as a parent node to move, scale and rotate children in a 2D project. Also gives control on the node's render order. + A 2D game object, with a transform (position, rotation, and scale). All 2D nodes, including physics objects and sprites, inherit from Node2D. Use Node2D as a parent node to move, scale and rotate children in a 2D project. Also gives control of the node's render order. </description> <tutorials> <link>https://docs.godotengine.org/en/latest/tutorials/2d/custom_drawing_in_2d.html</link> diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml index 54b4f3df64..265e87eba3 100644 --- a/doc/classes/OS.xml +++ b/doc/classes/OS.xml @@ -905,7 +905,7 @@ The current screen index (starting from 0). </member> <member name="exit_code" type="int" setter="set_exit_code" getter="get_exit_code" default="0"> - The exit code passed to the OS when the main loop exits. + The exit code passed to the OS when the main loop exits. By convention, an exit code of [code]0[/code] indicates success whereas a non-zero exit code indicates an error. For portability reasons, the exit code should be set between 0 and 125 (inclusive). </member> <member name="keep_screen_on" type="bool" setter="set_keep_screen_on" getter="is_keep_screen_on" default="true"> If [code]true[/code], the engine tries to keep the screen on while the game is running. Useful on mobile. diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml index 5a09fe39c0..1e5b8669fd 100644 --- a/doc/classes/Object.xml +++ b/doc/classes/Object.xml @@ -9,6 +9,12 @@ Objects do not manage memory. If a class inherits from Object, you will have to delete instances of it manually. To do so, call the [method free] method from your script or delete the instance from C++. Some classes that extend Object add memory management. This is the case of [Reference], which counts references and deletes itself automatically when no longer referenced. [Node], another fundamental type, deletes all its children when freed from memory. Objects export properties, which are mainly useful for storage and editing, but not really so much in programming. Properties are exported in [method _get_property_list] and handled in [method _get] and [method _set]. However, scripting languages and C++ have simpler means to export them. + Property membership can be tested directly in GDScript using [code]in[/code]: + [codeblock] + var n = Node2D.new() + print("position" in n) # Prints "True". + print("other_property" in n) # Prints "False". + [/codeblock] Objects also receive notifications. Notifications are a simple way to notify the object about different events, so they can all be handled together. See [method _notification]. </description> <tutorials> diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp index 7ba2175652..b4c595344b 100644 --- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp +++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp @@ -78,6 +78,8 @@ void AudioDriverPulseAudio::pa_source_info_cb(pa_context *c, const pa_source_inf } void AudioDriverPulseAudio::pa_server_info_cb(pa_context *c, const pa_server_info *i, void *userdata) { + + ERR_FAIL_COND_MSG(!i, "PulseAudio server info is null."); AudioDriverPulseAudio *ad = (AudioDriverPulseAudio *)userdata; ad->capture_default_device = i->default_source_name; diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 4ec245eacf..a1eb36209a 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -4579,7 +4579,7 @@ void AnimationTrackEditor::_new_track_property_selected(String p_name) { bool valid; subindices = _get_bezier_subindices_for_type(h.type, &valid); if (!valid) { - EditorNode::get_singleton()->show_warning("Invalid track for Bezier (no suitable sub-properties)"); + EditorNode::get_singleton()->show_warning(TTR("Invalid track for Bezier (no suitable sub-properties)")); return; } } diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp index 2249fb48ab..1c5f8fb7fc 100644 --- a/editor/editor_help_search.cpp +++ b/editor/editor_help_search.cpp @@ -33,6 +33,7 @@ #include "core/os/keyboard.h" #include "editor_feature_profile.h" #include "editor_node.h" +#include "editor_scale.h" void EditorHelpSearch::_update_icons() { @@ -203,7 +204,7 @@ EditorHelpSearch::EditorHelpSearch() { vbox->add_child(hbox); search_box = memnew(LineEdit); - search_box->set_custom_minimum_size(Size2(200, 0)); + search_box->set_custom_minimum_size(Size2(200, 0) * EDSCALE); search_box->set_h_size_flags(SIZE_EXPAND_FILL); search_box->connect("gui_input", this, "_search_box_gui_input"); search_box->connect("text_changed", this, "_search_box_text_changed"); @@ -211,14 +212,14 @@ EditorHelpSearch::EditorHelpSearch() { hbox->add_child(search_box); case_sensitive_button = memnew(ToolButton); - case_sensitive_button->set_tooltip("Case Sensitive"); + case_sensitive_button->set_tooltip(TTR("Case Sensitive")); case_sensitive_button->connect("pressed", this, "_update_results"); case_sensitive_button->set_toggle_mode(true); case_sensitive_button->set_focus_mode(FOCUS_NONE); hbox->add_child(case_sensitive_button); hierarchy_button = memnew(ToolButton); - hierarchy_button->set_tooltip("Show Hierarchy"); + hierarchy_button->set_tooltip(TTR("Show Hierarchy")); hierarchy_button->connect("pressed", this, "_update_results"); hierarchy_button->set_toggle_mode(true); hierarchy_button->set_pressed(true); @@ -226,7 +227,7 @@ EditorHelpSearch::EditorHelpSearch() { hbox->add_child(hierarchy_button); filter_combo = memnew(OptionButton); - filter_combo->set_custom_minimum_size(Size2(200, 0)); + filter_combo->set_custom_minimum_size(Size2(200, 0) * EDSCALE); filter_combo->set_stretch_ratio(0); // Fixed width. filter_combo->add_item(TTR("Display All"), SEARCH_ALL); filter_combo->add_separator(); @@ -246,8 +247,8 @@ EditorHelpSearch::EditorHelpSearch() { results_tree->set_column_title(0, TTR("Name")); results_tree->set_column_title(1, TTR("Member Type")); results_tree->set_column_expand(1, false); - results_tree->set_column_min_width(1, 150); - results_tree->set_custom_minimum_size(Size2(0, 100)); + results_tree->set_column_min_width(1, 150 * EDSCALE); + results_tree->set_custom_minimum_size(Size2(0, 100) * EDSCALE); results_tree->set_hide_root(true); results_tree->set_select_mode(Tree::SELECT_ROW); results_tree->connect("item_activated", this, "_confirmed"); @@ -518,7 +519,7 @@ TreeItem *EditorHelpSearch::Runner::_create_method_item(TreeItem *p_parent, cons tooltip += ", "; } tooltip += ")"; - return _create_member_item(p_parent, p_class_doc->name, "MemberMethod", p_doc->name, "Method", "method", tooltip); + return _create_member_item(p_parent, p_class_doc->name, "MemberMethod", p_doc->name, TTRC("Method"), "method", tooltip); } TreeItem *EditorHelpSearch::Runner::_create_signal_item(TreeItem *p_parent, const DocData::ClassDoc *p_class_doc, const DocData::MethodDoc *p_doc) { @@ -533,13 +534,13 @@ TreeItem *EditorHelpSearch::Runner::_create_signal_item(TreeItem *p_parent, cons tooltip += ", "; } tooltip += ")"; - return _create_member_item(p_parent, p_class_doc->name, "MemberSignal", p_doc->name, "Signal", "signal", tooltip); + return _create_member_item(p_parent, p_class_doc->name, "MemberSignal", p_doc->name, TTRC("Signal"), "signal", tooltip); } TreeItem *EditorHelpSearch::Runner::_create_constant_item(TreeItem *p_parent, const DocData::ClassDoc *p_class_doc, const DocData::ConstantDoc *p_doc) { String tooltip = p_class_doc->name + "." + p_doc->name; - return _create_member_item(p_parent, p_class_doc->name, "MemberConstant", p_doc->name, "Constant", "constant", tooltip); + return _create_member_item(p_parent, p_class_doc->name, "MemberConstant", p_doc->name, TTRC("Constant"), "constant", tooltip); } TreeItem *EditorHelpSearch::Runner::_create_property_item(TreeItem *p_parent, const DocData::ClassDoc *p_class_doc, const DocData::PropertyDoc *p_doc) { @@ -547,13 +548,13 @@ TreeItem *EditorHelpSearch::Runner::_create_property_item(TreeItem *p_parent, co String tooltip = p_doc->type + " " + p_class_doc->name + "." + p_doc->name; tooltip += "\n " + p_class_doc->name + "." + p_doc->setter + "(value) setter"; tooltip += "\n " + p_class_doc->name + "." + p_doc->getter + "() getter"; - return _create_member_item(p_parent, p_class_doc->name, "MemberProperty", p_doc->name, "Property", "property", tooltip); + return _create_member_item(p_parent, p_class_doc->name, "MemberProperty", p_doc->name, TTRC("Property"), "property", tooltip); } TreeItem *EditorHelpSearch::Runner::_create_theme_property_item(TreeItem *p_parent, const DocData::ClassDoc *p_class_doc, const DocData::PropertyDoc *p_doc) { String tooltip = p_doc->type + " " + p_class_doc->name + "." + p_doc->name; - return _create_member_item(p_parent, p_class_doc->name, "MemberTheme", p_doc->name, "Theme Property", "theme_item", tooltip); + return _create_member_item(p_parent, p_class_doc->name, "MemberTheme", p_doc->name, TTRC("Theme Property"), "theme_item", tooltip); } TreeItem *EditorHelpSearch::Runner::_create_member_item(TreeItem *p_parent, const String &p_class_name, const String &p_icon, const String &p_name, const String &p_type, const String &p_metatype, const String &p_tooltip) { @@ -576,7 +577,7 @@ TreeItem *EditorHelpSearch::Runner::_create_member_item(TreeItem *p_parent, cons TreeItem *item = results_tree->create_item(p_parent); item->set_icon(0, icon); item->set_text(0, text); - item->set_text(1, TTR(p_type)); + item->set_text(1, TTRGET(p_type)); item->set_tooltip(0, p_tooltip); item->set_tooltip(1, p_tooltip); item->set_metadata(0, "class_" + p_metatype + ":" + p_class_name + ":" + p_name); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index f382b98c72..430651472c 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -171,6 +171,7 @@ #include "editor/settings_config_dialog.h" #include <stdio.h> +#include <stdlib.h> EditorNode *EditorNode::singleton = NULL; @@ -573,11 +574,13 @@ void EditorNode::_fs_changed() { if (preset.is_null()) { String errstr = "Unknown export preset: " + export_defer.preset; ERR_PRINTS(errstr); + OS::get_singleton()->set_exit_code(EXIT_FAILURE); } else { Ref<EditorExportPlatform> platform = preset->get_platform(); if (platform.is_null()) { String errstr = "Preset \"" + export_defer.preset + "\" doesn't have a platform."; ERR_PRINTS(errstr); + OS::get_singleton()->set_exit_code(EXIT_FAILURE); } else { // ensures export_project does not loop infinitely, because notifications may // come during the export @@ -594,6 +597,7 @@ void EditorNode::_fs_changed() { } if (err != OK) { ERR_PRINTS(vformat(TTR("Project export failed with error code %d."), (int)err)); + OS::get_singleton()->set_exit_code(EXIT_FAILURE); } } } @@ -1059,71 +1063,75 @@ void EditorNode::_find_node_types(Node *p_node, int &count_2d, int &count_3d) { void EditorNode::_save_scene_with_preview(String p_file, int p_idx) { EditorProgress save("save", TTR("Saving Scene"), 4); - save.step(TTR("Analyzing"), 0); - int c2d = 0; - int c3d = 0; - _find_node_types(editor_data.get_edited_scene_root(), c2d, c3d); + if (editor_data.get_edited_scene_root() != NULL) { + save.step(TTR("Analyzing"), 0); - bool is2d; - if (c3d < c2d) { - is2d = true; - } else { - is2d = false; - } - save.step(TTR("Creating Thumbnail"), 1); - //current view? + int c2d = 0; + int c3d = 0; - Ref<Image> img; - if (is2d) { - img = scene_root->get_texture()->get_data(); - } else { - img = SpatialEditor::get_singleton()->get_editor_viewport(0)->get_viewport_node()->get_texture()->get_data(); - } + _find_node_types(editor_data.get_edited_scene_root(), c2d, c3d); - if (img.is_valid()) { + bool is2d; + if (c3d < c2d) { + is2d = true; + } else { + is2d = false; + } + save.step(TTR("Creating Thumbnail"), 1); + //current view? - img = img->duplicate(); + Ref<Image> img; + if (is2d) { + img = scene_root->get_texture()->get_data(); + } else { + img = SpatialEditor::get_singleton()->get_editor_viewport(0)->get_viewport_node()->get_texture()->get_data(); + } - save.step(TTR("Creating Thumbnail"), 2); - save.step(TTR("Creating Thumbnail"), 3); + if (img.is_valid()) { - int preview_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size"); - preview_size *= EDSCALE; + img = img->duplicate(); - // consider a square region - int vp_size = MIN(img->get_width(), img->get_height()); - int x = (img->get_width() - vp_size) / 2; - int y = (img->get_height() - vp_size) / 2; + save.step(TTR("Creating Thumbnail"), 2); + save.step(TTR("Creating Thumbnail"), 3); - if (vp_size < preview_size) { - // just square it. - img->crop_from_point(x, y, vp_size, vp_size); - } else { - int ratio = vp_size / preview_size; - int size = preview_size * MAX(1, ratio / 2); + int preview_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size"); + preview_size *= EDSCALE; - x = (img->get_width() - size) / 2; - y = (img->get_height() - size) / 2; + // consider a square region + int vp_size = MIN(img->get_width(), img->get_height()); + int x = (img->get_width() - vp_size) / 2; + int y = (img->get_height() - vp_size) / 2; - img->crop_from_point(x, y, size, size); - img->resize(preview_size, preview_size, Image::INTERPOLATE_LANCZOS); - } - img->convert(Image::FORMAT_RGB8); + if (vp_size < preview_size) { + // just square it. + img->crop_from_point(x, y, vp_size, vp_size); + } else { + int ratio = vp_size / preview_size; + int size = preview_size * MAX(1, ratio / 2); - img->flip_y(); + x = (img->get_width() - size) / 2; + y = (img->get_height() - size) / 2; - //save thumbnail directly, as thumbnailer may not update due to actual scene not changing md5 - String temp_path = EditorSettings::get_singleton()->get_cache_dir(); - String cache_base = ProjectSettings::get_singleton()->globalize_path(p_file).md5_text(); - cache_base = temp_path.plus_file("resthumb-" + cache_base); + img->crop_from_point(x, y, size, size); + img->resize(preview_size, preview_size, Image::INTERPOLATE_LANCZOS); + } + img->convert(Image::FORMAT_RGB8); + + img->flip_y(); - //does not have it, try to load a cached thumbnail + //save thumbnail directly, as thumbnailer may not update due to actual scene not changing md5 + String temp_path = EditorSettings::get_singleton()->get_cache_dir(); + String cache_base = ProjectSettings::get_singleton()->globalize_path(p_file).md5_text(); + cache_base = temp_path.plus_file("resthumb-" + cache_base); - String file = cache_base + ".png"; + //does not have it, try to load a cached thumbnail - post_process_preview(img); - img->save_png(file); + String file = cache_base + ".png"; + + post_process_preview(img); + img->save_png(file); + } } save.step(TTR("Saving Scene"), 4); diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 6ac20e6719..b203ca8bc0 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -587,24 +587,11 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_color("icon_color_pressed", "Button", icon_color_pressed); // OptionButton - Ref<StyleBoxFlat> style_option_button_normal = style_widget->duplicate(); - Ref<StyleBoxFlat> style_option_button_hover = style_widget_hover->duplicate(); - Ref<StyleBoxFlat> style_option_button_pressed = style_widget_pressed->duplicate(); - Ref<StyleBoxFlat> style_option_button_focus = style_widget_focus->duplicate(); - Ref<StyleBoxFlat> style_option_button_disabled = style_widget_disabled->duplicate(); - - int option_button_arrow_margin = theme->get_icon("GuiOptionArrow", "EditorIcons")->get_size().width + (default_margin_size + 4) * EDSCALE; - style_option_button_normal->set_default_margin(MARGIN_RIGHT, option_button_arrow_margin); - style_option_button_hover->set_default_margin(MARGIN_RIGHT, option_button_arrow_margin); - style_option_button_pressed->set_default_margin(MARGIN_RIGHT, option_button_arrow_margin); - style_option_button_focus->set_default_margin(MARGIN_RIGHT, option_button_arrow_margin); - style_option_button_disabled->set_default_margin(MARGIN_RIGHT, option_button_arrow_margin); - - theme->set_stylebox("normal", "OptionButton", style_option_button_normal); - theme->set_stylebox("hover", "OptionButton", style_option_button_hover); - theme->set_stylebox("pressed", "OptionButton", style_option_button_pressed); - theme->set_stylebox("focus", "OptionButton", style_option_button_focus); - theme->set_stylebox("disabled", "OptionButton", style_option_button_disabled); + theme->set_stylebox("normal", "OptionButton", style_widget); + theme->set_stylebox("hover", "OptionButton", style_widget_hover); + theme->set_stylebox("pressed", "OptionButton", style_widget_pressed); + theme->set_stylebox("focus", "OptionButton", style_widget_focus); + theme->set_stylebox("disabled", "OptionButton", style_widget_disabled); theme->set_color("font_color", "OptionButton", font_color); theme->set_color("font_color_hover", "OptionButton", font_color_hl); diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp index 8f2b0cee2b..9b306c50d0 100644 --- a/editor/export_template_manager.cpp +++ b/editor/export_template_manager.cpp @@ -353,7 +353,7 @@ void ExportTemplateManager::ok_pressed() { void ExportTemplateManager::_http_download_mirror_completed(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data) { if (p_status != HTTPRequest::RESULT_SUCCESS || p_code != 200) { - EditorNode::get_singleton()->show_warning("Error getting the list of mirrors."); + EditorNode::get_singleton()->show_warning(TTR("Error getting the list of mirrors.")); return; } @@ -371,7 +371,7 @@ void ExportTemplateManager::_http_download_mirror_completed(int p_status, int p_ int errline; Error err = JSON::parse(mirror_str, r, errs, errline); if (err != OK) { - EditorNode::get_singleton()->show_warning("Error parsing JSON of mirror list. Please report this issue!"); + EditorNode::get_singleton()->show_warning(TTR("Error parsing JSON of mirror list. Please report this issue!")); return; } diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 16bb62ad17..74db397121 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -128,6 +128,11 @@ bool FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory udata.push_back(file_item); EditorResourcePreview::get_singleton()->queue_resource_preview(file_metadata, this, "_tree_thumbnail_done", udata); } + } else if (display_mode == DISPLAY_MODE_SPLIT) { + if (lpath.get_base_dir() == path.get_base_dir()) { + subdirectory_item->select(0); + subdirectory_item->set_as_cursor(0); + } } if (searched_string.length() > 0) { @@ -1750,8 +1755,8 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected if (!fpath.ends_with("/")) { fpath = fpath.get_base_dir(); } - make_script_dialog_text->config("Node", fpath.plus_file("new_script.gd"), false); - make_script_dialog_text->popup_centered(Size2(300, 300) * EDSCALE); + make_script_dialog->config("Node", fpath.plus_file("new_script.gd"), false); + make_script_dialog->popup_centered(Size2(300, 300) * EDSCALE); } break; case FILE_COPY_PATH: { @@ -2686,9 +2691,9 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) { make_scene_dialog->register_text_enter(make_scene_dialog_text); make_scene_dialog->connect("confirmed", this, "_make_scene_confirm"); - make_script_dialog_text = memnew(ScriptCreateDialog); - make_script_dialog_text->set_title(TTR("Create Script")); - add_child(make_script_dialog_text); + make_script_dialog = memnew(ScriptCreateDialog); + make_script_dialog->set_title(TTR("Create Script")); + add_child(make_script_dialog); new_resource_dialog = memnew(CreateDialog); add_child(new_resource_dialog); diff --git a/editor/filesystem_dock.h b/editor/filesystem_dock.h index d81a5133f2..f8e0eb4d71 100644 --- a/editor/filesystem_dock.h +++ b/editor/filesystem_dock.h @@ -140,7 +140,7 @@ private: ConfirmationDialog *make_scene_dialog; LineEdit *make_scene_dialog_text; ConfirmationDialog *overwrite_dialog; - ScriptCreateDialog *make_script_dialog_text; + ScriptCreateDialog *make_script_dialog; CreateDialog *new_resource_dialog; bool always_show_folders; diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp index be066e15a5..796b950444 100644 --- a/editor/import/editor_scene_importer_gltf.cpp +++ b/editor/import/editor_scene_importer_gltf.cpp @@ -855,25 +855,24 @@ PoolVector<Color> EditorSceneImporterGLTF::_decode_accessor_as_color(GLTFState & const int type = state.accessors[p_accessor].type; ERR_FAIL_COND_V(!(type == TYPE_VEC3 || type == TYPE_VEC4), ret); - int components; - if (type == TYPE_VEC3) { - components = 3; - } else { // TYPE_VEC4 - components = 4; + int vec_len = 3; + if (type == TYPE_VEC4) { + vec_len = 4; } - ERR_FAIL_COND_V(attribs.size() % components != 0, ret); + ERR_FAIL_COND_V(attribs.size() % vec_len != 0, ret); const double *attribs_ptr = attribs.ptr(); - const int ret_size = attribs.size() / components; + const int ret_size = attribs.size() / vec_len; ret.resize(ret_size); { PoolVector<Color>::Write w = ret.write(); for (int i = 0; i < ret_size; i++) { - w[i] = Color(attribs_ptr[i * 4 + 0], attribs_ptr[i * 4 + 1], attribs_ptr[i * 4 + 2], components == 4 ? attribs_ptr[i * 4 + 3] : 1.0); + w[i] = Color(attribs_ptr[i * vec_len + 0], attribs_ptr[i * vec_len + 1], attribs_ptr[i * vec_len + 2], vec_len == 4 ? attribs_ptr[i * 4 + 3] : 1.0); } } return ret; } + Vector<Quat> EditorSceneImporterGLTF::_decode_accessor_as_quat(GLTFState &state, const GLTFAccessorIndex p_accessor, const bool p_for_vertex) { const Vector<double> attribs = _decode_accessor(state, p_accessor, p_for_vertex); diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp index e56d9d070f..884e665494 100644 --- a/editor/plugins/animation_state_machine_editor.cpp +++ b/editor/plugins/animation_state_machine_editor.cpp @@ -263,7 +263,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv if (connecting_to_node != StringName()) { if (state_machine->has_transition(connecting_from, connecting_to_node)) { - EditorNode::get_singleton()->show_warning("Transition exists!"); + EditorNode::get_singleton()->show_warning(TTR("Transition exists!")); } else { diff --git a/editor/plugins/mesh_instance_editor_plugin.cpp b/editor/plugins/mesh_instance_editor_plugin.cpp index 3f9e1da5e7..1ead1b8062 100644 --- a/editor/plugins/mesh_instance_editor_plugin.cpp +++ b/editor/plugins/mesh_instance_editor_plugin.cpp @@ -457,7 +457,7 @@ MeshInstanceEditor::MeshInstanceEditor() { add_child(err_dialog); debug_uv_dialog = memnew(AcceptDialog); - debug_uv_dialog->set_title("UV Channel Debug"); + debug_uv_dialog->set_title(TTR("UV Channel Debug")); add_child(debug_uv_dialog); debug_uv = memnew(Control); debug_uv->set_custom_minimum_size(Size2(600, 600) * EDSCALE); diff --git a/editor/plugins/mesh_library_editor_plugin.cpp b/editor/plugins/mesh_library_editor_plugin.cpp index fc3ca38104..1e4dd9d6bf 100644 --- a/editor/plugins/mesh_library_editor_plugin.cpp +++ b/editor/plugins/mesh_library_editor_plugin.cpp @@ -241,7 +241,7 @@ void MeshLibraryEditor::_menu_cbk(int p_option) { } break; case MENU_OPTION_UPDATE_FROM_SCENE: { - cd->set_text("Update from existing scene?:\n" + String(mesh_library->get_meta("_editor_source_scene"))); + cd->set_text(vformat(TTR("Update from existing scene?:\n%s"), String(mesh_library->get_meta("_editor_source_scene")))); cd->popup_centered(Size2(500, 60)); } break; } diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index b809397b95..f8313978c4 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -1270,12 +1270,15 @@ void ScriptEditor::_menu_option(int p_option) { _copy_script_path(); } break; case SHOW_IN_FILE_SYSTEM: { - RES script = current->get_edited_resource(); - FileSystemDock *file_system_dock = EditorNode::get_singleton()->get_filesystem_dock(); - file_system_dock->navigate_to_path(script->get_path()); - // Ensure that the FileSystem dock is visible. - TabContainer *tab_container = (TabContainer *)file_system_dock->get_parent_control(); - tab_container->set_current_tab(file_system_dock->get_position_in_parent()); + const RES script = current->get_edited_resource(); + const String path = script->get_path(); + if (!path.empty()) { + FileSystemDock *file_system_dock = EditorNode::get_singleton()->get_filesystem_dock(); + file_system_dock->navigate_to_path(path); + // Ensure that the FileSystem dock is visible. + TabContainer *tab_container = (TabContainer *)file_system_dock->get_parent_control(); + tab_container->set_current_tab(file_system_dock->get_position_in_parent()); + } } break; case CLOSE_DOCS: { _close_docs_tab(); diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 4c23e3fcd2..ef6f864a87 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -1560,7 +1560,7 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data Node *sn = _find_script_node(get_tree()->get_edited_scene_root(), get_tree()->get_edited_scene_root(), script); if (!sn) { - EditorNode::get_singleton()->show_warning("Can't drop nodes because script '" + get_name() + "' is not used in this scene."); + EditorNode::get_singleton()->show_warning(vformat(TTR("Can't drop nodes because script '%s' is not used in this scene."), get_name())); return; } diff --git a/editor/plugins/sprite_editor_plugin.cpp b/editor/plugins/sprite_editor_plugin.cpp index 6846b810a0..7759fd2fa6 100644 --- a/editor/plugins/sprite_editor_plugin.cpp +++ b/editor/plugins/sprite_editor_plugin.cpp @@ -126,7 +126,7 @@ void SpriteEditor::_menu_option(int p_option) { case MENU_OPTION_CONVERT_TO_MESH_2D: { debug_uv_dialog->get_ok()->set_text(TTR("Create Mesh2D")); - debug_uv_dialog->set_title("Mesh2D Preview"); + debug_uv_dialog->set_title(TTR("Mesh2D Preview")); _update_mesh_data(); debug_uv_dialog->popup_centered(); @@ -136,7 +136,7 @@ void SpriteEditor::_menu_option(int p_option) { case MENU_OPTION_CONVERT_TO_POLYGON_2D: { debug_uv_dialog->get_ok()->set_text(TTR("Create Polygon2D")); - debug_uv_dialog->set_title("Polygon2D Preview"); + debug_uv_dialog->set_title(TTR("Polygon2D Preview")); _update_mesh_data(); debug_uv_dialog->popup_centered(); @@ -145,7 +145,7 @@ void SpriteEditor::_menu_option(int p_option) { case MENU_OPTION_CREATE_COLLISION_POLY_2D: { debug_uv_dialog->get_ok()->set_text(TTR("Create CollisionPolygon2D")); - debug_uv_dialog->set_title("CollisionPolygon2D Preview"); + debug_uv_dialog->set_title(TTR("CollisionPolygon2D Preview")); _update_mesh_data(); debug_uv_dialog->popup_centered(); @@ -155,7 +155,7 @@ void SpriteEditor::_menu_option(int p_option) { case MENU_OPTION_CREATE_LIGHT_OCCLUDER_2D: { debug_uv_dialog->get_ok()->set_text(TTR("Create LightOccluder2D")); - debug_uv_dialog->set_title("LightOccluder2D Preview"); + debug_uv_dialog->set_title(TTR("LightOccluder2D Preview")); _update_mesh_data(); debug_uv_dialog->popup_centered(); diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index 27a5a1fb42..dd58ec23ce 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -204,7 +204,7 @@ void SpriteFramesEditor::_prepare_sprite_sheet(const String &p_file) { Ref<Resource> texture = ResourceLoader::load(p_file); if (!texture.is_valid()) { - EditorNode::get_singleton()->show_warning("Unable to load images"); + EditorNode::get_singleton()->show_warning(TTR("Unable to load images")); ERR_FAIL_COND(!texture.is_valid()); } if (texture != split_sheet_preview->get_texture()) { diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp index 3fc77dae02..52c28b84f6 100644 --- a/editor/plugins/theme_editor_plugin.cpp +++ b/editor/plugins/theme_editor_plugin.cpp @@ -910,7 +910,7 @@ ThemeEditorPlugin::ThemeEditorPlugin(EditorNode *p_node) { editor = p_node; theme_editor = memnew(ThemeEditor); - theme_editor->set_custom_minimum_size(Size2(0, 200)); + theme_editor->set_custom_minimum_size(Size2(0, 200) * EDSCALE); button = editor->add_bottom_panel_item(TTR("Theme"), theme_editor); button->hide(); diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index f6dbbbb0a9..6e0158670d 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -2037,10 +2037,10 @@ void TileSetEditor::_update_toggle_shape_button() { tools[SHAPE_TOGGLE_TYPE]->hide(); } else if (concave.is_valid()) { tools[SHAPE_TOGGLE_TYPE]->set_icon(get_icon("ConvexPolygonShape2D", "EditorIcons")); - tools[SHAPE_TOGGLE_TYPE]->set_text("Make Convex"); + tools[SHAPE_TOGGLE_TYPE]->set_text(TTR("Make Convex")); } else if (convex.is_valid()) { tools[SHAPE_TOGGLE_TYPE]->set_icon(get_icon("ConcavePolygonShape2D", "EditorIcons")); - tools[SHAPE_TOGGLE_TYPE]->set_text("Make Concave"); + tools[SHAPE_TOGGLE_TYPE]->set_text(TTR("Make Concave")); } else { // Shouldn't happen separator_shape_toggle->hide(); diff --git a/editor/rename_dialog.cpp b/editor/rename_dialog.cpp index cc9e14975f..9f77f9d82a 100644 --- a/editor/rename_dialog.cpp +++ b/editor/rename_dialog.cpp @@ -32,6 +32,7 @@ #include "core/print_string.h" #include "editor_node.h" +#include "editor_scale.h" #include "editor_settings.h" #include "editor_themes.h" #include "modules/regex/regex.h" @@ -106,7 +107,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und // -- Feature Tabs - const int feature_min_height = 160; + const int feature_min_height = 160 * EDSCALE; Ref<Theme> collapse_theme = create_editor_theme(); collapse_theme->set_icon("checked", "CheckBox", collapse_theme->get_icon("GuiTreeArrowDown", "EditorIcons")); diff --git a/main/main.cpp b/main/main.cpp index 81b12b91c5..c1dc4e37ca 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -286,8 +286,8 @@ void Main::print_help(const char *p_binary) { OS::get_singleton()->print(" -s, --script <script> Run a script.\n"); OS::get_singleton()->print(" --check-only Only parse for errors and quit (use with --script).\n"); #ifdef TOOLS_ENABLED - OS::get_singleton()->print(" --export <target> Export the project using the given export target. Export only main pack if path ends with .pck or .zip.\n"); - OS::get_singleton()->print(" --export-debug <target> Like --export, but use debug template.\n"); + OS::get_singleton()->print(" --export <target> <path> Export the project using the given export target. Export only main pack if path ends with .pck or .zip. <path> is relative to the project directory.\n"); + OS::get_singleton()->print(" --export-debug <target> <path> Like --export, but use debug template.\n"); OS::get_singleton()->print(" --doctool <path> Dump the engine API reference to the given <path> in XML format, merging if existing files are found.\n"); OS::get_singleton()->print(" --no-docbase Disallow dumping the base types (used with --doctool).\n"); OS::get_singleton()->print(" --build-solutions Build the scripting solutions (e.g. for C# projects).\n"); diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp index 1bd570c55f..63771f1583 100644 --- a/modules/gridmap/grid_map_editor_plugin.cpp +++ b/modules/gridmap/grid_map_editor_plugin.cpp @@ -1256,7 +1256,7 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) { options->get_popup()->add_item(TTR("Cursor Back Rotate Z"), MENU_OPTION_CURSOR_BACK_ROTATE_Z, KEY_MASK_SHIFT + KEY_D); options->get_popup()->add_item(TTR("Cursor Clear Rotation"), MENU_OPTION_CURSOR_CLEAR_ROTATION, KEY_W); options->get_popup()->add_separator(); - options->get_popup()->add_check_item("Paste Selects", MENU_OPTION_PASTE_SELECTS); + options->get_popup()->add_check_item(TTR("Paste Selects"), MENU_OPTION_PASTE_SELECTS); options->get_popup()->add_separator(); options->get_popup()->add_item(TTR("Duplicate Selection"), MENU_OPTION_SELECTION_DUPLICATE, KEY_MASK_CTRL + KEY_C); options->get_popup()->add_item(TTR("Cut Selection"), MENU_OPTION_SELECTION_CUT, KEY_MASK_CTRL + KEY_X); diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp index de8df4215d..f9214c3b1e 100644 --- a/scene/gui/option_button.cpp +++ b/scene/gui/option_button.cpp @@ -35,8 +35,9 @@ Size2 OptionButton::get_minimum_size() const { Size2 minsize = Button::get_minimum_size(); - if (has_icon("arrow")) + if (has_icon("arrow")) { minsize.width += Control::get_icon("arrow")->get_width() + get_constant("hseparation"); + } return minsize; } @@ -73,6 +74,12 @@ void OptionButton::_notification(int p_what) { Point2 ofs(size.width - arrow->get_width() - get_constant("arrow_margin"), int(Math::abs((size.height - arrow->get_height()) / 2))); arrow->draw(ci, ofs, clr); } break; + case NOTIFICATION_THEME_CHANGED: { + + if (has_icon("arrow")) { + _set_internal_margin(MARGIN_RIGHT, Control::get_icon("arrow")->get_width()); + } + } break; case NOTIFICATION_VISIBILITY_CHANGED: { if (!is_visible_in_tree()) { @@ -327,7 +334,7 @@ void OptionButton::_bind_methods() { ClassDB::bind_method(D_METHOD("_get_items"), &OptionButton::_get_items); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "items", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_items", "_get_items"); - // "selected" property must come after "items", otherwise GH-10213 occurs + // "selected" property must come after "items", otherwise GH-10213 occurs. ADD_PROPERTY(PropertyInfo(Variant::INT, "selected"), "_select_int", "get_selected"); ADD_SIGNAL(MethodInfo("item_selected", PropertyInfo(Variant::INT, "id"))); ADD_SIGNAL(MethodInfo("item_focused", PropertyInfo(Variant::INT, "id"))); @@ -339,6 +346,9 @@ OptionButton::OptionButton() { set_toggle_mode(true); set_text_align(ALIGN_LEFT); set_action_mode(ACTION_MODE_BUTTON_PRESS); + if (has_icon("arrow")) { + _set_internal_margin(MARGIN_RIGHT, Control::get_icon("arrow")->get_width()); + } popup = memnew(PopupMenu); popup->hide(); diff --git a/scene/main/timer.cpp b/scene/main/timer.cpp index da96c6e89c..db504a22c7 100755 --- a/scene/main/timer.cpp +++ b/scene/main/timer.cpp @@ -206,7 +206,7 @@ void Timer::_bind_methods() { ADD_SIGNAL(MethodInfo("timeout")); ADD_PROPERTY(PropertyInfo(Variant::INT, "process_mode", PROPERTY_HINT_ENUM, "Physics,Idle"), "set_timer_process_mode", "get_timer_process_mode"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "wait_time", PROPERTY_HINT_EXP_RANGE, "0.01,4096,0.01"), "set_wait_time", "get_wait_time"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "wait_time", PROPERTY_HINT_EXP_RANGE, "0.001,4096,0.001,or_greater"), "set_wait_time", "get_wait_time"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "one_shot"), "set_one_shot", "is_one_shot"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "autostart"), "set_autostart", "has_autostart"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "paused", PROPERTY_HINT_NONE, "", 0), "set_paused", "is_paused"); diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index c67e5a928c..7bbe2a7d09 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -266,10 +266,10 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const // OptionButton - Ref<StyleBox> sb_optbutton_normal = sb_expand(make_stylebox(option_button_normal_png, 4, 4, 21, 4, 6, 3, 21, 3), 2, 2, 2, 2); - Ref<StyleBox> sb_optbutton_pressed = sb_expand(make_stylebox(option_button_pressed_png, 4, 4, 21, 4, 6, 3, 21, 3), 2, 2, 2, 2); - Ref<StyleBox> sb_optbutton_hover = sb_expand(make_stylebox(option_button_hover_png, 4, 4, 21, 4, 6, 2, 21, 2), 2, 2, 2, 2); - Ref<StyleBox> sb_optbutton_disabled = sb_expand(make_stylebox(option_button_disabled_png, 4, 4, 21, 4, 6, 2, 21, 2), 2, 2, 2, 2); + Ref<StyleBox> sb_optbutton_normal = sb_expand(make_stylebox(option_button_normal_png, 4, 4, 21, 4, 6, 3, 9, 3), 2, 2, 2, 2); + Ref<StyleBox> sb_optbutton_pressed = sb_expand(make_stylebox(option_button_pressed_png, 4, 4, 21, 4, 6, 3, 9, 3), 2, 2, 2, 2); + Ref<StyleBox> sb_optbutton_hover = sb_expand(make_stylebox(option_button_hover_png, 4, 4, 21, 4, 6, 2, 9, 2), 2, 2, 2, 2); + Ref<StyleBox> sb_optbutton_disabled = sb_expand(make_stylebox(option_button_disabled_png, 4, 4, 21, 4, 6, 2, 9, 2), 2, 2, 2, 2); Ref<StyleBox> sb_optbutton_focus = sb_expand(make_stylebox(button_focus_png, 4, 4, 4, 4, 6, 2, 6, 2), 2, 2, 2, 2); theme->set_stylebox("normal", "OptionButton", sb_optbutton_normal); |