Merge pull request #64095 from akien-mga/3.x-cherrypicks
This commit is contained in:
commit
9ce185e3fa
28 changed files with 55 additions and 188 deletions
|
@ -315,10 +315,10 @@ uint64_t FileAccessCompressed::get_buffer(uint8_t *p_dst, uint64_t p_length) con
|
|||
} else {
|
||||
read_block--;
|
||||
at_end = true;
|
||||
if (i < p_length - 1) {
|
||||
if (i + 1 < p_length) {
|
||||
read_eof = true;
|
||||
}
|
||||
return i;
|
||||
return i + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
</brief_description>
|
||||
<description>
|
||||
A curve that can be saved and re-used for other objects. By default, it ranges between [code]0[/code] and [code]1[/code] on the Y axis and positions points relative to the [code]0.5[/code] Y position.
|
||||
See also [Gradient] which is designed for color interpolation. See also [Curve2D] and [Curve3D].
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
A color interpolator resource which can be used to generate colors between user-defined color points.
|
||||
</brief_description>
|
||||
<description>
|
||||
Given a set of colors, this resource will interpolate them in order. This means that if you have color 1, color 2 and color 3, the ramp will interpolate from color 1 to color 2 and from color 2 to color 3. The ramp will initially have 2 colors (black and white), one (black) at ramp lower offset 0 and the other (white) at the ramp higher offset 1.
|
||||
Given a set of colors, this resource will interpolate them in order. This means that if you have color 1, color 2 and color 3, the gradient will interpolate from color 1 to color 2 and from color 2 to color 3. The gradient will initially have 2 colors (black and white), one (black) at gradient lower offset 0 and the other (white) at the gradient higher offset 1.
|
||||
See also [Curve] which supports more complex easing methods, but does not support colors.
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
Low-level hyper-text transfer protocol client.
|
||||
</brief_description>
|
||||
<description>
|
||||
Hyper-text transfer protocol client (sometimes called "User Agent"). Used to make HTTP requests to download web content, upload files and other data or to communicate with various services, among other use cases. [b]See the [HTTPRequest] node for a higher-level alternative.[/b]
|
||||
Hyper-text transfer protocol client (sometimes called "User Agent"). Used to make HTTP requests to download web content, upload files and other data or to communicate with various services, among other use cases.
|
||||
See the [HTTPRequest] node for a higher-level alternative.
|
||||
[b]Note:[/b] This client only needs to connect to a host once (see [method connect_to_host]) to send multiple requests. Because of this, methods that take URLs usually take just the part after the host instead of the full URL, as the client is already connected to a host. See [method request] for a full example and to get started.
|
||||
A [HTTPClient] should be reused between multiple requests or to connect to different hosts instead of creating one client per request. Supports SSL and SSL server certificate verification. HTTP status codes in the 2xx range indicate success, 3xx redirection (i.e. "try again, but over here"), 4xx something was wrong with the request, and 5xx something went wrong on the server's side.
|
||||
For more information on HTTP, see https://developer.mozilla.org/en-US/docs/Web/HTTP (or read RFC 2616 to get it straight from the source: https://tools.ietf.org/html/rfc2616).
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
<argument index="1" name="color" type="Color" />
|
||||
<description>
|
||||
Sets the color of a specific instance by [i]multiplying[/i] the mesh's existing vertex colors.
|
||||
For the color to take effect, ensure that [member color_format] is non-[code]null[/code] on the [MultiMesh] and [member SpatialMaterial.vertex_color_use_as_albedo] is [code]true[/code] on the material.
|
||||
For the color to take effect, ensure that [member color_format] is non-[code]null[/code] on the [MultiMesh] and [member SpatialMaterial.vertex_color_use_as_albedo] is [code]true[/code] on the material. If the color doesn't look as expected, make sure the material's albedo color is set to pure white ([code]Color(1, 1, 1)[/code]).
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_instance_custom_data">
|
||||
|
|
|
@ -696,6 +696,7 @@
|
|||
<description>
|
||||
Splits the string by a [code]delimiter[/code] string and returns an array of the substrings, starting from right.
|
||||
The splits in the returned array are sorted in the same order as the original string, from left to right.
|
||||
If [code]allow_empty[/code] is [code]true[/code], and there are two adjacent delimiters in the string, it will add an empty string to the array of substrings at this position.
|
||||
If [code]maxsplit[/code] is specified, it defines the number of splits to do from the right up to [code]maxsplit[/code]. The default value of 0 means that all items are split, thus giving the same result as [method split].
|
||||
Example:
|
||||
[codeblock]
|
||||
|
@ -765,6 +766,7 @@
|
|||
<argument index="2" name="maxsplit" type="int" default="0" />
|
||||
<description>
|
||||
Splits the string by a [code]delimiter[/code] string and returns an array of the substrings. The [code]delimiter[/code] can be of any length.
|
||||
If [code]allow_empty[/code] is [code]true[/code], and there are two adjacent delimiters in the string, it will add an empty string to the array of substrings at this position.
|
||||
If [code]maxsplit[/code] is specified, it defines the number of splits to do from the left up to [code]maxsplit[/code]. The default value of [code]0[/code] means that all items are split.
|
||||
If you need only one element from the array at a specific index, [method get_slice] is a more performant option.
|
||||
Example:
|
||||
|
@ -785,6 +787,7 @@
|
|||
<description>
|
||||
Splits the string in floats by using a delimiter string and returns an array of the substrings.
|
||||
For example, [code]"1,2.5,3"[/code] will return [code][1,2.5,3][/code] if split by [code]","[/code].
|
||||
If [code]allow_empty[/code] is [code]true[/code], and there are two adjacent delimiters in the string, it will add an empty string to the array of substrings at this position.
|
||||
</description>
|
||||
</method>
|
||||
<method name="strip_edges">
|
||||
|
|
|
@ -95,12 +95,12 @@ void IP_Unix::_resolve_hostname(List<IP_Address> &r_addresses, const String &p_h
|
|||
|
||||
int s = getaddrinfo(p_hostname.utf8().get_data(), nullptr, &hints, &result);
|
||||
if (s != 0) {
|
||||
ERR_PRINT("getaddrinfo failed! Cannot resolve hostname.");
|
||||
print_verbose("getaddrinfo failed! Cannot resolve hostname.");
|
||||
return;
|
||||
};
|
||||
|
||||
if (result == nullptr || result->ai_addr == nullptr) {
|
||||
ERR_PRINT("Invalid response from getaddrinfo");
|
||||
print_verbose("Invalid response from getaddrinfo");
|
||||
if (result) {
|
||||
freeaddrinfo(result);
|
||||
}
|
||||
|
|
|
@ -1450,14 +1450,13 @@ void FileSystemDock::_folder_removed(String p_folder) {
|
|||
|
||||
void FileSystemDock::_rename_operation_confirm() {
|
||||
String new_name = rename_dialog_text->get_text().strip_edges();
|
||||
String old_name = tree->get_selected()->get_text(0);
|
||||
if (new_name.length() == 0) {
|
||||
EditorNode::get_singleton()->show_warning(TTR("No name provided."));
|
||||
return;
|
||||
} else if (new_name.find("/") != -1 || new_name.find("\\") != -1 || new_name.find(":") != -1) {
|
||||
EditorNode::get_singleton()->show_warning(TTR("Name contains invalid characters."));
|
||||
return;
|
||||
} else if (to_rename.is_file && old_name.get_extension() != new_name.get_extension()) {
|
||||
} else if (to_rename.is_file && to_rename.path.get_extension() != new_name.get_extension()) {
|
||||
if (!EditorFileSystem::get_singleton()->get_valid_extensions().find(new_name.get_extension())) {
|
||||
EditorNode::get_singleton()->show_warning(TTR("This file extension is not recognized by the editor.\nIf you want to rename it anyway, use your operating system's file manager.\nAfter renaming to an unknown extension, the file won't be shown in the editor anymore."));
|
||||
return;
|
||||
|
|
|
@ -319,9 +319,9 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
|
|||
return true;
|
||||
} else {
|
||||
Vector<Vector2> vertices2 = _get_polygon(insert.polygon);
|
||||
pre_move_edit = vertices2;
|
||||
edited_point = PosVertex(insert.polygon, insert.vertex + 1, xform.affine_inverse().xform(insert.pos));
|
||||
vertices2.insert(edited_point.vertex, edited_point.pos);
|
||||
pre_move_edit = vertices2;
|
||||
selected_point = edited_point;
|
||||
edge_point = PosVertex();
|
||||
|
||||
|
|
|
@ -6096,13 +6096,13 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
|
|||
group_button = memnew(ToolButton);
|
||||
main_menu_hbox->add_child(group_button);
|
||||
group_button->connect("pressed", this, "_popup_callback", varray(GROUP_SELECTED));
|
||||
group_button->set_tooltip(TTR("Makes sure the object's children are not selectable."));
|
||||
group_button->set_tooltip(TTR("Make selected node's children not selectable."));
|
||||
group_button->set_shortcut(ED_SHORTCUT("editor/group_selected_nodes", TTR("Group Selected Node(s)"), KEY_MASK_CMD | KEY_G));
|
||||
|
||||
ungroup_button = memnew(ToolButton);
|
||||
main_menu_hbox->add_child(ungroup_button);
|
||||
ungroup_button->connect("pressed", this, "_popup_callback", varray(UNGROUP_SELECTED));
|
||||
ungroup_button->set_tooltip(TTR("Restores the object's children's ability to be selected."));
|
||||
ungroup_button->set_tooltip(TTR("Make selected node's children selectable."));
|
||||
ungroup_button->set_shortcut(ED_SHORTCUT("editor/ungroup_selected_nodes", TTR("Ungroup Selected Node(s)"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_G));
|
||||
|
||||
main_menu_hbox->add_child(memnew(VSeparator));
|
||||
|
|
|
@ -6672,14 +6672,14 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
|
|||
main_menu_hbox->add_child(tool_button[TOOL_GROUP_SELECTED]);
|
||||
button_binds.write[0] = MENU_GROUP_SELECTED;
|
||||
tool_button[TOOL_GROUP_SELECTED]->connect("pressed", this, "_menu_item_pressed", button_binds);
|
||||
tool_button[TOOL_GROUP_SELECTED]->set_tooltip(TTR("Makes sure the object's children are not selectable."));
|
||||
tool_button[TOOL_GROUP_SELECTED]->set_tooltip(TTR("Make selected node's children not selectable."));
|
||||
tool_button[TOOL_GROUP_SELECTED]->set_shortcut(ED_SHORTCUT("editor/group_selected_nodes", TTR("Group Selected Node(s)"), KEY_MASK_CMD | KEY_G));
|
||||
|
||||
tool_button[TOOL_UNGROUP_SELECTED] = memnew(ToolButton);
|
||||
main_menu_hbox->add_child(tool_button[TOOL_UNGROUP_SELECTED]);
|
||||
button_binds.write[0] = MENU_UNGROUP_SELECTED;
|
||||
tool_button[TOOL_UNGROUP_SELECTED]->connect("pressed", this, "_menu_item_pressed", button_binds);
|
||||
tool_button[TOOL_UNGROUP_SELECTED]->set_tooltip(TTR("Restores the object's children's ability to be selected."));
|
||||
tool_button[TOOL_UNGROUP_SELECTED]->set_tooltip(TTR("Make selected node's children selectable."));
|
||||
tool_button[TOOL_UNGROUP_SELECTED]->set_shortcut(ED_SHORTCUT("editor/ungroup_selected_nodes", TTR("Ungroup Selected Node(s)"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_G));
|
||||
|
||||
main_menu_hbox->add_child(memnew(VSeparator));
|
||||
|
|
|
@ -357,7 +357,7 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent, bool p_scroll
|
|||
|
||||
bool is_grouped = p_node->has_meta("_edit_group_");
|
||||
if (is_grouped) {
|
||||
item->add_button(0, get_icon("Group", "EditorIcons"), BUTTON_GROUP, false, TTR("Children are not selectable.\nClick to make selectable."));
|
||||
item->add_button(0, get_icon("Group", "EditorIcons"), BUTTON_GROUP, false, TTR("Children are not selectable.\nClick to make them selectable."));
|
||||
}
|
||||
|
||||
bool v = p_node->call("is_visible");
|
||||
|
@ -391,7 +391,7 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent, bool p_scroll
|
|||
|
||||
bool is_grouped = p_node->has_meta("_edit_group_");
|
||||
if (is_grouped) {
|
||||
item->add_button(0, get_icon("Group", "EditorIcons"), BUTTON_GROUP, false, TTR("Children are not selectable.\nClick to make selectable."));
|
||||
item->add_button(0, get_icon("Group", "EditorIcons"), BUTTON_GROUP, false, TTR("Children are not selectable.\nClick to make them selectable."));
|
||||
}
|
||||
|
||||
bool v = p_node->call("is_visible");
|
||||
|
@ -1315,6 +1315,10 @@ void SceneTreeDialog::_select() {
|
|||
}
|
||||
}
|
||||
|
||||
void SceneTreeDialog::_selected_changed() {
|
||||
get_ok()->set_disabled(!tree->get_selected());
|
||||
}
|
||||
|
||||
void SceneTreeDialog::_filter_changed(const String &p_filter) {
|
||||
tree->set_filter(p_filter);
|
||||
}
|
||||
|
@ -1322,6 +1326,7 @@ void SceneTreeDialog::_filter_changed(const String &p_filter) {
|
|||
void SceneTreeDialog::_bind_methods() {
|
||||
ClassDB::bind_method("_select", &SceneTreeDialog::_select);
|
||||
ClassDB::bind_method("_cancel", &SceneTreeDialog::_cancel);
|
||||
ClassDB::bind_method(D_METHOD("_selected_changed"), &SceneTreeDialog::_selected_changed);
|
||||
ClassDB::bind_method(D_METHOD("_filter_changed"), &SceneTreeDialog::_filter_changed);
|
||||
|
||||
ADD_SIGNAL(MethodInfo("selected", PropertyInfo(Variant::NODE_PATH, "path")));
|
||||
|
@ -1343,6 +1348,10 @@ SceneTreeDialog::SceneTreeDialog() {
|
|||
tree->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
tree->get_scene_tree()->connect("item_activated", this, "_select");
|
||||
vbc->add_child(tree);
|
||||
|
||||
// Disable the OK button when no node is selected.
|
||||
get_ok()->set_disabled(!tree->get_selected());
|
||||
tree->connect("node_selected", this, "_selected_changed");
|
||||
}
|
||||
|
||||
SceneTreeDialog::~SceneTreeDialog() {
|
||||
|
|
|
@ -170,6 +170,7 @@ class SceneTreeDialog : public ConfirmationDialog {
|
|||
|
||||
void _select();
|
||||
void _cancel();
|
||||
void _selected_changed();
|
||||
void _filter_changed(const String &p_filter);
|
||||
|
||||
protected:
|
||||
|
|
|
@ -5,5 +5,5 @@ Import("env_modules")
|
|||
|
||||
env_bmp = env_modules.Clone()
|
||||
|
||||
# Godot's own source files
|
||||
# Godot source files
|
||||
env_bmp.add_source_files(env.modules_sources, "*.cpp")
|
||||
|
|
|
@ -5,5 +5,5 @@ Import("env_modules")
|
|||
|
||||
env_csg = env_modules.Clone()
|
||||
|
||||
# Godot's own source files
|
||||
# Godot source files
|
||||
env_csg.add_source_files(env.modules_sources, "*.cpp")
|
||||
|
|
|
@ -11,7 +11,7 @@ env_fbx.Prepend(CPPPATH=["#modules/fbx/"])
|
|||
if env["builtin_zlib"]:
|
||||
env_fbx.Prepend(CPPPATH=["#thirdparty/zlib/"])
|
||||
|
||||
# Godot's own source files
|
||||
# Godot source files
|
||||
env_fbx.add_source_files(env.modules_sources, "tools/*.cpp")
|
||||
env_fbx.add_source_files(env.modules_sources, "data/*.cpp")
|
||||
env_fbx.add_source_files(env.modules_sources, "fbx_parser/*.cpp")
|
||||
|
|
|
@ -425,7 +425,7 @@
|
|||
<argument index="1" name="to" type="float" />
|
||||
<argument index="2" name="weight" type="float" />
|
||||
<description>
|
||||
Returns an interpolation or extrapolation factor considering the range specified in [code]from[/code] and [code]to[/code], and the interpolated value specified in [code]weight[/code]. The returned value will be between [code]0.0[/code] and [code]1.0[/code] if [code]weight[/code] is between [code]from[/code] and [code]to[/code] (inclusive). If [code]weight[/code] is located outside this range, then an extrapolation factor will be returned (return value lower than [code]0.0[/code] or greater than [code]1.0[/code]).
|
||||
Returns an interpolation or extrapolation factor considering the range specified in [code]from[/code] and [code]to[/code], and the interpolated value specified in [code]weight[/code]. The returned value will be between [code]0.0[/code] and [code]1.0[/code] if [code]weight[/code] is between [code]from[/code] and [code]to[/code] (inclusive). If [code]weight[/code] is located outside this range, then an extrapolation factor will be returned (return value lower than [code]0.0[/code] or greater than [code]1.0[/code]). Use [method clamp] on the result of [method inverse_lerp] if this is not desired.
|
||||
[codeblock]
|
||||
# The interpolation ratio in the `lerp()` call below is 0.75.
|
||||
var middle = lerp(20, 30, 0.75)
|
||||
|
@ -434,7 +434,7 @@
|
|||
var ratio = inverse_lerp(20, 30, 27.5)
|
||||
# `ratio` is now 0.75.
|
||||
[/codeblock]
|
||||
See also [method lerp] which performs the reverse of this operation.
|
||||
See also [method lerp] which performs the reverse of this operation, and [method range_lerp] to map a continuous series of values to another.
|
||||
</description>
|
||||
</method>
|
||||
<method name="is_equal_approx">
|
||||
|
@ -494,14 +494,14 @@
|
|||
<argument index="1" name="to" type="Variant" />
|
||||
<argument index="2" name="weight" type="float" />
|
||||
<description>
|
||||
Linearly interpolates between two values by the factor defined in [code]weight[/code]. To perform interpolation, [code]weight[/code] should be between [code]0.0[/code] and [code]1.0[/code] (inclusive). However, values outside this range are allowed and can be used to perform [i]extrapolation[/i].
|
||||
Linearly interpolates between two values by the factor defined in [code]weight[/code]. To perform interpolation, [code]weight[/code] should be between [code]0.0[/code] and [code]1.0[/code] (inclusive). However, values outside this range are allowed and can be used to perform [i]extrapolation[/i]. Use [method clamp] on the result of [method lerp] if this is not desired.
|
||||
If the [code]from[/code] and [code]to[/code] arguments are of type [int] or [float], the return value is a [float].
|
||||
If both are of the same vector type ([Vector2], [Vector3] or [Color]), the return value will be of the same type ([code]lerp[/code] then calls the vector type's [code]linear_interpolate[/code] method).
|
||||
[codeblock]
|
||||
lerp(0, 4, 0.75) # Returns 3.0
|
||||
lerp(Vector2(1, 5), Vector2(3, 2), 0.5) # Returns Vector2(2, 3.5)
|
||||
[/codeblock]
|
||||
See also [method inverse_lerp] which performs the reverse of this operation. To perform eased interpolation with [method lerp], combine it with [method ease] or [method smoothstep].
|
||||
See also [method inverse_lerp] which performs the reverse of this operation. To perform eased interpolation with [method lerp], combine it with [method ease] or [method smoothstep]. See also [method range_lerp] to map a continuous series of values to another.
|
||||
</description>
|
||||
</method>
|
||||
<method name="lerp_angle">
|
||||
|
@ -892,10 +892,11 @@
|
|||
<argument index="3" name="ostart" type="float" />
|
||||
<argument index="4" name="ostop" type="float" />
|
||||
<description>
|
||||
Maps a [code]value[/code] from range [code][istart, istop][/code] to [code][ostart, ostop][/code].
|
||||
Maps a [code]value[/code] from range [code][istart, istop][/code] to [code][ostart, ostop][/code]. See also [method lerp] and [method inverse_lerp]. If [code]value[/code] is outside [code][istart, istop][/code], then the resulting value will also be outside [code][ostart, ostop][/code]. Use [method clamp] on the result of [method range_lerp] if this is not desired.
|
||||
[codeblock]
|
||||
range_lerp(75, 0, 100, -1, 1) # Returns 0.5
|
||||
[/codeblock]
|
||||
For complex use cases where you need multiple ranges, consider using [Curve] or [Gradient] instead.
|
||||
</description>
|
||||
</method>
|
||||
<method name="round">
|
||||
|
|
|
@ -5,5 +5,5 @@ Import("env_modules")
|
|||
|
||||
env_gltf = env_modules.Clone()
|
||||
|
||||
# Godot's own source files
|
||||
# Godot source files
|
||||
env_gltf.add_source_files(env.modules_sources, "*.cpp")
|
||||
|
|
|
@ -5,4 +5,5 @@ Import("env_modules")
|
|||
|
||||
env_gridmap = env_modules.Clone()
|
||||
|
||||
# Godot source files
|
||||
env_gridmap.add_source_files(env.modules_sources, "*.cpp")
|
||||
|
|
|
@ -5,5 +5,5 @@ Import("env_modules")
|
|||
|
||||
env_hdr = env_modules.Clone()
|
||||
|
||||
# Godot's own source files
|
||||
# Godot source files
|
||||
env_hdr.add_source_files(env.modules_sources, "*.cpp")
|
||||
|
|
|
@ -13,5 +13,5 @@ if not env.msvc:
|
|||
else:
|
||||
env_minimp3.Prepend(CPPPATH=[thirdparty_dir])
|
||||
|
||||
# Godot's own source files
|
||||
# Godot source files
|
||||
env_minimp3.add_source_files(env.modules_sources, "*.cpp")
|
||||
|
|
|
@ -66,6 +66,9 @@ namespace GodotTools.Ides.Rider
|
|||
if (string.IsNullOrEmpty(path))
|
||||
return false;
|
||||
|
||||
if (path.IndexOfAny(System.IO.Path.GetInvalidPathChars()) != -1)
|
||||
return false;
|
||||
|
||||
var fileInfo = new FileInfo(path);
|
||||
string filename = fileInfo.Name.ToLowerInvariant();
|
||||
return filename.StartsWith("rider", StringComparison.Ordinal);
|
||||
|
|
|
@ -5,5 +5,5 @@ Import("env_modules")
|
|||
|
||||
env_tga = env_modules.Clone()
|
||||
|
||||
# Godot's own source files
|
||||
# Godot source files
|
||||
env_tga.add_source_files(env.modules_sources, "*.cpp")
|
||||
|
|
|
@ -1,92 +0,0 @@
|
|||
/*************************************************************************/
|
||||
/* emws_server.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifdef JAVASCRIPT_ENABLED
|
||||
|
||||
#include "emws_server.h"
|
||||
#include "core/os/os.h"
|
||||
|
||||
void EMWSServer::set_extra_headers(const Vector<String> &p_headers) {
|
||||
}
|
||||
|
||||
Error EMWSServer::listen(int p_port, Vector<String> p_protocols, bool gd_mp_api) {
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
bool EMWSServer::is_listening() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
void EMWSServer::stop() {
|
||||
}
|
||||
|
||||
bool EMWSServer::has_peer(int p_id) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
Ref<WebSocketPeer> EMWSServer::get_peer(int p_id) const {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PoolVector<String> EMWSServer::get_protocols() const {
|
||||
PoolVector<String> out;
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
IP_Address EMWSServer::get_peer_address(int p_peer_id) const {
|
||||
return IP_Address();
|
||||
}
|
||||
|
||||
int EMWSServer::get_peer_port(int p_peer_id) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void EMWSServer::disconnect_peer(int p_peer_id, int p_code, String p_reason) {
|
||||
}
|
||||
|
||||
void EMWSServer::poll() {
|
||||
}
|
||||
|
||||
int EMWSServer::get_max_packet_size() const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Error EMWSServer::set_buffers(int p_in_buffer, int p_in_packets, int p_out_buffer, int p_out_packets) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
EMWSServer::EMWSServer() {
|
||||
}
|
||||
|
||||
EMWSServer::~EMWSServer() {
|
||||
}
|
||||
|
||||
#endif // JAVASCRIPT_ENABLED
|
|
@ -1,64 +0,0 @@
|
|||
/*************************************************************************/
|
||||
/* emws_server.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef EMWS_SERVER_H
|
||||
#define EMWS_SERVER_H
|
||||
|
||||
#ifdef JAVASCRIPT_ENABLED
|
||||
|
||||
#include "core/reference.h"
|
||||
#include "emws_peer.h"
|
||||
#include "websocket_server.h"
|
||||
|
||||
class EMWSServer : public WebSocketServer {
|
||||
GDCIIMPL(EMWSServer, WebSocketServer);
|
||||
|
||||
public:
|
||||
Error set_buffers(int p_in_buffer, int p_in_packets, int p_out_buffer, int p_out_packets);
|
||||
void set_extra_headers(const Vector<String> &p_headers);
|
||||
Error listen(int p_port, Vector<String> p_protocols = Vector<String>(), bool gd_mp_api = false);
|
||||
void stop();
|
||||
bool is_listening() const;
|
||||
bool has_peer(int p_id) const;
|
||||
Ref<WebSocketPeer> get_peer(int p_id) const;
|
||||
IP_Address get_peer_address(int p_peer_id) const;
|
||||
int get_peer_port(int p_peer_id) const;
|
||||
void disconnect_peer(int p_peer_id, int p_code = 1000, String p_reason = "");
|
||||
int get_max_packet_size() const;
|
||||
virtual void poll();
|
||||
virtual PoolVector<String> get_protocols() const;
|
||||
|
||||
EMWSServer();
|
||||
~EMWSServer();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif // EMWS_SERVER_H
|
|
@ -29,13 +29,17 @@
|
|||
/*************************************************************************/
|
||||
|
||||
#include "register_types.h"
|
||||
|
||||
#include "core/error_macros.h"
|
||||
#include "core/project_settings.h"
|
||||
|
||||
#include "websocket_client.h"
|
||||
#include "websocket_server.h"
|
||||
|
||||
#ifdef JAVASCRIPT_ENABLED
|
||||
#include "emscripten.h"
|
||||
#include "emws_client.h"
|
||||
#include "emws_peer.h"
|
||||
#include "emws_server.h"
|
||||
#else
|
||||
#include "wsl_client.h"
|
||||
#include "wsl_server.h"
|
||||
|
@ -61,7 +65,6 @@ void register_websocket_types() {
|
|||
#ifdef JAVASCRIPT_ENABLED
|
||||
EMWSPeer::make_default();
|
||||
EMWSClient::make_default();
|
||||
EMWSServer::make_default();
|
||||
#else
|
||||
WSLPeer::make_default();
|
||||
WSLClient::make_default();
|
||||
|
|
|
@ -412,7 +412,7 @@ real_t NavigationPolygonInstance::get_enter_cost() const {
|
|||
void NavigationPolygonInstance::set_travel_cost(real_t p_travel_cost) {
|
||||
ERR_FAIL_COND_MSG(p_travel_cost < 0.0, "The travel_cost must be positive.");
|
||||
travel_cost = MAX(p_travel_cost, 0.0);
|
||||
Navigation2DServer::get_singleton()->region_set_enter_cost(region, travel_cost);
|
||||
Navigation2DServer::get_singleton()->region_set_travel_cost(region, travel_cost);
|
||||
}
|
||||
|
||||
real_t NavigationPolygonInstance::get_travel_cost() const {
|
||||
|
|
|
@ -94,7 +94,7 @@ real_t NavigationMeshInstance::get_enter_cost() const {
|
|||
void NavigationMeshInstance::set_travel_cost(real_t p_travel_cost) {
|
||||
ERR_FAIL_COND_MSG(p_travel_cost < 0.0, "The travel_cost must be positive.");
|
||||
travel_cost = MAX(p_travel_cost, 0.0);
|
||||
NavigationServer::get_singleton()->region_set_enter_cost(region, travel_cost);
|
||||
NavigationServer::get_singleton()->region_set_travel_cost(region, travel_cost);
|
||||
}
|
||||
|
||||
real_t NavigationMeshInstance::get_travel_cost() const {
|
||||
|
|
Loading…
Add table
Reference in a new issue