diff options
-rw-r--r-- | core/ustring.cpp | 26 | ||||
-rw-r--r-- | core/ustring.h | 2 | ||||
-rw-r--r-- | core/variant_call.cpp | 4 | ||||
-rw-r--r-- | demos/misc/joysticks/joysticks.gd | 9 | ||||
-rw-r--r-- | demos/misc/tween/main.gd | 2 | ||||
-rw-r--r-- | doc/base/classes.xml | 160 | ||||
-rw-r--r-- | drivers/builtin_openssl2/SCsub | 1 | ||||
-rw-r--r-- | scene/2d/node_2d.cpp | 48 | ||||
-rw-r--r-- | scene/2d/node_2d.h | 5 | ||||
-rw-r--r-- | scene/3d/spatial.cpp | 51 | ||||
-rw-r--r-- | scene/3d/spatial.h | 7 | ||||
-rw-r--r-- | scene/gui/control.cpp | 45 | ||||
-rw-r--r-- | scene/gui/control.h | 7 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 86 | ||||
-rw-r--r-- | scene/gui/text_edit.h | 13 | ||||
-rw-r--r-- | scene/main/canvas_layer.cpp | 48 | ||||
-rw-r--r-- | scene/main/canvas_layer.h | 7 | ||||
-rw-r--r-- | tools/editor/editor_settings.cpp | 4 | ||||
-rw-r--r-- | tools/editor/plugins/script_editor_plugin.cpp | 4 | ||||
-rw-r--r-- | tools/editor/plugins/shader_editor_plugin.cpp | 6 |
20 files changed, 404 insertions, 131 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp index 730f7cfa3b..1f0eadc03f 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -2867,25 +2867,29 @@ CharType String::ord_at(int p_idx) const { return operator[](p_idx); } -String String::strip_edges() const { +String String::strip_edges(bool left, bool right) const { int len=length(); int beg=0,end=len; - for (int i=0;i<length();i++) { + if(left) { + for (int i=0;i<len;i++) { - if (operator[](i)<=32) - beg++; - else - break; + if (operator[](i)<=32) + beg++; + else + break; + } } - for (int i=(int)(length()-1);i>=0;i--) { + if(right) { + for (int i=(int)(len-1);i>=0;i--) { - if (operator[](i)<=32) - end--; - else - break; + if (operator[](i)<=32) + end--; + else + break; + } } if (beg==0 && end==len) diff --git a/core/ustring.h b/core/ustring.h index ec0932e54d..78c041fb92 100644 --- a/core/ustring.h +++ b/core/ustring.h @@ -169,7 +169,7 @@ public: String left(int p_pos) const; String right(int p_pos) const; - String strip_edges() const; + String strip_edges(bool left = true, bool right = true) const; String strip_escapes() const; String extension() const; String basename() const; diff --git a/core/variant_call.cpp b/core/variant_call.cpp index 01550a1593..4be763a511 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -257,7 +257,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var VCALL_LOCALMEM0R(String,to_lower); VCALL_LOCALMEM1R(String,left); VCALL_LOCALMEM1R(String,right); - VCALL_LOCALMEM0R(String,strip_edges); + VCALL_LOCALMEM2R(String,strip_edges); VCALL_LOCALMEM0R(String,extension); VCALL_LOCALMEM0R(String,basename); VCALL_LOCALMEM1R(String,plus_file); @@ -1277,7 +1277,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl ADDFUNC1(STRING,STRING,String,left,INT,"pos",varray()); ADDFUNC1(STRING,STRING,String,right,INT,"pos",varray()); - ADDFUNC0(STRING,STRING,String,strip_edges,varray()); + ADDFUNC2(STRING,STRING,String,strip_edges,BOOL,"left",BOOL,"right",varray(true,true)); ADDFUNC0(STRING,STRING,String,extension,varray()); ADDFUNC0(STRING,STRING,String,basename,varray()); ADDFUNC1(STRING,STRING,String,plus_file,STRING,"file",varray()); diff --git a/demos/misc/joysticks/joysticks.gd b/demos/misc/joysticks/joysticks.gd index f5466012e6..a6b90241b2 100644 --- a/demos/misc/joysticks/joysticks.gd +++ b/demos/misc/joysticks/joysticks.gd @@ -12,7 +12,6 @@ extends Node2D var joy_num var cur_joy var axis_value -var btn_state const DEADZONE = 0.2 @@ -26,11 +25,12 @@ func _fixed_process(delta): get_node("joy_name").set_text(Input.get_joy_name(joy_num)) # Loop through the axes and show their current values - for axis in range(0, 8): + for axis in range(JOY_ANALOG_0_X, JOY_AXIS_MAX): axis_value = Input.get_joy_axis(joy_num, axis) get_node("axis_prog" + str(axis)).set_value(100*axis_value) get_node("axis_val" + str(axis)).set_text(str(axis_value)) - if (axis < 4): + # Show joystick direction indicators + if (axis <= JOY_ANALOG_1_Y): if (abs(axis_value) < DEADZONE): get_node("diagram/axes/" + str(axis) + "+").hide() get_node("diagram/axes/" + str(axis) + "-").hide() @@ -40,8 +40,7 @@ func _fixed_process(delta): get_node("diagram/axes/" + str(axis) + "-").show() # Loop through the buttons and highlight the ones that are pressed - for btn in range(0, 16): - btn_state = 1 + for btn in range(JOY_BUTTON_0, JOY_BUTTON_MAX): if (Input.is_joy_button_pressed(joy_num, btn)): get_node("btn" + str(btn)).add_color_override("font_color", Color(1, 1, 1, 1)) get_node("diagram/buttons/" + str(btn)).show() diff --git a/demos/misc/tween/main.gd b/demos/misc/tween/main.gd index 512271311e..b899825d55 100644 --- a/demos/misc/tween/main.gd +++ b/demos/misc/tween/main.gd @@ -108,7 +108,7 @@ func reset_tween(): sprite.set_scale(Vector2(1,1)) if get_node("modes/rotate").is_pressed(): - tween.interpolate_method(sprite, "_set_rotd", 0, 360, 2, state.trans, state.eases) + tween.interpolate_method(sprite, "set_rotd", 0, 360, 2, state.trans, state.eases) tween.interpolate_property(sprite, "transform/rot", 360, 0, 2, state.trans, state.eases, 2) if get_node("modes/callback").is_pressed(): diff --git a/doc/base/classes.xml b/doc/base/classes.xml index 529601c741..643658fbb9 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -2680,6 +2680,22 @@ Get the list of names of the animations stored in the player. </description> </method> + <method name="animation_set_next"> + <argument index="0" name="anim_from" type="String"> + </argument> + <argument index="1" name="anim_to" type="String"> + </argument> + <description> + </description> + </method> + <method name="animation_get_next" qualifiers="const"> + <return type="String"> + </return> + <argument index="0" name="anim_from" type="String"> + </argument> + <description> + </description> + </method> <method name="set_blend_time"> <argument index="0" name="anim_from" type="String"> </argument> @@ -6766,9 +6782,9 @@ </argument> <argument index="1" name="colors" type="ColorArray"> </argument> - <argument index="2" name="uvs" type="Vector2Array" default="Array()"> + <argument index="2" name="uvs" type="Vector2Array"> </argument> - <argument index="3" name="texture" type="Texture" default="Object()"> + <argument index="3" name="texture" type="Texture" default="NULL"> </argument> <argument index="4" name="width" type="float" default="1"> </argument> @@ -6781,9 +6797,9 @@ </argument> <argument index="1" name="colors" type="ColorArray"> </argument> - <argument index="2" name="uvs" type="Vector2Array" default="Array()"> + <argument index="2" name="uvs" type="Vector2Array" default="Vector2Array()"> </argument> - <argument index="3" name="texture" type="Texture" default="Object()"> + <argument index="3" name="texture" type="Texture" default="NULL"> </argument> <description> Draw a polygon of any amount of points, convex or concave. @@ -6794,9 +6810,9 @@ </argument> <argument index="1" name="color" type="Color"> </argument> - <argument index="2" name="uvs" type="Vector2Array" default="Array()"> + <argument index="2" name="uvs" type="Vector2Array" default="Vector2Array()"> </argument> - <argument index="3" name="texture" type="Texture" default="Object()"> + <argument index="3" name="texture" type="Texture" default="NULL"> </argument> <description> Draw a colored polygon of any amount of points, convex or concave. @@ -7118,7 +7134,7 @@ </description> </method> <method name="set_rotation"> - <argument index="0" name="rotation" type="float"> + <argument index="0" name="radians" type="float"> </argument> <description> Set the base rotation for this layer (helper). @@ -7131,6 +7147,18 @@ Return the base rotation for this layer (helper). </description> </method> + <method name="set_rotationd"> + <argument index="0" name="degrees" type="float"> + </argument> + <description> + </description> + </method> + <method name="get_rotationd" qualifiers="const"> + <return type="float"> + </return> + <description> + </description> + </method> <method name="set_scale"> <argument index="0" name="scale" type="Vector2"> </argument> @@ -7146,7 +7174,7 @@ </description> </method> <method name="get_world_2d" qualifiers="const"> - <return type="Canvas"> + <return type="World2D"> </return> <description> Return the [World2D] used by this layer. @@ -8779,7 +8807,13 @@ </description> </method> <method name="set_rotation"> - <argument index="0" name="rotation" type="float"> + <argument index="0" name="radians" type="float"> + </argument> + <description> + </description> + </method> + <method name="set_rotation_deg"> + <argument index="0" name="degrees" type="float"> </argument> <description> </description> @@ -8832,6 +8866,12 @@ <description> </description> </method> + <method name="get_rotation_deg" qualifiers="const"> + <return type="float"> + </return> + <description> + </description> + </method> <method name="get_scale" qualifiers="const"> <return type="Vector2"> </return> @@ -9175,6 +9215,12 @@ <description> </description> </method> + <method name="set_drag_forwarding"> + <argument index="0" name="target" type="Control"> + </argument> + <description> + </description> + </method> <method name="set_drag_preview"> <argument index="0" name="control" type="Control"> </argument> @@ -14065,6 +14111,20 @@ Returns an empty String "" at the end of the list. <description> </description> </method> + <method name="request_raw"> + <return type="int"> + </return> + <argument index="0" name="method" type="int"> + </argument> + <argument index="1" name="url" type="String"> + </argument> + <argument index="2" name="headers" type="StringArray"> + </argument> + <argument index="3" name="body" type="RawArray" default=""""> + </argument> + <description> + </description> + </method> <method name="request"> <return type="int"> </return> @@ -14688,6 +14748,10 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) <description> </description> </method> + <method name="fix_alpha_edges"> + <description> + </description> + </method> <method name="get_data"> <return type="RawArray"> </return> @@ -15208,13 +15272,13 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) </signals> <constants> <constant name="MOUSE_MODE_VISIBLE" value="0"> - Makes the mouse cursor visible if it is hidden. + Makes the mouse cursor visible if it is hidden. </constant> <constant name="MOUSE_MODE_HIDDEN" value="1"> - Makes the mouse cursor hidden if it is visible. + Makes the mouse cursor hidden if it is visible. </constant> <constant name="MOUSE_MODE_CAPTURED" value="2"> - Captures the mouse. The mouse will be hidden and unable to leave the game window. But it will still register movement and mouse button presses. + Captures the mouse. The mouse will be hidden and unable to leave the game window. But it will still register movement and mouse button presses. </constant> </constants> </class> @@ -16377,7 +16441,7 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) <method name="add_item"> <argument index="0" name="text" type="String"> </argument> - <argument index="1" name="icon" type="Texture" default="Object()"> + <argument index="1" name="icon" type="Texture" default="NULL"> </argument> <argument index="2" name="selectable" type="bool" default="true"> </argument> @@ -17963,38 +18027,38 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) </class> <class name="LinkButton" inherits="BaseButton" category="Core"> <brief_description> - Simple button used to represent a link to some resource + Simple button used to represent a link to some resource </brief_description> <description> - This kind of buttons are primarily used when the interaction with the button causes a context change (like linking to a web page). + This kind of buttons are primarily used when the interaction with the button causes a context change (like linking to a web page). </description> <methods> <method name="set_text"> <argument index="0" name="text" type="String"> </argument> <description> - Sets the text of the button. + Sets the text of the button. </description> </method> <method name="get_text" qualifiers="const"> <return type="String"> </return> <description> - Returns the text of the button. + Returns the text of the button. </description> </method> <method name="set_underline_mode"> <argument index="0" name="underline_mode" type="int"> </argument> <description> - Sets the underline mode for this button, the argument must be one of the [LinkButton] constants (see constants section). + Sets the underline mode for this button, the argument must be one of the [LinkButton] constants (see constants section). </description> </method> <method name="get_underline_mode" qualifiers="const"> <return type="int"> </return> <description> - Returns the underline mode for this button. + Returns the underline mode for this button. </description> </method> </methods> @@ -20246,7 +20310,7 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) </description> </method> <method name="get_parent" qualifiers="const"> - <return type="Parent"> + <return type="Node"> </return> <description> Return the parent [Node] of the current [Node], or an empty Object if the node lacks a parent. @@ -20639,12 +20703,18 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) </description> </method> <method name="set_rot"> - <argument index="0" name="rot" type="float"> + <argument index="0" name="radians" type="float"> </argument> <description> Set the rotation of the 2D node. </description> </method> + <method name="set_rotd"> + <argument index="0" name="degrees" type="float"> + </argument> + <description> + </description> + </method> <method name="set_scale"> <argument index="0" name="scale" type="Vector2"> </argument> @@ -20666,6 +20736,12 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) Return the rotation of the 2D node. </description> </method> + <method name="get_rotd" qualifiers="const"> + <return type="float"> + </return> + <description> + </description> + </method> <method name="get_scale" qualifiers="const"> <return type="Vector2"> </return> @@ -21029,7 +21105,7 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) <argument index="0" name="size" type="Vector2"> </argument> <description> - Sets the window size to the specified size. + Sets the window size to the specified size. </description> </method> <method name="set_window_fullscreen"> @@ -21107,7 +21183,7 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) <return type="int"> </return> <description> - Returns the current screen orientation, the return value will be one of the SCREEN_ORIENTATION constants in this class. + Returns the current screen orientation, the return value will be one of the SCREEN_ORIENTATION constants in this class. </description> </method> <method name="set_keep_screen_on"> @@ -25033,7 +25109,7 @@ This method controls whether the position between two cached points is interpola </argument> <argument index="1" name="param" type="int"> </argument> - <argument index="2" name="value" type="float" default="RID()"> + <argument index="2" name="value" type="float"> </argument> <description> </description> @@ -33787,7 +33863,7 @@ This method controls whether the position between two cached points is interpola </description> </method> <method name="set_rotation"> - <argument index="0" name="rotation" type="Vector3"> + <argument index="0" name="rotation_rad" type="Vector3"> </argument> <description> </description> @@ -33798,6 +33874,18 @@ This method controls whether the position between two cached points is interpola <description> </description> </method> + <method name="set_rotation_deg"> + <argument index="0" name="rotation_deg" type="Vector3"> + </argument> + <description> + </description> + </method> + <method name="get_rotation_deg" qualifiers="const"> + <return type="Vector3"> + </return> + <description> + </description> + </method> <method name="set_scale"> <argument index="0" name="scale" type="Vector3"> </argument> @@ -34183,13 +34271,13 @@ This method controls whether the position between two cached points is interpola </description> <methods> <method name="set_stream"> - <argument index="0" name="stream" type="Stream"> + <argument index="0" name="stream" type="AudioStream"> </argument> <description> </description> </method> <method name="get_stream" qualifiers="const"> - <return type="Stream"> + <return type="AudioStream"> </return> <description> </description> @@ -36479,11 +36567,11 @@ This method controls whether the position between two cached points is interpola <method name="add_triangle_fan"> <argument index="0" name="vertexes" type="Vector3Array"> </argument> - <argument index="1" name="uvs" type="Vector2Array" default="[Vector2Array]"> + <argument index="1" name="uvs" type="Vector2Array" default="Vector2Array()"> </argument> <argument index="2" name="colors" type="ColorArray" default="ColorArray([ColorArray])"> </argument> - <argument index="3" name="uv2s" type="Vector2Array" default="[Vector2Array]"> + <argument index="3" name="uv2s" type="Vector2Array" default="Vector2Array()"> </argument> <argument index="4" name="normals" type="Vector3Array" default="Vector3Array()"> </argument> @@ -36513,7 +36601,7 @@ This method controls whether the position between two cached points is interpola <method name="commit"> <return type="Mesh"> </return> - <argument index="0" name="existing" type="Mesh" default="Object()"> + <argument index="0" name="existing" type="Mesh" default="NULL"> </argument> <description> </description> @@ -39130,7 +39218,7 @@ This method controls whether the position between two cached points is interpola <method name="create_item"> <return type="TreeItem"> </return> - <argument index="0" name="parent" type="TreeItem" default="Object()"> + <argument index="0" name="parent" type="TreeItem" default="NULL"> </argument> <description> </description> @@ -41264,13 +41352,13 @@ This method controls whether the position between two cached points is interpola </description> <methods> <method name="set_stream"> - <argument index="0" name="stream" type="Stream"> + <argument index="0" name="stream" type="VideoStream"> </argument> <description> </description> </method> <method name="get_stream" qualifiers="const"> - <return type="Stream"> + <return type="VideoStream"> </return> <description> </description> @@ -42087,6 +42175,12 @@ This method controls whether the position between two cached points is interpola <description> </description> </method> + <method name="texture_set_shrink_all_x2_on_set_data"> + <argument index="0" name="shrink" type="bool"> + </argument> + <description> + </description> + </method> <method name="shader_create"> <return type="RID"> </return> diff --git a/drivers/builtin_openssl2/SCsub b/drivers/builtin_openssl2/SCsub index 38880030b1..a51b0a3ed6 100644 --- a/drivers/builtin_openssl2/SCsub +++ b/drivers/builtin_openssl2/SCsub @@ -650,6 +650,7 @@ env_ssl.Append(CPPPATH=["#drivers/builtin_openssl2/crypto/asn1"]) env_ssl.Append(CPPPATH=["#drivers/builtin_openssl2/crypto/modes"]) #env_ssl.Append(CPPPATH=["#drivers/builtin_openssl2/crypto/store"]) env_ssl.Append(CPPFLAGS=["-DOPENSSL_NO_ASM","-DOPENSSL_THREADS","-DL_ENDIAN"]) +env_ssl.Append(CFLAGS=["-Wno-error=implicit-function-declaration"]); env_ssl.add_source_files(env.drivers_sources,openssl_sources) diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp index 7ef81306b6..134e0153b3 100644 --- a/scene/2d/node_2d.cpp +++ b/scene/2d/node_2d.cpp @@ -148,15 +148,28 @@ void Node2D::set_pos(const Point2& p_pos) { } -void Node2D::set_rot(float p_angle) { +void Node2D::set_rot(float p_radians) { if (_xform_dirty) ((Node2D*)this)->_update_xform_values(); - angle=p_angle; + angle=p_radians; _update_transform(); _change_notify("transform/rot"); } +void Node2D::set_rotd(float p_degrees) { + + set_rot(Math::deg2rad(p_degrees)); +} + +// Kept for compatibility after rename to set_rotd. +// Could be removed after a couple releases. +void Node2D::_set_rotd(float p_degrees) { + + WARN_PRINT("Deprecated method Node2D._set_rotd(): This method was renamed to set_rotd. Please adapt your code accordingly, as the old method will be obsoleted."); + set_rotd(p_degrees); +} + void Node2D::set_scale(const Size2& p_scale) { if (_xform_dirty) @@ -183,21 +196,22 @@ float Node2D::get_rot() const { return angle; } -Size2 Node2D::get_scale() const { - if (_xform_dirty) - ((Node2D*)this)->_update_xform_values(); +float Node2D::get_rotd() const { - return _scale; + return Math::rad2deg(get_rot()); } +// Kept for compatibility after rename to get_rotd. +// Could be removed after a couple releases. +float Node2D::_get_rotd() const { -void Node2D::_set_rotd(float p_angle) { - - set_rot(Math::deg2rad(p_angle)); + WARN_PRINT("Deprecated method Node2D._get_rotd(): This method was renamed to get_rotd. Please adapt your code accordingly, as the old method will be obsoleted."); + return get_rotd(); } +Size2 Node2D::get_scale() const { + if (_xform_dirty) + ((Node2D*)this)->_update_xform_values(); -float Node2D::_get_rotd() const { - - return Math::rad2deg(get_rot()); + return _scale; } @@ -361,16 +375,18 @@ float Node2D::get_angle_to(const Vector2& p_pos) const { void Node2D::_bind_methods() { - + // TODO: Obsolete those two methods (old name) properly (GH-4397) ObjectTypeDB::bind_method(_MD("_get_rotd"),&Node2D::_get_rotd); - ObjectTypeDB::bind_method(_MD("_set_rotd"),&Node2D::_set_rotd); + ObjectTypeDB::bind_method(_MD("_set_rotd","degrees"),&Node2D::_set_rotd); ObjectTypeDB::bind_method(_MD("set_pos","pos"),&Node2D::set_pos); - ObjectTypeDB::bind_method(_MD("set_rot","rot"),&Node2D::set_rot); + ObjectTypeDB::bind_method(_MD("set_rot","radians"),&Node2D::set_rot); + ObjectTypeDB::bind_method(_MD("set_rotd","degrees"),&Node2D::set_rotd); ObjectTypeDB::bind_method(_MD("set_scale","scale"),&Node2D::set_scale); ObjectTypeDB::bind_method(_MD("get_pos"),&Node2D::get_pos); ObjectTypeDB::bind_method(_MD("get_rot"),&Node2D::get_rot); + ObjectTypeDB::bind_method(_MD("get_rotd"),&Node2D::get_rotd); ObjectTypeDB::bind_method(_MD("get_scale"),&Node2D::get_scale); ObjectTypeDB::bind_method(_MD("rotate","radians"),&Node2D::rotate); @@ -400,7 +416,7 @@ void Node2D::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_relative_transform_to_parent","parent"),&Node2D::get_relative_transform_to_parent); ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2,"transform/pos"),_SCS("set_pos"),_SCS("get_pos")); - ADD_PROPERTYNZ(PropertyInfo(Variant::REAL,"transform/rot",PROPERTY_HINT_RANGE,"-1440,1440,0.1"),_SCS("_set_rotd"),_SCS("_get_rotd")); + ADD_PROPERTYNZ(PropertyInfo(Variant::REAL,"transform/rot",PROPERTY_HINT_RANGE,"-1440,1440,0.1"),_SCS("set_rotd"),_SCS("get_rotd")); ADD_PROPERTYNO(PropertyInfo(Variant::VECTOR2,"transform/scale"),_SCS("set_scale"),_SCS("get_scale")); ADD_PROPERTYNZ(PropertyInfo(Variant::INT,"z/z",PROPERTY_HINT_RANGE,itos(VS::CANVAS_ITEM_Z_MIN)+","+itos(VS::CANVAS_ITEM_Z_MAX)+",1"),_SCS("set_z"),_SCS("get_z")); ADD_PROPERTYNO(PropertyInfo(Variant::BOOL,"z/relative"),_SCS("set_z_as_relative"),_SCS("is_z_relative")); diff --git a/scene/2d/node_2d.h b/scene/2d/node_2d.h index 49d616fc1f..b0c628fd94 100644 --- a/scene/2d/node_2d.h +++ b/scene/2d/node_2d.h @@ -47,6 +47,7 @@ class Node2D : public CanvasItem { void _update_transform(); + // Deprecated, should be removed in a future version. void _set_rotd(float p_angle); float _get_rotd() const; @@ -69,7 +70,8 @@ public: virtual bool edit_has_pivot() const; void set_pos(const Point2& p_pos); - void set_rot(float p_angle); + void set_rot(float p_radians); + void set_rotd(float p_degrees); void set_scale(const Size2& p_scale); void rotate(float p_radians); @@ -81,6 +83,7 @@ public: Point2 get_pos() const; float get_rot() const; + float get_rotd() const; Size2 get_scale() const; Point2 get_global_pos() const; diff --git a/scene/3d/spatial.cpp b/scene/3d/spatial.cpp index c2d318e8a7..6a9c655141 100644 --- a/scene/3d/spatial.cpp +++ b/scene/3d/spatial.cpp @@ -346,14 +346,14 @@ void Spatial::set_translation(const Vector3& p_translation) { } -void Spatial::set_rotation(const Vector3& p_euler){ +void Spatial::set_rotation(const Vector3& p_euler_rad){ if (data.dirty&DIRTY_VECTORS) { data.scale=data.local_transform.basis.get_scale(); data.dirty&=~DIRTY_VECTORS; } - data.rotation=p_euler; + data.rotation=p_euler_rad; data.dirty|=DIRTY_LOCAL; _propagate_transform_changed(this); if (data.notify_local_transform) { @@ -361,6 +361,18 @@ void Spatial::set_rotation(const Vector3& p_euler){ } } + +void Spatial::set_rotation_deg(const Vector3& p_euler_deg) { + + set_rotation(p_euler_deg * Math_PI / 180.0); +} + +void Spatial::_set_rotation_deg(const Vector3& p_euler_deg) { + + WARN_PRINT("Deprecated method Spatial._set_rotation_deg(): This method was renamed to set_rotation_deg. Please adapt your code accordingly, as the old method will be obsoleted."); + set_rotation_deg(p_euler_deg); +} + void Spatial::set_scale(const Vector3& p_scale){ if (data.dirty&DIRTY_VECTORS) { @@ -381,6 +393,7 @@ Vector3 Spatial::get_translation() const{ return data.local_transform.origin; } + Vector3 Spatial::get_rotation() const{ if (data.dirty&DIRTY_VECTORS) { @@ -391,6 +404,20 @@ Vector3 Spatial::get_rotation() const{ return data.rotation; } + +Vector3 Spatial::get_rotation_deg() const { + + return get_rotation() * 180.0 / Math_PI; +} + +// Kept for compatibility after rename to set_rotd. +// Could be removed after a couple releases. +Vector3 Spatial::_get_rotation_deg() const { + + WARN_PRINT("Deprecated method Spatial._get_rotation_deg(): This method was renamed to get_rotation_deg. Please adapt your code accordingly, as the old method will be obsoleted."); + return get_rotation_deg(); +} + Vector3 Spatial::get_scale() const{ if (data.dirty&DIRTY_VECTORS) { @@ -495,16 +522,6 @@ bool Spatial::is_set_as_toplevel() const{ return data.toplevel; } -void Spatial::_set_rotation_deg(const Vector3& p_deg) { - - set_rotation(p_deg * Math_PI / 180.0); -} - -Vector3 Spatial::_get_rotation_deg() const { - - return get_rotation() * 180.0 / Math_PI; -} - Ref<World> Spatial::get_world() const { ERR_FAIL_COND_V(!is_inside_world(),Ref<World>()); @@ -722,8 +739,10 @@ void Spatial::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_transform"), &Spatial::get_transform); ObjectTypeDB::bind_method(_MD("set_translation","translation"), &Spatial::set_translation); ObjectTypeDB::bind_method(_MD("get_translation"), &Spatial::get_translation); - ObjectTypeDB::bind_method(_MD("set_rotation","rotation"), &Spatial::set_rotation); + ObjectTypeDB::bind_method(_MD("set_rotation","rotation_rad"), &Spatial::set_rotation); ObjectTypeDB::bind_method(_MD("get_rotation"), &Spatial::get_rotation); + ObjectTypeDB::bind_method(_MD("set_rotation_deg","rotation_deg"), &Spatial::set_rotation_deg); + ObjectTypeDB::bind_method(_MD("get_rotation_deg"), &Spatial::get_rotation_deg); ObjectTypeDB::bind_method(_MD("set_scale","scale"), &Spatial::set_scale); ObjectTypeDB::bind_method(_MD("get_scale"), &Spatial::get_scale); ObjectTypeDB::bind_method(_MD("set_global_transform","global"), &Spatial::set_global_transform); @@ -732,9 +751,11 @@ void Spatial::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_ignore_transform_notification","enabled"), &Spatial::set_ignore_transform_notification); ObjectTypeDB::bind_method(_MD("set_as_toplevel","enable"), &Spatial::set_as_toplevel); ObjectTypeDB::bind_method(_MD("is_set_as_toplevel"), &Spatial::is_set_as_toplevel); + ObjectTypeDB::bind_method(_MD("get_world:World"), &Spatial::get_world); + + // TODO: Obsolete those two methods (old name) properly (GH-4397) ObjectTypeDB::bind_method(_MD("_set_rotation_deg","rotation_deg"), &Spatial::_set_rotation_deg); ObjectTypeDB::bind_method(_MD("_get_rotation_deg"), &Spatial::_get_rotation_deg); - ObjectTypeDB::bind_method(_MD("get_world:World"), &Spatial::get_world); #ifdef TOOLS_ENABLED ObjectTypeDB::bind_method(_MD("_update_gizmo"), &Spatial::_update_gizmo); @@ -789,7 +810,7 @@ void Spatial::_bind_methods() { //ADD_PROPERTY( PropertyInfo(Variant::TRANSFORM,"transform/global",PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR ), _SCS("set_global_transform"), _SCS("get_global_transform") ); ADD_PROPERTYNZ( PropertyInfo(Variant::TRANSFORM,"transform/local",PROPERTY_HINT_NONE,""), _SCS("set_transform"), _SCS("get_transform") ); ADD_PROPERTY( PropertyInfo(Variant::VECTOR3,"transform/translation",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_EDITOR), _SCS("set_translation"), _SCS("get_translation") ); - ADD_PROPERTY( PropertyInfo(Variant::VECTOR3,"transform/rotation",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_EDITOR), _SCS("_set_rotation_deg"), _SCS("_get_rotation_deg") ); + ADD_PROPERTY( PropertyInfo(Variant::VECTOR3,"transform/rotation",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_EDITOR), _SCS("set_rotation_deg"), _SCS("get_rotation_deg") ); ADD_PROPERTY( PropertyInfo(Variant::VECTOR3,"transform/rotation_rad",PROPERTY_HINT_NONE,"",0), _SCS("set_rotation"), _SCS("get_rotation") ); ADD_PROPERTY( PropertyInfo(Variant::VECTOR3,"transform/scale",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_EDITOR), _SCS("set_scale"), _SCS("get_scale") ); ADD_PROPERTYNO( PropertyInfo(Variant::BOOL,"visibility/visible"), _SCS("_set_visible_"), _SCS("_is_visible_") ); diff --git a/scene/3d/spatial.h b/scene/3d/spatial.h index 50123b2d81..fdc9f95f0b 100644 --- a/scene/3d/spatial.h +++ b/scene/3d/spatial.h @@ -110,7 +110,8 @@ class Spatial : public Node { void _notify_dirty(); void _propagate_transform_changed(Spatial *p_origin); - void _set_rotation_deg(const Vector3& p_deg); + // Deprecated, should be removed in a future version. + void _set_rotation_deg(const Vector3& p_euler_deg); Vector3 _get_rotation_deg() const; void _propagate_visibility_changed(); @@ -144,11 +145,13 @@ public: Ref<World> get_world() const; void set_translation(const Vector3& p_translation); - void set_rotation(const Vector3& p_euler); + void set_rotation(const Vector3& p_euler_rad); + void set_rotation_deg(const Vector3& p_euler_deg); void set_scale(const Vector3& p_scale); Vector3 get_translation() const; Vector3 get_rotation() const; + Vector3 get_rotation_deg() const; Vector3 get_scale() const; void set_transform(const Transform& p_transform); diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 86ec31a9c2..d0e5e8b7ae 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -2157,17 +2157,9 @@ bool Control::is_text_field() const { } -void Control::_set_rotation_deg(float p_rot) { - set_rotation(Math::deg2rad(p_rot)); -} - -float Control::_get_rotation_deg() const { - return Math::rad2deg(get_rotation()); -} +void Control::set_rotation(float p_radians) { -void Control::set_rotation(float p_rotation) { - - data.rotation=p_rotation; + data.rotation=p_radians; update(); _notify_transform(); } @@ -2177,6 +2169,25 @@ float Control::get_rotation() const{ return data.rotation; } +void Control::set_rotation_deg(float p_degrees) { + set_rotation(Math::deg2rad(p_degrees)); +} + +float Control::get_rotation_deg() const { + return Math::rad2deg(get_rotation()); +} + +// Kept for compatibility after rename to {s,g}et_rotation_deg. +// Could be removed after a couple releases. +void Control::_set_rotation_deg(float p_degrees) { + WARN_PRINT("Deprecated method Control._set_rotation_deg(): This method was renamed to set_rotation_deg. Please adapt your code accordingly, as the old method will be obsoleted."); + set_rotation_deg(p_degrees); +} +float Control::_get_rotation_deg() const { + WARN_PRINT("Deprecated method Control._get_rotation_deg(): This method was renamed to get_rotation_deg. Please adapt your code accordingly, as the old method will be obsoleted."); + return get_rotation_deg(); +} + void Control::set_scale(const Vector2& p_scale){ data.scale=p_scale; @@ -2232,8 +2243,10 @@ void Control::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_size","size"),&Control::set_size); ObjectTypeDB::bind_method(_MD("set_custom_minimum_size","size"),&Control::set_custom_minimum_size); ObjectTypeDB::bind_method(_MD("set_global_pos","pos"),&Control::set_global_pos); - ObjectTypeDB::bind_method(_MD("set_rotation","rotation"),&Control::set_rotation); - ObjectTypeDB::bind_method(_MD("_set_rotation_deg","rotation"),&Control::_set_rotation_deg); + ObjectTypeDB::bind_method(_MD("set_rotation","radians"),&Control::set_rotation); + ObjectTypeDB::bind_method(_MD("set_rotation_deg","degrees"),&Control::set_rotation_deg); + // TODO: Obsolete this method (old name) properly (GH-4397) + ObjectTypeDB::bind_method(_MD("_set_rotation_deg","degrees"),&Control::_set_rotation_deg); ObjectTypeDB::bind_method(_MD("set_scale","scale"),&Control::set_scale); ObjectTypeDB::bind_method(_MD("get_margin","margin"),&Control::get_margin); ObjectTypeDB::bind_method(_MD("get_begin"),&Control::get_begin); @@ -2241,12 +2254,14 @@ void Control::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_pos"),&Control::get_pos); ObjectTypeDB::bind_method(_MD("get_size"),&Control::get_size); ObjectTypeDB::bind_method(_MD("get_rotation"),&Control::get_rotation); + ObjectTypeDB::bind_method(_MD("get_rotation_deg"),&Control::get_rotation_deg); + // TODO: Obsolete this method (old name) properly (GH-4397) + ObjectTypeDB::bind_method(_MD("_get_rotation_deg"),&Control::_get_rotation_deg); ObjectTypeDB::bind_method(_MD("get_scale"),&Control::get_scale); ObjectTypeDB::bind_method(_MD("get_custom_minimum_size"),&Control::get_custom_minimum_size); ObjectTypeDB::bind_method(_MD("get_parent_area_size"),&Control::get_size); ObjectTypeDB::bind_method(_MD("get_global_pos"),&Control::get_global_pos); ObjectTypeDB::bind_method(_MD("get_rect"),&Control::get_rect); - ObjectTypeDB::bind_method(_MD("_get_rotation_deg"),&Control::_get_rotation_deg); ObjectTypeDB::bind_method(_MD("get_global_rect"),&Control::get_global_rect); ObjectTypeDB::bind_method(_MD("set_area_as_parent_rect","margin"),&Control::set_area_as_parent_rect,DEFVAL(0)); ObjectTypeDB::bind_method(_MD("show_modal","exclusive"),&Control::show_modal,DEFVAL(false)); @@ -2305,7 +2320,7 @@ void Control::_bind_methods() { ObjectTypeDB::bind_method(_MD("grab_click_focus"),&Control::grab_click_focus); - ObjectTypeDB::bind_method(_MD("set_drag_forwarding;","target:Control"),&Control::set_drag_forwarding); + ObjectTypeDB::bind_method(_MD("set_drag_forwarding","target:Control"),&Control::set_drag_forwarding); ObjectTypeDB::bind_method(_MD("set_drag_preview","control:Control"),&Control::set_drag_preview); ObjectTypeDB::bind_method(_MD("warp_mouse","to_pos"),&Control::warp_mouse); @@ -2325,7 +2340,7 @@ void Control::_bind_methods() { ADD_PROPERTYNZ( PropertyInfo(Variant::VECTOR2,"rect/pos", PROPERTY_HINT_NONE, "",PROPERTY_USAGE_EDITOR), _SCS("set_pos"),_SCS("get_pos") ); ADD_PROPERTYNZ( PropertyInfo(Variant::VECTOR2,"rect/size", PROPERTY_HINT_NONE, "",PROPERTY_USAGE_EDITOR), _SCS("set_size"),_SCS("get_size") ); ADD_PROPERTYNZ( PropertyInfo(Variant::VECTOR2,"rect/min_size"), _SCS("set_custom_minimum_size"),_SCS("get_custom_minimum_size") ); - ADD_PROPERTYNZ( PropertyInfo(Variant::REAL,"rect/rotation",PROPERTY_HINT_RANGE,"-1080,1080,0.01"), _SCS("_set_rotation_deg"),_SCS("_get_rotation_deg") ); + ADD_PROPERTYNZ( PropertyInfo(Variant::REAL,"rect/rotation",PROPERTY_HINT_RANGE,"-1080,1080,0.01"), _SCS("set_rotation_deg"),_SCS("get_rotation_deg") ); ADD_PROPERTYNO( PropertyInfo(Variant::VECTOR2,"rect/scale"), _SCS("set_scale"),_SCS("get_scale") ); ADD_PROPERTYNZ( PropertyInfo(Variant::STRING,"hint/tooltip", PROPERTY_HINT_MULTILINE_TEXT), _SCS("set_tooltip"),_SCS("_get_tooltip") ); ADD_PROPERTYINZ( PropertyInfo(Variant::NODE_PATH,"focus_neighbour/left" ), _SCS("set_focus_neighbour"),_SCS("get_focus_neighbour"),MARGIN_LEFT ); diff --git a/scene/gui/control.h b/scene/gui/control.h index aa9a7612a5..f720185c9d 100644 --- a/scene/gui/control.h +++ b/scene/gui/control.h @@ -180,7 +180,8 @@ private: void _size_changed(); String _get_tooltip() const; - void _set_rotation_deg(float p_rot); + // Deprecated, should be removed in a future version. + void _set_rotation_deg(float p_degrees); float _get_rotation_deg() const; friend class Viewport; @@ -275,8 +276,10 @@ public: Rect2 get_global_rect() const; Rect2 get_window_rect() const; ///< use with care, as it blocks waiting for the visual server - void set_rotation(float p_rotation); + void set_rotation(float p_radians); + void set_rotation_deg(float p_degrees); float get_rotation() const; + float get_rotation_deg() const; void set_scale(const Vector2& p_scale); Vector2 get_scale() const; diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index a8a3cb5537..1a465baf49 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -921,14 +921,18 @@ void TextEdit::_notification(int p_what) { if (cursor.column==j && cursor.line==line) { cursor_pos = Point2i( char_ofs+char_margin, ofs_y ); + if (insert_mode) { cursor_pos.y += get_row_height(); - VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(cursor_pos, Size2i(char_w,1)),cache.caret_color); - } else { - VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(cursor_pos, Size2i(1,get_row_height())),cache.caret_color); } - + if (draw_caret) { + if (insert_mode) { + VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(cursor_pos, Size2i(char_w,1)),cache.caret_color); + } else { + VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(cursor_pos, Size2i(1,get_row_height())),cache.caret_color); + } + } } char_ofs+=char_w; @@ -937,12 +941,18 @@ void TextEdit::_notification(int p_what) { if (cursor.column==str.length() && cursor.line==line && (char_ofs+char_margin)>=xmargin_beg) { cursor_pos=Point2i( char_ofs+char_margin, ofs_y ); + if (insert_mode) { cursor_pos.y += get_row_height(); - int char_w = cache.font->get_char_size(' ').width; - VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(cursor_pos, Size2i(char_w,1)),cache.caret_color); - } else { - VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(cursor_pos, Size2i(1,get_row_height())),cache.caret_color); + } + + if (draw_caret) { + if (insert_mode) { + int char_w = cache.font->get_char_size(' ').width; + VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(cursor_pos, Size2i(char_w,1)),cache.caret_color); + } else { + VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(cursor_pos, Size2i(1,get_row_height())),cache.caret_color); + } } } } @@ -1390,6 +1400,8 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { } if (mb.button_index==BUTTON_LEFT) { + _reset_caret_blink_timer(); + int row,col; _get_mouse_pos(Point2i(mb.x,mb.y), row,col); @@ -1524,6 +1536,8 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { if (selection.selecting_mode!=Selection::MODE_NONE) { + _reset_caret_blink_timer(); + int row,col; _get_mouse_pos(Point2i(mm.x,mm.y), row,col); @@ -1644,6 +1658,8 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { if (k.scancode==KEY_BACKSPACE) { + _reset_caret_blink_timer(); + backspace_at_cursor(); _update_completion_candidates(); accept_event(); @@ -1659,6 +1675,8 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { if (k.unicode>32) { + _reset_caret_blink_timer(); + const CharType chr[2] = {(CharType)k.unicode, 0}; if(auto_brace_completion_enabled && _is_pair_symbol(chr[0])) { _consume_pair_symbol(chr[0]); @@ -1705,6 +1723,9 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { k.mod.shift=false; } + if (!k.mod.command) { + _reset_caret_blink_timer(); + } // save here for insert mode, just in case it is cleared in the following section bool had_selection = selection.active; @@ -2902,6 +2923,30 @@ int TextEdit::cursor_get_line() const { return cursor.line; } +bool TextEdit::cursor_get_blink_enabled() const { + return caret_blink_enabled; +} + +void TextEdit::cursor_set_blink_enabled(const bool p_enabled) { + caret_blink_enabled = p_enabled; + + if (p_enabled) { + caret_blink_timer->start(); + } else { + caret_blink_timer->stop(); + } + draw_caret = true; +} + + +float TextEdit::cursor_get_blink_speed() const { + return caret_blink_timer->get_wait_time(); +} + +void TextEdit::cursor_set_blink_speed(const float p_speed) { + ERR_FAIL_COND(p_speed <= 0); + caret_blink_timer->set_wait_time(p_speed); +} void TextEdit::_scroll_moved(double p_to_val) { @@ -3117,6 +3162,20 @@ void TextEdit::set_max_chars(int p_max_chars) { max_chars=p_max_chars; } +void TextEdit::_reset_caret_blink_timer() { + if (caret_blink_enabled) { + caret_blink_timer->stop(); + caret_blink_timer->start(); + draw_caret = true; + update(); + } +} + +void TextEdit::_toggle_draw_caret() { + draw_caret = !draw_caret; + update(); +} + void TextEdit::_update_caches() { cache.style_normal=get_stylebox("normal"); @@ -3903,7 +3962,7 @@ void TextEdit::_update_completion_candidates() { } } - if (l[cursor.column - 1] == '(' && !pre_keyword) { + if (l[cursor.column - 1] == '(' && !pre_keyword && !completion_strings[0].begins_with("\"")) { cancel = true; } @@ -4096,6 +4155,7 @@ void TextEdit::_bind_methods() { ObjectTypeDB::bind_method(_MD("_text_changed_emit"),&TextEdit::_text_changed_emit); ObjectTypeDB::bind_method(_MD("_push_current_op"),&TextEdit::_push_current_op); ObjectTypeDB::bind_method(_MD("_click_selection_held"),&TextEdit::_click_selection_held); + ObjectTypeDB::bind_method(_MD("_toggle_draw_caret"),&TextEdit::_toggle_draw_caret); BIND_CONSTANT( SEARCH_MATCH_CASE ); BIND_CONSTANT( SEARCH_WHOLE_WORDS ); @@ -4165,6 +4225,7 @@ TextEdit::TextEdit() { readonly=false; setting_row=false; draw_tabs=false; + draw_caret=true; max_chars=0; clear(); wrap=false; @@ -4204,6 +4265,13 @@ TextEdit::TextEdit() { selection.active=false; syntax_coloring=false; + caret_blink_enabled=false; + caret_blink_timer = memnew(Timer); + add_child(caret_blink_timer); + caret_blink_timer->set_wait_time(0.65); + caret_blink_timer->connect("timeout", this,"_toggle_draw_caret"); + cursor_set_blink_enabled(false); + custom_bg_color=Color(0,0,0,0); idle_detect = memnew( Timer ); add_child(idle_detect); diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h index 193dd236d1..ea4f148e91 100644 --- a/scene/gui/text_edit.h +++ b/scene/gui/text_edit.h @@ -210,6 +210,10 @@ class TextEdit : public Control { bool syntax_coloring; int tab_size; + Timer *caret_blink_timer; + bool caret_blink_enabled; + bool draw_caret; + bool setting_row; bool wrap; bool draw_tabs; @@ -267,6 +271,9 @@ class TextEdit : public Control { int get_row_height() const; + void _reset_caret_blink_timer(); + void _toggle_draw_caret(); + void _update_caches(); void _cursor_changed_emit(); void _text_changed_emit(); @@ -364,6 +371,12 @@ public: int cursor_get_column() const; int cursor_get_line() const; + bool cursor_get_blink_enabled() const; + void cursor_set_blink_enabled(const bool p_enabled); + + float cursor_get_blink_speed() const; + void cursor_set_blink_speed(const float p_speed); + void set_readonly(bool p_readonly); void set_max_chars(int p_max_chars); diff --git a/scene/main/canvas_layer.cpp b/scene/main/canvas_layer.cpp index bc37cde4a2..c31a57f819 100644 --- a/scene/main/canvas_layer.cpp +++ b/scene/main/canvas_layer.cpp @@ -94,13 +94,13 @@ Vector2 CanvasLayer::get_offset() const { } -void CanvasLayer::set_rotation(real_t p_rotation) { +void CanvasLayer::set_rotation(real_t p_radians) { if (locrotscale_dirty) _update_locrotscale(); - rot=p_rotation; + rot=p_radians; _update_xform(); } @@ -113,6 +113,29 @@ real_t CanvasLayer::get_rotation() const { return rot; } +void CanvasLayer::set_rotationd(real_t p_degrees) { + + set_rotation(Math::deg2rad(p_degrees)); +} + +real_t CanvasLayer::get_rotationd() const { + + return Math::rad2deg(get_rotation()); +} + +// Kept for compatibility after rename to {s,g}et_rotationd. +// Could be removed after a couple releases. +void CanvasLayer::_set_rotationd(real_t p_degrees) { + + WARN_PRINT("Deprecated method CanvasLayer._set_rotationd(): This method was renamed to set_rotationd. Please adapt your code accordingly, as the old method will be obsoleted."); + set_rotationd(p_degrees); +} + +real_t CanvasLayer::_get_rotationd() const { + + WARN_PRINT("Deprecated method CanvasLayer._get_rotationd(): This method was renamed to get_rotationd. Please adapt your code accordingly, as the old method will be obsoleted."); + return get_rotationd(); +} void CanvasLayer::set_scale(const Vector2& p_scale) { @@ -122,7 +145,6 @@ void CanvasLayer::set_scale(const Vector2& p_scale) { scale=p_scale; _update_xform(); - } Vector2 CanvasLayer::get_scale() const { @@ -193,16 +215,6 @@ RID CanvasLayer::get_viewport() const { return viewport; } -void CanvasLayer::_set_rotationd(real_t p_rotation) { - - set_rotation(Math::deg2rad(p_rotation)); -} - -real_t CanvasLayer::_get_rotationd() const { - - return Math::rad2deg(get_rotation()); -} - void CanvasLayer::_bind_methods() { @@ -216,10 +228,14 @@ void CanvasLayer::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_offset","offset"),&CanvasLayer::set_offset); ObjectTypeDB::bind_method(_MD("get_offset"),&CanvasLayer::get_offset); - ObjectTypeDB::bind_method(_MD("set_rotation","rotation"),&CanvasLayer::set_rotation); + ObjectTypeDB::bind_method(_MD("set_rotation","radians"),&CanvasLayer::set_rotation); ObjectTypeDB::bind_method(_MD("get_rotation"),&CanvasLayer::get_rotation); - ObjectTypeDB::bind_method(_MD("_set_rotationd","rotationd"),&CanvasLayer::_set_rotationd); + ObjectTypeDB::bind_method(_MD("set_rotationd","degrees"),&CanvasLayer::set_rotationd); + ObjectTypeDB::bind_method(_MD("get_rotationd"),&CanvasLayer::get_rotationd); + + // TODO: Obsolete those two methods (old name) properly (GH-4397) + ObjectTypeDB::bind_method(_MD("_set_rotationd","degrees"),&CanvasLayer::_set_rotationd); ObjectTypeDB::bind_method(_MD("_get_rotationd"),&CanvasLayer::_get_rotationd); ObjectTypeDB::bind_method(_MD("set_scale","scale"),&CanvasLayer::set_scale); @@ -231,7 +247,7 @@ void CanvasLayer::_bind_methods() { ADD_PROPERTY( PropertyInfo(Variant::INT,"layer",PROPERTY_HINT_RANGE,"-128,128,1"),_SCS("set_layer"),_SCS("get_layer") ); //ADD_PROPERTY( PropertyInfo(Variant::MATRIX32,"transform",PROPERTY_HINT_RANGE),_SCS("set_transform"),_SCS("get_transform") ); ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"offset"),_SCS("set_offset"),_SCS("get_offset") ); - ADD_PROPERTY( PropertyInfo(Variant::REAL,"rotation"),_SCS("_set_rotationd"),_SCS("_get_rotationd") ); + ADD_PROPERTY( PropertyInfo(Variant::REAL,"rotation"),_SCS("set_rotationd"),_SCS("get_rotationd") ); ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"scale"),_SCS("set_scale"),_SCS("get_scale") ); } diff --git a/scene/main/canvas_layer.h b/scene/main/canvas_layer.h index 809b3fae7f..a3e8211a43 100644 --- a/scene/main/canvas_layer.h +++ b/scene/main/canvas_layer.h @@ -48,7 +48,7 @@ class CanvasLayer : public Node { RID viewport; Viewport *vp; - + // Deprecated, should be removed in a future version. void _set_rotationd(real_t p_rotation); real_t _get_rotationd() const; @@ -70,9 +70,12 @@ public: void set_offset(const Vector2& p_offset); Vector2 get_offset() const; - void set_rotation(real_t p_rotation); + void set_rotation(real_t p_radians); real_t get_rotation() const; + void set_rotationd(real_t p_degrees); + real_t get_rotationd() const; + void set_scale(const Vector2& p_scale); Vector2 get_scale() const; diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp index 29f0af5aa4..475bef8b37 100644 --- a/tools/editor/editor_settings.cpp +++ b/tools/editor/editor_settings.cpp @@ -426,6 +426,10 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { set("text_editor/create_signal_callbacks",true); set("text_editor/autosave_interval_secs",0); + set("text_editor/caret_blink", false); + set("text_editor/caret_blink_speed", 0.65); + hints["text_editor/caret_blink_speed"]=PropertyInfo(Variant::REAL,"text_editor/caret_blink_speed",PROPERTY_HINT_RANGE,"0.1, 10, 0.1"); + set("text_editor/font",""); hints["text_editor/font"]=PropertyInfo(Variant::STRING,"text_editor/font",PROPERTY_HINT_GLOBAL_FILE,"*.fnt"); set("text_editor/auto_brace_complete", false); diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index eaf08ca1c0..d8d5fddfe9 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -1967,6 +1967,8 @@ void ScriptEditor::edit(const Ref<Script>& p_script) { ste->get_text_edit()->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/show_line_numbers")); ste->get_text_edit()->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/syntax_highlighting")); ste->get_text_edit()->set_highlight_all_occurrences(EditorSettings::get_singleton()->get("text_editor/highlight_all_occurrences")); + ste->get_text_edit()->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/caret_blink")); + ste->get_text_edit()->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/caret_blink_speed")); ste->get_text_edit()->set_callhint_settings( EditorSettings::get_singleton()->get("text_editor/put_callhint_tooltip_below_current_line"), EditorSettings::get_singleton()->get("text_editor/callhint_tooltip_offset")); @@ -2114,6 +2116,8 @@ void ScriptEditor::_editor_settings_changed() { ste->get_text_edit()->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/show_line_numbers")); ste->get_text_edit()->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/syntax_highlighting")); ste->get_text_edit()->set_highlight_all_occurrences(EditorSettings::get_singleton()->get("text_editor/highlight_all_occurrences")); + ste->get_text_edit()->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/caret_blink")); + ste->get_text_edit()->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/caret_blink_speed")); } } diff --git a/tools/editor/plugins/shader_editor_plugin.cpp b/tools/editor/plugins/shader_editor_plugin.cpp index 3399114402..8a65a3641f 100644 --- a/tools/editor/plugins/shader_editor_plugin.cpp +++ b/tools/editor/plugins/shader_editor_plugin.cpp @@ -368,6 +368,8 @@ void ShaderEditor::_editor_settings_changed() { vertex_editor->get_text_edit()->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/show_line_numbers")); vertex_editor->get_text_edit()->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/syntax_highlighting")); vertex_editor->get_text_edit()->set_highlight_all_occurrences(EditorSettings::get_singleton()->get("text_editor/highlight_all_occurrences")); + vertex_editor->get_text_edit()->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/caret_blink")); + vertex_editor->get_text_edit()->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/caret_blink_speed")); fragment_editor->get_text_edit()->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/auto_brace_complete")); fragment_editor->get_text_edit()->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/scroll_past_end_of_file")); @@ -376,6 +378,8 @@ void ShaderEditor::_editor_settings_changed() { fragment_editor->get_text_edit()->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/show_line_numbers")); fragment_editor->get_text_edit()->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/syntax_highlighting")); fragment_editor->get_text_edit()->set_highlight_all_occurrences(EditorSettings::get_singleton()->get("text_editor/highlight_all_occurrences")); + fragment_editor->get_text_edit()->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/caret_blink")); + fragment_editor->get_text_edit()->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/caret_blink_speed")); light_editor->get_text_edit()->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/auto_brace_complete")); light_editor->get_text_edit()->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/scroll_past_end_of_file")); @@ -384,6 +388,8 @@ void ShaderEditor::_editor_settings_changed() { light_editor->get_text_edit()->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/show_line_numbers")); light_editor->get_text_edit()->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/syntax_highlighting")); light_editor->get_text_edit()->set_highlight_all_occurrences(EditorSettings::get_singleton()->get("text_editor/highlight_all_occurrences")); + light_editor->get_text_edit()->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/caret_blink")); + light_editor->get_text_edit()->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/caret_blink_speed")); } void ShaderEditor::_bind_methods() { |