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-- | doc/base/classes.xml | 160 | ||||
-rw-r--r-- | scene/gui/control.cpp | 2 |
6 files changed, 150 insertions, 53 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/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/scene/gui/control.cpp b/scene/gui/control.cpp index 047b854862..d0e5e8b7ae 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -2320,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); |