diff options
30 files changed, 241 insertions, 42 deletions
diff --git a/core/math/math_funcs.h b/core/math/math_funcs.h index 9078abea68..a94b27fcc5 100644 --- a/core/math/math_funcs.h +++ b/core/math/math_funcs.h @@ -472,7 +472,7 @@ public: return p_step != 0 ? Math::stepify(p_target - p_offset, p_step) + p_offset : p_target; } - static _ALWAYS_INLINE_ float snap_scalar_seperation(float p_offset, float p_step, float p_target, float p_separation) { + static _ALWAYS_INLINE_ float snap_scalar_separation(float p_offset, float p_step, float p_target, float p_separation) { if (p_step != 0) { float a = Math::stepify(p_target - p_offset, p_step + p_separation) + p_offset; float b = a; diff --git a/core/pool_vector.h b/core/pool_vector.h index fbd4d630be..a698e72e18 100644 --- a/core/pool_vector.h +++ b/core/pool_vector.h @@ -385,6 +385,7 @@ public: } inline int size() const; + inline bool empty() const; T get(int p_index) const; void set(int p_index, const T &p_val); void push_back(const T &p_val); @@ -475,6 +476,12 @@ int PoolVector<T>::size() const { } template <class T> +bool PoolVector<T>::empty() const { + + return alloc ? alloc->size == 0 : true; +} + +template <class T> T PoolVector<T>::get(int p_index) const { return operator[](p_index); diff --git a/core/variant_call.cpp b/core/variant_call.cpp index 40b944744b..f7a3438d32 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -626,6 +626,7 @@ struct _VariantCall { } VCALL_LOCALMEM0R(PoolByteArray, size); + VCALL_LOCALMEM0R(PoolByteArray, empty); VCALL_LOCALMEM2(PoolByteArray, set); VCALL_LOCALMEM1R(PoolByteArray, get); VCALL_LOCALMEM1(PoolByteArray, push_back); @@ -638,6 +639,7 @@ struct _VariantCall { VCALL_LOCALMEM2R(PoolByteArray, subarray); VCALL_LOCALMEM0R(PoolIntArray, size); + VCALL_LOCALMEM0R(PoolIntArray, empty); VCALL_LOCALMEM2(PoolIntArray, set); VCALL_LOCALMEM1R(PoolIntArray, get); VCALL_LOCALMEM1(PoolIntArray, push_back); @@ -649,6 +651,7 @@ struct _VariantCall { VCALL_LOCALMEM0(PoolIntArray, invert); VCALL_LOCALMEM0R(PoolRealArray, size); + VCALL_LOCALMEM0R(PoolRealArray, empty); VCALL_LOCALMEM2(PoolRealArray, set); VCALL_LOCALMEM1R(PoolRealArray, get); VCALL_LOCALMEM1(PoolRealArray, push_back); @@ -660,6 +663,7 @@ struct _VariantCall { VCALL_LOCALMEM0(PoolRealArray, invert); VCALL_LOCALMEM0R(PoolStringArray, size); + VCALL_LOCALMEM0R(PoolStringArray, empty); VCALL_LOCALMEM2(PoolStringArray, set); VCALL_LOCALMEM1R(PoolStringArray, get); VCALL_LOCALMEM1(PoolStringArray, push_back); @@ -672,6 +676,7 @@ struct _VariantCall { VCALL_LOCALMEM1R(PoolStringArray, join); VCALL_LOCALMEM0R(PoolVector2Array, size); + VCALL_LOCALMEM0R(PoolVector2Array, empty); VCALL_LOCALMEM2(PoolVector2Array, set); VCALL_LOCALMEM1R(PoolVector2Array, get); VCALL_LOCALMEM1(PoolVector2Array, push_back); @@ -683,6 +688,7 @@ struct _VariantCall { VCALL_LOCALMEM0(PoolVector2Array, invert); VCALL_LOCALMEM0R(PoolVector3Array, size); + VCALL_LOCALMEM0R(PoolVector3Array, empty); VCALL_LOCALMEM2(PoolVector3Array, set); VCALL_LOCALMEM1R(PoolVector3Array, get); VCALL_LOCALMEM1(PoolVector3Array, push_back); @@ -694,6 +700,7 @@ struct _VariantCall { VCALL_LOCALMEM0(PoolVector3Array, invert); VCALL_LOCALMEM0R(PoolColorArray, size); + VCALL_LOCALMEM0R(PoolColorArray, empty); VCALL_LOCALMEM2(PoolColorArray, set); VCALL_LOCALMEM1R(PoolColorArray, get); VCALL_LOCALMEM1(PoolColorArray, push_back); @@ -1782,6 +1789,7 @@ void register_variant_methods() { ADDFUNC0R(ARRAY, NIL, Array, min, varray()); ADDFUNC0R(POOL_BYTE_ARRAY, INT, PoolByteArray, size, varray()); + ADDFUNC0R(POOL_BYTE_ARRAY, BOOL, PoolByteArray, empty, varray()); ADDFUNC2(POOL_BYTE_ARRAY, NIL, PoolByteArray, set, INT, "idx", INT, "byte", varray()); ADDFUNC1(POOL_BYTE_ARRAY, NIL, PoolByteArray, push_back, INT, "byte", varray()); ADDFUNC1(POOL_BYTE_ARRAY, NIL, PoolByteArray, append, INT, "byte", varray()); @@ -1799,6 +1807,7 @@ void register_variant_methods() { ADDFUNC2R(POOL_BYTE_ARRAY, POOL_BYTE_ARRAY, PoolByteArray, decompress, INT, "buffer_size", INT, "compression_mode", varray(0)); ADDFUNC0R(POOL_INT_ARRAY, INT, PoolIntArray, size, varray()); + ADDFUNC0R(POOL_INT_ARRAY, BOOL, PoolIntArray, empty, varray()); ADDFUNC2(POOL_INT_ARRAY, NIL, PoolIntArray, set, INT, "idx", INT, "integer", varray()); ADDFUNC1(POOL_INT_ARRAY, NIL, PoolIntArray, push_back, INT, "integer", varray()); ADDFUNC1(POOL_INT_ARRAY, NIL, PoolIntArray, append, INT, "integer", varray()); @@ -1809,6 +1818,7 @@ void register_variant_methods() { ADDFUNC0(POOL_INT_ARRAY, NIL, PoolIntArray, invert, varray()); ADDFUNC0R(POOL_REAL_ARRAY, INT, PoolRealArray, size, varray()); + ADDFUNC0R(POOL_REAL_ARRAY, BOOL, PoolRealArray, empty, varray()); ADDFUNC2(POOL_REAL_ARRAY, NIL, PoolRealArray, set, INT, "idx", REAL, "value", varray()); ADDFUNC1(POOL_REAL_ARRAY, NIL, PoolRealArray, push_back, REAL, "value", varray()); ADDFUNC1(POOL_REAL_ARRAY, NIL, PoolRealArray, append, REAL, "value", varray()); @@ -1819,6 +1829,7 @@ void register_variant_methods() { ADDFUNC0(POOL_REAL_ARRAY, NIL, PoolRealArray, invert, varray()); ADDFUNC0R(POOL_STRING_ARRAY, INT, PoolStringArray, size, varray()); + ADDFUNC0R(POOL_STRING_ARRAY, BOOL, PoolStringArray, empty, varray()); ADDFUNC2(POOL_STRING_ARRAY, NIL, PoolStringArray, set, INT, "idx", STRING, "string", varray()); ADDFUNC1(POOL_STRING_ARRAY, NIL, PoolStringArray, push_back, STRING, "string", varray()); ADDFUNC1(POOL_STRING_ARRAY, NIL, PoolStringArray, append, STRING, "string", varray()); @@ -1830,6 +1841,7 @@ void register_variant_methods() { ADDFUNC1(POOL_STRING_ARRAY, STRING, PoolStringArray, join, STRING, "delimiter", varray()); ADDFUNC0R(POOL_VECTOR2_ARRAY, INT, PoolVector2Array, size, varray()); + ADDFUNC0R(POOL_VECTOR2_ARRAY, BOOL, PoolVector2Array, empty, varray()); ADDFUNC2(POOL_VECTOR2_ARRAY, NIL, PoolVector2Array, set, INT, "idx", VECTOR2, "vector2", varray()); ADDFUNC1(POOL_VECTOR2_ARRAY, NIL, PoolVector2Array, push_back, VECTOR2, "vector2", varray()); ADDFUNC1(POOL_VECTOR2_ARRAY, NIL, PoolVector2Array, append, VECTOR2, "vector2", varray()); @@ -1840,6 +1852,7 @@ void register_variant_methods() { ADDFUNC0(POOL_VECTOR2_ARRAY, NIL, PoolVector2Array, invert, varray()); ADDFUNC0R(POOL_VECTOR3_ARRAY, INT, PoolVector3Array, size, varray()); + ADDFUNC0R(POOL_VECTOR3_ARRAY, BOOL, PoolVector3Array, empty, varray()); ADDFUNC2(POOL_VECTOR3_ARRAY, NIL, PoolVector3Array, set, INT, "idx", VECTOR3, "vector3", varray()); ADDFUNC1(POOL_VECTOR3_ARRAY, NIL, PoolVector3Array, push_back, VECTOR3, "vector3", varray()); ADDFUNC1(POOL_VECTOR3_ARRAY, NIL, PoolVector3Array, append, VECTOR3, "vector3", varray()); @@ -1850,6 +1863,7 @@ void register_variant_methods() { ADDFUNC0(POOL_VECTOR3_ARRAY, NIL, PoolVector3Array, invert, varray()); ADDFUNC0R(POOL_COLOR_ARRAY, INT, PoolColorArray, size, varray()); + ADDFUNC0R(POOL_COLOR_ARRAY, BOOL, PoolColorArray, empty, varray()); ADDFUNC2(POOL_COLOR_ARRAY, NIL, PoolColorArray, set, INT, "idx", COLOR, "color", varray()); ADDFUNC1(POOL_COLOR_ARRAY, NIL, PoolColorArray, push_back, COLOR, "color", varray()); ADDFUNC1(POOL_COLOR_ARRAY, NIL, PoolColorArray, append, COLOR, "color", varray()); diff --git a/doc/classes/Area2D.xml b/doc/classes/Area2D.xml index e1cb9056da..9a5870c73d 100644 --- a/doc/classes/Area2D.xml +++ b/doc/classes/Area2D.xml @@ -7,6 +7,7 @@ 2D area that detects [CollisionObject2D] nodes overlapping, entering, or exiting. Can also alter or override local physics parameters (gravity, damping). </description> <tutorials> + <link>https://docs.godotengine.org/en/latest/tutorials/physics/using_area_2d.html</link> </tutorials> <methods> <method name="get_collision_layer_bit" qualifiers="const"> diff --git a/doc/classes/CanvasItem.xml b/doc/classes/CanvasItem.xml index a920001de4..8372d15324 100644 --- a/doc/classes/CanvasItem.xml +++ b/doc/classes/CanvasItem.xml @@ -363,6 +363,7 @@ <return type="void"> </return> <description> + Forces the transform to update. Transform changes in physics are not instant for performance reasons. Transforms are accumulated and then set. Use this if you need an up-to-date transform when doing physics operations. </description> </method> <method name="get_canvas" qualifiers="const"> diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml index b6eeed4a21..5aeeb61647 100644 --- a/doc/classes/OS.xml +++ b/doc/classes/OS.xml @@ -157,6 +157,8 @@ <return type="PoolStringArray"> </return> <description> + Returns an array of MIDI device names. + The returned array will be empty if the system MIDI driver has not previously been initialised with [method open_midi_inputs]. </description> </method> <method name="get_current_video_driver" qualifiers="const"> @@ -699,6 +701,7 @@ <return type="void"> </return> <description> + Initialises the singleton for the system MIDI driver. </description> </method> <method name="print_all_resources"> diff --git a/doc/classes/PoolByteArray.xml b/doc/classes/PoolByteArray.xml index 21bf078017..867f042cd2 100644 --- a/doc/classes/PoolByteArray.xml +++ b/doc/classes/PoolByteArray.xml @@ -53,6 +53,13 @@ Returns a new [PoolByteArray] with the data decompressed. Set [code]buffer_size[/code] to the size of the uncompressed data. Set the compression mode using one of [enum File.CompressionMode]'s constants. </description> </method> + <method name="empty"> + <return type="bool"> + </return> + <description> + Returns [code]true[/code] if the array is empty. + </description> + </method> <method name="get_string_from_ascii"> <return type="String"> </return> diff --git a/doc/classes/PoolColorArray.xml b/doc/classes/PoolColorArray.xml index a1fb868ef5..34cfa0ab53 100644 --- a/doc/classes/PoolColorArray.xml +++ b/doc/classes/PoolColorArray.xml @@ -33,6 +33,13 @@ Appends a [PoolColorArray] at the end of this array. </description> </method> + <method name="empty"> + <return type="bool"> + </return> + <description> + Returns [code]true[/code] if the array is empty. + </description> + </method> <method name="insert"> <return type="int"> </return> diff --git a/doc/classes/PoolIntArray.xml b/doc/classes/PoolIntArray.xml index 28a28b2bba..25e1e718f7 100644 --- a/doc/classes/PoolIntArray.xml +++ b/doc/classes/PoolIntArray.xml @@ -34,6 +34,13 @@ Appends a [PoolIntArray] at the end of this array. </description> </method> + <method name="empty"> + <return type="bool"> + </return> + <description> + Returns [code]true[/code] if the array is empty. + </description> + </method> <method name="insert"> <return type="int"> </return> diff --git a/doc/classes/PoolRealArray.xml b/doc/classes/PoolRealArray.xml index 7eaec82338..e8afe46640 100644 --- a/doc/classes/PoolRealArray.xml +++ b/doc/classes/PoolRealArray.xml @@ -33,6 +33,13 @@ Appends a [PoolRealArray] at the end of this array. </description> </method> + <method name="empty"> + <return type="bool"> + </return> + <description> + Returns [code]true[/code] if the array is empty. + </description> + </method> <method name="insert"> <return type="int"> </return> diff --git a/doc/classes/PoolStringArray.xml b/doc/classes/PoolStringArray.xml index a408a18b19..f41a3c7a68 100644 --- a/doc/classes/PoolStringArray.xml +++ b/doc/classes/PoolStringArray.xml @@ -33,6 +33,13 @@ Appends a [PoolStringArray] at the end of this array. </description> </method> + <method name="empty"> + <return type="bool"> + </return> + <description> + Returns [code]true[/code] if the array is empty. + </description> + </method> <method name="insert"> <return type="int"> </return> diff --git a/doc/classes/PoolVector2Array.xml b/doc/classes/PoolVector2Array.xml index 623247e639..321846d08b 100644 --- a/doc/classes/PoolVector2Array.xml +++ b/doc/classes/PoolVector2Array.xml @@ -33,6 +33,13 @@ Appends a [PoolVector2Array] at the end of this array. </description> </method> + <method name="empty"> + <return type="bool"> + </return> + <description> + Returns [code]true[/code] if the array is empty. + </description> + </method> <method name="insert"> <return type="int"> </return> diff --git a/doc/classes/PoolVector3Array.xml b/doc/classes/PoolVector3Array.xml index adc28b46cb..c82bd62a11 100644 --- a/doc/classes/PoolVector3Array.xml +++ b/doc/classes/PoolVector3Array.xml @@ -33,6 +33,13 @@ Appends a [PoolVector3Array] at the end of this array. </description> </method> + <method name="empty"> + <return type="bool"> + </return> + <description> + Returns [code]true[/code] if the array is empty. + </description> + </method> <method name="insert"> <return type="int"> </return> diff --git a/doc/classes/SoftBody.xml b/doc/classes/SoftBody.xml index 5cde31fa59..e4a5087db5 100644 --- a/doc/classes/SoftBody.xml +++ b/doc/classes/SoftBody.xml @@ -7,6 +7,7 @@ A deformable physics body. Used to create elastic or deformable objects such as cloth, rubber, or other flexible materials. </description> <tutorials> + <link>https://docs.godotengine.org/en/latest/tutorials/physics/soft_body.html</link> </tutorials> <methods> <method name="add_collision_exception_with"> @@ -43,12 +44,6 @@ Returns an individual bit on the collision mask. </description> </method> - <method name="is_ray_pickable" qualifiers="const"> - <return type="bool"> - </return> - <description> - </description> - </method> <method name="remove_collision_exception_with"> <return type="void"> </return> @@ -80,25 +75,20 @@ Sets individual bits on the collision mask. Use this if you only need to change one layer's value. </description> </method> - <method name="set_ray_pickable"> - <return type="void"> - </return> - <argument index="0" name="ray_pickable" type="bool"> - </argument> - <description> - </description> - </method> </methods> <members> + <member name="ray_pickable" type="bool" setter="set_ray_pickable" getter="is_ray_pickable" default="false"> + If true, the [SoftBody] will respond to [RayCast]s. + </member> <member name="areaAngular_stiffness" type="float" setter="set_areaAngular_stiffness" getter="get_areaAngular_stiffness" default="0.5"> </member> <member name="collision_layer" type="int" setter="set_collision_layer" getter="get_collision_layer" default="1"> - The physics layers this area is in. + The physics layers this SoftBody is in. Collidable objects can exist in any of 32 different layers. These layers work like a tagging system, and are not visual. A collidable can use these layers to select with which objects it can collide, using the collision_mask property. A contact is detected if object A is in any of the layers that object B scans, or object B is in any layer scanned by object A. </member> <member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask" default="1"> - The physics layers this area scans for collisions. + The physics layers this SoftBody scans for collisions. </member> <member name="damping_coefficient" type="float" setter="set_damping_coefficient" getter="get_damping_coefficient" default="0.01"> </member> @@ -107,6 +97,7 @@ <member name="linear_stiffness" type="float" setter="set_linear_stiffness" getter="get_linear_stiffness" default="0.5"> </member> <member name="parent_collision_ignore" type="NodePath" setter="set_parent_collision_ignore" getter="get_parent_collision_ignore" default="NodePath("")"> + [NodePath] to a [CollisionObject] this SoftBody should avoid clipping. </member> <member name="pose_matching_coefficient" type="float" setter="set_pose_matching_coefficient" getter="get_pose_matching_coefficient" default="0.0"> </member> @@ -116,6 +107,7 @@ Increasing this value will improve the resulting simulation, but can affect performance. Use with care. </member> <member name="total_mass" type="float" setter="set_total_mass" getter="get_total_mass" default="1.0"> + The SoftBody's mass. </member> <member name="volume_stiffness" type="float" setter="set_volume_stiffness" getter="get_volume_stiffness" default="0.5"> </member> diff --git a/doc/classes/Spatial.xml b/doc/classes/Spatial.xml index 128aa93f15..0309e73eec 100644 --- a/doc/classes/Spatial.xml +++ b/doc/classes/Spatial.xml @@ -15,6 +15,7 @@ <return type="void"> </return> <description> + Forces the transform to update. Transform changes in physics are not instant for performance reasons. Transforms are accumulated and then set. Use this if you need an up-to-date transform when doing physics operations. </description> </method> <method name="get_parent_spatial" qualifiers="const"> diff --git a/editor/array_property_edit.cpp b/editor/array_property_edit.cpp index f2471e80d4..906139e239 100644 --- a/editor/array_property_edit.cpp +++ b/editor/array_property_edit.cpp @@ -267,9 +267,9 @@ void ArrayPropertyEdit::edit(Object *p_obj, const StringName &p_prop, const Stri default_type = p_deftype; if (!p_hint_string.empty()) { - int hint_subtype_seperator = p_hint_string.find(":"); - if (hint_subtype_seperator >= 0) { - String subtype_string = p_hint_string.substr(0, hint_subtype_seperator); + int hint_subtype_separator = p_hint_string.find(":"); + if (hint_subtype_separator >= 0) { + String subtype_string = p_hint_string.substr(0, hint_subtype_separator); int slash_pos = subtype_string.find("/"); if (slash_pos >= 0) { @@ -277,7 +277,7 @@ void ArrayPropertyEdit::edit(Object *p_obj, const StringName &p_prop, const Stri subtype_string = subtype_string.substr(0, slash_pos); } - subtype_hint_string = p_hint_string.substr(hint_subtype_seperator + 1, p_hint_string.size() - hint_subtype_seperator - 1); + subtype_hint_string = p_hint_string.substr(hint_subtype_separator + 1, p_hint_string.size() - hint_subtype_separator - 1); subtype = Variant::Type(subtype_string.to_int()); } } diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index d2306abfd7..dd49e38d7f 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -1224,11 +1224,18 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) { Ref<Font> doc_font = p_rt->get_font("doc", "EditorFonts"); Ref<Font> doc_bold_font = p_rt->get_font("doc_bold", "EditorFonts"); Ref<Font> doc_code_font = p_rt->get_font("doc_source", "EditorFonts"); + Color font_color_hl = p_rt->get_color("headline_color", "EditorHelp"); - Color link_color = p_rt->get_color("accent_color", "Editor").linear_interpolate(font_color_hl, 0.8); + Color accent_color = p_rt->get_color("accent_color", "Editor"); + Color link_color = accent_color.linear_interpolate(font_color_hl, 0.8); + Color code_color = accent_color.linear_interpolate(font_color_hl, 0.6); String bbcode = p_bbcode.dedent().replace("\t", "").replace("\r", "").strip_edges(); + // remove extra new lines around code blocks + bbcode = bbcode.replace("[codeblock]\n", "[codeblock]"); + bbcode = bbcode.replace("\n[/codeblock]", "[/codeblock]"); + List<String> tag_stack; bool code_tag = false; @@ -1276,9 +1283,14 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) { tag_stack.pop_front(); pos = brk_end + 1; - code_tag = false; - if (tag != "/img") + if (tag != "/img") { p_rt->pop(); + if (code_tag) { + p_rt->pop(); + } + } + code_tag = false; + } else if (code_tag) { p_rt->add_text("["); @@ -1323,6 +1335,7 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) { //use monospace font p_rt->push_font(doc_code_font); + p_rt->push_color(code_color); code_tag = true; pos = brk_end + 1; tag_stack.push_front(tag); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 9fa33044e1..d42345d9a2 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -5171,14 +5171,20 @@ void EditorNode::_open_imported() { } void EditorNode::dim_editor(bool p_dimming, bool p_force_dim) { - // Dimming can be forced regardless of the editor setting, which is useful when quitting the editor + // Dimming can be forced regardless of the editor setting, which is useful when quitting the editor. if ((p_force_dim || EditorSettings::get_singleton()->get("interface/editor/dim_editor_on_dialog_popup")) && p_dimming) { + dimmed = true; gui_base->set_modulate(Color(0.5, 0.5, 0.5)); } else { + dimmed = false; gui_base->set_modulate(Color(1, 1, 1)); } } +bool EditorNode::is_editor_dimmed() const { + return dimmed; +} + void EditorNode::open_export_template_manager() { export_template_manager->popup_manager(); @@ -5487,6 +5493,7 @@ EditorNode::EditorNode() { singleton = this; exiting = false; + dimmed = false; last_checked_version = 0; changing_scene = false; _initializing_addons = false; diff --git a/editor/editor_node.h b/editor/editor_node.h index fb7e81d2d2..b7775b5e83 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -260,6 +260,7 @@ private: int tab_closing; bool exiting; + bool dimmed; int old_split_ofs; VSplitContainer *top_split; @@ -850,6 +851,7 @@ public: void restart_editor(); void dim_editor(bool p_dimming, bool p_force_dim = false); + bool is_editor_dimmed() const; void edit_current() { _edit_current(); }; diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp index 8abe91bdc1..c75b66c601 100644 --- a/editor/editor_properties_array_dict.cpp +++ b/editor/editor_properties_array_dict.cpp @@ -475,16 +475,16 @@ void EditorPropertyArray::setup(Variant::Type p_array_type, const String &p_hint array_type = p_array_type; if (array_type == Variant::ARRAY && !p_hint_string.empty()) { - int hint_subtype_seperator = p_hint_string.find(":"); - if (hint_subtype_seperator >= 0) { - String subtype_string = p_hint_string.substr(0, hint_subtype_seperator); + int hint_subtype_separator = p_hint_string.find(":"); + if (hint_subtype_separator >= 0) { + String subtype_string = p_hint_string.substr(0, hint_subtype_separator); int slash_pos = subtype_string.find("/"); if (slash_pos >= 0) { subtype_hint = PropertyHint(subtype_string.substr(slash_pos + 1, subtype_string.size() - slash_pos - 1).to_int()); subtype_string = subtype_string.substr(0, slash_pos); } - subtype_hint_string = p_hint_string.substr(hint_subtype_seperator + 1, p_hint_string.size() - hint_subtype_seperator - 1); + subtype_hint_string = p_hint_string.substr(hint_subtype_separator + 1, p_hint_string.size() - hint_subtype_separator - 1); subtype = Variant::Type(subtype_string.to_int()); } } diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp index 21eebf9ca2..bda3d142fa 100644 --- a/editor/plugins/texture_region_editor_plugin.cpp +++ b/editor/plugins/texture_region_editor_plugin.cpp @@ -866,8 +866,8 @@ void TextureRegionEditor::_edit_region() { Vector2 TextureRegionEditor::snap_point(Vector2 p_target) const { if (snap_mode == SNAP_GRID) { - p_target.x = Math::snap_scalar_seperation(snap_offset.x, snap_step.x, p_target.x, snap_separation.x); - p_target.y = Math::snap_scalar_seperation(snap_offset.y, snap_step.y, p_target.y, snap_separation.y); + p_target.x = Math::snap_scalar_separation(snap_offset.x, snap_step.x, p_target.x, snap_separation.x); + p_target.y = Math::snap_scalar_separation(snap_offset.y, snap_step.y, p_target.y, snap_separation.y); } return p_target; diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index e0bf8dfdb2..d81c6d3f96 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -3038,8 +3038,8 @@ Vector2 TileSetEditor::snap_point(const Vector2 &point) { } if (tools[TOOL_GRID_SNAP]->is_pressed()) { - p.x = Math::snap_scalar_seperation(snap_offset.x, snap_step.x, p.x, snap_separation.x); - p.y = Math::snap_scalar_seperation(snap_offset.y, snap_step.y, p.y, snap_separation.y); + p.x = Math::snap_scalar_separation(snap_offset.x, snap_step.x, p.x, snap_separation.x); + p.y = Math::snap_scalar_separation(snap_offset.y, snap_step.y, p.y, snap_separation.y); } if (tools[SHAPE_KEEP_INSIDE_TILE]->is_pressed()) { if (p.x < region.position.x) diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 0884620e5d..beead9e7f1 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -340,8 +340,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { if (!profile_allow_editing) { break; } - Tree *tree = scene_tree->get_scene_tree(); - if (tree->is_anything_selected()) { + if (editor_selection->get_selected_node_list().size() > 1) { rename_dialog->popup_centered(); } } break; diff --git a/modules/gdnative/gdnative/pool_arrays.cpp b/modules/gdnative/gdnative/pool_arrays.cpp index 74c540ca14..23791af67e 100644 --- a/modules/gdnative/gdnative/pool_arrays.cpp +++ b/modules/gdnative/gdnative/pool_arrays.cpp @@ -129,6 +129,11 @@ godot_int GDAPI godot_pool_byte_array_size(const godot_pool_byte_array *p_self) return self->size(); } +godot_bool GDAPI godot_pool_byte_array_empty(const godot_pool_byte_array *p_self) { + const PoolVector<uint8_t> *self = (const PoolVector<uint8_t> *)p_self; + return self->empty(); +} + void GDAPI godot_pool_byte_array_destroy(godot_pool_byte_array *p_self) { ((PoolVector<uint8_t> *)p_self)->~PoolVector(); } @@ -218,6 +223,11 @@ godot_int GDAPI godot_pool_int_array_size(const godot_pool_int_array *p_self) { return self->size(); } +godot_bool GDAPI godot_pool_int_array_empty(const godot_pool_int_array *p_self) { + const PoolVector<godot_int> *self = (const PoolVector<godot_int> *)p_self; + return self->empty(); +} + void GDAPI godot_pool_int_array_destroy(godot_pool_int_array *p_self) { ((PoolVector<godot_int> *)p_self)->~PoolVector(); } @@ -307,6 +317,11 @@ godot_int GDAPI godot_pool_real_array_size(const godot_pool_real_array *p_self) return self->size(); } +godot_bool GDAPI godot_pool_real_array_empty(const godot_pool_real_array *p_self) { + const PoolVector<godot_real> *self = (const PoolVector<godot_real> *)p_self; + return self->empty(); +} + void GDAPI godot_pool_real_array_destroy(godot_pool_real_array *p_self) { ((PoolVector<godot_real> *)p_self)->~PoolVector(); } @@ -404,6 +419,11 @@ godot_int GDAPI godot_pool_string_array_size(const godot_pool_string_array *p_se return self->size(); } +godot_bool GDAPI godot_pool_string_array_empty(const godot_pool_string_array *p_self) { + const PoolVector<String> *self = (const PoolVector<String> *)p_self; + return self->empty(); +} + void GDAPI godot_pool_string_array_destroy(godot_pool_string_array *p_self) { ((PoolVector<String> *)p_self)->~PoolVector(); } @@ -500,6 +520,11 @@ godot_int GDAPI godot_pool_vector2_array_size(const godot_pool_vector2_array *p_ return self->size(); } +godot_bool GDAPI godot_pool_vector2_array_empty(const godot_pool_vector2_array *p_self) { + const PoolVector<Vector2> *self = (const PoolVector<Vector2> *)p_self; + return self->empty(); +} + void GDAPI godot_pool_vector2_array_destroy(godot_pool_vector2_array *p_self) { ((PoolVector<Vector2> *)p_self)->~PoolVector(); } @@ -596,6 +621,11 @@ godot_int GDAPI godot_pool_vector3_array_size(const godot_pool_vector3_array *p_ return self->size(); } +godot_bool GDAPI godot_pool_vector3_array_empty(const godot_pool_vector3_array *p_self) { + const PoolVector<Vector3> *self = (const PoolVector<Vector3> *)p_self; + return self->empty(); +} + void GDAPI godot_pool_vector3_array_destroy(godot_pool_vector3_array *p_self) { ((PoolVector<Vector3> *)p_self)->~PoolVector(); } @@ -692,6 +722,11 @@ godot_int GDAPI godot_pool_color_array_size(const godot_pool_color_array *p_self return self->size(); } +godot_bool GDAPI godot_pool_color_array_empty(const godot_pool_color_array *p_self) { + const PoolVector<Color> *self = (const PoolVector<Color> *)p_self; + return self->empty(); +} + void GDAPI godot_pool_color_array_destroy(godot_pool_color_array *p_self) { ((PoolVector<Color> *)p_self)->~PoolVector(); } diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json index 55ba4ecc1e..2f304ca49c 100644 --- a/modules/gdnative/gdnative_api.json +++ b/modules/gdnative/gdnative_api.json @@ -1717,6 +1717,13 @@ ] }, { + "name": "godot_pool_byte_array_empty", + "return_type": "godot_bool", + "arguments": [ + ["const godot_pool_byte_array *", "p_self"] + ] + }, + { "name": "godot_pool_byte_array_destroy", "return_type": "void", "arguments": [ @@ -1841,6 +1848,13 @@ ] }, { + "name": "godot_pool_int_array_empty", + "return_type": "godot_bool", + "arguments": [ + ["const godot_pool_int_array *", "p_self"] + ] + }, + { "name": "godot_pool_int_array_destroy", "return_type": "void", "arguments": [ @@ -1965,6 +1979,13 @@ ] }, { + "name": "godot_pool_real_array_empty", + "return_type": "godot_bool", + "arguments": [ + ["const godot_pool_real_array *", "p_self"] + ] + }, + { "name": "godot_pool_real_array_destroy", "return_type": "void", "arguments": [ @@ -2089,6 +2110,13 @@ ] }, { + "name": "godot_pool_string_array_empty", + "return_type": "godot_bool", + "arguments": [ + ["const godot_pool_string_array *", "p_self"] + ] + }, + { "name": "godot_pool_string_array_destroy", "return_type": "void", "arguments": [ @@ -2213,6 +2241,13 @@ ] }, { + "name": "godot_pool_vector2_array_empty", + "return_type": "godot_bool", + "arguments": [ + ["const godot_pool_vector2_array *", "p_self"] + ] + }, + { "name": "godot_pool_vector2_array_destroy", "return_type": "void", "arguments": [ @@ -2337,6 +2372,13 @@ ] }, { + "name": "godot_pool_vector3_array_empty", + "return_type": "godot_bool", + "arguments": [ + ["const godot_pool_vector3_array *", "p_self"] + ] + }, + { "name": "godot_pool_vector3_array_destroy", "return_type": "void", "arguments": [ @@ -2461,6 +2503,13 @@ ] }, { + "name": "godot_pool_color_array_empty", + "return_type": "godot_bool", + "arguments": [ + ["const godot_pool_color_array *", "p_self"] + ] + }, + { "name": "godot_pool_color_array_destroy", "return_type": "void", "arguments": [ diff --git a/modules/gdnative/include/gdnative/pool_arrays.h b/modules/gdnative/include/gdnative/pool_arrays.h index 96730ab085..63e8267f0e 100644 --- a/modules/gdnative/include/gdnative/pool_arrays.h +++ b/modules/gdnative/include/gdnative/pool_arrays.h @@ -191,6 +191,8 @@ uint8_t GDAPI godot_pool_byte_array_get(const godot_pool_byte_array *p_self, con godot_int GDAPI godot_pool_byte_array_size(const godot_pool_byte_array *p_self); +godot_bool GDAPI godot_pool_byte_array_empty(const godot_pool_byte_array *p_self); + void GDAPI godot_pool_byte_array_destroy(godot_pool_byte_array *p_self); // int @@ -222,6 +224,8 @@ godot_int GDAPI godot_pool_int_array_get(const godot_pool_int_array *p_self, con godot_int GDAPI godot_pool_int_array_size(const godot_pool_int_array *p_self); +godot_bool GDAPI godot_pool_int_array_empty(const godot_pool_int_array *p_self); + void GDAPI godot_pool_int_array_destroy(godot_pool_int_array *p_self); // real @@ -253,6 +257,8 @@ godot_real GDAPI godot_pool_real_array_get(const godot_pool_real_array *p_self, godot_int GDAPI godot_pool_real_array_size(const godot_pool_real_array *p_self); +godot_bool GDAPI godot_pool_real_array_empty(const godot_pool_real_array *p_self); + void GDAPI godot_pool_real_array_destroy(godot_pool_real_array *p_self); // string @@ -284,6 +290,8 @@ godot_string GDAPI godot_pool_string_array_get(const godot_pool_string_array *p_ godot_int GDAPI godot_pool_string_array_size(const godot_pool_string_array *p_self); +godot_bool GDAPI godot_pool_string_array_empty(const godot_pool_string_array *p_self); + void GDAPI godot_pool_string_array_destroy(godot_pool_string_array *p_self); // vector2 @@ -315,6 +323,8 @@ godot_vector2 GDAPI godot_pool_vector2_array_get(const godot_pool_vector2_array godot_int GDAPI godot_pool_vector2_array_size(const godot_pool_vector2_array *p_self); +godot_bool GDAPI godot_pool_vector2_array_empty(const godot_pool_vector2_array *p_self); + void GDAPI godot_pool_vector2_array_destroy(godot_pool_vector2_array *p_self); // vector3 @@ -346,6 +356,8 @@ godot_vector3 GDAPI godot_pool_vector3_array_get(const godot_pool_vector3_array godot_int GDAPI godot_pool_vector3_array_size(const godot_pool_vector3_array *p_self); +godot_bool GDAPI godot_pool_vector3_array_empty(const godot_pool_vector3_array *p_self); + void GDAPI godot_pool_vector3_array_destroy(godot_pool_vector3_array *p_self); // color @@ -377,6 +389,8 @@ godot_color GDAPI godot_pool_color_array_get(const godot_pool_color_array *p_sel godot_int GDAPI godot_pool_color_array_size(const godot_pool_color_array *p_self); +godot_bool GDAPI godot_pool_color_array_empty(const godot_pool_color_array *p_self); + void GDAPI godot_pool_color_array_destroy(godot_pool_color_array *p_self); // diff --git a/scene/3d/soft_body.cpp b/scene/3d/soft_body.cpp index 9bd89f1121..6883da7f6d 100644 --- a/scene/3d/soft_body.cpp +++ b/scene/3d/soft_body.cpp @@ -115,7 +115,7 @@ SoftBody::PinnedPoint SoftBody::PinnedPoint::operator=(const PinnedPoint &obj) { void SoftBody::_update_pickable() { if (!is_inside_tree()) return; - bool pickable = ray_pickable && is_inside_tree() && is_visible_in_tree(); + bool pickable = ray_pickable && is_visible_in_tree(); PhysicsServer::get_singleton()->soft_body_set_ray_pickable(physics_rid, pickable); } @@ -395,6 +395,8 @@ void SoftBody::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::REAL, "damping_coefficient", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_damping_coefficient", "get_damping_coefficient"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "drag_coefficient", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_drag_coefficient", "get_drag_coefficient"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "pose_matching_coefficient", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_pose_matching_coefficient", "get_pose_matching_coefficient"); + + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "ray_pickable"), "set_ray_pickable", "is_ray_pickable"); } String SoftBody::get_configuration_warning() const { @@ -700,7 +702,8 @@ SoftBody::SoftBody() : collision_mask(1), collision_layer(1), simulation_started(false), - pinned_points_cache_dirty(true) { + pinned_points_cache_dirty(true), + ray_pickable(true) { PhysicsServer::get_singleton()->body_attach_object_instance_id(physics_rid, get_instance_id()); //set_notify_transform(true); diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp index 062089d80b..19bac5e5ac 100644 --- a/scene/gui/dialogs.cpp +++ b/scene/gui/dialogs.cpp @@ -239,13 +239,15 @@ void WindowDialog::_notification(int p_what) { #ifdef TOOLS_ENABLED case NOTIFICATION_POST_POPUP: { - if (get_tree() && Engine::get_singleton()->is_editor_hint() && EditorNode::get_singleton()) + if (get_tree() && Engine::get_singleton()->is_editor_hint() && EditorNode::get_singleton()) { + was_editor_dimmed = EditorNode::get_singleton()->is_editor_dimmed(); EditorNode::get_singleton()->dim_editor(true); + } } break; case NOTIFICATION_POPUP_HIDE: { - if (get_tree() && Engine::get_singleton()->is_editor_hint() && EditorNode::get_singleton() && !get_viewport()->gui_has_modal_stack()) - EditorNode::get_singleton()->dim_editor(false); + if (get_tree() && Engine::get_singleton()->is_editor_hint() && EditorNode::get_singleton()) + EditorNode::get_singleton()->dim_editor(was_editor_dimmed); } break; #endif } @@ -345,6 +347,10 @@ WindowDialog::WindowDialog() { close_button = memnew(TextureButton); add_child(close_button); close_button->connect("pressed", this, "_closed"); + +#ifdef TOOLS_ENABLED + was_editor_dimmed = false; +#endif } WindowDialog::~WindowDialog() { diff --git a/scene/gui/dialogs.h b/scene/gui/dialogs.h index afd1173f28..2eb0978e9b 100644 --- a/scene/gui/dialogs.h +++ b/scene/gui/dialogs.h @@ -59,6 +59,10 @@ class WindowDialog : public Popup { Point2 drag_offset_far; bool resizable; +#ifdef TOOLS_ENABLED + bool was_editor_dimmed; +#endif + void _gui_input(const Ref<InputEvent> &p_event); void _closed(); int _drag_hit_test(const Point2 &pos) const; @@ -106,7 +110,6 @@ class AcceptDialog : public WindowDialog { HBoxContainer *hbc; Label *label; Button *ok; - //Button *cancel; no more cancel (there is X on that titlebar) bool hide_on_ok; void _custom_action(const String &p_action); diff --git a/thirdparty/README.md b/thirdparty/README.md index 434e0c8a36..6f0d4da958 100644 --- a/thirdparty/README.md +++ b/thirdparty/README.md @@ -162,7 +162,7 @@ Files extracted from upstream source: Files extracted from upstream source: -- `src/*.c` +- `src/*.{c,h}` - `include/ogg/*.h` in ogg/ - COPYING |