diff options
83 files changed, 1281 insertions, 289 deletions
diff --git a/.gitignore b/.gitignore index f8296ef51e..35fadafbda 100644 --- a/.gitignore +++ b/.gitignore @@ -288,6 +288,7 @@ logo.h TAGS !TAGS/ tags +*.tags !tags/ gtags.files GTAGS diff --git a/core/io/multiplayer_api.cpp b/core/io/multiplayer_api.cpp index 0ede7e87cb..456d29520f 100644 --- a/core/io/multiplayer_api.cpp +++ b/core/io/multiplayer_api.cpp @@ -76,7 +76,7 @@ Ref<NetworkedMultiplayerPeer> MultiplayerAPI::get_network_peer() const { void MultiplayerAPI::_process_packet(int p_from, const uint8_t *p_packet, int p_packet_len) { ERR_FAIL_COND(root_node == NULL); - ERR_FAIL_COND(p_packet_len < 5); + ERR_FAIL_COND(p_packet_len < 1); uint8_t packet_type = p_packet[0]; @@ -123,6 +123,11 @@ void MultiplayerAPI::_process_packet(int p_from, const uint8_t *p_packet, int p_ } } break; + + case NETWORK_COMMAND_RAW: { + + _process_raw(p_from, p_packet, p_packet_len); + } break; } } @@ -259,6 +264,8 @@ void MultiplayerAPI::_process_simplify_path(int p_from, const uint8_t *p_packet, void MultiplayerAPI::_process_confirm_path(int p_from, const uint8_t *p_packet, int p_packet_len) { + ERR_FAIL_COND(p_packet_len < 2); + String paths; paths.parse_utf8((const char *)&p_packet[1], p_packet_len - 1); @@ -648,6 +655,34 @@ void MultiplayerAPI::rsetp(Node *p_node, int p_peer_id, bool p_unreliable, const _send_rpc(p_node, p_peer_id, p_unreliable, true, p_property, &vptr, 1); } +Error MultiplayerAPI::send_bytes(PoolVector<uint8_t> p_data, int p_to) { + + ERR_FAIL_COND_V(p_data.size() < 1, ERR_INVALID_DATA); + ERR_FAIL_COND_V(!network_peer.is_valid(), ERR_UNCONFIGURED); + ERR_FAIL_COND_V(network_peer->get_connection_status() != NetworkedMultiplayerPeer::CONNECTION_CONNECTED, ERR_UNCONFIGURED); + + MAKE_ROOM(p_data.size() + 1); + PoolVector<uint8_t>::Read r = p_data.read(); + packet_cache[0] = NETWORK_COMMAND_RAW; + memcpy(&packet_cache[1], &r[0], p_data.size()); + network_peer->set_target_peer(p_to); + return network_peer->put_packet(packet_cache.ptr(), p_data.size() + 1); +} + +void MultiplayerAPI::_process_raw(int p_from, const uint8_t *p_packet, int p_packet_len) { + + ERR_FAIL_COND(p_packet_len < 2); + + PoolVector<uint8_t> out; + int len = p_packet_len - 1; + out.resize(len); + { + PoolVector<uint8_t>::Write w = out.write(); + memcpy(&w[0], &p_packet[1], len); + } + emit_signal("network_peer_packet", p_from, out); +} + int MultiplayerAPI::get_network_unique_id() const { ERR_FAIL_COND_V(!network_peer.is_valid(), 0); @@ -686,6 +721,7 @@ Vector<int> MultiplayerAPI::get_network_connected_peers() const { void MultiplayerAPI::_bind_methods() { ClassDB::bind_method(D_METHOD("set_root_node", "node"), &MultiplayerAPI::set_root_node); + ClassDB::bind_method(D_METHOD("send_bytes", "bytes", "id"), &MultiplayerAPI::send_bytes, DEFVAL(NetworkedMultiplayerPeer::TARGET_PEER_BROADCAST)); ClassDB::bind_method(D_METHOD("has_network_peer"), &MultiplayerAPI::has_network_peer); ClassDB::bind_method(D_METHOD("get_network_peer"), &MultiplayerAPI::get_network_peer); ClassDB::bind_method(D_METHOD("get_network_unique_id"), &MultiplayerAPI::get_network_unique_id); @@ -708,6 +744,7 @@ void MultiplayerAPI::_bind_methods() { ADD_SIGNAL(MethodInfo("network_peer_connected", PropertyInfo(Variant::INT, "id"))); ADD_SIGNAL(MethodInfo("network_peer_disconnected", PropertyInfo(Variant::INT, "id"))); + ADD_SIGNAL(MethodInfo("network_peer_packet", PropertyInfo(Variant::INT, "id"), PropertyInfo(Variant::POOL_BYTE_ARRAY, "packet"))); ADD_SIGNAL(MethodInfo("connected_to_server")); ADD_SIGNAL(MethodInfo("connection_failed")); ADD_SIGNAL(MethodInfo("server_disconnected")); diff --git a/core/io/multiplayer_api.h b/core/io/multiplayer_api.h index cc60890ced..25f445004d 100644 --- a/core/io/multiplayer_api.h +++ b/core/io/multiplayer_api.h @@ -43,6 +43,7 @@ protected: Node *_process_get_node(int p_from, const uint8_t *p_packet, int p_packet_len); void _process_rpc(Node *p_node, const StringName &p_name, int p_from, const uint8_t *p_packet, int p_packet_len, int p_offset); void _process_rset(Node *p_node, const StringName &p_name, int p_from, const uint8_t *p_packet, int p_packet_len, int p_offset); + void _process_raw(int p_from, const uint8_t *p_packet, int p_packet_len); void _send_rpc(Node *p_from, int p_to, bool p_unreliable, bool p_set, const StringName &p_name, const Variant **p_arg, int p_argcount); bool _send_confirm_path(NodePath p_path, PathSentCache *psc, int p_from); @@ -53,6 +54,7 @@ public: NETWORK_COMMAND_REMOTE_SET, NETWORK_COMMAND_SIMPLIFY_PATH, NETWORK_COMMAND_CONFIRM_PATH, + NETWORK_COMMAND_RAW, }; void poll(); @@ -60,6 +62,7 @@ public: void set_root_node(Node *p_node); void set_network_peer(const Ref<NetworkedMultiplayerPeer> &p_peer); Ref<NetworkedMultiplayerPeer> get_network_peer() const; + Error send_bytes(PoolVector<uint8_t> p_data, int p_to = NetworkedMultiplayerPeer::TARGET_PEER_BROADCAST); // Called by Node.rpc void rpcp(Node *p_node, int p_peer_id, bool p_unreliable, const StringName &p_method, const Variant **p_arg, int p_argcount); diff --git a/doc/classes/@GDScript.xml b/doc/classes/@GDScript.xml index acece05510..cddc59ab71 100644 --- a/doc/classes/@GDScript.xml +++ b/doc/classes/@GDScript.xml @@ -485,6 +485,14 @@ Returns True/False whether [code]s[/code] is an infinity value (either positive infinity or negative infinity). </description> </method> + <method name="is_instance_valid"> + <return type="bool"> + </return> + <argument index="0" name="instance" type="Object"> + </argument> + <description> + </description> + </method> <method name="is_nan"> <return type="bool"> </return> @@ -510,9 +518,9 @@ <method name="lerp"> <return type="float"> </return> - <argument index="0" name="from" type="float"> + <argument index="0" name="from" type="Variant"> </argument> - <argument index="1" name="to" type="float"> + <argument index="1" name="to" type="Variant"> </argument> <argument index="2" name="weight" type="float"> </argument> diff --git a/doc/classes/AnimatedSprite.xml b/doc/classes/AnimatedSprite.xml index a6521c0cd1..a41ed0e689 100644 --- a/doc/classes/AnimatedSprite.xml +++ b/doc/classes/AnimatedSprite.xml @@ -60,6 +60,8 @@ <member name="playing" type="bool" setter="_set_playing" getter="_is_playing"> If [code]true[/code] the [member animation] is currently playing. </member> + <member name="speed_scale" type="float" setter="set_speed_scale" getter="get_speed_scale"> + </member> </members> <signals> <signal name="animation_finished"> diff --git a/doc/classes/Bone2D.xml b/doc/classes/Bone2D.xml new file mode 100644 index 0000000000..7e714305cd --- /dev/null +++ b/doc/classes/Bone2D.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="Bone2D" inherits="Node2D" category="Core" version="3.1"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="apply_rest"> + <return type="void"> + </return> + <description> + </description> + </method> + <method name="get_index_in_skeleton" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="get_skeleton_rest" qualifiers="const"> + <return type="Transform2D"> + </return> + <description> + </description> + </method> + </methods> + <members> + <member name="default_length" type="float" setter="set_default_length" getter="get_default_length"> + </member> + <member name="rest" type="Transform2D" setter="set_rest" getter="get_rest"> + </member> + </members> + <constants> + </constants> +</class> diff --git a/doc/classes/CanvasItem.xml b/doc/classes/CanvasItem.xml index 1705808c04..c8622be4ad 100644 --- a/doc/classes/CanvasItem.xml +++ b/doc/classes/CanvasItem.xml @@ -566,6 +566,9 @@ <constant name="BLEND_MODE_PREMULT_ALPHA" value="4" enum="BlendMode"> Mix blending mode. Colors are assumed to be premultiplied by the alpha (opacity) value. </constant> + <constant name="BLEND_MODE_DISABLED" value="5" enum="BlendMode"> + Disable blending mode. Colors including alpha are written as is. Only applicable for render targets with a transparent background. No lighting will be applied. + </constant> <constant name="NOTIFICATION_TRANSFORM_CHANGED" value="29"> Canvas item transform has changed. Only received if requested. </constant> diff --git a/doc/classes/CanvasItemMaterial.xml b/doc/classes/CanvasItemMaterial.xml index 354bc10cd2..fe7194dcfe 100644 --- a/doc/classes/CanvasItemMaterial.xml +++ b/doc/classes/CanvasItemMaterial.xml @@ -36,9 +36,6 @@ <constant name="BLEND_MODE_PREMULT_ALPHA" value="4" enum="BlendMode"> Mix blending mode. Colors are assumed to be premultiplied by the alpha (opacity) value. </constant> - <constant name="BLEND_MODE_DISABLED" value="5" enum="BlendMode"> - Disable blending mode. Colors including alpha are written as is. Only applicable for render targets with a transparent background. No lighting will be applied. - </constant> <constant name="LIGHT_MODE_NORMAL" value="0" enum="LightMode"> Render the material using both light and non-light sensitive material properties. </constant> diff --git a/doc/classes/Color.xml b/doc/classes/Color.xml index 2617aaef17..104c9e0a98 100644 --- a/doc/classes/Color.xml +++ b/doc/classes/Color.xml @@ -129,9 +129,9 @@ <argument index="3" name="a" type="float" default="1"> </argument> <description> - Constructs a color from an HSV profile. [code]h[/code] is a value between 0 and 360. [code]s[/code] and [code]v[/code] are values between 0 and 1. + Constructs a color from an HSV profile. [code]h[/code], [code]s[/code], and [code]v[/code] are values between 0 and 1. [codeblock] - var c = Color.from_hsv(210, 0.5, 0.79, 0.8) # equivalent to HSV(210, 50, 79, 0.8) or Color8(100, 151, 201, 0.8) + var c = Color.from_hsv(0.58, 0.5, 0.79, 0.8) # equivalent to HSV(210, 50, 79, 0.8) or Color8(100, 151, 201, 0.8) [/codeblock] </description> </method> diff --git a/doc/classes/ColorPickerButton.xml b/doc/classes/ColorPickerButton.xml index eb86dc8af8..656fce587f 100644 --- a/doc/classes/ColorPickerButton.xml +++ b/doc/classes/ColorPickerButton.xml @@ -42,6 +42,10 @@ Emitted when the color changes. </description> </signal> + <signal name="popup_closed"> + <description> + </description> + </signal> </signals> <constants> </constants> diff --git a/doc/classes/Curve2D.xml b/doc/classes/Curve2D.xml index 03db9c2ea1..71bdaff688 100644 --- a/doc/classes/Curve2D.xml +++ b/doc/classes/Curve2D.xml @@ -49,6 +49,22 @@ Returns the cache of points as a [PoolVector2Array]. </description> </method> + <method name="get_closest_offset" qualifiers="const"> + <return type="float"> + </return> + <argument index="0" name="to_point" type="Vector2"> + </argument> + <description> + </description> + </method> + <method name="get_closest_point" qualifiers="const"> + <return type="Vector2"> + </return> + <argument index="0" name="to_point" type="Vector2"> + </argument> + <description> + </description> + </method> <method name="get_point_count" qualifiers="const"> <return type="int"> </return> diff --git a/doc/classes/Curve3D.xml b/doc/classes/Curve3D.xml index f2308de12c..c012e2794e 100644 --- a/doc/classes/Curve3D.xml +++ b/doc/classes/Curve3D.xml @@ -56,6 +56,22 @@ Returns the cache of tilts as a [RealArray]. </description> </method> + <method name="get_closest_offset" qualifiers="const"> + <return type="float"> + </return> + <argument index="0" name="to_point" type="Vector3"> + </argument> + <description> + </description> + </method> + <method name="get_closest_point" qualifiers="const"> + <return type="Vector3"> + </return> + <argument index="0" name="to_point" type="Vector3"> + </argument> + <description> + </description> + </method> <method name="get_point_count" qualifiers="const"> <return type="int"> </return> diff --git a/doc/classes/DynamicFont.xml b/doc/classes/DynamicFont.xml index 03752c6e89..2e2904c16c 100644 --- a/doc/classes/DynamicFont.xml +++ b/doc/classes/DynamicFont.xml @@ -73,6 +73,10 @@ <member name="font_data" type="DynamicFontData" setter="set_font_data" getter="get_font_data"> The font data. </member> + <member name="outline_color" type="Color" setter="set_outline_color" getter="get_outline_color"> + </member> + <member name="outline_size" type="int" setter="set_outline_size" getter="get_outline_size"> + </member> <member name="size" type="int" setter="set_size" getter="get_size"> The font size. </member> diff --git a/doc/classes/EditorPlugin.xml b/doc/classes/EditorPlugin.xml index 846d6f18ff..e8e2c4fd74 100644 --- a/doc/classes/EditorPlugin.xml +++ b/doc/classes/EditorPlugin.xml @@ -114,7 +114,7 @@ <argument index="3" name="ud" type="Variant" default="null"> </argument> <description> - Adds a custom menu to 'Project > Tools' as [code]name[/code] that calls [code]callback[/code] on an instance of [code]handler[/code] with a parameter [code]ud[/code] when user activates it. + Adds a custom menu to 'Project > Tools' as [code]name[/code] that calls [code]callback[/code] on an instance of [code]handler[/code] with a parameter [code]ud[/code] when user activates it. </description> </method> <method name="add_tool_submenu_item"> @@ -368,7 +368,7 @@ <argument index="0" name="name" type="String"> </argument> <description> - Removes a menu [code]name[/code] from 'Project > Tools'. + Removes a menu [code]name[/code] from 'Project > Tools'. </description> </method> <method name="save_external_data" qualifiers="virtual"> @@ -424,6 +424,12 @@ Emitted when user change main screen view (2D, 3D, Script, AssetLib). Works also with screens which are defined by plugins. </description> </signal> + <signal name="resource_saved"> + <argument index="0" name="resource" type="Object"> + </argument> + <description> + </description> + </signal> <signal name="scene_changed"> <argument index="0" name="scene_root" type="Object"> </argument> diff --git a/doc/classes/Engine.xml b/doc/classes/Engine.xml index 6384b4d0fd..cc2ae4e768 100644 --- a/doc/classes/Engine.xml +++ b/doc/classes/Engine.xml @@ -77,6 +77,8 @@ <member name="iterations_per_second" type="int" setter="set_iterations_per_second" getter="get_iterations_per_second"> The number of fixed iterations per second (for fixed process and physics). </member> + <member name="physics_jitter_fix" type="float" setter="set_physics_jitter_fix" getter="get_physics_jitter_fix"> + </member> <member name="target_fps" type="int" setter="set_target_fps" getter="get_target_fps"> The desired frames per second. If the hardware cannot keep up, this setting may not be respected. Defaults to 0, which indicates no limit. </member> diff --git a/doc/classes/Font.xml b/doc/classes/Font.xml index 376d234ec3..3e47b167ef 100644 --- a/doc/classes/Font.xml +++ b/doc/classes/Font.xml @@ -24,6 +24,8 @@ </argument> <argument index="4" name="clip_w" type="int" default="-1"> </argument> + <argument index="5" name="outline_modulate" type="Color" default="Color( 1, 1, 1, 1 )"> + </argument> <description> Draw "string" into a canvas item using the font at a given position, with "modulate" color, and optionally clipping the width. "position" specifies the baseline, not the top. To draw from the top, [i]ascent[/i] must be added to the Y axis. </description> @@ -41,6 +43,8 @@ </argument> <argument index="4" name="modulate" type="Color" default="Color( 1, 1, 1, 1 )"> </argument> + <argument index="5" name="outline" type="bool" default="false"> + </argument> <description> Draw character "char" into a canvas item using the font at a given position, with "modulate" color, and optionally kerning if "next" is passed. clipping the width. "position" specifies the baseline, not the top. To draw from the top, [i]ascent[/i] must be added to the Y axis. The width used by the character is returned, making this function useful for drawing strings character by character. </description> @@ -75,6 +79,12 @@ Return the size of a string, taking kerning and advance into account. </description> </method> + <method name="has_outline" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> <method name="is_distance_field_hint" qualifiers="const"> <return type="bool"> </return> diff --git a/doc/classes/Geometry.xml b/doc/classes/Geometry.xml index 78496700dc..ea2e2f7595 100644 --- a/doc/classes/Geometry.xml +++ b/doc/classes/Geometry.xml @@ -160,6 +160,21 @@ <description> </description> </method> + <method name="line_intersects_line_2d"> + <return type="Variant"> + </return> + <argument index="0" name="from_a" type="Vector2"> + </argument> + <argument index="1" name="dir_a" type="Vector2"> + </argument> + <argument index="2" name="from_b" type="Vector2"> + </argument> + <argument index="3" name="dir_b" type="Vector2"> + </argument> + <description> + Checks if the two lines ([code]from_a[/code], [code]dir_a[/code]) and ([code]from_b[/code], [code]dir_b[/code]) intersect. If yes, return the point of intersection as [Vector2]. If no intersection takes place, returns an empty [Variant]. Note that the lines are specified using direction vectors, not end points. + </description> + </method> <method name="make_atlas"> <return type="Dictionary"> </return> @@ -259,21 +274,6 @@ Checks if the two segments ([code]from_a[/code], [code]to_a[/code]) and ([code]from_b[/code], [code]to_b[/code]) intersect. If yes, return the point of intersection as [Vector2]. If no intersection takes place, returns an empty [Variant]. </description> </method> - <method name="line_intersects_line_2d"> - <return type="Variant"> - </return> - <argument index="0" name="from_a" type="Vector2"> - </argument> - <argument index="1" name="dir_a" type="Vector2"> - </argument> - <argument index="2" name="from_b" type="Vector2"> - </argument> - <argument index="3" name="dir_b" type="Vector2"> - </argument> - <description> - Checks if the two lines ([code]from_a[/code], [code]dir_a[/code]) and ([code]from_b[/code], [code]dir_b[/code]) intersect. If yes, return the point of intersection as [Vector2]. If no intersection takes place, returns an empty [Variant]. Note that the lines are specified using direction vectors, not end points. - </description> - </method> <method name="segment_intersects_sphere"> <return type="PoolVector3Array"> </return> diff --git a/doc/classes/GridContainer.xml b/doc/classes/GridContainer.xml index 346ab9d357..8a8a9a2d24 100644 --- a/doc/classes/GridContainer.xml +++ b/doc/classes/GridContainer.xml @@ -11,6 +11,16 @@ <demos> </demos> <methods> + <method name="get_child_control_at_cell"> + <return type="Control"> + </return> + <argument index="0" name="row" type="int"> + </argument> + <argument index="1" name="column" type="int"> + </argument> + <description> + </description> + </method> </methods> <members> <member name="columns" type="int" setter="set_columns" getter="get_columns"> diff --git a/doc/classes/Image.xml b/doc/classes/Image.xml index ea61aced83..ca2d519e8a 100644 --- a/doc/classes/Image.xml +++ b/doc/classes/Image.xml @@ -210,6 +210,8 @@ <method name="generate_mipmaps"> <return type="int" enum="Error"> </return> + <argument index="0" name="renormalize" type="bool" default="false"> + </argument> <description> Generates mipmaps for the image. Mipmaps are pre-calculated and lower resolution copies of the image. Mipmaps are automatically used if the image needs to be scaled down when rendered. This improves image quality and the performance of the rendering. Returns an error if the image is compressed, in a custom format or if the image's width/height is 0. </description> @@ -255,6 +257,14 @@ Returns the color of the pixel at [code](x, y)[/code] if the image is locked. If the image is unlocked it always returns a [Color] with the value [code](0, 0, 0, 1.0)[/code]. </description> </method> + <method name="get_pixelv" qualifiers="const"> + <return type="Color"> + </return> + <argument index="0" name="src" type="Vector2"> + </argument> + <description> + </description> + </method> <method name="get_rect" qualifiers="const"> <return type="Image"> </return> @@ -411,6 +421,16 @@ [/codeblock] </description> </method> + <method name="set_pixelv"> + <return type="void"> + </return> + <argument index="0" name="dst" type="Vector2"> + </argument> + <argument index="1" name="color" type="Color"> + </argument> + <description> + </description> + </method> <method name="shrink_x2"> <return type="void"> </return> diff --git a/doc/classes/Input.xml b/doc/classes/Input.xml index f537908625..f92f8da5dd 100644 --- a/doc/classes/Input.xml +++ b/doc/classes/Input.xml @@ -48,6 +48,14 @@ If the device has an accelerometer, this will return the acceleration. Otherwise, it returns an empty [Vector3]. </description> </method> + <method name="get_action_strength" qualifiers="const"> + <return type="float"> + </return> + <argument index="0" name="action" type="String"> + </argument> + <description> + </description> + </method> <method name="get_connected_joypads"> <return type="Array"> </return> @@ -284,7 +292,15 @@ <argument index="2" name="hotspot" type="Vector2" default="Vector2( 0, 0 )"> </argument> <description> - Set a custom mouse cursor image, which is only visible inside the game window. The hotspot can also be specified. See enum [code]CURSOR_*[/code] for the list of shapes. + Set a custom mouse cursor image, which is only visible inside the game window. The hotspot can also be specified. Passing [code]null[/code] to the image parameter resets to the system cursor. See enum [code]CURSOR_*[/code] for the list of shapes. + </description> + </method> + <method name="set_default_cursor_shape"> + <return type="void"> + </return> + <argument index="0" name="shape" type="int" enum="Input.CursorShape" default="0"> + </argument> + <description> </description> </method> <method name="set_mouse_mode"> diff --git a/doc/classes/InputEvent.xml b/doc/classes/InputEvent.xml index b30b144614..cbed2285df 100644 --- a/doc/classes/InputEvent.xml +++ b/doc/classes/InputEvent.xml @@ -13,20 +13,19 @@ <demos> </demos> <methods> - <method name="action_match" qualifiers="const"> - <return type="bool"> + <method name="as_text" qualifiers="const"> + <return type="String"> </return> - <argument index="0" name="event" type="InputEvent"> - </argument> <description> - Returns [code]true[/code] if this event matches [code]event[/code]. + Returns a [String] representation of the event. </description> </method> - <method name="as_text" qualifiers="const"> - <return type="String"> + <method name="get_action_strength" qualifiers="const"> + <return type="float"> </return> + <argument index="0" name="action" type="String"> + </argument> <description> - Returns a [String] representation of the event. </description> </method> <method name="is_action" qualifiers="const"> diff --git a/doc/classes/InputMap.xml b/doc/classes/InputMap.xml index eeb225d445..3399a3f096 100644 --- a/doc/classes/InputMap.xml +++ b/doc/classes/InputMap.xml @@ -34,6 +34,14 @@ Removes an [InputEvent] from an action. </description> </method> + <method name="action_erase_events"> + <return type="void"> + </return> + <argument index="0" name="action" type="String"> + </argument> + <description> + </description> + </method> <method name="action_has_event"> <return type="bool"> </return> @@ -45,13 +53,26 @@ Returns [true] if an action has an [InputEvent] associated with it. </description> </method> + <method name="action_set_deadzone"> + <return type="void"> + </return> + <argument index="0" name="deadzone" type="String"> + </argument> + <argument index="1" name="arg1" type="float"> + </argument> + <description> + </description> + </method> <method name="add_action"> <return type="void"> </return> <argument index="0" name="action" type="String"> </argument> + <argument index="1" name="deadzone" type="float" default="0.5"> + </argument> <description> - Adds an (empty) action to the [code]InputMap[/code]. An [InputEvent] can then be added to this action with [method action_add_event]. + Adds an (empty) action to the [code]InputMap[/code], with a configurable [code]deadzone[/code]. + An [InputEvent] can then be added to this action with [method action_add_event]. </description> </method> <method name="erase_action"> diff --git a/doc/classes/InstancePlaceholder.xml b/doc/classes/InstancePlaceholder.xml index 5945e1068f..71c859fd9e 100644 --- a/doc/classes/InstancePlaceholder.xml +++ b/doc/classes/InstancePlaceholder.xml @@ -12,6 +12,16 @@ <demos> </demos> <methods> + <method name="create_instance"> + <return type="Node"> + </return> + <argument index="0" name="replace" type="bool" default="false"> + </argument> + <argument index="1" name="custom_scene" type="PackedScene" default="null"> + </argument> + <description> + </description> + </method> <method name="get_instance_path" qualifiers="const"> <return type="String"> </return> diff --git a/doc/classes/Label.xml b/doc/classes/Label.xml index 24c28fc810..1e78a196b1 100644 --- a/doc/classes/Label.xml +++ b/doc/classes/Label.xml @@ -106,6 +106,8 @@ </theme_item> <theme_item name="font_color_shadow" type="Color"> </theme_item> + <theme_item name="font_outline_modulate" type="Color"> + </theme_item> <theme_item name="line_spacing" type="int"> </theme_item> <theme_item name="normal" type="StyleBox"> diff --git a/doc/classes/LineEdit.xml b/doc/classes/LineEdit.xml index c31438283e..d7a0385bb3 100644 --- a/doc/classes/LineEdit.xml +++ b/doc/classes/LineEdit.xml @@ -112,7 +112,7 @@ <member name="secret" type="bool" setter="set_secret" getter="is_secret"> If [code]true[/code], every character is replaced with the secret character (see [member secret_character]). </member> - <member name="secret_character" type="string" setter="set_secret_character" getter="get_secret_character"> + <member name="secret_character" type="String" setter="set_secret_character" getter="get_secret_character"> The character to use to mask secret input (defaults to "*"). Only a single character can be used as the secret character. </member> <member name="text" type="String" setter="set_text" getter="get_text"> diff --git a/doc/classes/MultiplayerAPI.xml b/doc/classes/MultiplayerAPI.xml index b2ed712554..f6950d0fbc 100644 --- a/doc/classes/MultiplayerAPI.xml +++ b/doc/classes/MultiplayerAPI.xml @@ -61,10 +61,21 @@ </return> <description> Method used for polling the MultiplayerAPI. - You only need to worry about this if you are using [memeber Node.custom_multplayer] override. + You only need to worry about this if you are using [member Node.custom_multplayer] override. SceneTree will poll the default MultiplayerAPI for you. </description> </method> + <method name="send_bytes"> + <return type="int" enum="Error"> + </return> + <argument index="0" name="bytes" type="PoolByteArray"> + </argument> + <argument index="1" name="id" type="int" default="0"> + </argument> + <description> + Sends the given raw [code]bytes[/code] to a specific peer identified by [code]id[/code] (see [method NetworkedMultiplayerPeer.set_target_peer]). Default ID is [code]0[/code], i.e. broadcast to all peers. + </description> + </method> <method name="set_root_node"> <return type="void"> </return> @@ -78,7 +89,7 @@ </methods> <members> <member name="network_peer" type="NetworkedMultiplayerPeer" setter="set_network_peer" getter="get_network_peer"> - The peer object to handle the RPC system (effectively enabling networking when set). Depending on the peer itself, the MultiplayerAPI will become a network server (check with [method is_network_server()]) and will set root node's network mode to master (see NETWORK_MODE_* constants in [Node]), or it will become a regular peer with root node set to slave. All child nodes are set to inherit the network mode by default. Handling of networking-related events (connection, disconnection, new clients) is done by connecting to MultiplayerAPI's signals. + The peer object to handle the RPC system (effectively enabling networking when set). Depending on the peer itself, the MultiplayerAPI will become a network server (check with [method is_network_server]) and will set root node's network mode to master (see NETWORK_MODE_* constants in [Node]), or it will become a regular peer with root node set to slave. All child nodes are set to inherit the network mode by default. Handling of networking-related events (connection, disconnection, new clients) is done by connecting to MultiplayerAPI's signals. </member> <member name="refuse_new_network_connections" type="bool" setter="set_refuse_new_network_connections" getter="is_refusing_new_network_connections"> If [code]true[/code] the MultiplayerAPI's [member network_peer] refuses new incoming connections. @@ -109,9 +120,18 @@ Emitted whenever this MultiplayerAPI's [member network_peer] disconnects from a peer. Clients get notified when other clients disconnect from the same server. </description> </signal> + <signal name="network_peer_packet"> + <argument index="0" name="id" type="int"> + </argument> + <argument index="1" name="packet" type="PoolByteArray"> + </argument> + <description> + Emitted whenever this MultiplayerAPI's [member network_peer] receive a [code]packet[/code] with custom data (see [method send_bytes]). ID is the peer ID of the peer that sent the packet. + </description> + </signal> <signal name="server_disconnected"> <description> - Emitted whenever this MultiplayerAPI's [member network_peer] disconnected from server. Only emitted on clients. + Emitted whenever this MultiplayerAPI's [member network_peer] disconnects from server. Only emitted on clients. </description> </signal> </signals> diff --git a/doc/classes/NetworkedMultiplayerPeer.xml b/doc/classes/NetworkedMultiplayerPeer.xml index 71614c5f76..2780334384 100644 --- a/doc/classes/NetworkedMultiplayerPeer.xml +++ b/doc/classes/NetworkedMultiplayerPeer.xml @@ -46,7 +46,8 @@ <argument index="0" name="id" type="int"> </argument> <description> - The peer to which packets will be sent. Default value: [code]0[/code]. + Sets the peer to which packets will be sent. + The [code]id[/code] can be one of: [code]TARGET_PEER_BROADCAST[/code] to send to all connected peers, [code]TARGET_PEER_SERVER[/code] to send to the peer acting as server, a valid peer ID to send to that specific peer, a negative peer ID to send to all peers except that one. Default: [code]TARGET_PEER_BROADCAST[/code] </description> </method> </methods> diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml index c11b8aacaa..05ac6b1c0e 100644 --- a/doc/classes/Node.xml +++ b/doc/classes/Node.xml @@ -586,7 +586,7 @@ <argument index="1" name="method" type="String"> </argument> <description> - Sends a [method rpc] to a specific peer identified by [code]peer_id[/code]. Returns an empty [Variant]. + Sends a [method rpc] to a specific peer identified by [code]peer_id[/code] (see [method NetworkedMultiplayerPeer.set_target_peer]). Returns an empty [Variant]. </description> </method> <method name="rpc_unreliable" qualifiers="vararg"> @@ -606,7 +606,7 @@ <argument index="1" name="method" type="String"> </argument> <description> - Sends a [method rpc] to a specific peer identified by [code]peer_id[/code] using an unreliable protocol. Returns an empty [Variant]. + Sends a [method rpc] to a specific peer identified by [code]peer_id[/code] using an unreliable protocol (see [method NetworkedMultiplayerPeer.set_target_peer]). Returns an empty [Variant]. </description> </method> <method name="rset"> @@ -641,7 +641,7 @@ <argument index="2" name="value" type="Variant"> </argument> <description> - Remotely changes the property's value on a specific peer identified by [code]peer_id[/code]. + Remotely changes the property's value on a specific peer identified by [code]peer_id[/code] (see [method NetworkedMultiplayerPeer.set_target_peer]). </description> </method> <method name="rset_unreliable"> @@ -665,7 +665,7 @@ <argument index="2" name="value" type="Variant"> </argument> <description> - Remotely changes property's value on a specific peer identified by [code]peer_id[/code] using an unreliable protocol. + Remotely changes property's value on a specific peer identified by [code]peer_id[/code] using an unreliable protocol (see [method NetworkedMultiplayerPeer.set_target_peer]). </description> </method> <method name="set_display_folded"> @@ -703,7 +703,7 @@ <argument index="0" name="enable" type="bool"> </argument> <description> - Enables or disables internal physics for this node. Internal physics processing happens in isolation from the normal [method]_physics_process[/code] calls and is used by some nodes internally to guarantee proper functioning even if the node is paused or physics processing is disabled for scripting ([method set_physics_process]). Only useful for advanced uses to manipulate built-in nodes behaviour. + Enables or disables internal physics for this node. Internal physics processing happens in isolation from the normal [method _physics_process] calls and is used by some nodes internally to guarantee proper functioning even if the node is paused or physics processing is disabled for scripting ([method set_physics_process]). Only useful for advanced uses to manipulate built-in nodes behaviour. </description> </method> <method name="set_process"> @@ -730,7 +730,7 @@ <argument index="0" name="enable" type="bool"> </argument> <description> - Enables or disabled internal processing for this node. Internal processing happens in isolation from the normal [method]_process[/code] calls and is used by some nodes internally to guarantee proper functioning even if the node is paused or processing is disabled for scripting ([method set_process]). Only useful for advanced uses to manipulate built-in nodes behaviour. + Enables or disabled internal processing for this node. Internal processing happens in isolation from the normal [method _process] calls and is used by some nodes internally to guarantee proper functioning even if the node is paused or processing is disabled for scripting ([method set_process]). Only useful for advanced uses to manipulate built-in nodes behaviour. </description> </method> <method name="set_process_unhandled_input"> diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml index d38a89874c..e4375cfb79 100644 --- a/doc/classes/OS.xml +++ b/doc/classes/OS.xml @@ -430,6 +430,12 @@ Returns the on-screen keyboard's height in pixels. Returns 0 if there is no keyboard or it is currently hidden. </description> </method> + <method name="get_window_safe_area" qualifiers="const"> + <return type="Rect2"> + </return> + <description> + </description> + </method> <method name="has_environment" qualifiers="const"> <return type="bool"> </return> @@ -698,7 +704,7 @@ <member name="low_processor_usage_mode" type="bool" setter="set_low_processor_usage_mode" getter="is_in_low_processor_usage_mode"> If [code]true[/code] the engine optimizes for low processor usage by only refreshing the screen if needed. Can improve battery consumption on mobile. </member> - <member name="screen_orientation" type="int" setter="set_screen_orientation" getter="get_screen_orientation" enum="OS.ScreenOrientation"> + <member name="screen_orientation" type="int" setter="set_screen_orientation" getter="get_screen_orientation" enum="_OS.ScreenOrientation"> The current screen orientation. </member> <member name="vsync_enabled" type="bool" setter="set_use_vsync" getter="is_vsync_enabled"> @@ -716,6 +722,8 @@ <member name="window_minimized" type="bool" setter="set_window_minimized" getter="is_window_minimized"> If [code]true[/code] the window is minimized. </member> + <member name="window_per_pixel_transparency_enabled" type="bool" setter="set_window_per_pixel_transparency_enabled" getter="get_window_per_pixel_transparency_enabled"> + </member> <member name="window_position" type="Vector2" setter="set_window_position" getter="get_window_position"> The window position relative to the screen, the origin is the top left corner, +Y axis goes to the bottom and +X axis goes to the right. </member> diff --git a/doc/classes/OptionButton.xml b/doc/classes/OptionButton.xml index 8cb53dd98e..c58c932b61 100644 --- a/doc/classes/OptionButton.xml +++ b/doc/classes/OptionButton.xml @@ -18,7 +18,7 @@ </argument> <argument index="1" name="label" type="String"> </argument> - <argument index="2" name="id" type="int"> + <argument index="2" name="id" type="int" default="-1"> </argument> <description> Add an item, with a "texture" icon, text "label" and (optionally) id. If no "id" is passed, "id" becomes the item index. New items are appended at the end. diff --git a/doc/classes/PanoramaSky.xml b/doc/classes/PanoramaSky.xml index eb288d13be..402e65c573 100644 --- a/doc/classes/PanoramaSky.xml +++ b/doc/classes/PanoramaSky.xml @@ -1,8 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="PanoramaSky" inherits="Sky" category="Core" version="3.1"> <brief_description> + A type of [Sky] used to draw a background texture. </brief_description> <description> + A resource referenced in an [Environment] that is used to draw a background. The Panorama sky functions similar to skyboxes in other engines except it uses a equirectangular sky map instead of a cube map. </description> <tutorials> </tutorials> @@ -12,6 +14,7 @@ </methods> <members> <member name="panorama" type="Texture" setter="set_panorama" getter="get_panorama"> + [Texture] to be applied to the PanoramaSky. </member> </members> <constants> diff --git a/doc/classes/Path.xml b/doc/classes/Path.xml index 621a513da3..5ece747aaf 100644 --- a/doc/classes/Path.xml +++ b/doc/classes/Path.xml @@ -16,6 +16,12 @@ <member name="curve" type="Curve3D" setter="set_curve" getter="get_curve"> </member> </members> + <signals> + <signal name="curve_changed"> + <description> + </description> + </signal> + </signals> <constants> </constants> </class> diff --git a/doc/classes/PhysicalBone.xml b/doc/classes/PhysicalBone.xml new file mode 100644 index 0000000000..80b3c11270 --- /dev/null +++ b/doc/classes/PhysicalBone.xml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="PhysicalBone" inherits="PhysicsBody" category="Core" version="3.1"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="is_simulating_physics"> + <return type="bool"> + </return> + <description> + </description> + </method> + </methods> + <members> + <member name="body_offset" type="Transform" setter="set_body_offset" getter="get_body_offset"> + </member> + <member name="bounce" type="float" setter="set_bounce" getter="get_bounce"> + </member> + <member name="friction" type="float" setter="set_friction" getter="get_friction"> + </member> + <member name="gravity_scale" type="float" setter="set_gravity_scale" getter="get_gravity_scale"> + </member> + <member name="joint_offset" type="Transform" setter="set_joint_offset" getter="get_joint_offset"> + </member> + <member name="joint_type" type="int" setter="set_joint_type" getter="get_joint_type" enum="PhysicalBone.JointType"> + </member> + <member name="mass" type="float" setter="set_mass" getter="get_mass"> + </member> + <member name="simulate_physics" type="bool" setter="set_simulate_physics" getter="get_simulate_physics"> + </member> + <member name="static_body" type="bool" setter="set_static_body" getter="is_static_body"> + </member> + <member name="weight" type="float" setter="set_weight" getter="get_weight"> + </member> + </members> + <constants> + <constant name="JOINT_TYPE_NONE" value="0" enum="JointType"> + </constant> + <constant name="JOINT_TYPE_PIN" value="1" enum="JointType"> + </constant> + <constant name="JOINT_TYPE_CONE" value="2" enum="JointType"> + </constant> + <constant name="JOINT_TYPE_HINGE" value="3" enum="JointType"> + </constant> + <constant name="JOINT_TYPE_SLIDER" value="4" enum="JointType"> + </constant> + <constant name="JOINT_TYPE_6DOF" value="5" enum="JointType"> + </constant> + </constants> +</class> diff --git a/doc/classes/Polygon2D.xml b/doc/classes/Polygon2D.xml index 429114a128..bf4519fd0a 100644 --- a/doc/classes/Polygon2D.xml +++ b/doc/classes/Polygon2D.xml @@ -11,11 +11,79 @@ <demos> </demos> <methods> + <method name="add_bone"> + <return type="void"> + </return> + <argument index="0" name="path" type="NodePath"> + </argument> + <argument index="1" name="weights" type="PoolRealArray"> + </argument> + <description> + </description> + </method> + <method name="clear_bones"> + <return type="void"> + </return> + <description> + </description> + </method> + <method name="erase_bone"> + <return type="void"> + </return> + <argument index="0" name="index" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_bone_count" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="get_bone_path" qualifiers="const"> + <return type="NodePath"> + </return> + <argument index="0" name="index" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_bone_weights" qualifiers="const"> + <return type="PoolRealArray"> + </return> + <argument index="0" name="index" type="int"> + </argument> + <description> + </description> + </method> + <method name="set_bone_path"> + <return type="void"> + </return> + <argument index="0" name="index" type="int"> + </argument> + <argument index="1" name="path" type="NodePath"> + </argument> + <description> + </description> + </method> + <method name="set_bone_weights"> + <return type="void"> + </return> + <argument index="0" name="index" type="int"> + </argument> + <argument index="1" name="weights" type="PoolRealArray"> + </argument> + <description> + </description> + </method> </methods> <members> <member name="antialiased" type="bool" setter="set_antialiased" getter="get_antialiased"> If [code]true[/code] polygon edges will be anti-aliased. Default value: [code]false[/code]. </member> + <member name="bones" type="Array" setter="_set_bones" getter="_get_bones"> + </member> <member name="color" type="Color" setter="set_color" getter="get_color"> The polygon's fill color. If [code]texture[/code] is defined, it will be multiplied by this color. It will also be the default color for vertices not set in [code]vertex_colors[/code]. </member> @@ -31,6 +99,8 @@ <member name="polygon" type="PoolVector2Array" setter="set_polygon" getter="get_polygon"> The polygon's list of vertices. The final point will be connected to the first. </member> + <member name="skeleton" type="NodePath" setter="set_skeleton" getter="get_skeleton"> + </member> <member name="splits" type="PoolIntArray" setter="set_splits" getter="get_splits"> </member> <member name="texture" type="Texture" setter="set_texture" getter="get_texture"> diff --git a/doc/classes/Popup.xml b/doc/classes/Popup.xml index db8d927c9e..ae5bce5d7d 100644 --- a/doc/classes/Popup.xml +++ b/doc/classes/Popup.xml @@ -50,7 +50,7 @@ </methods> <members> <member name="popup_exclusive" type="bool" setter="set_exclusive" getter="is_exclusive"> - If [code]true[/code] the popup will not be hidden when a click event occurs outside of it, or when it receives the [code]ui_cancel[/code] action event. + If [code]true[/code] the popup will not be hidden when a click event occurs outside of it, or when it receives the [code]ui_cancel[/code] action event. </member> </members> <signals> diff --git a/doc/classes/PrimitiveMesh.xml b/doc/classes/PrimitiveMesh.xml index c5bc3d6e47..0f0511258b 100644 --- a/doc/classes/PrimitiveMesh.xml +++ b/doc/classes/PrimitiveMesh.xml @@ -19,6 +19,10 @@ </method> </methods> <members> + <member name="custom_aabb" type="AABB" setter="set_custom_aabb" getter="get_custom_aabb"> + </member> + <member name="flip_faces" type="bool" setter="set_flip_faces" getter="get_flip_faces"> + </member> <member name="material" type="Material" setter="set_material" getter="get_material"> The current [Material] of the primitive mesh. </member> diff --git a/doc/classes/RichTextLabel.xml b/doc/classes/RichTextLabel.xml index a6c63cfb76..4ec4bbee4f 100644 --- a/doc/classes/RichTextLabel.xml +++ b/doc/classes/RichTextLabel.xml @@ -47,6 +47,13 @@ Clears the tag stack and sets [member bbcode_text] to an empty string. </description> </method> + <method name="get_content_height"> + <return type="int"> + </return> + <description> + Returns the height of the content. + </description> + </method> <method name="get_line_count" qualifiers="const"> <return type="int"> </return> @@ -75,13 +82,6 @@ Returns the number of visible lines. </description> </method> - <method name="get_content_height"> - <return type="int"> - </return> - <description> - Returns the height of the content. - </description> - </method> <method name="newline"> <return type="void"> </return> @@ -328,12 +328,6 @@ </theme_item> <theme_item name="font_color_shadow" type="Color"> </theme_item> - <theme_item name="shadow_as_outline" type="int"> - </theme_item> - <theme_item name="shadow_offset_x" type="int"> - </theme_item> - <theme_item name="shadow_offset_y" type="int"> - </theme_item> <theme_item name="italics_font" type="Font"> </theme_item> <theme_item name="line_separation" type="int"> @@ -346,6 +340,12 @@ </theme_item> <theme_item name="selection_color" type="Color"> </theme_item> + <theme_item name="shadow_as_outline" type="int"> + </theme_item> + <theme_item name="shadow_offset_x" type="int"> + </theme_item> + <theme_item name="shadow_offset_y" type="int"> + </theme_item> <theme_item name="table_hseparation" type="int"> </theme_item> <theme_item name="table_vseparation" type="int"> diff --git a/doc/classes/ScrollContainer.xml b/doc/classes/ScrollContainer.xml index 64b0fcfd83..f16b3920c2 100644 --- a/doc/classes/ScrollContainer.xml +++ b/doc/classes/ScrollContainer.xml @@ -22,7 +22,7 @@ If [code]true[/code], enables horizontal scrolling. </member> <member name="scroll_vertical" type="int" setter="set_v_scroll" getter="get_v_scroll"> - The current horizontal scroll value. + The current vertical scroll value. </member> <member name="scroll_vertical_enabled" type="bool" setter="set_enable_v_scroll" getter="is_v_scroll_enabled"> If [code]true[/code], enables vertical scrolling. diff --git a/doc/classes/Skeleton.xml b/doc/classes/Skeleton.xml index 0208d56cfa..67e10e8f0a 100644 --- a/doc/classes/Skeleton.xml +++ b/doc/classes/Skeleton.xml @@ -131,6 +131,30 @@ <description> </description> </method> + <method name="physical_bones_add_collision_exception"> + <return type="void"> + </return> + <argument index="0" name="exception" type="RID"> + </argument> + <description> + </description> + </method> + <method name="physical_bones_remove_collision_exception"> + <return type="void"> + </return> + <argument index="0" name="exception" type="RID"> + </argument> + <description> + </description> + </method> + <method name="physical_bones_simulation"> + <return type="void"> + </return> + <argument index="0" name="start" type="bool"> + </argument> + <description> + </description> + </method> <method name="set_bone_custom_pose"> <return type="void"> </return> diff --git a/doc/classes/Skeleton2D.xml b/doc/classes/Skeleton2D.xml new file mode 100644 index 0000000000..654c816ba8 --- /dev/null +++ b/doc/classes/Skeleton2D.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="Skeleton2D" inherits="Node2D" category="Core" version="3.1"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="get_bone"> + <return type="Bone2D"> + </return> + <argument index="0" name="arg0" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_bone_count" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="get_skeleton" qualifiers="const"> + <return type="RID"> + </return> + <description> + </description> + </method> + </methods> + <constants> + </constants> +</class> diff --git a/doc/classes/SpatialMaterial.xml b/doc/classes/SpatialMaterial.xml index ace1aa846e..5feaf70e9d 100644 --- a/doc/classes/SpatialMaterial.xml +++ b/doc/classes/SpatialMaterial.xml @@ -84,6 +84,8 @@ </member> <member name="flags_albedo_tex_force_srgb" type="bool" setter="set_flag" getter="get_flag"> </member> + <member name="flags_do_not_receive_shadows" type="bool" setter="set_flag" getter="get_flag"> + </member> <member name="flags_fixed_size" type="bool" setter="set_flag" getter="get_flag"> </member> <member name="flags_no_depth_test" type="bool" setter="set_flag" getter="get_flag"> @@ -316,7 +318,9 @@ </constant> <constant name="FLAG_ALBEDO_TEXTURE_FORCE_SRGB" value="13" enum="Flags"> </constant> - <constant name="FLAG_MAX" value="14" enum="Flags"> + <constant name="FLAG_DONT_RECEIVE_SHADOWS" value="14" enum="Flags"> + </constant> + <constant name="FLAG_MAX" value="15" enum="Flags"> </constant> <constant name="DIFFUSE_BURLEY" value="0" enum="DiffuseMode"> </constant> diff --git a/doc/classes/TileMap.xml b/doc/classes/TileMap.xml index ec67370c79..775fef4fb7 100644 --- a/doc/classes/TileMap.xml +++ b/doc/classes/TileMap.xml @@ -16,14 +16,14 @@ <return type="void"> </return> <description> - Clear all cells. + Clears all cells. </description> </method> <method name="fix_invalid_tiles"> <return type="void"> </return> <description> - Clear cells that does not exist in the tileset. + Clears cells that do not exist in the tileset. </description> </method> <method name="get_cell" qualifiers="const"> @@ -34,7 +34,7 @@ <argument index="1" name="y" type="int"> </argument> <description> - Return the tile index of the referenced cell. + Returns the tile index of the given cell. </description> </method> <method name="get_cellv" qualifiers="const"> @@ -43,7 +43,7 @@ <argument index="0" name="position" type="Vector2"> </argument> <description> - Return the tile index of the cell referenced by a Vector2. + Returns the tile index of the cell given by a Vector2. </description> </method> <method name="get_collision_layer_bit" qualifiers="const"> @@ -52,6 +52,7 @@ <argument index="0" name="bit" type="int"> </argument> <description> + Returns [code]true[/code] if the given collision layer bit is set. </description> </method> <method name="get_collision_mask_bit" qualifiers="const"> @@ -60,13 +61,14 @@ <argument index="0" name="bit" type="int"> </argument> <description> + Returns [code]true[/code] if the given collision mask bit is set. </description> </method> <method name="get_used_cells" qualifiers="const"> <return type="Array"> </return> <description> - Return an array of all cells containing a tile from the tileset (i.e. a tile index different from -1). + Returns an array of all cells containing a tile from the tileset (i.e. a tile index different from [code]-1[/code]). </description> </method> <method name="get_used_cells_by_id" qualifiers="const"> @@ -75,12 +77,14 @@ <argument index="0" name="id" type="int"> </argument> <description> + Returns an array of all cells with the given tile id. </description> </method> <method name="get_used_rect"> <return type="Rect2"> </return> <description> + Returns a rectangle enclosing the used (non-empty) tiles of the map. </description> </method> <method name="is_cell_transposed" qualifiers="const"> @@ -91,7 +95,7 @@ <argument index="1" name="y" type="int"> </argument> <description> - Return whether the referenced cell is transposed, i.e. the X and Y axes are swapped (mirroring with regard to the (1,1) vector). + Returns [code]true[/code] if the given cell is transposed, i.e. the x and y axes are swapped. </description> </method> <method name="is_cell_x_flipped" qualifiers="const"> @@ -102,7 +106,7 @@ <argument index="1" name="y" type="int"> </argument> <description> - Return whether the referenced cell is flipped over the X axis. + Returns [code]true[/code] if the given cell is flipped in the x axis. </description> </method> <method name="is_cell_y_flipped" qualifiers="const"> @@ -113,7 +117,7 @@ <argument index="1" name="y" type="int"> </argument> <description> - Return whether the referenced cell is flipped over the Y axis. + Returns [code]true[/code] if the given cell is flipped in the y axis. </description> </method> <method name="map_to_world" qualifiers="const"> @@ -124,8 +128,8 @@ <argument index="1" name="ignore_half_ofs" type="bool" default="false"> </argument> <description> - Return the absolute world position corresponding to the tilemap (grid-based) coordinates given as an argument. - Optionally, the tilemap's potential half offset can be ignored. + Returns the global position corresponding to the given tilemap (grid-based) coordinates. + Optionally, the tilemap's half offset can be ignored. </description> </method> <method name="set_cell"> @@ -146,9 +150,9 @@ <argument index="6" name="autotile_coord" type="Vector2" default="Vector2( 0, 0 )"> </argument> <description> - Set the tile index for the cell referenced by its grid-based X and Y coordinates. - A tile index of -1 clears the cell. - Optionally, the tile can also be flipped over the X and Y coordinates, transposed, or be given autotile coordinates. + Sets the tile index for the cell given by a Vector2. + An index of [code]-1[/code] clears the cell. + Optionally, the tile can also be flipped, transposed, or given autotile coordinates. </description> </method> <method name="set_cellv"> @@ -165,9 +169,9 @@ <argument index="4" name="transpose" type="bool" default="false"> </argument> <description> - Set the tile index for the cell referenced by a Vector2 of grid-based coordinates. - A tile index of -1 clears the cell. - Optionally, the tile can also be flipped over the X and Y axes or transposed. + Sets the tile index for the given cell. + An index of [code]-1[/code] clears the cell. + Optionally, the tile can also be flipped or transposed. </description> </method> <method name="set_collision_layer_bit"> @@ -178,7 +182,7 @@ <argument index="1" name="value" type="bool"> </argument> <description> - Set any collision layer to be [code]true[/code] or [code]false[/code]. + Sets the given collision layer bit. </description> </method> <method name="set_collision_mask_bit"> @@ -189,6 +193,7 @@ <argument index="1" name="value" type="bool"> </argument> <description> + Sets the given collision mask bit. </description> </method> <method name="update_bitmask_area"> @@ -197,7 +202,7 @@ <argument index="0" name="position" type="Vector2"> </argument> <description> - Applies autotiling rules to the cell (and its adjacent cells) referenced by its grid-based X and Y coordinates. + Applies autotiling rules to the cell (and its adjacent cells) referenced by its grid-based x and y coordinates. </description> </method> <method name="update_bitmask_region"> @@ -208,8 +213,8 @@ <argument index="1" name="end" type="Vector2" default="Vector2( 0, 0 )"> </argument> <description> - Applies autotiling rules to the cells in the given region (specified by grid-based X and Y coordinates). - Calling with invalid (or missing) parameters applies autotiling rules for the entire TileMap. + Applies autotiling rules to the cells in the given region (specified by grid-based x and y coordinates). + Calling with invalid (or missing) parameters applies autotiling rules for the entire tilemap. </description> </method> <method name="world_to_map" qualifiers="const"> @@ -218,7 +223,7 @@ <argument index="0" name="world_position" type="Vector2"> </argument> <description> - Return the tilemap (grid-based) coordinates corresponding to the absolute world position given as an argument. + Returns the tilemap (grid-based) coordinatescorresponding to the given global position. </description> </method> </methods> diff --git a/doc/classes/TileSet.xml b/doc/classes/TileSet.xml index 4e218f5595..8f7969505e 100644 --- a/doc/classes/TileSet.xml +++ b/doc/classes/TileSet.xml @@ -262,6 +262,14 @@ <description> </description> </method> + <method name="tile_get_z_index" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="id" type="int"> + </argument> + <description> + </description> + </method> <method name="tile_set_light_occluder"> <return type="void"> </return> @@ -428,6 +436,16 @@ <description> </description> </method> + <method name="tile_set_z_index"> + <return type="void"> + </return> + <argument index="0" name="id" type="int"> + </argument> + <argument index="1" name="z_index" type="int"> + </argument> + <description> + </description> + </method> </methods> <constants> <constant name="BITMASK_2X2" value="0" enum="BitmaskMode"> diff --git a/doc/classes/Timer.xml b/doc/classes/Timer.xml index c51a52d911..d1c8722901 100644 --- a/doc/classes/Timer.xml +++ b/doc/classes/Timer.xml @@ -24,7 +24,7 @@ <argument index="0" name="time_sec" type="float" default="-1"> </argument> <description> - Starts the timer. Sets [code]wait_time[/code] to [code]time_sec[/code] if [code]time_sec[/code] > 0. This also resets the remaining time to [code]wait_time[/code]. + Starts the timer. Sets [code]wait_time[/code] to [code]time_sec[/code] if [code]time_sec[/code] > 0. This also resets the remaining time to [code]wait_time[/code]. Note: this method will not resume a paused timer. See [method set_paused]. </description> </method> diff --git a/doc/classes/Tween.xml b/doc/classes/Tween.xml index 95405cc4f6..2332c1a7aa 100644 --- a/doc/classes/Tween.xml +++ b/doc/classes/Tween.xml @@ -340,7 +340,7 @@ </methods> <members> <member name="playback_process_mode" type="int" setter="set_tween_process_mode" getter="get_tween_process_mode" enum="Tween.TweenProcessMode"> - The tween's animation process thread. See [enum TweenProcessMode]. Default value: [enum TWEEN_PROCESS_IDLE]. + The tween's animation process thread. See [enum TweenProcessMode]. Default value: [enum TWEEN_PROCESS_IDLE]. </member> <member name="playback_speed" type="float" setter="set_speed_scale" getter="get_speed_scale"> The tween's speed multiplier. For example, set it to [code]1.0[/code] for normal speed, [code]2.0[/code] for two times normal speed, or [code]0.5[/code] for half of the normal speed. A value of [code]0[/code] pauses the animation, but see also [method set_active] or [method stop_all] for this. diff --git a/doc/classes/Vector2.xml b/doc/classes/Vector2.xml index 5ffe807606..ec92dcf900 100644 --- a/doc/classes/Vector2.xml +++ b/doc/classes/Vector2.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="Vector2" category="Built-In Types" version="3.1"> <brief_description> - Vector used for 2D Math. + Vector used for 2D math. </brief_description> <description> - 2-element structure that can be used to represent positions in 2d-space, or any other pair of numeric values. + 2-element structure that can be used to represent positions in 2d space or any other pair of numeric values. </description> <tutorials> http://docs.godotengine.org/en/3.0/tutorials/math/index.html @@ -34,8 +34,8 @@ <return type="float"> </return> <description> - Returns the result of atan2 when called with the Vector's x and y as parameters (Math::atan2(x,y)). - Be aware that it therefore returns an angle oriented clockwise with regard to the (0, 1) unit vector, and not an angle oriented counter-clockwise with regard to the (1, 0) unit vector (which would be the typical trigonometric representation of the angle when calling Math::atan2(y,x)). + Returns the vector's angle in radians with respect to the x-axis, or [code](1, 0)[/code] vector. + Equivalent to the result of atan2 when called with the vector's x and y as parameters: [code]atan2(x, y)[/code]. </description> </method> <method name="angle_to"> @@ -60,7 +60,7 @@ <return type="float"> </return> <description> - Returns the ratio of X to Y. + Returns the ratio of x to y. </description> </method> <method name="bounce"> @@ -69,7 +69,13 @@ <argument index="0" name="n" type="Vector2"> </argument> <description> - Bounce returns the vector "bounced off" from the given plane, specified by its normal vector. + Returns the vector "bounced off" from a plane defined by the given normal. + </description> + </method> + <method name="ceil"> + <return type="Vector2"> + </return> + <description> </description> </method> <method name="clamped"> @@ -87,7 +93,7 @@ <argument index="0" name="with" type="Vector2"> </argument> <description> - Returns the 2-dimensional analog of the cross product with the given Vector2. + Returns the 2 dimensional analog of the cross product with the given vector. </description> </method> <method name="cubic_interpolate"> @@ -102,7 +108,7 @@ <argument index="3" name="t" type="float"> </argument> <description> - Cubicly interpolates between this Vector and "b", using "pre_a" and "post_b" as handles, and returning the result at position "t". "t" should be a float of 0.0-1.0, a percentage of how far along the interpolation is. + Cubicly interpolates between this vector and [code]b[/code] using [code]pre_a[/code] and [code]post_b[/code] as handles, and returns the result at position [code]t[/code]. [code]t[/code] is in the range of [code]0.0 - 1.0[/code], or a percentage of how far along the interpolation is. </description> </method> <method name="distance_squared_to"> @@ -111,7 +117,7 @@ <argument index="0" name="to" type="Vector2"> </argument> <description> - Returns the squared distance to vector "b". Prefer this function over "distance_to" if you need to sort vectors or need the squared distance for some formula. + Returns the squared distance to vector [code]b[/code]. Prefer this function over [method distance_to] if you need to sort vectors or need the squared distance for some formula. </description> </method> <method name="distance_to"> @@ -120,7 +126,7 @@ <argument index="0" name="to" type="Vector2"> </argument> <description> - Returns the distance to vector "b". + Returns the distance to vector [code]b[/code]. </description> </method> <method name="dot"> @@ -129,7 +135,7 @@ <argument index="0" name="with" type="Vector2"> </argument> <description> - Returns the dot product with vector "b". + Returns the dot product with vector [code]b[/code]. </description> </method> <method name="floor"> @@ -143,21 +149,21 @@ <return type="bool"> </return> <description> - Returns whether the vector is normalized or not. + Returns [code]true[/code] if the vector is normalized. </description> </method> <method name="length"> <return type="float"> </return> <description> - Returns the length of the vector. + Returns the vector's length. </description> </method> <method name="length_squared"> <return type="float"> </return> <description> - Returns the squared length of the vector. Prefer this function over "length" if you need to sort vectors or need the squared length for some formula. + Returns the vector's length squared. Prefer this function over [member length] if you need to sort vectors or need the squared length for some formula. </description> </method> <method name="linear_interpolate"> @@ -168,14 +174,14 @@ <argument index="1" name="t" type="float"> </argument> <description> - Returns the result of the linear interpolation between this vector and "b", by amount "t". "t" should be a float of 0.0-1.0, a percentage of how far along the interpolation is. + Returns the result of the linear interpolation between this vector and [code]b[/code] by amount [code]t[/code]. [code]t[/code] is in the range of [code]0.0 - 1.0[/code], a percentage of how far along the interpolation is. </description> </method> <method name="normalized"> <return type="Vector2"> </return> <description> - Returns a normalized vector to unit length. + Returns the vector scaled to unit length. Equivalent to [code]v / v.length()[/code]. </description> </method> <method name="reflect"> @@ -184,7 +190,7 @@ <argument index="0" name="n" type="Vector2"> </argument> <description> - Reflects the vector along the given plane, specified by its normal vector. + Returns the vector reflected from a plane defined by the given normal. </description> </method> <method name="rotated"> @@ -193,7 +199,13 @@ <argument index="0" name="phi" type="float"> </argument> <description> - Rotates the vector by "phi" radians. + Returns the vector rotated by [code]phi[/code] radians. + </description> + </method> + <method name="round"> + <return type="Vector2"> + </return> + <description> </description> </method> <method name="slide"> @@ -202,7 +214,7 @@ <argument index="0" name="n" type="Vector2"> </argument> <description> - Slide returns the component of the vector along the given plane, specified by its normal vector. + Returns the component of the vector along a plane defined by the given normal. </description> </method> <method name="snapped"> @@ -211,7 +223,7 @@ <argument index="0" name="by" type="Vector2"> </argument> <description> - Snaps the vector to a grid with the given size. + Returns the vector snapped to a grid with the given size. </description> </method> <method name="tangent"> @@ -224,10 +236,10 @@ </methods> <members> <member name="x" type="float" setter="" getter=""> - X component of the vector. + The vector's x component. </member> <member name="y" type="float" setter="" getter=""> - Y component of the vector. + The vector's y component. </member> </members> <constants> diff --git a/doc/classes/Vector3.xml b/doc/classes/Vector3.xml index 940d4dd6cf..a5fc62b6f0 100644 --- a/doc/classes/Vector3.xml +++ b/doc/classes/Vector3.xml @@ -38,7 +38,7 @@ <argument index="0" name="to" type="Vector3"> </argument> <description> - Returns the vector's minimum angle to the vector [code]to[/code]. + Returns the minimum angle to the given vector. </description> </method> <method name="bounce"> @@ -47,7 +47,7 @@ <argument index="0" name="n" type="Vector3"> </argument> <description> - Bounce returns the vector "bounced off" from the given plane, specified by its normal vector. + Returns the vector "bounced off" from a plane defined by the given normal. </description> </method> <method name="ceil"> @@ -87,7 +87,7 @@ <argument index="0" name="b" type="Vector3"> </argument> <description> - Returns the squared distance to [code]b[/code]. Prefer this function over distance_to if you need to sort vectors or need the squared distance for some formula. + Returns the squared distance to [code]b[/code]. Prefer this function over [method distance_to] if you need to sort vectors or need the squared distance for some formula. </description> </method> <method name="distance_to"> @@ -96,7 +96,7 @@ <argument index="0" name="b" type="Vector3"> </argument> <description> - Returns the distance to b. + Returns the distance to [code]b[/code]. </description> </method> <method name="dot"> @@ -105,7 +105,7 @@ <argument index="0" name="b" type="Vector3"> </argument> <description> - Returns the dot product with b. + Returns the dot product with [code]b[/code]. </description> </method> <method name="floor"> @@ -119,28 +119,28 @@ <return type="Vector3"> </return> <description> - Returns the inverse of the vector. This is the same as Vector3( 1.0 / v.x, 1.0 / v.y, 1.0 / v.z ) + Returns the inverse of the vector. This is the same as [code]Vector3( 1.0 / v.x, 1.0 / v.y, 1.0 / v.z )[/code]. </description> </method> <method name="is_normalized"> <return type="bool"> </return> <description> - Returns whether the vector is normalized or not. + Returns [code]true[/code] if the vector is normalized. </description> </method> <method name="length"> <return type="float"> </return> <description> - Returns the length of the vector. + Returns the vector's length. </description> </method> <method name="length_squared"> <return type="float"> </return> <description> - Returns the length of the vector, squared. Prefer this function over "length" if you need to sort vectors or need the squared length for some formula. + Returns the vector's length squared. Prefer this function over [method length] if you need to sort vectors or need the squared length for some formula. </description> </method> <method name="linear_interpolate"> @@ -151,28 +151,28 @@ <argument index="1" name="t" type="float"> </argument> <description> - Linearly interpolates the vector to a given one (b), by the given amount (t). (t) should be a float of 0.0-1.0, a percentage of how far along the interpolation is. + Returns the result of the linear interpolation between this vector and [code]b[/code] by amount [code]t[/code]. [code]t[/code] is in the range of [code]0.0 - 1.0[/code], a percentage of how far along the interpolation is. </description> </method> <method name="max_axis"> <return type="int"> </return> <description> - Returns AXIS_X, AXIS_Y or AXIS_Z depending on which axis is the largest. + Returns the axis of the vector's largest value. See [code]AXIS_*[/code] constants. </description> </method> <method name="min_axis"> <return type="int"> </return> <description> - Returns AXIS_X, AXIS_Y or AXIS_Z depending on which axis is the smallest. + Returns the axis of the vector's smallest value. See [code]AXIS_*[/code] constants. </description> </method> <method name="normalized"> <return type="Vector3"> </return> <description> - Returns a copy of the normalized vector to unit length. This is the same as v / v.length(). + Returns the vector scaled to unit length. Equivalent to [code]v / v.length()[/code]. </description> </method> <method name="outer"> @@ -181,7 +181,7 @@ <argument index="0" name="b" type="Vector3"> </argument> <description> - Returns the outer product with b. + Returns the outer product with [code]b[/code]. </description> </method> <method name="reflect"> @@ -190,7 +190,7 @@ <argument index="0" name="n" type="Vector3"> </argument> <description> - Reflects the vector along the given plane, specified by its normal vector. + Returns the vector reflected from a plane defined by the given normal. </description> </method> <method name="rotated"> @@ -201,7 +201,13 @@ <argument index="1" name="phi" type="float"> </argument> <description> - Rotates the vector around some axis by phi radians. The axis must be a normalized vector. + Rotates the vector around a given axis by [code]phi[/code] radians. The axis must be a normalized vector. + </description> + </method> + <method name="round"> + <return type="Vector3"> + </return> + <description> </description> </method> <method name="slide"> @@ -210,7 +216,7 @@ <argument index="0" name="n" type="Vector3"> </argument> <description> - Slide returns the component of the vector along the given plane, specified by its normal vector. + Returns the component of the vector along a plane defined by the given normal. </description> </method> <method name="snapped"> @@ -232,18 +238,18 @@ </methods> <members> <member name="x" type="float" setter="" getter=""> - X component of the vector. + The vector's x component. </member> <member name="y" type="float" setter="" getter=""> - Y component of the vector. + The vector's y component. </member> <member name="z" type="float" setter="" getter=""> - Z component of the vector. + The vector's z component. </member> </members> <constants> <constant name="AXIS_X" value="0"> - Enumerated value for the X axis. Returned by functions like max_axis or min_axis. + Enumerated value for the X axis. Returned by [method max_axis] and [method min_axis]. </constant> <constant name="AXIS_Y" value="1"> Enumerated value for the Y axis. diff --git a/doc/classes/VisualServer.xml b/doc/classes/VisualServer.xml index baebddf3e0..893db84640 100644 --- a/doc/classes/VisualServer.xml +++ b/doc/classes/VisualServer.xml @@ -388,14 +388,17 @@ </argument> <argument index="4" name="uvs" type="PoolVector2Array" default="PoolVector2Array( )"> </argument> - <argument index="5" name="texture" type="RID"> + <argument index="5" name="bones" type="PoolIntArray" default="PoolIntArray( )"> </argument> - <argument index="6" name="count" type="int" default="-1"> + <argument index="6" name="weights" type="PoolRealArray" default="PoolRealArray( )"> </argument> - <argument index="7" name="normal_map" type="RID"> + <argument index="7" name="texture" type="RID"> + </argument> + <argument index="8" name="count" type="int" default="-1"> + </argument> + <argument index="9" name="normal_map" type="RID"> </argument> <description> - Adds a triangle array to the [CanvasItem]'s draw commands. </description> </method> <method name="canvas_item_clear"> @@ -3330,6 +3333,32 @@ Sets the texture's image data. If it's a CubeMap, it sets the image data at a cube side. </description> </method> + <method name="texture_set_data_partial"> + <return type="void"> + </return> + <argument index="0" name="texture" type="RID"> + </argument> + <argument index="1" name="image" type="Image"> + </argument> + <argument index="2" name="src_x" type="int"> + </argument> + <argument index="3" name="src_y" type="int"> + </argument> + <argument index="4" name="src_w" type="int"> + </argument> + <argument index="5" name="src_h" type="int"> + </argument> + <argument index="6" name="dst_x" type="int"> + </argument> + <argument index="7" name="dst_y" type="int"> + </argument> + <argument index="8" name="dst_mip" type="int"> + </argument> + <argument index="9" name="cube_side" type="int" enum="VisualServer.CubeMapSide" default="0"> + </argument> + <description> + </description> + </method> <method name="texture_set_flags"> <return type="void"> </return> diff --git a/doc/tools/makerst.py b/doc/tools/makerst.py index 8074ce45ea..adbd810d11 100644..100755 --- a/doc/tools/makerst.py +++ b/doc/tools/makerst.py @@ -106,6 +106,7 @@ def make_class_list(class_list, columns): f.close() + def rstize_text(text, cclass): # Linebreak + tabs in the XML should become two line breaks unless in a "codeblock" pos = 0 @@ -156,7 +157,7 @@ def rstize_text(text, cclass): # Escape * character to avoid interpreting it as emphasis pos = 0 - next_brac_pos = text.find('['); + next_brac_pos = text.find('[') while True: pos = text.find('*', pos, next_brac_pos) if pos == -1: @@ -258,15 +259,17 @@ def rstize_text(text, cclass): elif cmd == 'code': tag_text = '``' inside_code = True + elif cmd.startswith('enum '): + tag_text = make_enum(cmd[5:]) else: tag_text = make_type(tag_text) escape_post = True # Properly escape things like `[Node]s` - if escape_post and post_text and post_text[0].isalnum(): # not punctuation, escape + if escape_post and post_text and post_text[0].isalnum(): # not punctuation, escape post_text = '\ ' + post_text - next_brac_pos = post_text.find('[',0) + next_brac_pos = post_text.find('[', 0) iter_pos = 0 while not inside_code: iter_pos = post_text.find('*', iter_pos, next_brac_pos) @@ -286,7 +289,6 @@ def rstize_text(text, cclass): else: iter_pos += 1 - text = pre_text + tag_text + post_text pos = len(pre_text) + len(tag_text) @@ -299,16 +301,27 @@ def make_type(t): return ':ref:`' + t + '<class_' + t.lower() + '>`' return t + def make_enum(t): global class_names p = t.find(".") + # Global enums such as Error are relative to @GlobalScope. if p >= 0: c = t[0:p] - e = t[p+1:] - if c in class_names: - return ':ref:`' + e + '<enum_' + c.lower() + '_' + e.lower() + '>`' + e = t[p + 1:] + # Variant enums live in GlobalScope but still use periods. + if c == "Variant": + c = "@GlobalScope" + e = "Variant." + e + else: + # Things in GlobalScope don't have a period. + c = "@GlobalScope" + e = t + if c in class_names: + return ':ref:`' + e + '<enum_' + c.lower() + '_' + e.lower() + '>`' return t + def make_method( f, name, @@ -340,7 +353,10 @@ def make_method( if not event: if -1 in mdata['argidx']: - t += make_type(mdata[-1].attrib['type']) + if 'enum' in mdata[-1].attrib: + t += make_enum(mdata[-1].attrib['enum']) + else: + t += make_type(mdata[-1].attrib['type']) else: t += 'void' t += ' ' @@ -362,7 +378,10 @@ def make_method( else: s += ' ' - s += make_type(arg.attrib['type']) + if 'enum' in arg.attrib: + s += make_enum(arg.attrib['enum']) + else: + s += make_type(arg.attrib['type']) if 'name' in arg.attrib: s += ' ' + arg.attrib['name'] else: diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index 1e34d63b13..05dfd69f58 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -244,7 +244,7 @@ OS::TimeZoneInfo OS_Unix::get_time_zone_info() const { void OS_Unix::delay_usec(uint32_t p_usec) const { - struct timespec rem = { p_usec / 1000000, (p_usec % 1000000) * 1000 }; + struct timespec rem = { static_cast<time_t>(p_usec / 1000000), static_cast<long>((p_usec % 1000000) * 1000) }; while (nanosleep(&rem, &rem) == EINTR) { } } diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp index 953d787322..c4a17d5402 100644 --- a/editor/dependency_editor.cpp +++ b/editor/dependency_editor.cpp @@ -504,25 +504,25 @@ void DependencyRemoveDialog::show(const Vector<String> &p_folders, const Vector< void DependencyRemoveDialog::ok_pressed() { + for (int i = 0; i < files_to_delete.size(); ++i) { + if (ResourceCache::has(files_to_delete[i])) { + Resource *res = ResourceCache::get(files_to_delete[i]); + res->set_path(""); + } + String path = OS::get_singleton()->get_resource_dir() + files_to_delete[i].replace_first("res://", "/"); + print_line("Moving to trash: " + path); + Error err = OS::get_singleton()->move_to_trash(path); + if (err != OK) { + EditorNode::get_singleton()->add_io_error(TTR("Cannot remove:") + "\n" + files_to_delete[i] + "\n"); + } + } + if (dirs_to_delete.size() == 0) { //If we only deleted files we should only need to tell the file system about the files we touched. for (int i = 0; i < files_to_delete.size(); ++i) EditorFileSystem::get_singleton()->update_file(files_to_delete[i]); } else { - for (int i = 0; i < files_to_delete.size(); ++i) { - if (ResourceCache::has(files_to_delete[i])) { - Resource *res = ResourceCache::get(files_to_delete[i]); - res->set_path(""); - } - String path = OS::get_singleton()->get_resource_dir() + files_to_delete[i].replace_first("res://", "/"); - print_line("Moving to trash: " + path); - Error err = OS::get_singleton()->move_to_trash(path); - if (err != OK) { - EditorNode::get_singleton()->add_io_error(TTR("Cannot remove:") + "\n" + files_to_delete[i] + "\n"); - } - } - for (int i = 0; i < dirs_to_delete.size(); ++i) { String path = OS::get_singleton()->get_resource_dir() + dirs_to_delete[i].replace_first("res://", "/"); print_line("Moving to trash: " + path); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index fd5a6dffc9..3f0a09cfd9 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -483,7 +483,7 @@ void EditorNode::_fs_changed() { // come during the export export_defer.preset = ""; Error err = OK; - if (!preset->is_runnable() && (export_defer.path.ends_with(".pck") || export_defer.path.ends_with(".zip"))) { + if (export_defer.path.ends_with(".pck") || export_defer.path.ends_with(".zip")) { if (export_defer.path.ends_with(".zip")) { err = platform->export_zip(preset, export_defer.debug, export_defer.path); } else if (export_defer.path.ends_with(".pck")) { diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index b741c432ce..7aca92e3ab 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -298,8 +298,8 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { hints["interface/editor/code_font_hinting"] = PropertyInfo(Variant::INT, "interface/editor/code_font_hinting", PROPERTY_HINT_ENUM, "None,Light,Normal", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); _initial_set("interface/editor/main_font", ""); hints["interface/editor/main_font"] = PropertyInfo(Variant::STRING, "interface/editor/main_font", PROPERTY_HINT_GLOBAL_FILE, "*.ttf,*.otf", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); - _initial_set("interface/editor/main__bold_font", ""); - hints["interface/editor/main_font_bold"] = PropertyInfo(Variant::STRING, "interface/editor/main_bold_font", PROPERTY_HINT_GLOBAL_FILE, "*.ttf,*.otf", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); + _initial_set("interface/editor/main_font_bold", ""); + hints["interface/editor/main_font_bold"] = PropertyInfo(Variant::STRING, "interface/editor/main_font_bold", PROPERTY_HINT_GLOBAL_FILE, "*.ttf,*.otf", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); _initial_set("interface/editor/code_font", ""); hints["interface/editor/code_font"] = PropertyInfo(Variant::STRING, "interface/editor/code_font", PROPERTY_HINT_GLOBAL_FILE, "*.ttf,*.otf", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); _initial_set("interface/editor/dim_editor_on_dialog_popup", true); diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp index af79f9946a..f4be6e8d59 100644 --- a/editor/import/editor_scene_importer_gltf.cpp +++ b/editor/import/editor_scene_importer_gltf.cpp @@ -1163,7 +1163,7 @@ Error EditorSceneImporterGLTF::_parse_images(GLTFState &state, const String &p_b continue; } - if (mimetype.findn("jpg") != -1) { + if (mimetype.findn("jpeg") != -1) { //is a jpg Ref<Image> img = Image::_jpg_mem_loader_func(data_ptr, data_size); diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index 05833704d1..eef72a8b3e 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -65,7 +65,7 @@ void EditorAssetLibraryItem::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - icon->set_normal_texture(get_icon("GodotAssetDefault", "EditorIcons")); + icon->set_normal_texture(get_icon("DefaultProjectIcon", "EditorIcons")); category->add_color_override("font_color", Color(0.5, 0.5, 0.5)); author->add_color_override("font_color", Color(0.5, 0.5, 0.5)); } @@ -110,6 +110,7 @@ EditorAssetLibraryItem::EditorAssetLibraryItem() { add_child(hb); icon = memnew(TextureButton); + icon->set_custom_minimum_size(Size2(64, 64)); icon->set_default_cursor_shape(CURSOR_POINTING_HAND); icon->connect("pressed", this, "_asset_clicked"); @@ -383,7 +384,7 @@ void EditorAssetLibraryItemDownload::configure(const String &p_title, int p_asse icon->set_texture(p_preview); asset_id = p_asset_id; if (!p_preview.is_valid()) - icon->set_texture(get_icon("GodotAssetDefault", "EditorIcons")); + icon->set_texture(get_icon("DefaultProjectIcon", "EditorIcons")); host = p_download_url; sha256 = p_sha256_hash; asset_installer->connect("confirmed", this, "_close"); @@ -694,7 +695,7 @@ void EditorAssetLibrary::_image_update(bool use_cache, bool final, const PoolByt switch (image_queue[p_queue_id].image_type) { case IMAGE_QUEUE_ICON: - image->resize(80 * EDSCALE, 80 * EDSCALE, Image::INTERPOLATE_CUBIC); + image->resize(64 * EDSCALE, 64 * EDSCALE, Image::INTERPOLATE_CUBIC); break; case IMAGE_QUEUE_THUMBNAIL: { @@ -724,7 +725,7 @@ void EditorAssetLibrary::_image_update(bool use_cache, bool final, const PoolByt } if (!image_set && final) { - obj->call("set_image", image_queue[p_queue_id].image_type, image_queue[p_queue_id].image_index, get_icon("ErrorSign", "EditorIcons")); + obj->call("set_image", image_queue[p_queue_id].image_type, image_queue[p_queue_id].image_index, get_icon("DefaultProjectIcon", "EditorIcons")); } } } @@ -767,7 +768,7 @@ void EditorAssetLibrary::_image_request_completed(int p_status, int p_code, cons WARN_PRINTS("Error getting PNG file from URL: " + image_queue[p_queue_id].image_url); Object *obj = ObjectDB::get_instance(image_queue[p_queue_id].target); if (obj) { - obj->call("set_image", image_queue[p_queue_id].image_type, image_queue[p_queue_id].image_index, get_icon("ErrorSign", "EditorIcons")); + obj->call("set_image", image_queue[p_queue_id].image_type, image_queue[p_queue_id].image_index, get_icon("DefaultProjectIcon", "EditorIcons")); } } diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp index 8542296bde..d76c515c1f 100644 --- a/editor/plugins/editor_preview_plugins.cpp +++ b/editor/plugins/editor_preview_plugins.cpp @@ -467,15 +467,6 @@ Ref<Texture> EditorScriptPreviewPlugin::generate(const RES &p_from) { Color text_color = EditorSettings::get_singleton()->get("text_editor/highlighting/text_color"); Color symbol_color = EditorSettings::get_singleton()->get("text_editor/highlighting/symbol_color"); - if (EditorSettings::get_singleton()->get("text_editor/theme/color_theme") == "Adaptive") { - Ref<Theme> tm = EditorNode::get_singleton()->get_theme_base()->get_theme(); - - bg_color = tm->get_color("text_editor/highlighting/background_color", "Editor"); - keyword_color = tm->get_color("text_editor/highlighting/keyword_color", "Editor"); - text_color = tm->get_color("text_editor/highlighting/text_color", "Editor"); - symbol_color = tm->get_color("text_editor/highlighting/symbol_color", "Editor"); - } - img->lock(); if (bg_color.a == 0) diff --git a/main/main.cpp b/main/main.cpp index 9c8474cb5b..5836c9c739 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -262,8 +262,8 @@ void Main::print_help(const char *p_binary) { OS::get_singleton()->print("Standalone tools:\n"); OS::get_singleton()->print(" -s, --script <script> Run a script.\n"); #ifdef TOOLS_ENABLED - OS::get_singleton()->print(" --export <target> Export the project using the given export target.\n"); - OS::get_singleton()->print(" --export-debug Use together with --export, enables debug mode for the template.\n"); + OS::get_singleton()->print(" --export <target> Export the project using the given export target. Export only main pack if path ends with .pck or .zip'.\n"); + OS::get_singleton()->print(" --export-debug <target> Like --export, but use debug template.\n"); OS::get_singleton()->print(" --doctool <path> Dump the engine API reference to the given <path> in XML format, merging if existing files are found.\n"); OS::get_singleton()->print(" --no-docbase Disallow dumping the base types (used with --doctool).\n"); OS::get_singleton()->print(" --build-solutions Build the scripting solutions (e.g. for C# projects).\n"); @@ -337,7 +337,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph String video_driver = ""; String audio_driver = ""; - String game_path = "."; + String project_path = "."; bool upwards = false; String debug_mode; String debug_host; @@ -553,7 +553,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph if (OS::get_singleton()->set_cwd(p) == OK) { //nothing } else { - game_path = I->next()->get(); //use game_path instead + project_path = I->next()->get(); //use project_path instead } N = I->next()->next(); } else { @@ -576,7 +576,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph if (OS::get_singleton()->set_cwd(path) == OK) { // path already specified, don't override } else { - game_path = path; + project_path = path; } #ifdef TOOLS_ENABLED editor = true; @@ -672,35 +672,20 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } else if (I->get() == "--disable-crash-handler") { OS::get_singleton()->disable_crash_handler(); } else { - - //test for game path - bool gpfound = false; - - if (!I->get().begins_with("-") && game_path == "") { - DirAccess *da = DirAccess::open(I->get()); - if (da != NULL) { - game_path = I->get(); - gpfound = true; - memdelete(da); - } - } - - if (!gpfound) { - main_args.push_back(I->get()); - } + main_args.push_back(I->get()); } I = N; } - if (globals->setup(game_path, main_pack, upwards) == OK) { + if (globals->setup(project_path, main_pack, upwards) == OK) { found_project = true; } else { #ifdef TOOLS_ENABLED editor = false; #else - OS::get_singleton()->print("Error: Could not load game path '%s'.\n", game_path.ascii().get_data()); + OS::get_singleton()->print("Error: Could not load game path '%s'.\n", project_path.ascii().get_data()); goto error; #endif @@ -991,7 +976,7 @@ error: video_driver = ""; audio_driver = ""; - game_path = ""; + project_path = ""; args.clear(); main_args.clear(); diff --git a/misc/dist/linux/godot.6 b/misc/dist/linux/godot.6 index 26ebe01af7..64495d817e 100644 --- a/misc/dist/linux/godot.6 +++ b/misc/dist/linux/godot.6 @@ -128,10 +128,10 @@ Print the frames per second to the stdout. Run a script. .TP \fB\-\-export\fR <target> -Export the project using the given export target. +Export the project using the given export target. Export only main pack if path ends with .pck or .zip. .TP \fB\-\-export\-debug\fR -Use together with \fB\-\-export\fR, enables debug mode for the template. +Like \-\-export, but use debug template. .TP \fB\-\-doctool\fR <path> Dump the engine API reference to the given <path> in XML format, merging if existing files are found. diff --git a/modules/csg/config.py b/modules/csg/config.py index 5f133eba90..5e1d916790 100644 --- a/modules/csg/config.py +++ b/modules/csg/config.py @@ -3,3 +3,19 @@ def can_build(platform): def configure(env): pass + +def get_doc_classes(): + return [ + "CSGBox", + "CSGCombiner", + "CSGCylinder", + "CSGMesh", + "CSGPolygon", + "CSGPrimitive", + "CSGShape", + "CSGSphere", + "CSGTorus", + ] + +def get_doc_path(): + return "doc_classes" diff --git a/modules/csg/doc_classes/CSGBox.xml b/modules/csg/doc_classes/CSGBox.xml new file mode 100644 index 0000000000..80455fda80 --- /dev/null +++ b/modules/csg/doc_classes/CSGBox.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="CSGBox" inherits="CSGPrimitive" category="Core" version="3.1"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <members> + <member name="depth" type="float" setter="set_depth" getter="get_depth"> + </member> + <member name="height" type="float" setter="set_height" getter="get_height"> + </member> + <member name="material" type="Material" setter="set_material" getter="get_material"> + </member> + <member name="width" type="float" setter="set_width" getter="get_width"> + </member> + </members> + <constants> + </constants> +</class> diff --git a/modules/csg/doc_classes/CSGCombiner.xml b/modules/csg/doc_classes/CSGCombiner.xml new file mode 100644 index 0000000000..b2265d7703 --- /dev/null +++ b/modules/csg/doc_classes/CSGCombiner.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="CSGCombiner" inherits="CSGShape" category="Core" version="3.1"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <constants> + </constants> +</class> diff --git a/modules/csg/doc_classes/CSGCylinder.xml b/modules/csg/doc_classes/CSGCylinder.xml new file mode 100644 index 0000000000..0cab26ad3d --- /dev/null +++ b/modules/csg/doc_classes/CSGCylinder.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="CSGCylinder" inherits="CSGPrimitive" category="Core" version="3.1"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <members> + <member name="cone" type="bool" setter="set_cone" getter="is_cone"> + </member> + <member name="height" type="float" setter="set_height" getter="get_height"> + </member> + <member name="material" type="Material" setter="set_material" getter="get_material"> + </member> + <member name="radius" type="float" setter="set_radius" getter="get_radius"> + </member> + <member name="sides" type="int" setter="set_sides" getter="get_sides"> + </member> + <member name="smooth_faces" type="bool" setter="set_smooth_faces" getter="get_smooth_faces"> + </member> + </members> + <constants> + </constants> +</class> diff --git a/modules/csg/doc_classes/CSGMesh.xml b/modules/csg/doc_classes/CSGMesh.xml new file mode 100644 index 0000000000..e5c3e5ccf3 --- /dev/null +++ b/modules/csg/doc_classes/CSGMesh.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="CSGMesh" inherits="CSGPrimitive" category="Core" version="3.1"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <members> + <member name="mesh" type="Mesh" setter="set_mesh" getter="get_mesh"> + </member> + </members> + <constants> + </constants> +</class> diff --git a/modules/csg/doc_classes/CSGPolygon.xml b/modules/csg/doc_classes/CSGPolygon.xml new file mode 100644 index 0000000000..379c512d6a --- /dev/null +++ b/modules/csg/doc_classes/CSGPolygon.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="CSGPolygon" inherits="CSGPrimitive" category="Core" version="3.1"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <members> + <member name="depth" type="float" setter="set_depth" getter="get_depth"> + </member> + <member name="material" type="Material" setter="set_material" getter="get_material"> + </member> + <member name="mode" type="int" setter="set_mode" getter="get_mode" enum="CSGPolygon.Mode"> + </member> + <member name="path_interval" type="float" setter="set_path_interval" getter="get_path_interval"> + </member> + <member name="path_node" type="NodePath" setter="set_path_node" getter="get_path_node"> + </member> + <member name="path_rotation" type="int" setter="set_path_rotation" getter="get_path_rotation" enum="CSGPolygon.PathRotation"> + </member> + <member name="polygon" type="PoolVector2Array" setter="set_polygon" getter="get_polygon"> + </member> + <member name="smooth_faces" type="bool" setter="set_smooth_faces" getter="get_smooth_faces"> + </member> + <member name="spin_degrees" type="float" setter="set_spin_degrees" getter="get_spin_degrees"> + </member> + <member name="spin_sides" type="int" setter="set_spin_sides" getter="get_spin_sides"> + </member> + </members> + <constants> + <constant name="MODE_DEPTH" value="0" enum="Mode"> + </constant> + <constant name="MODE_SPIN" value="1" enum="Mode"> + </constant> + <constant name="MODE_PATH" value="2" enum="Mode"> + </constant> + <constant name="PATH_ROTATION_POLYGON" value="0" enum="PathRotation"> + </constant> + <constant name="PATH_ROTATION_PATH" value="1" enum="PathRotation"> + </constant> + <constant name="PATH_ROTATION_PATH_FOLLOW" value="2" enum="PathRotation"> + </constant> + </constants> +</class> diff --git a/modules/csg/doc_classes/CSGPrimitive.xml b/modules/csg/doc_classes/CSGPrimitive.xml new file mode 100644 index 0000000000..bf41c40f22 --- /dev/null +++ b/modules/csg/doc_classes/CSGPrimitive.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="CSGPrimitive" inherits="CSGShape" category="Core" version="3.1"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <members> + <member name="invert_faces" type="bool" setter="set_invert_faces" getter="is_inverting_faces"> + </member> + </members> + <constants> + </constants> +</class> diff --git a/modules/csg/doc_classes/CSGShape.xml b/modules/csg/doc_classes/CSGShape.xml new file mode 100644 index 0000000000..cf236a4207 --- /dev/null +++ b/modules/csg/doc_classes/CSGShape.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="CSGShape" inherits="VisualInstance" category="Core" version="3.1"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + <method name="is_root_shape" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> + </methods> + <members> + <member name="operation" type="int" setter="set_operation" getter="get_operation" enum="CSGShape.Operation"> + </member> + <member name="snap" type="float" setter="set_snap" getter="get_snap"> + </member> + <member name="use_collision" type="bool" setter="set_use_collision" getter="is_using_collision"> + </member> + </members> + <constants> + <constant name="OPERATION_UNION" value="0" enum="Operation"> + </constant> + <constant name="OPERATION_INTERSECTION" value="1" enum="Operation"> + </constant> + <constant name="OPERATION_SUBTRACTION" value="2" enum="Operation"> + </constant> + </constants> +</class> diff --git a/modules/csg/doc_classes/CSGSphere.xml b/modules/csg/doc_classes/CSGSphere.xml new file mode 100644 index 0000000000..520368506e --- /dev/null +++ b/modules/csg/doc_classes/CSGSphere.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="CSGSphere" inherits="CSGPrimitive" category="Core" version="3.1"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <members> + <member name="material" type="Material" setter="set_material" getter="get_material"> + </member> + <member name="radial_segments" type="int" setter="set_radial_segments" getter="get_radial_segments"> + </member> + <member name="radius" type="float" setter="set_radius" getter="get_radius"> + </member> + <member name="rings" type="int" setter="set_rings" getter="get_rings"> + </member> + <member name="smooth_faces" type="bool" setter="set_smooth_faces" getter="get_smooth_faces"> + </member> + </members> + <constants> + </constants> +</class> diff --git a/modules/csg/doc_classes/CSGTorus.xml b/modules/csg/doc_classes/CSGTorus.xml new file mode 100644 index 0000000000..58bbef2600 --- /dev/null +++ b/modules/csg/doc_classes/CSGTorus.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="CSGTorus" inherits="CSGPrimitive" category="Core" version="3.1"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <demos> + </demos> + <methods> + </methods> + <members> + <member name="inner_radius" type="float" setter="set_inner_radius" getter="get_inner_radius"> + </member> + <member name="material" type="Material" setter="set_material" getter="get_material"> + </member> + <member name="outer_radius" type="float" setter="set_outer_radius" getter="get_outer_radius"> + </member> + <member name="ring_sides" type="int" setter="set_ring_sides" getter="get_ring_sides"> + </member> + <member name="sides" type="int" setter="set_sides" getter="get_sides"> + </member> + <member name="smooth_faces" type="bool" setter="set_smooth_faces" getter="get_smooth_faces"> + </member> + </members> + <constants> + </constants> +</class> diff --git a/modules/enet/doc_classes/NetworkedMultiplayerENet.xml b/modules/enet/doc_classes/NetworkedMultiplayerENet.xml index 4b2a9df8c4..d5fd4bff09 100644 --- a/modules/enet/doc_classes/NetworkedMultiplayerENet.xml +++ b/modules/enet/doc_classes/NetworkedMultiplayerENet.xml @@ -65,6 +65,20 @@ Disconnect the given peer. If "now" is set to true, the connection will be closed immediately without flushing queued messages. </description> </method> + <method name="get_last_packet_channel" qualifiers="const"> + <return type="int"> + </return> + <description> + Returns the channel of the last packet fetched via [method PacketPeer.get_packet] + </description> + </method> + <method name="get_packet_channel" qualifiers="const"> + <return type="int"> + </return> + <description> + Returns the channel of the next packet that will be retrieved via [method PacketPeer.get_packet_peer] + </description> + </method> <method name="get_peer_address" qualifiers="const"> <return type="String"> </return> @@ -94,9 +108,18 @@ </method> </methods> <members> + <member name="always_ordered" type="bool" setter="set_always_ordered" getter="is_always_ordered"> + Always use [code]TRANSFER_MODE_ORDERED[/code] in place of [code]TRANSFER_MODE_UNRELIABLE[/code]. This is the only way to use ordering with the RPC system. + </member> + <member name="channel_count" type="int" setter="set_channel_count" getter="get_channel_count"> + The number of channels to be used by ENet. Default: [code]3[/code]. Channels are used to separate different kinds of data. In realiable or ordered mode, for example, the packet delivery order is ensured on a per channel basis. + </member> <member name="compression_mode" type="int" setter="set_compression_mode" getter="get_compression_mode" enum="NetworkedMultiplayerENet.CompressionMode"> The compression method used for network packets. Default is no compression. These have different tradeoffs of compression speed versus bandwidth, you may need to test which one works best for your use case if you use compression at all. </member> + <member name="transfer_channel" type="int" setter="set_transfer_channel" getter="get_transfer_channel"> + Set the default channel to be used to transfer data. By default this value is [code]-1[/code] which means that ENet will only use 2 channels, one for reliable and one for unreliable packets. Channel [code]0[/code] is reserved, and cannot be used. Setting this member to any value between [code]0[/code] and [member channel_count] (excluded) will force ENet to use that channel for sending data. + </member> </members> <constants> <constant name="COMPRESS_NONE" value="0" enum="CompressionMode"> diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp index e948df2742..88768829d7 100644 --- a/modules/enet/networked_multiplayer_enet.cpp +++ b/modules/enet/networked_multiplayer_enet.cpp @@ -55,6 +55,22 @@ int NetworkedMultiplayerENet::get_packet_peer() const { return incoming_packets.front()->get().from; } +int NetworkedMultiplayerENet::get_packet_channel() const { + + ERR_FAIL_COND_V(!active, -1); + ERR_FAIL_COND_V(incoming_packets.size() == 0, -1); + + return incoming_packets.front()->get().channel; +} + +int NetworkedMultiplayerENet::get_last_packet_channel() const { + + ERR_FAIL_COND_V(!active, -1); + ERR_FAIL_COND_V(!current_packet.packet, -1); + + return current_packet.channel; +} + Error NetworkedMultiplayerENet::create_server(int p_port, int p_max_clients, int p_in_bandwidth, int p_out_bandwidth) { ERR_FAIL_COND_V(active, ERR_ALREADY_IN_USE); @@ -83,7 +99,7 @@ Error NetworkedMultiplayerENet::create_server(int p_port, int p_max_clients, int host = enet_host_create(&address /* the address to bind the server host to */, p_max_clients /* allow up to 32 clients and/or outgoing connections */, - SYSCH_MAX /* allow up to SYSCH_MAX channels to be used */, + channel_count /* allow up to channel_count to be used */, p_in_bandwidth /* limit incoming bandwith if > 0 */, p_out_bandwidth /* limit outgoing bandwith if > 0 */); @@ -127,13 +143,13 @@ Error NetworkedMultiplayerENet::create_client(const String &p_address, int p_por host = enet_host_create(&c_client /* create a client host */, 1 /* only allow 1 outgoing connection */, - SYSCH_MAX /* allow up to SYSCH_MAX channels to be used */, + channel_count /* allow up to channel_count to be used */, p_in_bandwidth /* limit incoming bandwith if > 0 */, p_out_bandwidth /* limit outgoing bandwith if > 0 */); } else { host = enet_host_create(NULL /* create a client host */, 1 /* only allow 1 outgoing connection */, - SYSCH_MAX /* allow up to SYSCH_MAX channels to be used */, + channel_count /* allow up to channel_count to be used */, p_in_bandwidth /* limit incoming bandwith if > 0 */, p_out_bandwidth /* limit outgoing bandwith if > 0 */); } @@ -167,7 +183,7 @@ Error NetworkedMultiplayerENet::create_client(const String &p_address, int p_por unique_id = _gen_unique_id(); // Initiate connection, allocating enough channels - ENetPeer *peer = enet_host_connect(host, &address, SYSCH_MAX, unique_id); + ENetPeer *peer = enet_host_connect(host, &address, channel_count, unique_id); if (peer == NULL) { enet_host_destroy(host); @@ -316,7 +332,7 @@ void NetworkedMultiplayerENet::poll() { } enet_packet_destroy(event.packet); - } else if (event.channelID < SYSCH_MAX) { + } else if (event.channelID < channel_count) { Packet packet; packet.packet = event.packet; @@ -330,6 +346,7 @@ void NetworkedMultiplayerENet::poll() { uint32_t flags = decode_uint32(&event.packet->data[8]); packet.from = source; + packet.channel = event.channelID; if (server) { // Someone is cheating and trying to fake the source! @@ -496,7 +513,10 @@ Error NetworkedMultiplayerENet::put_packet(const uint8_t *p_buffer, int p_buffer switch (transfer_mode) { case TRANSFER_MODE_UNRELIABLE: { - packet_flags = ENET_PACKET_FLAG_UNSEQUENCED; + if (always_ordered) + packet_flags = 0; + else + packet_flags = ENET_PACKET_FLAG_UNSEQUENCED; channel = SYSCH_UNRELIABLE; } break; case TRANSFER_MODE_UNRELIABLE_ORDERED: { @@ -509,6 +529,9 @@ Error NetworkedMultiplayerENet::put_packet(const uint8_t *p_buffer, int p_buffer } break; } + if (transfer_channel > SYSCH_CONFIG) + channel = transfer_channel; + Map<int, ENetPeer *>::Element *E = NULL; if (target_peer != 0) { @@ -572,6 +595,7 @@ void NetworkedMultiplayerENet::_pop_current_packet() { enet_packet_destroy(current_packet.packet); current_packet.packet = NULL; current_packet.from = 0; + current_packet.channel = -1; } } @@ -759,6 +783,40 @@ int NetworkedMultiplayerENet::get_peer_port(int p_peer_id) const { #endif } +void NetworkedMultiplayerENet::set_transfer_channel(int p_channel) { + + ERR_FAIL_COND(p_channel < -1 || p_channel >= channel_count); + + if (p_channel == SYSCH_CONFIG) { + ERR_EXPLAIN("Channel " + itos(SYSCH_CONFIG) + " is reserved"); + ERR_FAIL(); + } + transfer_channel = p_channel; +} + +int NetworkedMultiplayerENet::get_transfer_channel() const { + return transfer_channel; +} + +void NetworkedMultiplayerENet::set_channel_count(int p_channel) { + + ERR_FAIL_COND(active); + ERR_FAIL_COND(p_channel < SYSCH_MAX); + channel_count = p_channel; +} + +int NetworkedMultiplayerENet::get_channel_count() const { + return channel_count; +} + +void NetworkedMultiplayerENet::set_always_ordered(bool p_ordered) { + always_ordered = p_ordered; +} + +bool NetworkedMultiplayerENet::is_always_ordered() const { + return always_ordered; +} + void NetworkedMultiplayerENet::_bind_methods() { ClassDB::bind_method(D_METHOD("create_server", "port", "max_clients", "in_bandwidth", "out_bandwidth"), &NetworkedMultiplayerENet::create_server, DEFVAL(32), DEFVAL(0), DEFVAL(0)); @@ -771,7 +829,19 @@ void NetworkedMultiplayerENet::_bind_methods() { ClassDB::bind_method(D_METHOD("get_peer_address", "id"), &NetworkedMultiplayerENet::get_peer_address); ClassDB::bind_method(D_METHOD("get_peer_port", "id"), &NetworkedMultiplayerENet::get_peer_port); + ClassDB::bind_method(D_METHOD("get_packet_channel"), &NetworkedMultiplayerENet::get_packet_channel); + ClassDB::bind_method(D_METHOD("get_last_packet_channel"), &NetworkedMultiplayerENet::get_last_packet_channel); + ClassDB::bind_method(D_METHOD("set_transfer_channel", "channel"), &NetworkedMultiplayerENet::set_transfer_channel); + ClassDB::bind_method(D_METHOD("get_transfer_channel"), &NetworkedMultiplayerENet::get_transfer_channel); + ClassDB::bind_method(D_METHOD("set_channel_count", "channels"), &NetworkedMultiplayerENet::set_channel_count); + ClassDB::bind_method(D_METHOD("get_channel_count"), &NetworkedMultiplayerENet::get_channel_count); + ClassDB::bind_method(D_METHOD("set_always_ordered", "ordered"), &NetworkedMultiplayerENet::set_always_ordered); + ClassDB::bind_method(D_METHOD("is_always_ordered"), &NetworkedMultiplayerENet::is_always_ordered); + ADD_PROPERTY(PropertyInfo(Variant::INT, "compression_mode", PROPERTY_HINT_ENUM, "None,Range Coder,FastLZ,ZLib,ZStd"), "set_compression_mode", "get_compression_mode"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "transfer_channel"), "set_transfer_channel", "get_transfer_channel"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "channel_count"), "set_channel_count", "get_channel_count"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "always_ordered"), "set_always_ordered", "is_always_ordered"); BIND_ENUM_CONSTANT(COMPRESS_NONE); BIND_ENUM_CONSTANT(COMPRESS_RANGE_CODER); @@ -789,6 +859,9 @@ NetworkedMultiplayerENet::NetworkedMultiplayerENet() { target_peer = 0; current_packet.packet = NULL; transfer_mode = TRANSFER_MODE_RELIABLE; + channel_count = SYSCH_MAX; + transfer_channel = -1; + always_ordered = false; connection_status = CONNECTION_DISCONNECTED; compression_mode = COMPRESS_NONE; enet_compressor.context = this; diff --git a/modules/enet/networked_multiplayer_enet.h b/modules/enet/networked_multiplayer_enet.h index d481f5d496..705807d429 100644 --- a/modules/enet/networked_multiplayer_enet.h +++ b/modules/enet/networked_multiplayer_enet.h @@ -68,6 +68,9 @@ private: int target_peer; TransferMode transfer_mode; + int transfer_channel; + int channel_count; + bool always_ordered; ENetEvent event; ENetPeer *peer; @@ -83,6 +86,7 @@ private: ENetPacket *packet; int from; + int channel; }; CompressionMode compression_mode; @@ -145,6 +149,15 @@ public: void set_compression_mode(CompressionMode p_mode); CompressionMode get_compression_mode() const; + int get_packet_channel() const; + int get_last_packet_channel() const; + void set_transfer_channel(int p_channel); + int get_transfer_channel() const; + void set_channel_count(int p_channel); + int get_channel_count() const; + void set_always_ordered(bool p_ordered); + bool is_always_ordered() const; + NetworkedMultiplayerENet(); ~NetworkedMultiplayerENet(); diff --git a/modules/freetype/SCsub b/modules/freetype/SCsub index 8a7c2a773a..301f218361 100644 --- a/modules/freetype/SCsub +++ b/modules/freetype/SCsub @@ -17,18 +17,15 @@ if env['builtin_freetype']: "src/base/ftbitmap.c", "src/base/ftcid.c", "src/base/ftdebug.c", - "src/base/ftfntfmt.c", "src/base/ftfstype.c", "src/base/ftgasp.c", "src/base/ftglyph.c", "src/base/ftgxval.c", "src/base/ftinit.c", - "src/base/ftlcdfil.c", "src/base/ftmm.c", "src/base/ftotval.c", "src/base/ftpatent.c", "src/base/ftpfr.c", - "src/base/ftpic.c", "src/base/ftstroke.c", "src/base/ftsynth.c", "src/base/ftsystem.c", diff --git a/modules/gdnative/SCsub b/modules/gdnative/SCsub index 8654ef3d82..6d2f8ce8ad 100644 --- a/modules/gdnative/SCsub +++ b/modules/gdnative/SCsub @@ -23,7 +23,8 @@ def _build_gdnative_api_struct_header(api): '\textern const godot_gdnative_core_api_struct *_gdnative_wrapper_api_struct;' ] - for name in api['extensions']: + for ext in api['extensions']: + name = ext['name'] gdnative_api_init_macro.append( '\textern const godot_gdnative_ext_{0}_api_struct *_gdnative_wrapper_{0}_api_struct;'.format(name)) @@ -31,9 +32,10 @@ def _build_gdnative_api_struct_header(api): gdnative_api_init_macro.append('\tfor (unsigned int i = 0; i < _gdnative_wrapper_api_struct->num_extensions; i++) { ') gdnative_api_init_macro.append('\t\tswitch (_gdnative_wrapper_api_struct->extensions[i]->type) {') - for name in api['extensions']: + for ext in api['extensions']: + name = ext['name'] gdnative_api_init_macro.append( - '\t\t\tcase GDNATIVE_EXT_%s:' % api['extensions'][name]['type']) + '\t\t\tcase GDNATIVE_EXT_%s:' % ext['type']) gdnative_api_init_macro.append( '\t\t\t\t_gdnative_wrapper_{0}_api_struct = (godot_gdnative_ext_{0}_api_struct *)' ' _gdnative_wrapper_api_struct->extensions[i];'.format(name)) @@ -61,8 +63,8 @@ def _build_gdnative_api_struct_header(api): '\tGDNATIVE_' + api['core']['type'] + ',' ] - for name in api['extensions']: - out += ['\tGDNATIVE_EXT_' + api['extensions'][name]['type'] + ','] + for ext in api['extensions']: + out += ['\tGDNATIVE_EXT_' + ext['type'] + ','] out += ['};', ''] @@ -88,8 +90,9 @@ def _build_gdnative_api_struct_header(api): return ret_val - for name in api['extensions']: - out += generate_extension_struct(name, api['extensions'][name], False) + for ext in api['extensions']: + name = ext['name'] + out += generate_extension_struct(name, ext, False) out += [ 'typedef struct godot_gdnative_core_api_struct {', @@ -151,12 +154,14 @@ def _build_gdnative_api_struct_source(api): return ret_val - for name in api['extensions']: - out += get_extension_struct_definition(name, api['extensions'][name], False) + for ext in api['extensions']: + name = ext['name'] + out += get_extension_struct_definition(name, ext, False) out += ['', 'const godot_gdnative_api_struct *gdnative_extensions_pointers[] = {'] - for name in api['extensions']: + for ext in api['extensions']: + name = ext['name'] out += ['\t(godot_gdnative_api_struct *)&api_extension_' + name + '_struct,'] out += ['};\n'] @@ -214,7 +219,8 @@ def _build_gdnative_wrapper_code(api): 'godot_gdnative_core_api_struct *_gdnative_wrapper_api_struct = 0;', ] - for name in api['extensions']: + for ext in api['extensions']: + name = ext['name'] out.append('godot_gdnative_ext_' + name + '_api_struct *_gdnative_wrapper_' + name + '_api_struct = 0;') out += [''] @@ -232,8 +238,9 @@ def _build_gdnative_wrapper_code(api): out.append('}') out.append('') - for name in api['extensions']: - for funcdef in api['extensions'][name]['api']: + for ext in api['extensions']: + name = ext['name'] + for funcdef in ext['api']: args = ', '.join(['%s%s' % (_spaced(t), n) for t, n in funcdef['arguments']]) out.append('%s%s(%s) {' % (_spaced(funcdef['return_type']), funcdef['name'], args)) @@ -267,7 +274,7 @@ def build_gdnative_wrapper_code(target, source, env): if ARGUMENTS.get('gdnative_wrapper', False): - #build wrapper code +#build wrapper code gensource, = gdn_env.Command('gdnative_wrapper_code.gen.cpp', 'gdnative_api.json', build_gdnative_wrapper_code) gd_wrapper_env = env.Clone() diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json index f41c3859bd..9fcf61af8a 100644 --- a/modules/gdnative/gdnative_api.json +++ b/modules/gdnative/gdnative_api.json @@ -5756,8 +5756,9 @@ } ] }, - "extensions": { - "nativescript": { + "extensions": [ + { + "name": "nativescript", "type": "NATIVESCRIPT", "version": { "major": 1, @@ -5942,7 +5943,8 @@ } ] }, - "pluginscript": { + { + "name": "pluginscript", "type": "PLUGINSCRIPT", "version": { "major": 1, @@ -5959,7 +5961,8 @@ } ] }, - "arvr": { + { + "name": "arvr", "type": "ARVR", "version": { "major": 1, @@ -6055,5 +6058,5 @@ } ] } - } + ] } diff --git a/modules/webm/libvpx/SCsub b/modules/webm/libvpx/SCsub index b09c232b3c..c681e2b34f 100644 --- a/modules/webm/libvpx/SCsub +++ b/modules/webm/libvpx/SCsub @@ -263,7 +263,7 @@ if env["platform"] == 'uwp': webm_cpu_x86 = True else: import platform - is_x11_or_server_arm = ((env["platform"] == 'x11' or env["platform"] == 'server') and platform.machine().startswith('arm')) + is_x11_or_server_arm = ((env["platform"] == 'x11' or env["platform"] == 'server') and (platform.machine().startswith('arm') or platform.machine().startswith('aarch'))) is_ios_x86 = (env["platform"] == 'iphone' and env["ios_sim"]) is_android_x86 = (env["platform"] == 'android' and env["android_arch"] == 'x86') if is_android_x86: @@ -337,7 +337,6 @@ if webm_cpu_arm: if webm_simd_optimizations == False: print("WebM SIMD optimizations are disabled. Check if your CPU architecture, CPU bits or platform are supported!") - env_libvpx.add_source_files(env.modules_sources, libvpx_sources) if webm_cpu_x86: is_clang_or_gcc = ('gcc' in env["CC"]) or ('clang' in env["CC"]) or ("OSXCROSS_ROOT" in os.environ) @@ -379,5 +378,5 @@ elif webm_cpu_arm: env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm_neon_armasm_ms) elif env["platform"] == 'iphone': env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm_neon_gas_apple) - elif not env["android_arch"] == 'arm64v8': + elif (is_x11_or_server_arm and cpu_bits == '32') or (env["platform"] == 'android' and not env["android_arch"] == 'arm64v8'): env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm_neon_gas) diff --git a/platform/iphone/app_delegate.mm b/platform/iphone/app_delegate.mm index 7ed1328b20..dd5ce4ab10 100644 --- a/platform/iphone/app_delegate.mm +++ b/platform/iphone/app_delegate.mm @@ -709,21 +709,18 @@ static int frame_count = 0; iphone_finish(); }; -- (void)applicationDidEnterBackground:(UIApplication *)application { - ///@TODO maybe add pause motionManager? and where would we unpause it? +// When application goes to background (e.g. user switches to another app or presses Home), +// then applicationWillResignActive -> applicationDidEnterBackground are called. +// When user opens the inactive app again, +// applicationWillEnterForeground -> applicationDidBecomeActive are called. - on_focus_out(view_controller, &is_focus_out); -} - -- (void)applicationWillEnterForeground:(UIApplication *)application { - // OS::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_FOCUS_IN); - [view_controller.view startAnimation]; -} +// There are cases when applicationWillResignActive -> applicationDidBecomeActive +// sequence is called without the app going to background. For example, that happens +// if you open the app list without switching to another app or open/close the +// notification panel by swiping from the upper part of the screen. - (void)applicationWillResignActive:(UIApplication *)application { - // OS::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_FOCUS_OUT); - [view_controller.view - stopAnimation]; // FIXME: pause seems to be recommended elsewhere + on_focus_out(view_controller, &is_focus_out); } - (void)applicationDidBecomeActive:(UIApplication *)application { diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 80d466f4b6..bde0b4e898 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -541,7 +541,9 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; } - (void)cursorUpdate:(NSEvent *)event { - //setModeCursor(window, window->cursorMode); + OS::CursorShape p_shape = OS_OSX::singleton->cursor_shape; + OS_OSX::singleton->cursor_shape = OS::CURSOR_MAX; + OS_OSX::singleton->set_cursor_shape(p_shape); } static void _mouseDownEvent(NSEvent *event, int index, int mask, bool pressed) { @@ -656,11 +658,12 @@ static void _mouseDownEvent(NSEvent *event, int index, int mask, bool pressed) { return; if (OS_OSX::singleton->main_loop && OS_OSX::singleton->mouse_mode != OS::MOUSE_MODE_CAPTURED) OS_OSX::singleton->main_loop->notification(MainLoop::NOTIFICATION_WM_MOUSE_ENTER); - if (OS_OSX::singleton->input) { + if (OS_OSX::singleton->input) OS_OSX::singleton->input->set_mouse_in_window(true); - OS_OSX::singleton->cursor_shape = OS::CURSOR_MAX; - OS_OSX::singleton->set_cursor_shape(OS::CURSOR_ARROW); - } + + OS::CursorShape p_shape = OS_OSX::singleton->cursor_shape; + OS_OSX::singleton->cursor_shape = OS::CURSOR_MAX; + OS_OSX::singleton->set_cursor_shape(p_shape); } - (void)magnifyWithEvent:(NSEvent *)event { @@ -847,16 +850,16 @@ struct _KeyCodeMap { static const _KeyCodeMap _keycodes[55] = { { '`', KEY_QUOTELEFT }, { '~', KEY_ASCIITILDE }, - { '0', KEY_KP_0 }, - { '1', KEY_KP_1 }, - { '2', KEY_KP_2 }, - { '3', KEY_KP_3 }, - { '4', KEY_KP_4 }, - { '5', KEY_KP_5 }, - { '6', KEY_KP_6 }, - { '7', KEY_KP_7 }, - { '8', KEY_KP_8 }, - { '9', KEY_KP_9 }, + { '0', KEY_0 }, + { '1', KEY_1 }, + { '2', KEY_2 }, + { '3', KEY_3 }, + { '4', KEY_4 }, + { '5', KEY_5 }, + { '6', KEY_6 }, + { '7', KEY_7 }, + { '8', KEY_8 }, + { '9', KEY_9 }, { '-', KEY_MINUS }, { '_', KEY_UNDERSCORE }, { '=', KEY_EQUAL }, @@ -1594,6 +1597,11 @@ void OS_OSX::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c if (p_shape == CURSOR_ARROW) { [cursor set]; } + } else { + // Reset to default system cursor + cursors[p_shape] = NULL; + cursor_shape = CURSOR_MAX; + set_cursor_shape(p_shape); } } @@ -2419,12 +2427,21 @@ void OS_OSX::run() { //int frames=0; //uint64_t frame=0; - while (!force_quit) { + bool quit = false; - process_events(); // get rid of pending events - joypad_osx->process_joypads(); - if (Main::iteration() == true) - break; + while (!force_quit && !quit) { + + @try { + + process_events(); // get rid of pending events + joypad_osx->process_joypads(); + + if (Main::iteration() == true) { + quit = true; + } + } @catch (NSException *exception) { + ERR_PRINTS("NSException: " + String([exception reason].UTF8String)); + } }; main_loop->finish(); diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 2850d38ce4..d6cdea7b88 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -2117,6 +2117,11 @@ void OS_Windows::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shap if (hXorMask != NULL) { DeleteObject(hXorMask); } + } else { + // Reset to default system cursor + cursors[p_shape] = NULL; + cursor_shape = CURSOR_MAX; + set_cursor_shape(p_shape); } } diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 117995ea48..eec371865e 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -2486,6 +2486,14 @@ void OS_X11::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c if (p_shape == CURSOR_ARROW) { XDefineCursor(x11_display, x11_window, cursors[p_shape]); } + } else { + // Reset to default system cursor + if (img[p_shape]) { + cursors[p_shape] = XcursorImageLoadCursor(x11_display, img[p_shape]); + } + + current_cursor = CURSOR_MAX; + set_cursor_shape(p_shape); } } diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp index 5512fd4f10..0577a23ea6 100644 --- a/scene/3d/physics_body.cpp +++ b/scene/3d/physics_body.cpp @@ -1825,6 +1825,7 @@ void PhysicalBone::_notification(int p_what) { parent_skeleton = find_skeleton_parent(get_parent()); update_bone_id(); reset_to_rest_position(); + _reset_physics_simulation_state(); break; case NOTIFICATION_EXIT_TREE: if (parent_skeleton) { @@ -1886,10 +1887,8 @@ void PhysicalBone::_bind_methods() { ClassDB::bind_method(D_METHOD("set_body_offset", "offset"), &PhysicalBone::set_body_offset); ClassDB::bind_method(D_METHOD("get_body_offset"), &PhysicalBone::get_body_offset); - ClassDB::bind_method(D_METHOD("set_static_body", "simulate"), &PhysicalBone::set_static_body); ClassDB::bind_method(D_METHOD("is_static_body"), &PhysicalBone::is_static_body); - ClassDB::bind_method(D_METHOD("set_simulate_physics", "simulate"), &PhysicalBone::set_simulate_physics); ClassDB::bind_method(D_METHOD("get_simulate_physics"), &PhysicalBone::get_simulate_physics); ClassDB::bind_method(D_METHOD("is_simulating_physics"), &PhysicalBone::is_simulating_physics); @@ -1913,9 +1912,7 @@ void PhysicalBone::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "joint_type", PROPERTY_HINT_ENUM, "None,PinJoint,ConeJoint,HingeJoint,SliderJoint,6DOFJoint"), "set_joint_type", "get_joint_type"); ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "joint_offset"), "set_joint_offset", "get_joint_offset"); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "simulate_physics"), "set_simulate_physics", "get_simulate_physics"); ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "body_offset"), "set_body_offset", "get_body_offset"); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "static_body"), "set_static_body", "is_static_body"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "mass", PROPERTY_HINT_EXP_RANGE, "0.01,65535,0.01"), "set_mass", "get_mass"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "weight", PROPERTY_HINT_EXP_RANGE, "0.01,65535,0.01"), "set_weight", "get_weight"); @@ -2255,8 +2252,8 @@ PhysicalBone::PhysicalBone() : joint_data(NULL), static_body(false), simulate_physics(false), - _internal_static_body(!static_body), - _internal_simulate_physics(simulate_physics), + _internal_static_body(false), + _internal_simulate_physics(false), bone_id(-1), parent_skeleton(NULL), bone_name(""), diff --git a/scene/3d/skeleton.cpp b/scene/3d/skeleton.cpp index a7eb54c85d..76d90dc6ff 100644 --- a/scene/3d/skeleton.cpp +++ b/scene/3d/skeleton.cpp @@ -330,7 +330,7 @@ void Skeleton::add_bone(const String &p_name) { _make_dirty(); update_gizmo(); } -int Skeleton::find_bone(String p_name) const { +int Skeleton::find_bone(const String &p_name) const { for (int i = 0; i < bones.size(); i++) { @@ -347,6 +347,19 @@ String Skeleton::get_bone_name(int p_bone) const { return bones[p_bone].name; } +bool Skeleton::is_bone_parent_of(int p_bone, int p_parent_bone_id) const { + + int parent_of_bone = get_bone_parent(p_bone); + + if (-1 == parent_of_bone) + return false; + + if (parent_of_bone == p_parent_bone_id) + return true; + + return is_bone_parent_of(parent_of_bone, p_parent_bone_id); +} + int Skeleton::get_bone_count() const { return bones.size(); @@ -534,18 +547,6 @@ void Skeleton::localize_rests() { } } -void _notify_physical_bones_simulation(bool start, Node *p_node) { - - for (int i = p_node->get_child_count() - 1; 0 <= i; --i) { - _notify_physical_bones_simulation(start, p_node->get_child(i)); - } - - PhysicalBone *pb = Object::cast_to<PhysicalBone>(p_node); - if (pb) { - pb->set_simulate_physics(start); - } -} - void Skeleton::bind_physical_bone_to_bone(int p_bone, PhysicalBone *p_physical_bone) { ERR_FAIL_INDEX(p_bone, bones.size()); ERR_FAIL_COND(bones[p_bone].physical_bone); @@ -603,8 +604,67 @@ void Skeleton::_rebuild_physical_bones_cache() { } } -void Skeleton::physical_bones_simulation(bool start) { - _notify_physical_bones_simulation(start, this); +void _pb_stop_simulation(Node *p_node) { + + for (int i = p_node->get_child_count() - 1; 0 <= i; --i) { + _pb_stop_simulation(p_node->get_child(i)); + } + + PhysicalBone *pb = Object::cast_to<PhysicalBone>(p_node); + if (pb) { + pb->set_simulate_physics(false); + pb->set_static_body(false); + } +} + +void Skeleton::physical_bones_stop_simulation() { + _pb_stop_simulation(this); +} + +void _pb_start_simulation(const Skeleton *p_skeleton, Node *p_node, const Vector<int> &p_sim_bones) { + + for (int i = p_node->get_child_count() - 1; 0 <= i; --i) { + _pb_start_simulation(p_skeleton, p_node->get_child(i), p_sim_bones); + } + + PhysicalBone *pb = Object::cast_to<PhysicalBone>(p_node); + if (pb) { + bool sim = false; + for (int i = p_sim_bones.size() - 1; 0 <= i; --i) { + if (p_sim_bones[i] == pb->get_bone_id() || p_skeleton->is_bone_parent_of(pb->get_bone_id(), p_sim_bones[i])) { + sim = true; + break; + } + } + + pb->set_simulate_physics(true); + if (sim) { + pb->set_static_body(false); + } else { + pb->set_static_body(true); + } + } +} + +void Skeleton::physical_bones_start_simulation_on(const Array &p_bones) { + + Vector<int> sim_bones; + if (p_bones.size() <= 0) { + sim_bones.push_back(0); // if no bones is specified, activate ragdoll on full body + } else { + sim_bones.resize(p_bones.size()); + int c = 0; + for (int i = sim_bones.size() - 1; 0 <= i; --i) { + if (Variant::STRING == p_bones.get(i).get_type()) { + int bone_id = find_bone(p_bones.get(i)); + if (bone_id != -1) + sim_bones[c++] = bone_id; + } + } + sim_bones.resize(c); + } + + _pb_start_simulation(this, this, sim_bones); } void _physical_bones_add_remove_collision_exception(bool p_add, Node *p_node, RID p_exception) { @@ -667,7 +727,8 @@ void Skeleton::_bind_methods() { ClassDB::bind_method(D_METHOD("get_bone_transform", "bone_idx"), &Skeleton::get_bone_transform); - ClassDB::bind_method(D_METHOD("physical_bones_simulation", "start"), &Skeleton::physical_bones_simulation); + ClassDB::bind_method(D_METHOD("physical_bones_stop_simulation"), &Skeleton::physical_bones_stop_simulation); + ClassDB::bind_method(D_METHOD("physical_bones_start_simulation", "bones"), &Skeleton::physical_bones_start_simulation_on, DEFVAL(Array())); ClassDB::bind_method(D_METHOD("physical_bones_add_collision_exception", "exception"), &Skeleton::physical_bones_add_collision_exception); ClassDB::bind_method(D_METHOD("physical_bones_remove_collision_exception", "exception"), &Skeleton::physical_bones_remove_collision_exception); @@ -683,6 +744,5 @@ Skeleton::Skeleton() { } Skeleton::~Skeleton() { - VisualServer::get_singleton()->free(skeleton); } diff --git a/scene/3d/skeleton.h b/scene/3d/skeleton.h index f0e71c8b4f..dad11960a5 100644 --- a/scene/3d/skeleton.h +++ b/scene/3d/skeleton.h @@ -120,9 +120,11 @@ public: // skeleton creation api void add_bone(const String &p_name); - int find_bone(String p_name) const; + int find_bone(const String &p_name) const; String get_bone_name(int p_bone) const; + bool is_bone_parent_of(int p_bone_id, int p_parent_bone_id) const; + void set_bone_parent(int p_bone, int p_parent); int get_bone_parent(int p_bone) const; @@ -176,7 +178,8 @@ private: void _rebuild_physical_bones_cache(); public: - void physical_bones_simulation(bool start); + void physical_bones_stop_simulation(); + void physical_bones_start_simulation_on(const Array &p_bones); void physical_bones_add_collision_exception(RID p_exception); void physical_bones_remove_collision_exception(RID p_exception); diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp index f41a26a680..f0870349d9 100644 --- a/scene/resources/dynamic_font.cpp +++ b/scene/resources/dynamic_font.cpp @@ -1080,6 +1080,11 @@ void DynamicFont::update_oversampling() { if (E->self()->data_at_size.is_valid()) { E->self()->data_at_size->update_oversampling(); + + if (E->self()->outline_data_at_size.is_valid()) { + E->self()->outline_data_at_size->update_oversampling(); + } + changed.push_back(Ref<DynamicFont>(E->self())); } E = E->next(); |