diff --git a/core/func_ref.cpp b/core/func_ref.cpp index 2dffb30bab3..f47848249e9 100644 --- a/core/func_ref.cpp +++ b/core/func_ref.cpp @@ -68,6 +68,10 @@ void FuncRef::set_function(const StringName &p_func) { function = p_func; } +StringName FuncRef::get_function() { + return function; +} + bool FuncRef::is_valid() const { if (id == 0) return false; @@ -91,8 +95,12 @@ void FuncRef::_bind_methods() { ClassDB::bind_method(D_METHOD("call_funcv", "arg_array"), &FuncRef::call_funcv); ClassDB::bind_method(D_METHOD("set_instance", "instance"), &FuncRef::set_instance); - ClassDB::bind_method(D_METHOD("set_function", "name"), &FuncRef::set_function); ClassDB::bind_method(D_METHOD("is_valid"), &FuncRef::is_valid); + + ClassDB::bind_method(D_METHOD("set_function", "name"), &FuncRef::set_function); + ClassDB::bind_method(D_METHOD("get_function"), &FuncRef::get_function); + + ADD_PROPERTY(PropertyInfo(Variant::STRING, "function"), "set_function", "get_function"); } FuncRef::FuncRef() : diff --git a/core/func_ref.h b/core/func_ref.h index 1d1ca47ad7d..898950b5e62 100644 --- a/core/func_ref.h +++ b/core/func_ref.h @@ -47,6 +47,7 @@ public: Variant call_funcv(const Array &p_args); void set_instance(Object *p_obj); void set_function(const StringName &p_func); + StringName get_function(); bool is_valid() const; FuncRef(); }; diff --git a/doc/classes/CanvasItem.xml b/doc/classes/CanvasItem.xml index c717058827d..8f0c1ba7221 100644 --- a/doc/classes/CanvasItem.xml +++ b/doc/classes/CanvasItem.xml @@ -472,13 +472,6 @@ Returns [code]true[/code] if local transform notifications are communicated to children. - - - - - Returns [code]true[/code] if the node is set as top-level. See [method set_as_toplevel]. - - @@ -511,15 +504,6 @@ Transformations issued by [code]event[/code]'s inputs are applied in local space instead of global space. - - - - - - - If [code]enable[/code] is [code]true[/code], the node won't inherit its transform from parent canvas items. - - @@ -569,6 +553,9 @@ If [code]true[/code], the object draws behind its parent. + + If [code]true[/code], the node will not inherit its transform from parent [CanvasItem]s. + If [code]true[/code], the object draws on top of its parent. diff --git a/doc/classes/File.xml b/doc/classes/File.xml index b972301fe33..22981c2b118 100644 --- a/doc/classes/File.xml +++ b/doc/classes/File.xml @@ -399,8 +399,7 @@ - Stores the given [String] as a line in the file. - Text will be encoded as UTF-8. + Appends [code]line[/code] to the file followed by a line return character ([code]\n[/code]), encoding the text as UTF-8. @@ -428,8 +427,7 @@ - Stores the given [String] in the file. - Text will be encoded as UTF-8. + Appends [code]string[/code] to the file without a line return, encoding the text as UTF-8. diff --git a/doc/classes/FuncRef.xml b/doc/classes/FuncRef.xml index 707de8d2f8f..34984d9feca 100644 --- a/doc/classes/FuncRef.xml +++ b/doc/classes/FuncRef.xml @@ -14,7 +14,7 @@ - Calls the referenced function previously set by [method set_function] or [method @GDScript.funcref]. + Calls the referenced function previously set in [member function] or [method @GDScript.funcref]. @@ -23,23 +23,7 @@ - Calls the referenced function previously set by [method set_function] or [method @GDScript.funcref]. Contrarily to [method call_func], this method does not support a variable number of arguments but expects all parameters to be passed via a single [Array]. - - - - - - - Returns whether the object still exists and has the function assigned. - - - - - - - - - The name of the referenced function to call on the object, without parentheses or any parameters. + Calls the referenced function previously set in [member function] or [method @GDScript.funcref]. Contrarily to [method call_func], this method does not support a variable number of arguments but expects all parameters to be passed via a single [Array]. @@ -51,7 +35,19 @@ The object containing the referenced function. This object must be of a type actually inheriting from [Object], not a built-in type such as [int], [Vector2] or [Dictionary]. + + + + + Returns whether the object still exists and has the function assigned. + + + + + The name of the referenced function. + + diff --git a/doc/classes/Spatial.xml b/doc/classes/Spatial.xml index 086081b6709..4cb38dd6d8d 100644 --- a/doc/classes/Spatial.xml +++ b/doc/classes/Spatial.xml @@ -83,13 +83,6 @@ Returns whether this node uses a scale of [code](1, 1, 1)[/code] or its local transformation scale. - - - - - Returns whether this node is set as Toplevel, that is whether it ignores its parent nodes transformations. - - @@ -195,15 +188,6 @@ Scales the local transformation by given 3D scale factors in object-local coordinate system. - - - - - - - Makes the node ignore its parents transformations. Node transformations are only in global space. - - @@ -316,6 +300,9 @@ Scale part of the local transformation. + + If [code]true[/code], the node will not inherit its transformations from its parent. Node transformations are only in global space. + Local space [Transform] of this node, with respect to the parent node. diff --git a/doc/classes/String.xml b/doc/classes/String.xml index 32e6a0cfda5..b6789a5f91c 100644 --- a/doc/classes/String.xml +++ b/doc/classes/String.xml @@ -270,7 +270,10 @@ - Performs a case-sensitive comparison to another string. Returns [code]-1[/code] if less than, [code]+1[/code] if greater than, or [code]0[/code] if equal. + Performs a case-sensitive comparison to another string. Returns [code]-1[/code] if less than, [code]1[/code] if greater than, or [code]0[/code] if equal. "less than" or "greater than" are determined by the [url=https://en.wikipedia.org/wiki/List_of_Unicode_characters]Unicode code points[/code] of each string, which roughly matches the alphabetical order. + [b]Behavior with different string lengths:[/b] Returns [code]1[/code] if the "base" string is longer than the [code]to[/code] string or [code]-1[/code] if the "base" string is shorter than the [code]to[/code] string. Keep in mind this length is determined by the number of Unicode codepoints, [i]not[/i] the actual visible characters. + [b]Behavior with empty strings:[/b] Returns [code]-1[/code] if the "base" string is empty, [code]1[/code] if the [code]to[/code] string is empty or [code]0[/code] if both strings are empty. + To get a boolean result from a string comparison, use the [code]==[/code] operator instead. See also [method nocasecmp_to]. @@ -550,7 +553,7 @@ - Returns [code]true[/code] if this string contains a valid IP address. + Returns [code]true[/code] if this string contains only a well-formatted IPv4 or IPv6 address. This method considers [url=https://en.wikipedia.org/wiki/Reserved_IP_addresses]reserved IP addresses[/url] such as [code]0.0.0.0[/code] as valid. @@ -623,7 +626,10 @@ - Performs a case-insensitive comparison to another string. Returns [code]-1[/code] if less than, [code]+1[/code] if greater than, or [code]0[/code] if equal. + Performs a case-insensitive comparison to another string. Returns [code]-1[/code] if less than, [code]1[/code] if greater than, or [code]0[/code] if equal. "less than" or "greater than" are determined by the [url=https://en.wikipedia.org/wiki/List_of_Unicode_characters]Unicode code points[/code] of each string, which roughly matches the alphabetical order. Internally, lowercase characters will be converted to uppercase during the comparison. + [b]Behavior with different string lengths:[/b] Returns [code]1[/code] if the "base" string is longer than the [code]to[/code] string or [code]-1[/code] if the "base" string is shorter than the [code]to[/code] string. Keep in mind this length is determined by the number of Unicode codepoints, [i]not[/i] the actual visible characters. + [b]Behavior with empty strings:[/b] Returns [code]-1[/code] if the "base" string is empty, [code]1[/code] if the [code]to[/code] string is empty or [code]0[/code] if both strings are empty. + To get a boolean result from a string comparison, use the [code]==[/code] operator instead. See also [method casecmp_to]. diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp index fcebd14ea9c..9c39ef4811b 100644 --- a/editor/editor_resource_preview.cpp +++ b/editor/editor_resource_preview.cpp @@ -172,7 +172,6 @@ void EditorResourcePreview::_generate_preview(Ref &r_texture, Ref< return; int small_thumbnail_size = EditorNode::get_singleton()->get_theme_base()->get_icon("Object", "EditorIcons")->get_width(); // Kind of a workaround to retrieve the default icon size - small_thumbnail_size *= EDSCALE; if (preview_generators[i]->can_generate_small_preview()) { Ref generated_small; diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 60c06f92994..d9dd875bbd6 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -2487,13 +2487,28 @@ void CanvasItemEditor::_gui_input_viewport(const Ref &p_event) { // Handles the mouse hovering _gui_input_hover(p_event); - // Change the cursor - CursorShape c = CURSOR_ARROW; - bool should_switch = false; - if (drag_selection.size() != 0) { - float angle = drag_selection[0]->_edit_get_rotation(); - should_switch = abs(Math::cos(angle)) < Math_SQRT12; + // Compute an eventual rotation of the cursor + CursorShape rotation_array[4] = { CURSOR_HSIZE, CURSOR_BDIAGSIZE, CURSOR_VSIZE, CURSOR_FDIAGSIZE }; + int rotation_array_index = 0; + + List selection = _get_edited_canvas_items(); + if (selection.size() == 1) { + float angle = Math::fposmod((double)selection[0]->get_global_transform_with_canvas().get_rotation(), Math_PI); + if (angle > Math_PI * 7.0 / 8.0) { + rotation_array_index = 0; + } else if (angle > Math_PI * 5.0 / 8.0) { + rotation_array_index = 1; + } else if (angle > Math_PI * 3.0 / 8.0) { + rotation_array_index = 2; + } else if (angle > Math_PI * 1.0 / 8.0) { + rotation_array_index = 3; + } else { + rotation_array_index = 0; + } } + + // Choose the correct cursor + CursorShape c = CURSOR_ARROW; switch (drag_type) { case DRAG_NONE: switch (tool) { @@ -2515,38 +2530,28 @@ void CanvasItemEditor::_gui_input_viewport(const Ref &p_event) { break; case DRAG_LEFT: case DRAG_RIGHT: + c = rotation_array[rotation_array_index]; + break; case DRAG_V_GUIDE: - if (should_switch) { - c = CURSOR_VSIZE; - } else { - c = CURSOR_HSIZE; - } + c = CURSOR_HSIZE; break; case DRAG_TOP: case DRAG_BOTTOM: + c = rotation_array[(rotation_array_index + 2) % 4]; + break; case DRAG_H_GUIDE: - if (should_switch) { - c = CURSOR_HSIZE; - } else { - c = CURSOR_VSIZE; - } + c = CURSOR_VSIZE; break; case DRAG_TOP_LEFT: case DRAG_BOTTOM_RIGHT: + c = rotation_array[(rotation_array_index + 3) % 4]; + break; case DRAG_DOUBLE_GUIDE: - if (should_switch) { - c = CURSOR_BDIAGSIZE; - } else { - c = CURSOR_FDIAGSIZE; - } + c = CURSOR_FDIAGSIZE; break; case DRAG_TOP_RIGHT: case DRAG_BOTTOM_LEFT: - if (should_switch) { - c = CURSOR_FDIAGSIZE; - } else { - c = CURSOR_BDIAGSIZE; - } + c = rotation_array[(rotation_array_index + 1) % 4]; break; case DRAG_MOVE: c = CURSOR_MOVE; @@ -3898,6 +3903,12 @@ void CanvasItemEditor::_notification(int p_what) { key_scale_button->set_icon(get_icon("KeyScale", "EditorIcons")); key_insert_button->set_icon(get_icon("Key", "EditorIcons")); key_auto_insert_button->set_icon(get_icon("AutoKey", "EditorIcons")); + // Use a different color for the active autokey icon to make them easier + // to distinguish from the other key icons at the top. On a light theme, + // the icon will be dark, so we need to lighten it before blending it + // with the red color. + const Color key_auto_color = EditorSettings::get_singleton()->is_dark_theme() ? Color(1, 1, 1) : Color(4.25, 4.25, 4.25); + key_auto_insert_button->add_color_override("icon_color_pressed", key_auto_color.linear_interpolate(Color(1, 0, 0), 0.55)); animation_menu->set_icon(get_icon("GuiTabMenuHl", "EditorIcons")); zoom_minus->set_icon(get_icon("ZoomLess", "EditorIcons")); diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index d233e7f20bf..14d79c853ca 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -2608,14 +2608,14 @@ bool CSharpScript::_get_member_export(IMonoClassMember *p_member, bool p_inspect if (!property->has_getter()) { #ifdef TOOLS_ENABLED if (exported) - ERR_PRINTS("Read-only property cannot be exported: '" + MEMBER_FULL_QUALIFIED_NAME(p_member) + "'."); + ERR_PRINT("Cannot export a property without a getter: '" + MEMBER_FULL_QUALIFIED_NAME(p_member) + "'."); #endif return false; } if (!property->has_setter()) { #ifdef TOOLS_ENABLED if (exported) - ERR_PRINTS("Write-only property (without getter) cannot be exported: '" + MEMBER_FULL_QUALIFIED_NAME(p_member) + "'."); + ERR_PRINT("Cannot export a property without a setter: '" + MEMBER_FULL_QUALIFIED_NAME(p_member) + "'."); #endif return false; } diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp index 5631aa33550..efec1827060 100644 --- a/scene/2d/canvas_item.cpp +++ b/scene/2d/canvas_item.cpp @@ -1228,14 +1228,13 @@ void CanvasItem::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::COLOR, "modulate"), "set_modulate", "get_modulate"); ADD_PROPERTY(PropertyInfo(Variant::COLOR, "self_modulate"), "set_self_modulate", "get_self_modulate"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "show_behind_parent"), "set_draw_behind_parent", "is_draw_behind_parent_enabled"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "toplevel"), "set_as_toplevel", "is_set_as_toplevel"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "show_on_top", PROPERTY_HINT_NONE, "", 0), "_set_on_top", "_is_on_top"); //compatibility ADD_PROPERTY(PropertyInfo(Variant::INT, "light_mask", PROPERTY_HINT_LAYERS_2D_RENDER), "set_light_mask", "get_light_mask"); ADD_GROUP("Material", ""); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "ShaderMaterial,CanvasItemMaterial"), "set_material", "get_material"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_parent_material"), "set_use_parent_material", "get_use_parent_material"); - //exporting these things doesn't really make much sense i think - // ADD_PROPERTY(PropertyInfo(Variant::BOOL, "toplevel", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_as_toplevel", "is_set_as_toplevel"); // ADD_PROPERTY(PropertyInfo(Variant::BOOL,"transform/notify"),"set_transform_notify","is_transform_notify_enabled"); ADD_SIGNAL(MethodInfo("draw")); diff --git a/scene/3d/spatial.cpp b/scene/3d/spatial.cpp index f1911348cea..afe6532cb84 100644 --- a/scene/3d/spatial.cpp +++ b/scene/3d/spatial.cpp @@ -810,6 +810,7 @@ void Spatial::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "rotation_degrees", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_rotation_degrees", "get_rotation_degrees"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "rotation", PROPERTY_HINT_NONE, "", 0), "set_rotation", "get_rotation"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "scale", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_scale", "get_scale"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "toplevel"), "set_as_toplevel", "is_set_as_toplevel"); ADD_GROUP("Matrix", ""); ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "transform", PROPERTY_HINT_NONE, ""), "set_transform", "get_transform"); ADD_GROUP("Visibility", "");