diff options
121 files changed, 1082 insertions, 657 deletions
diff --git a/core/io/image_loader.h b/core/io/image_loader.h index 95c562b7a9..ae4b72a534 100644 --- a/core/io/image_loader.h +++ b/core/io/image_loader.h @@ -88,7 +88,6 @@ public: }; class ResourceFormatLoaderImage : public ResourceFormatLoader { - GDCLASS(ResourceFormatLoaderImage, ResourceFormatLoader) public: virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL); virtual void get_recognized_extensions(List<String> *p_extensions) const; diff --git a/core/io/resource_format_binary.h b/core/io/resource_format_binary.h index a4894e4033..27777c8e8b 100644 --- a/core/io/resource_format_binary.h +++ b/core/io/resource_format_binary.h @@ -100,7 +100,6 @@ public: }; class ResourceFormatLoaderBinary : public ResourceFormatLoader { - GDCLASS(ResourceFormatLoaderBinary, ResourceFormatLoader) public: virtual Ref<ResourceInteractiveLoader> load_interactive(const String &p_path, const String &p_original_path = "", Error *r_error = NULL); virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const; @@ -162,7 +161,6 @@ public: }; class ResourceFormatSaverBinary : public ResourceFormatSaver { - GDCLASS(ResourceFormatSaverBinary, ResourceFormatSaver) public: static ResourceFormatSaverBinary *singleton; virtual Error save(const String &p_path, const RES &p_resource, uint32_t p_flags = 0); diff --git a/core/io/resource_importer.h b/core/io/resource_importer.h index 2e01989564..317f301b5c 100644 --- a/core/io/resource_importer.h +++ b/core/io/resource_importer.h @@ -37,8 +37,6 @@ class ResourceImporter; class ResourceFormatImporter : public ResourceFormatLoader { - GDCLASS(ResourceFormatImporter, ResourceFormatLoader) - struct PathAndType { String path; String type; diff --git a/core/io/translation_loader_po.h b/core/io/translation_loader_po.h index d5fd264385..9d9c5d16ee 100644 --- a/core/io/translation_loader_po.h +++ b/core/io/translation_loader_po.h @@ -36,7 +36,6 @@ #include "core/translation.h" class TranslationLoaderPO : public ResourceFormatLoader { - GDCLASS(TranslationLoaderPO, ResourceFormatLoader) public: static RES load_translation(FileAccess *f, Error *r_error, const String &p_path = String()); virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL); diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp index 359446dde6..7ce3824505 100644 --- a/core/math/a_star.cpp +++ b/core/math/a_star.cpp @@ -458,13 +458,12 @@ void AStar::_bind_methods() { ClassDB::bind_method(D_METHOD("set_point_weight_scale", "id", "weight_scale"), &AStar::set_point_weight_scale); ClassDB::bind_method(D_METHOD("remove_point", "id"), &AStar::remove_point); ClassDB::bind_method(D_METHOD("has_point", "id"), &AStar::has_point); + ClassDB::bind_method(D_METHOD("get_point_connections", "id"), &AStar::get_point_connections); ClassDB::bind_method(D_METHOD("get_points"), &AStar::get_points); ClassDB::bind_method(D_METHOD("set_point_disabled", "id", "disabled"), &AStar::set_point_disabled, DEFVAL(true)); ClassDB::bind_method(D_METHOD("is_point_disabled", "id"), &AStar::is_point_disabled); - ClassDB::bind_method(D_METHOD("get_point_connections", "id"), &AStar::get_point_connections); - ClassDB::bind_method(D_METHOD("connect_points", "id", "to_id", "bidirectional"), &AStar::connect_points, DEFVAL(true)); ClassDB::bind_method(D_METHOD("disconnect_points", "id", "to_id"), &AStar::disconnect_points); ClassDB::bind_method(D_METHOD("are_points_connected", "id", "to_id"), &AStar::are_points_connected); @@ -491,3 +490,135 @@ AStar::~AStar() { pass = 1; clear(); } + +///////////////////////////////////////////////////////////// + +int AStar2D::get_available_point_id() const { + return astar.get_available_point_id(); +} + +void AStar2D::add_point(int p_id, const Vector2 &p_pos, real_t p_weight_scale) { + astar.add_point(p_id, Vector3(p_pos.x, p_pos.y, 0), p_weight_scale); +} + +Vector2 AStar2D::get_point_position(int p_id) const { + Vector3 p = astar.get_point_position(p_id); + return Vector2(p.x, p.y); +} + +void AStar2D::set_point_position(int p_id, const Vector2 &p_pos) { + astar.set_point_position(p_id, Vector3(p_pos.x, p_pos.y, 0)); +} + +real_t AStar2D::get_point_weight_scale(int p_id) const { + return astar.get_point_weight_scale(p_id); +} + +void AStar2D::set_point_weight_scale(int p_id, real_t p_weight_scale) { + astar.set_point_weight_scale(p_id, p_weight_scale); +} + +void AStar2D::remove_point(int p_id) { + astar.remove_point(p_id); +} + +bool AStar2D::has_point(int p_id) const { + return astar.has_point(p_id); +} + +PoolVector<int> AStar2D::get_point_connections(int p_id) { + return astar.get_point_connections(p_id); +} + +Array AStar2D::get_points() { + return astar.get_points(); +} + +void AStar2D::set_point_disabled(int p_id, bool p_disabled) { + astar.set_point_disabled(p_id, p_disabled); +} + +bool AStar2D::is_point_disabled(int p_id) const { + return astar.is_point_disabled(p_id); +} + +void AStar2D::connect_points(int p_id, int p_with_id, bool p_bidirectional) { + astar.connect_points(p_id, p_with_id, p_bidirectional); +} + +void AStar2D::disconnect_points(int p_id, int p_with_id) { + astar.disconnect_points(p_id, p_with_id); +} + +bool AStar2D::are_points_connected(int p_id, int p_with_id) const { + return astar.are_points_connected(p_id, p_with_id); +} + +void AStar2D::clear() { + astar.clear(); +} + +int AStar2D::get_closest_point(const Vector2 &p_point) const { + return astar.get_closest_point(Vector3(p_point.x, p_point.y, 0)); +} + +Vector2 AStar2D::get_closest_position_in_segment(const Vector2 &p_point) const { + Vector3 p = astar.get_closest_position_in_segment(Vector3(p_point.x, p_point.y, 0)); + return Vector2(p.x, p.y); +} + +PoolVector<Vector2> AStar2D::get_point_path(int p_from_id, int p_to_id) { + + PoolVector3Array pv = astar.get_point_path(p_from_id, p_to_id); + int size = pv.size(); + PoolVector2Array path; + path.resize(size); + { + PoolVector<Vector3>::Read r = pv.read(); + PoolVector<Vector2>::Write w = path.write(); + for (int i = 0; i < size; i++) { + Vector3 p = r[i]; + w[i] = Vector2(p.x, p.y); + } + } + return path; +} + +PoolVector<int> AStar2D::get_id_path(int p_from_id, int p_to_id) { + return astar.get_id_path(p_from_id, p_to_id); +} + +void AStar2D::_bind_methods() { + + ClassDB::bind_method(D_METHOD("get_available_point_id"), &AStar2D::get_available_point_id); + ClassDB::bind_method(D_METHOD("add_point", "id", "position", "weight_scale"), &AStar2D::add_point, DEFVAL(1.0)); + ClassDB::bind_method(D_METHOD("get_point_position", "id"), &AStar2D::get_point_position); + ClassDB::bind_method(D_METHOD("set_point_position", "id", "position"), &AStar2D::set_point_position); + ClassDB::bind_method(D_METHOD("get_point_weight_scale", "id"), &AStar2D::get_point_weight_scale); + ClassDB::bind_method(D_METHOD("set_point_weight_scale", "id", "weight_scale"), &AStar2D::set_point_weight_scale); + ClassDB::bind_method(D_METHOD("remove_point", "id"), &AStar2D::remove_point); + ClassDB::bind_method(D_METHOD("has_point", "id"), &AStar2D::has_point); + ClassDB::bind_method(D_METHOD("get_point_connections", "id"), &AStar2D::get_point_connections); + ClassDB::bind_method(D_METHOD("get_points"), &AStar2D::get_points); + + ClassDB::bind_method(D_METHOD("set_point_disabled", "id", "disabled"), &AStar2D::set_point_disabled, DEFVAL(true)); + ClassDB::bind_method(D_METHOD("is_point_disabled", "id"), &AStar2D::is_point_disabled); + + ClassDB::bind_method(D_METHOD("connect_points", "id", "to_id", "bidirectional"), &AStar2D::connect_points, DEFVAL(true)); + ClassDB::bind_method(D_METHOD("disconnect_points", "id", "to_id"), &AStar2D::disconnect_points); + ClassDB::bind_method(D_METHOD("are_points_connected", "id", "to_id"), &AStar2D::are_points_connected); + + ClassDB::bind_method(D_METHOD("clear"), &AStar2D::clear); + + ClassDB::bind_method(D_METHOD("get_closest_point", "to_position"), &AStar2D::get_closest_point); + ClassDB::bind_method(D_METHOD("get_closest_position_in_segment", "to_position"), &AStar2D::get_closest_position_in_segment); + + ClassDB::bind_method(D_METHOD("get_point_path", "from_id", "to_id"), &AStar2D::get_point_path); + ClassDB::bind_method(D_METHOD("get_id_path", "from_id", "to_id"), &AStar2D::get_id_path); +} + +AStar2D::AStar2D() { +} + +AStar2D::~AStar2D() { +} diff --git a/core/math/a_star.h b/core/math/a_star.h index ba35d929b3..e2a0356c7c 100644 --- a/core/math/a_star.h +++ b/core/math/a_star.h @@ -143,4 +143,43 @@ public: ~AStar(); }; +class AStar2D : public Reference { + GDCLASS(AStar2D, Reference); + AStar astar; + +protected: + static void _bind_methods(); + +public: + int get_available_point_id() const; + + void add_point(int p_id, const Vector2 &p_pos, real_t p_weight_scale = 1); + Vector2 get_point_position(int p_id) const; + void set_point_position(int p_id, const Vector2 &p_pos); + real_t get_point_weight_scale(int p_id) const; + void set_point_weight_scale(int p_id, real_t p_weight_scale); + void remove_point(int p_id); + bool has_point(int p_id) const; + PoolVector<int> get_point_connections(int p_id); + Array get_points(); + + void set_point_disabled(int p_id, bool p_disabled = true); + bool is_point_disabled(int p_id) const; + + void connect_points(int p_id, int p_with_id, bool p_bidirectional = true); + void disconnect_points(int p_id, int p_with_id); + bool are_points_connected(int p_id, int p_with_id) const; + + void clear(); + + int get_closest_point(const Vector2 &p_point) const; + Vector2 get_closest_position_in_segment(const Vector2 &p_point) const; + + PoolVector<Vector2> get_point_path(int p_from_id, int p_to_id); + PoolVector<int> get_id_path(int p_from_id, int p_to_id); + + AStar2D(); + ~AStar2D(); +}; + #endif // ASTAR_H diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp index 97c96b4018..135df4e5bd 100644 --- a/core/register_core_types.cpp +++ b/core/register_core_types.cpp @@ -184,6 +184,7 @@ void register_core_types() { ClassDB::register_class<PackedDataContainer>(); ClassDB::register_virtual_class<PackedDataContainerRef>(); ClassDB::register_class<AStar>(); + ClassDB::register_class<AStar2D>(); ClassDB::register_class<EncodedObjectAsID>(); ClassDB::register_class<RandomNumberGenerator>(); diff --git a/core/ustring.cpp b/core/ustring.cpp index 35b817b1d2..686aa6f8e3 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -2331,6 +2331,9 @@ String String::insert(int p_at_pos, const String &p_string) const { } String String::substr(int p_from, int p_chars) const { + if (p_chars == -1) + p_chars = length() - p_from; + if (empty() || p_from < 0 || p_from >= length() || p_chars <= 0) return ""; diff --git a/core/ustring.h b/core/ustring.h index 5b9be9f27c..ecf934a26b 100644 --- a/core/ustring.h +++ b/core/ustring.h @@ -201,7 +201,7 @@ public: } /* complex helpers */ - String substr(int p_from, int p_chars) const; + String substr(int p_from, int p_chars = -1) const; int find(const String &p_str, int p_from = 0) const; ///< return <0 if failed int find(const char *p_str, int p_from = 0) const; ///< return <0 if failed int find_char(const CharType &p_char, int p_from = 0) const; ///< return <0 if failed diff --git a/core/variant_call.cpp b/core/variant_call.cpp index b3a4a13b08..dc28f1ca02 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -285,6 +285,8 @@ struct _VariantCall { VCALL_LOCALMEM0R(String, get_file); VCALL_LOCALMEM0R(String, xml_escape); VCALL_LOCALMEM0R(String, xml_unescape); + VCALL_LOCALMEM0R(String, http_escape); + VCALL_LOCALMEM0R(String, http_unescape); VCALL_LOCALMEM0R(String, c_escape); VCALL_LOCALMEM0R(String, c_unescape); VCALL_LOCALMEM0R(String, json_escape); @@ -1497,7 +1499,7 @@ void register_variant_methods() { ADDFUNC1R(STRING, INT, String, casecmp_to, STRING, "to", varray()); ADDFUNC1R(STRING, INT, String, nocasecmp_to, STRING, "to", varray()); ADDFUNC0R(STRING, INT, String, length, varray()); - ADDFUNC2R(STRING, STRING, String, substr, INT, "from", INT, "len", varray()); + ADDFUNC2R(STRING, STRING, String, substr, INT, "from", INT, "len", varray(-1)); ADDFUNC2R(STRING, INT, String, find, STRING, "what", INT, "from", varray(0)); @@ -1550,6 +1552,8 @@ void register_variant_methods() { ADDFUNC0R(STRING, STRING, String, get_file, varray()); ADDFUNC0R(STRING, STRING, String, xml_escape, varray()); ADDFUNC0R(STRING, STRING, String, xml_unescape, varray()); + ADDFUNC0R(STRING, STRING, String, http_escape, varray()); + ADDFUNC0R(STRING, STRING, String, http_unescape, varray()); ADDFUNC0R(STRING, STRING, String, c_escape, varray()); ADDFUNC0R(STRING, STRING, String, c_unescape, varray()); ADDFUNC0R(STRING, STRING, String, json_escape, varray()); diff --git a/doc/classes/AStar.xml b/doc/classes/AStar.xml index 16ceb293ad..81722535c2 100644 --- a/doc/classes/AStar.xml +++ b/doc/classes/AStar.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AStar" inherits="Reference" category="Core" version="3.2"> <brief_description> - AStar class representation that uses vectors as edges. + AStar class representation that uses 3d-vectors as edges. </brief_description> <description> A* (A star) is a computer algorithm that is widely used in pathfinding and graph traversal, the process of plotting an efficiently directed path between multiple points. It enjoys widespread use due to its performance and accuracy. Godot's A* implementation make use of vectors as points. diff --git a/doc/classes/AStar2D.xml b/doc/classes/AStar2D.xml new file mode 100644 index 0000000000..b86e53d4d4 --- /dev/null +++ b/doc/classes/AStar2D.xml @@ -0,0 +1,258 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="AStar2D" inherits="Reference" category="Core" version="3.2"> + <brief_description> + AStar class representation that uses 2d-vectors as edges. + </brief_description> + <description> + This is a wrapper for the [AStar] class which uses 2D vectors instead of 3D vectors. + </description> + <tutorials> + </tutorials> + <methods> + <method name="add_point"> + <return type="void"> + </return> + <argument index="0" name="id" type="int"> + </argument> + <argument index="1" name="position" type="Vector2"> + </argument> + <argument index="2" name="weight_scale" type="float" default="1.0"> + </argument> + <description> + Adds a new point at the given position with the given identifier. The algorithm prefers points with lower [code]weight_scale[/code] to form a path. The [code]id[/code] must be 0 or larger, and the [code]weight_scale[/code] must be 1 or larger. + [codeblock] + var as = AStar2D.new() + as.add_point(1, Vector2(1, 0), 4) # Adds the point (1, 0) with weight_scale 4 and id 1 + [/codeblock] + If there already exists a point for the given id, its position and weight scale are updated to the given values. + </description> + </method> + <method name="are_points_connected" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="id" type="int"> + </argument> + <argument index="1" name="to_id" type="int"> + </argument> + <description> + Returns whether there is a connection/segment between the given points. + </description> + </method> + <method name="clear"> + <return type="void"> + </return> + <description> + Clears all the points and segments. + </description> + </method> + <method name="connect_points"> + <return type="void"> + </return> + <argument index="0" name="id" type="int"> + </argument> + <argument index="1" name="to_id" type="int"> + </argument> + <argument index="2" name="bidirectional" type="bool" default="true"> + </argument> + <description> + Creates a segment between the given points. If [code]bidirectional[/code] is [code]false[/code], only movement from [code]id[/code] to [code]to_id[/code] is allowed, not the reverse direction. + [codeblock] + var as = AStar2D.new() + as.add_point(1, Vector2(1, 1)) + as.add_point(2, Vector2(0, 5)) + as.connect_points(1, 2, false) + [/codeblock] + </description> + </method> + <method name="disconnect_points"> + <return type="void"> + </return> + <argument index="0" name="id" type="int"> + </argument> + <argument index="1" name="to_id" type="int"> + </argument> + <description> + Deletes the segment between the given points. + </description> + </method> + <method name="get_available_point_id" qualifiers="const"> + <return type="int"> + </return> + <description> + Returns the next available point id with no point associated to it. + </description> + </method> + <method name="get_closest_point" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="to_position" type="Vector2"> + </argument> + <description> + Returns the id of the closest point to [code]to_position[/code]. Returns -1 if there are no points in the points pool. + </description> + </method> + <method name="get_closest_position_in_segment" qualifiers="const"> + <return type="Vector2"> + </return> + <argument index="0" name="to_position" type="Vector2"> + </argument> + <description> + Returns the closest position to [code]to_position[/code] that resides inside a segment between two connected points. + [codeblock] + var as = AStar2D.new() + as.add_point(1, Vector2(0, 0)) + as.add_point(2, Vector2(0, 5)) + as.connect_points(1, 2) + var res = as.get_closest_position_in_segment(Vector2(3, 3)) # returns (0, 3) + [/codeblock] + The result is in the segment that goes from [code]y = 0[/code] to [code]y = 5[/code]. It's the closest position in the segment to the given point. + </description> + </method> + <method name="get_id_path"> + <return type="PoolIntArray"> + </return> + <argument index="0" name="from_id" type="int"> + </argument> + <argument index="1" name="to_id" type="int"> + </argument> + <description> + Returns an array with the ids of the points that form the path found by AStar2D between the given points. The array is ordered from the starting point to the ending point of the path. + [codeblock] + var as = AStar2D.new() + as.add_point(1, Vector2(0, 0)) + as.add_point(2, Vector2(0, 1), 1) # default weight is 1 + as.add_point(3, Vector2(1, 1)) + as.add_point(4, Vector2(2, 0)) + + as.connect_points(1, 2, false) + as.connect_points(2, 3, false) + as.connect_points(4, 3, false) + as.connect_points(1, 4, false) + as.connect_points(5, 4, false) + + var res = as.get_id_path(1, 3) # returns [1, 2, 3] + [/codeblock] + If you change the 2nd point's weight to 3, then the result will be [code][1, 4, 3][/code] instead, because now even though the distance is longer, it's "easier" to get through point 4 than through point 2. + </description> + </method> + <method name="get_point_connections"> + <return type="PoolIntArray"> + </return> + <argument index="0" name="id" type="int"> + </argument> + <description> + Returns an array with the ids of the points that form the connect with the given point. + [codeblock] + var as = AStar2D.new() + as.add_point(1, Vector2(0, 0)) + as.add_point(2, Vector2(0, 1)) + as.add_point(3, Vector2(1, 1)) + as.add_point(4, Vector2(2, 0)) + + as.connect_points(1, 2, true) + as.connect_points(1, 3, true) + + var neighbors = as.get_point_connections(1) # returns [2, 3] + [/codeblock] + </description> + </method> + <method name="get_point_path"> + <return type="PoolVector2Array"> + </return> + <argument index="0" name="from_id" type="int"> + </argument> + <argument index="1" name="to_id" type="int"> + </argument> + <description> + Returns an array with the points that are in the path found by AStar2D between the given points. The array is ordered from the starting point to the ending point of the path. + </description> + </method> + <method name="get_point_position" qualifiers="const"> + <return type="Vector2"> + </return> + <argument index="0" name="id" type="int"> + </argument> + <description> + Returns the position of the point associated with the given id. + </description> + </method> + <method name="get_point_weight_scale" qualifiers="const"> + <return type="float"> + </return> + <argument index="0" name="id" type="int"> + </argument> + <description> + Returns the weight scale of the point associated with the given id. + </description> + </method> + <method name="get_points"> + <return type="Array"> + </return> + <description> + Returns an array of all points. + </description> + </method> + <method name="has_point" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="id" type="int"> + </argument> + <description> + Returns whether a point associated with the given id exists. + </description> + </method> + <method name="is_point_disabled" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="id" type="int"> + </argument> + <description> + Returns whether a point is disabled or not for pathfinding. By default, all points are enabled. + </description> + </method> + <method name="remove_point"> + <return type="void"> + </return> + <argument index="0" name="id" type="int"> + </argument> + <description> + Removes the point associated with the given id from the points pool. + </description> + </method> + <method name="set_point_disabled"> + <return type="void"> + </return> + <argument index="0" name="id" type="int"> + </argument> + <argument index="1" name="disabled" type="bool" default="true"> + </argument> + <description> + Disables or enables the specified point for pathfinding. Useful for making a temporary obstacle. + </description> + </method> + <method name="set_point_position"> + <return type="void"> + </return> + <argument index="0" name="id" type="int"> + </argument> + <argument index="1" name="position" type="Vector2"> + </argument> + <description> + Sets the position for the point with the given id. + </description> + </method> + <method name="set_point_weight_scale"> + <return type="void"> + </return> + <argument index="0" name="id" type="int"> + </argument> + <argument index="1" name="weight_scale" type="float"> + </argument> + <description> + Sets the [code]weight_scale[/code] for the point with the given id. + </description> + </method> + </methods> + <constants> + </constants> +</class> diff --git a/doc/classes/AcceptDialog.xml b/doc/classes/AcceptDialog.xml index db35b2f352..3ea280cba3 100644 --- a/doc/classes/AcceptDialog.xml +++ b/doc/classes/AcceptDialog.xml @@ -57,12 +57,15 @@ </method> </methods> <members> + <member name="dialog_autowrap" type="bool" setter="set_autowrap" getter="has_autowrap"> + Sets autowrapping for the text in the dialog. + </member> <member name="dialog_hide_on_ok" type="bool" setter="set_hide_on_ok" getter="get_hide_on_ok"> If [code]true[/code], the dialog is hidden when the OK button is pressed. You can set it to [code]false[/code] if you want to do e.g. input validation when receiving the [signal confirmed] signal, and handle hiding the dialog in your own logic. Default value: [code]true[/code]. Note: Some nodes derived from this class can have a different default value, and potentially their own built-in logic overriding this setting. For example [FileDialog] defaults to [code]false[/code], and has its own input validation code that is called when you press OK, which eventually hides the dialog if the input is valid. As such this property can't be used in [FileDialog] to disable hiding the dialog when pressing OK. </member> <member name="dialog_text" type="String" setter="set_text" getter="get_text"> - The text displayed by this dialog. + The text displayed by the dialog. </member> </members> <signals> diff --git a/doc/classes/CPUParticles2D.xml b/doc/classes/CPUParticles2D.xml index e6df2d2f27..7283d5084c 100644 --- a/doc/classes/CPUParticles2D.xml +++ b/doc/classes/CPUParticles2D.xml @@ -99,7 +99,7 @@ Particles will be emitted inside this region. Use [enum EmissionShape] for values. Default value: [constant EMISSION_SHAPE_POINT]. </member> <member name="emission_sphere_radius" type="float" setter="set_emission_sphere_radius" getter="get_emission_sphere_radius"> - The circle's radius if [member emission_shape] is set to [constant EMISSION_SHAPE_CIRCLE]. + The sphere's radius if [member emission_shape] is set to [constant EMISSION_SHAPE_SPHERE]. </member> <member name="emitting" type="bool" setter="set_emitting" getter="is_emitting"> If [code]true[/code], particles are being emitted. Default value: [code]true[/code]. @@ -271,7 +271,7 @@ All particles will be emitted from a single point. </constant> <constant name="EMISSION_SHAPE_SPHERE" value="1" enum="EmissionShape"> - Particles will be emitted on the surface of a sphere flattened to two dimensions. + Particles will be emitted on the surface of a sphere flattened to two dimensions. </constant> <constant name="EMISSION_SHAPE_RECTANGLE" value="2" enum="EmissionShape"> Particles will be emitted in the area of a rectangle. diff --git a/doc/classes/ColorPicker.xml b/doc/classes/ColorPicker.xml index 32e6014c75..1fefc719b7 100644 --- a/doc/classes/ColorPicker.xml +++ b/doc/classes/ColorPicker.xml @@ -49,8 +49,13 @@ </member> <member name="presets_visible" type="bool" setter="set_presets_visible" getter="are_presets_visible"> </member> + <member name="hsv_mode" type="bool" setter="set_hsv_mode" getter="is_hsv_mode"> + If [code]true[/code], allows to edit color with Hue/Saturation/Value sliders. + [b]Note:[/b] Cannot be enabled if raw mode is on. + </member> <member name="raw_mode" type="bool" setter="set_raw_mode" getter="is_raw_mode"> If [code]true[/code], allows the color R, G, B component values to go beyond 1.0, which can be used for certain special operations that require it (like tinting without darkening or rendering sprites in HDR). + [b]Note:[/b] Cannot be enabled if hsv mode is on. </member> </members> <signals> diff --git a/doc/classes/File.xml b/doc/classes/File.xml index 30da143f88..32fa628bbf 100644 --- a/doc/classes/File.xml +++ b/doc/classes/File.xml @@ -115,7 +115,7 @@ <return type="int" enum="Error"> </return> <description> - Returns the last error that happened when trying to perform operations. Compare with the [code]ERR_FILE_*[/code] constants from [@GlobalScope]. + Returns the last error that happened when trying to perform operations. Compare with the [code]ERR_FILE_*[/code] constants from [enum @GlobalScope.Error]. </description> </method> <method name="get_float" qualifiers="const"> @@ -241,7 +241,7 @@ <argument index="2" name="compression_mode" type="int" enum="File.CompressionMode" default="0"> </argument> <description> - Opens a compressed file for reading or writing. Use COMPRESSION_* constants to set [code]compression_mode[/code]. + Opens a compressed file for reading or writing. Use [enum CompressionMode] constants to set [code]compression_mode[/code]. </description> </method> <method name="open_encrypted"> diff --git a/doc/classes/GDNativeLibraryResourceLoader.xml b/doc/classes/GDNativeLibraryResourceLoader.xml deleted file mode 100644 index 1b98fa3889..0000000000 --- a/doc/classes/GDNativeLibraryResourceLoader.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="GDNativeLibraryResourceLoader" inherits="ResourceFormatLoader" category="Core" version="3.2"> - <brief_description> - </brief_description> - <description> - </description> - <tutorials> - </tutorials> - <methods> - </methods> - <constants> - </constants> -</class> diff --git a/doc/classes/GDNativeLibraryResourceSaver.xml b/doc/classes/GDNativeLibraryResourceSaver.xml deleted file mode 100644 index 346d0d87d4..0000000000 --- a/doc/classes/GDNativeLibraryResourceSaver.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="GDNativeLibraryResourceSaver" inherits="ResourceFormatSaver" category="Core" version="3.2"> - <brief_description> - </brief_description> - <description> - </description> - <tutorials> - </tutorials> - <methods> - </methods> - <constants> - </constants> -</class> diff --git a/doc/classes/ItemList.xml b/doc/classes/ItemList.xml index ba3a7fe6d8..d78c930351 100644 --- a/doc/classes/ItemList.xml +++ b/doc/classes/ItemList.xml @@ -46,7 +46,7 @@ <return type="void"> </return> <description> - Ensure selection is visible, adjusting the scroll position as necessary. + Ensure current selection is visible, adjusting the scroll position as necessary. </description> </method> <method name="get_item_at_position" qualifiers="const"> @@ -64,7 +64,7 @@ <return type="int"> </return> <description> - Returns count of items currently in the item list. + Returns the number of items currently in the list. </description> </method> <method name="get_item_custom_bg_color" qualifiers="const"> @@ -73,6 +73,7 @@ <argument index="0" name="idx" type="int"> </argument> <description> + Returns the custom background color of the item specified by [code]idx[/code] index. Default value is [code]Color(0, 0, 0, 0)[/code]. </description> </method> <method name="get_item_custom_fg_color" qualifiers="const"> @@ -81,6 +82,7 @@ <argument index="0" name="idx" type="int"> </argument> <description> + Returns the custom foreground color of the item specified by [code]idx[/code] index. Default value is [code]Color(0, 0, 0, 0)[/code]. </description> </method> <method name="get_item_icon" qualifiers="const"> @@ -89,6 +91,7 @@ <argument index="0" name="idx" type="int"> </argument> <description> + Returns the icon associated with the specified index. Default value is [code]null[/code] </description> </method> <method name="get_item_icon_modulate" qualifiers="const"> @@ -114,6 +117,7 @@ <argument index="0" name="idx" type="int"> </argument> <description> + Returns the metadata value of the specified index. </description> </method> <method name="get_item_text" qualifiers="const"> @@ -122,7 +126,7 @@ <argument index="0" name="idx" type="int"> </argument> <description> - Returns the text for specified item index. + Returns the text associated with the specified index. </description> </method> <method name="get_item_tooltip" qualifiers="const"> @@ -131,21 +135,21 @@ <argument index="0" name="idx" type="int"> </argument> <description> - Returns tooltip hint for specified item index. + Returns the tooltip hint associated with the specified index. </description> </method> <method name="get_selected_items"> <return type="PoolIntArray"> </return> <description> - Returns the list of selected indexes. + Returns an array with the indexes of the selected items. </description> </method> <method name="get_v_scroll"> <return type="VScrollBar"> </return> <description> - Returns the current vertical scroll bar for the List. + Returns the [Object] ID associated with the list. </description> </method> <method name="is_anything_selected"> @@ -161,7 +165,7 @@ <argument index="0" name="idx" type="int"> </argument> <description> - Returns whether or not the item at the specified index is disabled + Returns whether or not the item at the specified index is disabled. </description> </method> <method name="is_item_icon_transposed" qualifiers="const"> @@ -207,7 +211,7 @@ <argument index="1" name="to_idx" type="int"> </argument> <description> - Moves item at index [code]from_idx[/code] to [code]to_idx[/code]. + Moves item from index [code]from_idx[/code] to [code]to_idx[/code]. </description> </method> <method name="remove_item"> @@ -216,7 +220,7 @@ <argument index="0" name="idx" type="int"> </argument> <description> - Remove item at specified index from the list. + Removes the item specified by [code]idx[/code] index from the list. </description> </method> <method name="select"> @@ -239,6 +243,11 @@ <argument index="1" name="custom_bg_color" type="Color"> </argument> <description> + Sets the background color of the item specified by [code]idx[/code] index to the specified [Color]. + [codeblock] + var some_string = "Some text" + some_string.set_item_custom_bg_color(0,Color(1, 0, 0, 1) # This will set the background color of the first item of the control to red. + [/codeblock] </description> </method> <method name="set_item_custom_fg_color"> @@ -249,6 +258,11 @@ <argument index="1" name="custom_fg_color" type="Color"> </argument> <description> + Sets the foreground color of the item specified by [code]idx[/code] index to the specified [Color]. + [codeblock] + var some_string = "Some text" + some_string.set_item_custom_fg_color(0,Color(1, 0, 0, 1) # This will set the foreground color of the first item of the control to red. + [/codeblock] </description> </method> <method name="set_item_disabled"> @@ -259,8 +273,8 @@ <argument index="1" name="disabled" type="bool"> </argument> <description> - Disable (or enable) item at specified index. - Disabled items are not be selectable and do not fire activation (Enter or double-click) signals. + Disable (or enable) item at the specified index. + Disabled items are not be selectable and do not trigger activation (Enter or double-click) signals. </description> </method> <method name="set_item_icon"> @@ -271,7 +285,7 @@ <argument index="1" name="icon" type="Texture"> </argument> <description> - Set (or replace) icon of the item at the specified index. + Set (or replace) the icon's [Texture] associated with the specified index. </description> </method> <method name="set_item_icon_modulate"> @@ -282,7 +296,7 @@ <argument index="1" name="modulate" type="Color"> </argument> <description> - Sets a modulating [Color] for item's icon at the specified index. + Sets a modulating [Color] of the item associated with the specified index. </description> </method> <method name="set_item_icon_region"> @@ -313,7 +327,7 @@ <argument index="1" name="metadata" type="Variant"> </argument> <description> - Sets a value (of any type) to be stored with the item at the specified index. + Sets a value (of any type) to be stored with the item associated with the specified index. </description> </method> <method name="set_item_selectable"> @@ -324,7 +338,7 @@ <argument index="1" name="selectable" type="bool"> </argument> <description> - Allow or disallow selection of the item at the specified index. + Allow or disallow selection of the item associated with the specified index. </description> </method> <method name="set_item_text"> @@ -335,7 +349,7 @@ <argument index="1" name="text" type="String"> </argument> <description> - Sets text of item at specified index. + Sets text of the item associated with the specified index. </description> </method> <method name="set_item_tooltip"> @@ -346,7 +360,7 @@ <argument index="1" name="tooltip" type="String"> </argument> <description> - Sets tooltip hint for item at specified index. + Sets tooltip hint for the item associated with the specified index. </description> </method> <method name="set_item_tooltip_enabled"> @@ -357,7 +371,7 @@ <argument index="1" name="enable" type="bool"> </argument> <description> - Sets whether the tooltip is enabled for specified item index. + Sets whether the tooltip hint is enabled for specified item index. </description> </method> <method name="sort_items_by_text"> @@ -373,7 +387,7 @@ <argument index="0" name="idx" type="int"> </argument> <description> - Ensure item at specified index is not selected. + Ensure the item associated with the specified index is not selected. </description> </method> <method name="unselect_all"> @@ -386,29 +400,38 @@ </methods> <members> <member name="allow_reselect" type="bool" setter="set_allow_reselect" getter="get_allow_reselect"> - If [code]true[/code], the currently selected item may be selected again. + If [code]true[/code], the currently selected item can be selected again. </member> <member name="allow_rmb_select" type="bool" setter="set_allow_rmb_select" getter="get_allow_rmb_select"> - If [code]true[/code], a right mouse button click can select items. + If [code]true[/code], right mouse button click can select items. </member> <member name="auto_height" type="bool" setter="set_auto_height" getter="has_auto_height"> + If [code]true[/code], the control will automatically resize the height to fit its content. </member> <member name="fixed_column_width" type="int" setter="set_fixed_column_width" getter="get_fixed_column_width"> + Sets the default column width in pixels. + If left to default value, each item will have a width equal to the width of its content and the columns will have an uneven width. </member> <member name="fixed_icon_size" type="Vector2" setter="set_fixed_icon_size" getter="get_fixed_icon_size"> + Sets the default icon size in pixels. </member> <member name="icon_mode" type="int" setter="set_icon_mode" getter="get_icon_mode" enum="ItemList.IconMode"> + Sets the default position of the icon to either [constant ICON_MODE_LEFT] or [constant ICON_MODE_TOP]. </member> <member name="icon_scale" type="float" setter="set_icon_scale" getter="get_icon_scale"> + Sets the icon size to its initial size multiplied by the specified scale. Default value is 1.0. </member> <member name="max_columns" type="int" setter="set_max_columns" getter="get_max_columns"> + Sets the maximum columns the list will have. + If set to anything other than the default, the content will be split among the specified columns. </member> <member name="max_text_lines" type="int" setter="set_max_text_lines" getter="get_max_text_lines"> </member> <member name="same_column_width" type="bool" setter="set_same_column_width" getter="is_same_column_width"> + If set to [code]true[/code], all columns will have the same width specified by [member fixed_column_width]. </member> <member name="select_mode" type="int" setter="set_select_mode" getter="get_select_mode" enum="ItemList.SelectMode"> - Allow single or multiple selection. See the [code]SELECT_*[/code] constants. + Allow single or multiple item selection. See the [enum SelectMode] constants. </member> </members> <signals> @@ -416,7 +439,7 @@ <argument index="0" name="index" type="int"> </argument> <description> - Fired when specified list item is activated via double click or Enter. + Triggered when specified list item is activated via double click or Enter. </description> </signal> <signal name="item_rmb_selected"> @@ -425,7 +448,7 @@ <argument index="1" name="at_position" type="Vector2"> </argument> <description> - Fired when specified list item has been selected via right mouse clicking. + Triggered when specified list item has been selected via right mouse clicking. The click position is also provided to allow appropriate popup of context menus at the correct location. [member allow_rmb_select] must be enabled. @@ -435,7 +458,7 @@ <argument index="0" name="index" type="int"> </argument> <description> - Fired when specified item has been selected. + Triggered when specified item has been selected. [member allow_reselect] must be enabled to reselect an item. </description> </signal> @@ -445,17 +468,20 @@ <argument index="1" name="selected" type="bool"> </argument> <description> - Fired when a multiple selection is altered on a list allowing multiple selection. + Triggered when a multiple selection is altered on a list allowing multiple selection. </description> </signal> <signal name="nothing_selected"> <description> + Triggered when a left mouse click is issued within the rect of the list but on empty space. </description> </signal> <signal name="rmb_clicked"> <argument index="0" name="at_position" type="Vector2"> </argument> <description> + Triggered when a right mouse click is issued within the rect of the list but on empty space. + [member allow_rmb_select] must be enabled. </description> </signal> </signals> diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml index 2c680e828e..7b50021284 100644 --- a/doc/classes/OS.xml +++ b/doc/classes/OS.xml @@ -811,12 +811,12 @@ <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="min_window_size" type="Vector2" setter="set_min_window_size" getter="get_min_window_size"> - The minimum size of the window (without counting window manager decorations). Does not affect fullscreen mode. Set to [code](0, 0)[/code] to reset to the system default value. - </member> <member name="max_window_size" type="Vector2" setter="set_max_window_size" getter="get_max_window_size"> The maximum size of the window (without counting window manager decorations). Does not affect fullscreen mode. Set to [code](0, 0)[/code] to reset to the system default value. </member> + <member name="min_window_size" type="Vector2" setter="set_min_window_size" getter="get_min_window_size"> + The minimum size of the window (without counting window manager decorations). Does not affect fullscreen mode. Set to [code](0, 0)[/code] to reset to the system default value. + </member> <member name="screen_orientation" type="int" setter="set_screen_orientation" getter="get_screen_orientation" enum="_OS.ScreenOrientation"> The current screen orientation. </member> diff --git a/doc/classes/Resource.xml b/doc/classes/Resource.xml index 211bda1a09..acd608de6a 100644 --- a/doc/classes/Resource.xml +++ b/doc/classes/Resource.xml @@ -4,7 +4,7 @@ Base class for all resources. </brief_description> <description> - Resource is the base class for all resource types, serving primarily as data containers. They are reference counted and freed when no longer in use. They are also loaded only once from disk, and further attempts to load the resource will return the same reference (all this in contrast to a [Node], which is not reference counted and can be instanced from disk as many times as desired). Resources can be saved externally on disk or bundled into another object, such as a [Node] or another resource. + Resource is the base class for all Godot-specific resource types, serving primarily as data containers. They are reference counted and freed when no longer in use. They are also cached once loaded from disk, so that any further attempts to load a resource from a given path will return the same reference (all this in contrast to a [Node], which is not reference counted and can be instanced from disk as many times as desired). Resources can be saved externally on disk or bundled into another object, such as a [Node] or another resource. </description> <tutorials> <link>https://docs.godotengine.org/en/latest/getting_started/step_by_step/resources.html</link> @@ -14,6 +14,7 @@ <return type="void"> </return> <description> + Virtual function which can be overridden to customize the behavior value of [method setup_local_to_scene]. </description> </method> <method name="duplicate" qualifiers="const"> @@ -29,6 +30,7 @@ <return type="Node"> </return> <description> + If [member resource_local_to_scene] is enabled and the resource was loaded from a [PackedScene] instantiation, returns the local scene where this resource's unique copy is in use. Otherwise, returns [code]null[/code]. </description> </method> <method name="get_rid" qualifiers="const"> @@ -42,6 +44,8 @@ <return type="void"> </return> <description> + This method is called when a resource with [member resource_local_to_scene] enabled is loaded from a [PackedScene] instantiation. Its behavior can be customized by overriding [method _setup_local_to_scene] from script. + For most resources, this method performs no base logic. [ViewportTexture] performs custom logic to properly set the proxy texture and flags in the local viewport. </description> </method> <method name="take_over_path"> @@ -50,12 +54,13 @@ <argument index="0" name="path" type="String"> </argument> <description> - Sets the path of the resource. Differs from [code]set_path()[/code], if another [Resource] exists with "path" it over-takes it, instead of failing. + Sets the path of the resource, potentially overriding an existing cache entry for this path. This differs from setting [member resource_path], as the latter would error out if another resource was already cached for the given path. </description> </method> </methods> <members> <member name="resource_local_to_scene" type="bool" setter="set_local_to_scene" getter="is_local_to_scene"> + If [code]true[/code], the resource will be made unique in each instance of its local scene. It can thus be modified in a scene instance without impacting other instances of that same scene. </member> <member name="resource_name" type="String" setter="set_name" getter="get_name"> The name of the resource. This is an optional identifier. diff --git a/doc/classes/ResourceFormatDDS.xml b/doc/classes/ResourceFormatDDS.xml deleted file mode 100644 index 9717052a5d..0000000000 --- a/doc/classes/ResourceFormatDDS.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="ResourceFormatDDS" inherits="ResourceFormatLoader" category="Core" version="3.2"> - <brief_description> - </brief_description> - <description> - </description> - <tutorials> - </tutorials> - <methods> - </methods> - <constants> - </constants> -</class> diff --git a/doc/classes/ResourceFormatImporter.xml b/doc/classes/ResourceFormatImporter.xml deleted file mode 100644 index e5c84e6db4..0000000000 --- a/doc/classes/ResourceFormatImporter.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="ResourceFormatImporter" inherits="ResourceFormatLoader" category="Core" version="3.2"> - <brief_description> - </brief_description> - <description> - </description> - <tutorials> - </tutorials> - <methods> - </methods> - <constants> - </constants> -</class> diff --git a/doc/classes/ResourceFormatLoader.xml b/doc/classes/ResourceFormatLoader.xml index 925706b50c..f62191413a 100644 --- a/doc/classes/ResourceFormatLoader.xml +++ b/doc/classes/ResourceFormatLoader.xml @@ -4,9 +4,9 @@ Loads a specific resource type from a file. </brief_description> <description> - Godot loads resources in the editor or in exported games using ResourceFormatLoaders. They get queried when you call [code]load[/code], or when a resource with internal dependencies is loaded. Each file type may load as a different resource type, so multiple ResourceFormatLoader are registered in the engine. - Extending this class allows you to define your own. You should give it a global class name with [code]class_name[/code] for it to be registered. You may as well implement a [ResourceFormatSaver]. - Note: You can also extend [EditorImportPlugin] if the resource type you need exists but Godot is unable to load its format. Choosing one way over another depends if the format is suitable or not for the final exported game. Example: it's better to import .PNG textures as .STEX first, so they can be loaded with better efficiency on the graphics card. + Godot loads resources in the editor or in exported games using ResourceFormatLoaders. They are queried automatically via the [ResourceLoader] singleton, or when a resource with internal dependencies is loaded. Each file type may load as a different resource type, so multiple ResourceFormatLoaders are registered in the engine. + Extending this class allows you to define your own loader. Be sure to respect the documented return types and values. You should give it a global class name with [code]class_name[/code] for it to be registered. Like built-in ResourceFormatLoaders, it will be called automatically when loading resources of its handled type(s). You may also implement a [ResourceFormatSaver]. + Note: You can also extend [EditorImportPlugin] if the resource type you need exists but Godot is unable to load its format. Choosing one way over another depends if the format is suitable or not for the final exported game. For example, it's better to import [code].png[/code] textures as [code].stex[/code] ([StreamTexture]) first, so they can be loaded with better efficiency on the graphics card. </description> <tutorials> </tutorials> @@ -19,7 +19,7 @@ <argument index="1" name="add_types" type="String"> </argument> <description> - If implemented, gets the dependencies of a given resource. If [code]add_types[/code] is [code]true[/code], paths should be appended [code]::TypeName[/code], where [code]TypeName[/code] is the class name of the dependency. Note that custom resource types defined by scripts aren't known by the [ClassDB], so you might just return [code]Resource[/code] for them. + If implemented, gets the dependencies of a given resource. If [code]add_types[/code] is [code]true[/code], paths should be appended [code]::TypeName[/code], where [code]TypeName[/code] is the class name of the dependency. Note that custom resource types defined by scripts aren't known by the [ClassDB], so you might just return [code]"Resource"[/code] for them. </description> </method> <method name="get_recognized_extensions" qualifiers="virtual"> @@ -55,7 +55,7 @@ <argument index="1" name="original_path" type="String"> </argument> <description> - Loads a resource when the engine finds this loader to be compatible. If the loaded resource is the result of an import, [code]original_path[/code] will target the source file. Returns a resource object if succeeded, or an [code]ERR_*[/code] constant listed in [@GlobalScope] if it failed. + Loads a resource when the engine finds this loader to be compatible. If the loaded resource is the result of an import, [code]original_path[/code] will target the source file. Returns a [Resource] object on success, or an [enum @GlobalScope.Error] constant in case of failure. </description> </method> <method name="rename_dependencies" qualifiers="virtual"> @@ -66,7 +66,8 @@ <argument index="1" name="renames" type="String"> </argument> <description> - If implemented, renames dependencies within the given resource and saves it. [code]renames[/code] is a dictionary [code]{ String => String }[/code] mapping old dependency paths to new paths. Returns [code]OK[/code] on success, or an [code]ERR_*[/code] constant listed in [@GlobalScope] in case of failure. + If implemented, renames dependencies within the given resource and saves it. [code]renames[/code] is a dictionary [code]{ String => String }[/code] mapping old dependency paths to new paths. + Returns [constant @GlobalScope.OK] on success, or an [enum @GlobalScope.Error] constant in case of failure. </description> </method> </methods> diff --git a/doc/classes/ResourceFormatLoaderBMFont.xml b/doc/classes/ResourceFormatLoaderBMFont.xml deleted file mode 100644 index f5b26a6ff7..0000000000 --- a/doc/classes/ResourceFormatLoaderBMFont.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="ResourceFormatLoaderBMFont" inherits="ResourceFormatLoader" category="Core" version="3.2"> - <brief_description> - </brief_description> - <description> - </description> - <tutorials> - </tutorials> - <methods> - </methods> - <constants> - </constants> -</class> diff --git a/doc/classes/ResourceFormatLoaderBinary.xml b/doc/classes/ResourceFormatLoaderBinary.xml deleted file mode 100644 index cf4a2373dc..0000000000 --- a/doc/classes/ResourceFormatLoaderBinary.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="ResourceFormatLoaderBinary" inherits="ResourceFormatLoader" category="Core" version="3.2"> - <brief_description> - </brief_description> - <description> - </description> - <tutorials> - </tutorials> - <methods> - </methods> - <constants> - </constants> -</class> diff --git a/doc/classes/ResourceFormatLoaderDynamicFont.xml b/doc/classes/ResourceFormatLoaderDynamicFont.xml deleted file mode 100644 index af06ea0d8d..0000000000 --- a/doc/classes/ResourceFormatLoaderDynamicFont.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="ResourceFormatLoaderDynamicFont" inherits="ResourceFormatLoader" category="Core" version="3.2"> - <brief_description> - </brief_description> - <description> - </description> - <tutorials> - </tutorials> - <methods> - </methods> - <constants> - </constants> -</class> diff --git a/doc/classes/ResourceFormatLoaderGDScript.xml b/doc/classes/ResourceFormatLoaderGDScript.xml deleted file mode 100644 index 5bb9127978..0000000000 --- a/doc/classes/ResourceFormatLoaderGDScript.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="ResourceFormatLoaderGDScript" inherits="ResourceFormatLoader" category="Core" version="3.2"> - <brief_description> - </brief_description> - <description> - </description> - <tutorials> - </tutorials> - <methods> - </methods> - <constants> - </constants> -</class> diff --git a/doc/classes/ResourceFormatLoaderImage.xml b/doc/classes/ResourceFormatLoaderImage.xml deleted file mode 100644 index de53d2c076..0000000000 --- a/doc/classes/ResourceFormatLoaderImage.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="ResourceFormatLoaderImage" inherits="ResourceFormatLoader" category="Core" version="3.2"> - <brief_description> - </brief_description> - <description> - </description> - <tutorials> - </tutorials> - <methods> - </methods> - <constants> - </constants> -</class> diff --git a/doc/classes/ResourceFormatLoaderNativeScript.xml b/doc/classes/ResourceFormatLoaderNativeScript.xml deleted file mode 100644 index 7355f702b9..0000000000 --- a/doc/classes/ResourceFormatLoaderNativeScript.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="ResourceFormatLoaderNativeScript" inherits="ResourceFormatLoader" category="Core" version="3.2"> - <brief_description> - </brief_description> - <description> - </description> - <tutorials> - </tutorials> - <methods> - </methods> - <constants> - </constants> -</class> diff --git a/doc/classes/ResourceFormatLoaderShader.xml b/doc/classes/ResourceFormatLoaderShader.xml deleted file mode 100644 index 1bef7485fb..0000000000 --- a/doc/classes/ResourceFormatLoaderShader.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="ResourceFormatLoaderShader" inherits="ResourceFormatLoader" category="Core" version="3.2"> - <brief_description> - </brief_description> - <description> - </description> - <tutorials> - </tutorials> - <methods> - </methods> - <constants> - </constants> -</class> diff --git a/doc/classes/ResourceFormatLoaderStreamTexture.xml b/doc/classes/ResourceFormatLoaderStreamTexture.xml deleted file mode 100644 index 4bdc74acbc..0000000000 --- a/doc/classes/ResourceFormatLoaderStreamTexture.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="ResourceFormatLoaderStreamTexture" inherits="ResourceFormatLoader" category="Core" version="3.2"> - <brief_description> - </brief_description> - <description> - </description> - <tutorials> - </tutorials> - <methods> - </methods> - <constants> - </constants> -</class> diff --git a/doc/classes/ResourceFormatLoaderText.xml b/doc/classes/ResourceFormatLoaderText.xml deleted file mode 100644 index 92ad3179bf..0000000000 --- a/doc/classes/ResourceFormatLoaderText.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="ResourceFormatLoaderText" inherits="ResourceFormatLoader" category="Core" version="3.2"> - <brief_description> - </brief_description> - <description> - </description> - <tutorials> - </tutorials> - <methods> - </methods> - <constants> - </constants> -</class> diff --git a/doc/classes/ResourceFormatLoaderTextureLayered.xml b/doc/classes/ResourceFormatLoaderTextureLayered.xml deleted file mode 100644 index 69c3eedf63..0000000000 --- a/doc/classes/ResourceFormatLoaderTextureLayered.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="ResourceFormatLoaderTextureLayered" inherits="ResourceFormatLoader" category="Core" version="3.2"> - <brief_description> - </brief_description> - <description> - </description> - <tutorials> - </tutorials> - <methods> - </methods> - <constants> - </constants> -</class> diff --git a/doc/classes/ResourceFormatLoaderTheora.xml b/doc/classes/ResourceFormatLoaderTheora.xml deleted file mode 100644 index 1b5e30f09c..0000000000 --- a/doc/classes/ResourceFormatLoaderTheora.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="ResourceFormatLoaderTheora" inherits="ResourceFormatLoader" category="Core" version="3.2"> - <brief_description> - </brief_description> - <description> - </description> - <tutorials> - </tutorials> - <methods> - </methods> - <constants> - </constants> -</class> diff --git a/doc/classes/ResourceFormatLoaderWebm.xml b/doc/classes/ResourceFormatLoaderWebm.xml deleted file mode 100644 index a45e5d488d..0000000000 --- a/doc/classes/ResourceFormatLoaderWebm.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="ResourceFormatLoaderWebm" inherits="ResourceFormatLoader" category="Core" version="3.2"> - <brief_description> - </brief_description> - <description> - </description> - <tutorials> - </tutorials> - <methods> - </methods> - <constants> - </constants> -</class> diff --git a/doc/classes/ResourceFormatPKM.xml b/doc/classes/ResourceFormatPKM.xml deleted file mode 100644 index 6c442cd934..0000000000 --- a/doc/classes/ResourceFormatPKM.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="ResourceFormatPKM" inherits="ResourceFormatLoader" category="Core" version="3.2"> - <brief_description> - </brief_description> - <description> - </description> - <tutorials> - </tutorials> - <methods> - </methods> - <constants> - </constants> -</class> diff --git a/doc/classes/ResourceFormatPVR.xml b/doc/classes/ResourceFormatPVR.xml deleted file mode 100644 index d82f48f207..0000000000 --- a/doc/classes/ResourceFormatPVR.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="ResourceFormatPVR" inherits="ResourceFormatLoader" category="Core" version="3.2"> - <brief_description> - </brief_description> - <description> - </description> - <tutorials> - </tutorials> - <methods> - </methods> - <constants> - </constants> -</class> diff --git a/doc/classes/ResourceFormatSaver.xml b/doc/classes/ResourceFormatSaver.xml index caa05dce26..c40f614aa2 100644 --- a/doc/classes/ResourceFormatSaver.xml +++ b/doc/classes/ResourceFormatSaver.xml @@ -4,8 +4,8 @@ Saves a specific resource type to a file. </brief_description> <description> - The engine can save resources when you do it from the editor, or when you call [method ResourceSaver.save]. This is accomplished with multiple [ResourceFormatSaver]s, each handling its own format. - By default, Godot saves resources as [code].tres[/code], [code].res[/code] or another built-in format, but you can choose to create your own format by extending this class. You should give it a global class name with [code]class_name[/code] for it to be registered. You may as well implement a [ResourceFormatLoader]. + The engine can save resources when you do it from the editor, or when you use the [ResourceSaver] singleton. This is accomplished thanks to multiple [ResourceFormatSaver]s, each handling its own format and called automatically by the engine. + By default, Godot saves resources as [code].tres[/code] (text-based), [code].res[/code] (binary) or another built-in format, but you can choose to create your own format by extending this class. Be sure to respect the documented return types and values. You should give it a global class name with [code]class_name[/code] for it to be registered. Like built-in ResourceFormatSavers, it will be called automatically when saving resources of its recognized type(s). You may also implement a [ResourceFormatLoader]. </description> <tutorials> </tutorials> @@ -16,7 +16,7 @@ <argument index="0" name="resource" type="Resource"> </argument> <description> - Gets the list of extensions for files this saver is able to write. + Returns the list of extensions available for saving the resource object, provided it is recognized (see [method recognize]). </description> </method> <method name="recognize" qualifiers="virtual"> @@ -25,7 +25,7 @@ <argument index="0" name="resource" type="Resource"> </argument> <description> - Returns [code]true[/code] if the given resource object can be saved by this saver. + Returns whether the given resource object can be saved by this saver. </description> </method> <method name="save" qualifiers="virtual"> @@ -38,7 +38,8 @@ <argument index="2" name="flags" type="int"> </argument> <description> - Saves the given resource object to a file. [code]flags[/code] is a bitmask composed with [code]FLAG_*[/code] constants defined in [ResourceSaver]. Returns [code]OK[/code] on success, or an [code]ERR_*[/code] constant listed in [@GlobalScope] if it failed. + Saves the given resource object to a file at the target [code]path[/code]. [code]flags[/code] is a bitmask composed with [enum ResourceSaver.SaverFlags] constants. + Returns [constant @GlobalScope.OK] on success, or an [enum @GlobalScope.Error] constant in case of failure. </description> </method> </methods> diff --git a/doc/classes/ResourceFormatSaverBinary.xml b/doc/classes/ResourceFormatSaverBinary.xml deleted file mode 100644 index 32c286d0d9..0000000000 --- a/doc/classes/ResourceFormatSaverBinary.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="ResourceFormatSaverBinary" inherits="ResourceFormatSaver" category="Core" version="3.2"> - <brief_description> - </brief_description> - <description> - </description> - <tutorials> - </tutorials> - <methods> - </methods> - <constants> - </constants> -</class> diff --git a/doc/classes/ResourceFormatSaverGDScript.xml b/doc/classes/ResourceFormatSaverGDScript.xml deleted file mode 100644 index 0fe65e28b0..0000000000 --- a/doc/classes/ResourceFormatSaverGDScript.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="ResourceFormatSaverGDScript" inherits="ResourceFormatSaver" category="Core" version="3.2"> - <brief_description> - </brief_description> - <description> - </description> - <tutorials> - </tutorials> - <methods> - </methods> - <constants> - </constants> -</class> diff --git a/doc/classes/ResourceFormatSaverNativeScript.xml b/doc/classes/ResourceFormatSaverNativeScript.xml deleted file mode 100644 index 7a699a2cca..0000000000 --- a/doc/classes/ResourceFormatSaverNativeScript.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="ResourceFormatSaverNativeScript" inherits="ResourceFormatSaver" category="Core" version="3.2"> - <brief_description> - </brief_description> - <description> - </description> - <tutorials> - </tutorials> - <methods> - </methods> - <constants> - </constants> -</class> diff --git a/doc/classes/ResourceFormatSaverShader.xml b/doc/classes/ResourceFormatSaverShader.xml deleted file mode 100644 index 65ddee42fd..0000000000 --- a/doc/classes/ResourceFormatSaverShader.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="ResourceFormatSaverShader" inherits="ResourceFormatSaver" category="Core" version="3.2"> - <brief_description> - </brief_description> - <description> - </description> - <tutorials> - </tutorials> - <methods> - </methods> - <constants> - </constants> -</class> diff --git a/doc/classes/ResourceFormatSaverText.xml b/doc/classes/ResourceFormatSaverText.xml deleted file mode 100644 index 921de81031..0000000000 --- a/doc/classes/ResourceFormatSaverText.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="ResourceFormatSaverText" inherits="ResourceFormatSaver" category="Core" version="3.2"> - <brief_description> - </brief_description> - <description> - </description> - <tutorials> - </tutorials> - <methods> - </methods> - <constants> - </constants> -</class> diff --git a/doc/classes/ResourceImporter.xml b/doc/classes/ResourceImporter.xml deleted file mode 100644 index e0c0aa9a47..0000000000 --- a/doc/classes/ResourceImporter.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="ResourceImporter" inherits="Reference" category="Core" version="3.2"> - <brief_description> - </brief_description> - <description> - </description> - <tutorials> - </tutorials> - <methods> - </methods> - <constants> - </constants> -</class> diff --git a/doc/classes/ResourceInteractiveLoader.xml b/doc/classes/ResourceInteractiveLoader.xml index bb9826999c..9d5a52deb2 100644 --- a/doc/classes/ResourceInteractiveLoader.xml +++ b/doc/classes/ResourceInteractiveLoader.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="ResourceInteractiveLoader" inherits="Reference" category="Core" version="3.2"> <brief_description> - Interactive Resource Loader. + Interactive [Resource] loader. </brief_description> <description> - Interactive Resource Loader. This object is returned by ResourceLoader when performing an interactive load. It allows to load with high granularity, so this is mainly useful for displaying load bars/percentages. + Interactive [Resource] loader. This object is returned by [ResourceLoader] when performing an interactive load. It allows to load with high granularity, so this is mainly useful for displaying loading bars/percentages. </description> <tutorials> </tutorials> @@ -13,14 +13,14 @@ <return type="Resource"> </return> <description> - Returns the loaded resource (only if loaded). Otherwise, returns null. + Returns the loaded resource if the load operation completed successfully, [code]null[/code] otherwise. </description> </method> <method name="get_stage" qualifiers="const"> <return type="int"> </return> <description> - Returns the load stage. The total amount of stages can be queried with [method get_stage_count] + Returns the load stage. The total amount of stages can be queried with [method get_stage_count]. </description> </method> <method name="get_stage_count" qualifiers="const"> @@ -34,13 +34,19 @@ <return type="int" enum="Error"> </return> <description> - Poll the load. If OK is returned, this means poll will have to be called again. If ERR_FILE_EOF is returned, them the load has finished and the resource can be obtained by calling [method get_resource]. + Polls the loading operation, i.e. loads a data chunk up to the next stage. + Returns [constant @GlobalScope.OK] if the poll is successful but the load operation has not finished yet (intermediate stage). This means [method poll] will have to be called again until the last stage is completed. + Returns [constant @GlobalScope.ERR_FILE_EOF] if the load operation has completed successfully. The loaded resource can be obtained by calling [method get_resource]. + Returns another [enum @GlobalScope.Error] code if the poll has failed. </description> </method> <method name="wait"> <return type="int" enum="Error"> </return> <description> + Polls the loading operation successively until the resource is completely loaded or a [method poll] fails. + Returns [constant @GlobalScope.ERR_FILE_EOF] if the load operation has completed successfully. The loaded resource can be obtained by calling [method get_resource]. + Returns another [enum @GlobalScope.Error] code if a poll has failed, aborting the operation. </description> </method> </methods> diff --git a/doc/classes/ResourceLoader.xml b/doc/classes/ResourceLoader.xml index 76b7c39191..558852704e 100644 --- a/doc/classes/ResourceLoader.xml +++ b/doc/classes/ResourceLoader.xml @@ -1,10 +1,12 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="ResourceLoader" inherits="Object" category="Core" version="3.2"> <brief_description> - Resource Loader. + Singleton used to load resource files. </brief_description> <description> - Resource Loader. This is a static object accessible as [ResourceLoader]. GDScript has a simplified load() function, though. + Singleton used to load resource files from the filesystem. + It uses the many [ResourceFormatLoader] classes registered in the engine (either built-in or from a plugin) to load files into memory and convert them to a format that can be used by the engine. + GDScript has a simplified [method @GDScript.load] built-in method which can be used in most situations, leaving the use of [ResourceLoader] for more advanced scenarios. </description> <tutorials> </tutorials> @@ -17,6 +19,8 @@ <argument index="1" name="type_hint" type="String" default=""""> </argument> <description> + Returns whether a recognized resource exists for the given [code]path[/code]. + An optional [code]type_hint[/code] can be used to further specify the [Resource] type that should be handled by the [ResourceFormatLoader]. </description> </method> <method name="get_dependencies"> @@ -25,6 +29,7 @@ <argument index="0" name="path" type="String"> </argument> <description> + Returns the dependencies for the resource at the given [code]path[/code]. </description> </method> <method name="get_recognized_extensions_for_type"> @@ -42,6 +47,7 @@ <argument index="0" name="path" type="String"> </argument> <description> + Deprecated method. Use [method has_cached] or [method exists] instead. </description> </method> <method name="has_cached"> @@ -50,6 +56,8 @@ <argument index="0" name="path" type="String"> </argument> <description> + Returns whether a cached resource is available for the given [code]path[/code]. + Once a resource has been loaded by the engine, it is cached in memory for faster access, and future calls to the [method load] or [method load_interactive] methods will use the cached version. The cached resource can be overridden by using [method Resource.take_over_path] on a new resource for that same path. </description> </method> <method name="load"> @@ -62,6 +70,11 @@ <argument index="2" name="no_cache" type="bool" default="false"> </argument> <description> + Loads a resource at the given [code]path[/code], caching the result for further access. + The registered [ResourceFormatLoader]s are queried sequentially to find the first one which can handle the file's extension, and then attempt loading. If loading fails, the remaining ResourceFormatLoaders are also attempted. + An optional [code]type_hint[/code] can be used to further specify the [Resource] type that should be handled by the [ResourceFormatLoader]. + If [code]no_cache[/code] is [code]true[/code], the resource cache will be bypassed and the resource will be loaded anew. Otherwise, the cached resource will be returned if it exists. + Returns an empty resource if no ResourceFormatLoader could handle the file. </description> </method> <method name="load_interactive"> @@ -72,7 +85,8 @@ <argument index="1" name="type_hint" type="String" default=""""> </argument> <description> - Load a resource interactively, the returned object allows to load with high granularity. + Starts loading a resource interactively. The returned [ResourceInteractiveLoader] object allows to load with high granularity, calling its [method ResourceInteractiveLoader.poll] method successively to load chunks. + An optional [code]type_hint[/code] can be used to further specify the [Resource] type that should be handled by the [ResourceFormatLoader]. </description> </method> <method name="set_abort_on_missing_resources"> diff --git a/doc/classes/ResourcePreloader.xml b/doc/classes/ResourcePreloader.xml index d6c635b6eb..2b00c038e1 100644 --- a/doc/classes/ResourcePreloader.xml +++ b/doc/classes/ResourcePreloader.xml @@ -5,6 +5,7 @@ </brief_description> <description> This node is used to preload sub-resources inside a scene, so when the scene is loaded, all the resources are ready to use and can be retrieved from the preloader. + GDScript has a simplified [method @GDScript.preload] built-in method which can be used in most situations, leaving the use of [ResourcePreloader] for more advanced scenarios. </description> <tutorials> </tutorials> diff --git a/doc/classes/ResourceSaver.xml b/doc/classes/ResourceSaver.xml index eac022f564..778ba4293f 100644 --- a/doc/classes/ResourceSaver.xml +++ b/doc/classes/ResourceSaver.xml @@ -1,10 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="ResourceSaver" inherits="Object" category="Core" version="3.2"> <brief_description> - Resource saving interface. + Singleton for saving Godot-specific resource types. </brief_description> <description> - Resource saving interface, used for saving resources to disk. + Singleton for saving Godot-specific resource types to the filesystem. + It uses the many [ResourceFormatSaver] classes registered in the engine (either built-in or from a plugin) to save engine-specific resource data to text-based (e.g. [code].tres[/code] or [code].tscn[/code]) or binary files (e.g. [code].res[/code] or [code].scn[/code]). </description> <tutorials> </tutorials> @@ -28,24 +29,33 @@ <argument index="2" name="flags" type="int" enum="ResourceSaver.SaverFlags" default="0"> </argument> <description> - Saves a resource to disk. + Saves a resource to disk to the given path, using a [ResourceFormatSaver] that recognizes the resource object. + The [code]flags[/code] bitmask can be specified to customize the save behavior. + Returns [constant @GlobalScope.OK] on success. </description> </method> </methods> <constants> <constant name="FLAG_RELATIVE_PATHS" value="1" enum="SaverFlags"> + Save the resource with a path relative to the scene which uses it. </constant> <constant name="FLAG_BUNDLE_RESOURCES" value="2" enum="SaverFlags"> + Bundles external resources. </constant> <constant name="FLAG_CHANGE_PATH" value="4" enum="SaverFlags"> + Change the [member Resource.resource_path] of the saved resource to match its new location. </constant> <constant name="FLAG_OMIT_EDITOR_PROPERTIES" value="8" enum="SaverFlags"> + Do not save editor-specific metadata (identified by their [code]__editor[/code] prefix). </constant> <constant name="FLAG_SAVE_BIG_ENDIAN" value="16" enum="SaverFlags"> + Save as big endian (see [member File.endian_swap]). </constant> <constant name="FLAG_COMPRESS" value="32" enum="SaverFlags"> + Compress the resource on save using [constant File.COMPRESSION_ZSTD]. Only available for binary resource types. </constant> <constant name="FLAG_REPLACE_SUBRESOURCE_PATHS" value="64" enum="SaverFlags"> + Take over the paths of the saved subresources (see [method Resource.take_over_path]). </constant> </constants> </class> diff --git a/doc/classes/ResourceSaverPNG.xml b/doc/classes/ResourceSaverPNG.xml deleted file mode 100644 index 5ed4829f25..0000000000 --- a/doc/classes/ResourceSaverPNG.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="ResourceSaverPNG" inherits="ResourceFormatSaver" category="Core" version="3.2"> - <brief_description> - </brief_description> - <description> - </description> - <tutorials> - </tutorials> - <methods> - </methods> - <constants> - </constants> -</class> diff --git a/doc/classes/Sprite.xml b/doc/classes/Sprite.xml index 26ff67cc74..097a5f2ed2 100644 --- a/doc/classes/Sprite.xml +++ b/doc/classes/Sprite.xml @@ -28,6 +28,8 @@ <argument index="0" name="pos" type="Vector2"> </argument> <description> + Returns [code]true[/code], if the pixel at the given position is opaque and [code]false[/code] in other case. + Note: It also returns [code]false[/code], if the sprite's texture is null or if the given position is invalid. </description> </method> </methods> diff --git a/doc/classes/String.xml b/doc/classes/String.xml index af7e5a395a..ff0572f384 100644 --- a/doc/classes/String.xml +++ b/doc/classes/String.xml @@ -757,10 +757,10 @@ </return> <argument index="0" name="from" type="int"> </argument> - <argument index="1" name="len" type="int"> + <argument index="1" name="len" type="int" default="-1"> </argument> <description> - Returns part of the string from the position [code]from[/code] with length [code]len[/code]. + Returns part of the string from the position [code]from[/code] with length [code]len[/code]. Argument [code]len[/code] is optional and using -1 will return remaining characters from given position. </description> </method> <method name="to_ascii"> diff --git a/doc/classes/TextEdit.xml b/doc/classes/TextEdit.xml index 3e4b70f8f8..8139da3a4c 100644 --- a/doc/classes/TextEdit.xml +++ b/doc/classes/TextEdit.xml @@ -105,7 +105,7 @@ <description> Moves the cursor at the specified [code]line[/code] index. If [code]adjust_viewport[/code] is set to true, the viewport will center at the cursor position after the move occurs. Default value is [code]true[/code]. - If [code]can_be_hidden[/code] is set to true, the specified [code]line[/code] can be hidden using [member set_line_as_hidden]. Default value is [code]true[/code]. + If [code]can_be_hidden[/code] is set to true, the specified [code]line[/code] can be hidden using [method set_line_as_hidden]. Default value is [code]true[/code]. </description> </method> <method name="cut"> @@ -369,7 +369,7 @@ <return type="void"> </return> <description> - Unhide all lines that were previously set to hidden by [member set_line_as_hidden]. + Unhide all lines that were previously set to hidden by [method set_line_as_hidden]. </description> </method> </methods> @@ -404,7 +404,7 @@ If [code]true[/code], the fold gutter is visible. This enables folding groups of indented lines. </member> <member name="hiding_enabled" type="bool" setter="set_hiding_enabled" getter="is_hiding_enabled"> - If [code]true[/code], all lines that have been set to hidden by [member set_line_as_hidden], will not be visible. + If [code]true[/code], all lines that have been set to hidden by [method set_line_as_hidden], will not be visible. </member> <member name="highlight_all_occurrences" type="bool" setter="set_highlight_all_occurrences" getter="is_highlight_all_occurrences_enabled"> If [code]true[/code], all occurrences of the selected text will be highlighted. @@ -515,15 +515,12 @@ </constants> <theme_items> <theme_item name="background_color" type="Color"> - Sets the background [Color] of this [TextEdit]. [member syntax_highlighting] has to be enabled. </theme_item> <theme_item name="bookmark_color" type="Color"> - Sets the [Color] of the bookmark marker. [member syntax_highlighting] has to be enabled. </theme_item> <theme_item name="brace_mismatch_color" type="Color"> </theme_item> <theme_item name="breakpoint_color" type="Color"> - Sets the [Color] of the breakpoints. [member breakpoint_gutter] has to be enabled. </theme_item> <theme_item name="caret_background_color" type="Color"> </theme_item> @@ -550,7 +547,6 @@ <theme_item name="completion_selected_color" type="Color"> </theme_item> <theme_item name="current_line_color" type="Color"> - Sets the current line highlight [Color]. [member highlight_current_line] has to be enabled. </theme_item> <theme_item name="executing_line_color" type="Color"> </theme_item> @@ -561,48 +557,38 @@ <theme_item name="folded" type="Texture"> </theme_item> <theme_item name="font" type="Font"> - Sets the default [Font]. </theme_item> <theme_item name="font_color" type="Color"> - Sets the font [Color]. </theme_item> <theme_item name="font_color_selected" type="Color"> </theme_item> <theme_item name="function_color" type="Color"> </theme_item> <theme_item name="line_number_color" type="Color"> - Sets the [Color] of the line numbers. [member show_line_numbers] has to be enabled. </theme_item> <theme_item name="line_spacing" type="int"> - Sets the spacing between the lines. </theme_item> <theme_item name="mark_color" type="Color"> - Sets the [Color] of marked text. </theme_item> <theme_item name="member_variable_color" type="Color"> </theme_item> <theme_item name="normal" type="StyleBox"> - Sets the [StyleBox] of this [TextEdit]. </theme_item> <theme_item name="number_color" type="Color"> </theme_item> <theme_item name="read_only" type="StyleBox"> - Sets the [StyleBox] of this [TextEdit] when [member read_only] is enabled. </theme_item> <theme_item name="safe_line_number_color" type="Color"> </theme_item> <theme_item name="selection_color" type="Color"> - Sets the highlight [Color] of text selections. </theme_item> <theme_item name="space" type="Texture"> </theme_item> <theme_item name="symbol_color" type="Color"> </theme_item> <theme_item name="tab" type="Texture"> - Sets a custom [Texture] for tab text characters. </theme_item> <theme_item name="word_highlighted_color" type="Color"> - Sets the highlight [Color] of multiple occurrences. [member highlight_all_occurrences] has to be enabled. </theme_item> </theme_items> </class> diff --git a/doc/classes/TranslationLoaderPO.xml b/doc/classes/TranslationLoaderPO.xml deleted file mode 100644 index d9896e1807..0000000000 --- a/doc/classes/TranslationLoaderPO.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="TranslationLoaderPO" inherits="ResourceFormatLoader" category="Core" version="3.2"> - <brief_description> - </brief_description> - <description> - </description> - <tutorials> - </tutorials> - <methods> - </methods> - <constants> - </constants> -</class> diff --git a/doc/classes/TranslationServer.xml b/doc/classes/TranslationServer.xml index 400a6e31d5..268fb5b6a5 100644 --- a/doc/classes/TranslationServer.xml +++ b/doc/classes/TranslationServer.xml @@ -31,6 +31,7 @@ <return type="Array"> </return> <description> + Returns an Array of all loaded locales of the game. </description> </method> <method name="get_locale" qualifiers="const"> diff --git a/drivers/dummy/texture_loader_dummy.h b/drivers/dummy/texture_loader_dummy.h index 3038bffc95..0bc7fa226b 100644 --- a/drivers/dummy/texture_loader_dummy.h +++ b/drivers/dummy/texture_loader_dummy.h @@ -35,7 +35,6 @@ #include "scene/resources/texture.h" class ResourceFormatDummyTexture : public ResourceFormatLoader { - GDCLASS(ResourceFormatDummyTexture, ResourceFormatLoader) public: virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL); virtual void get_recognized_extensions(List<String> *p_extensions) const; diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp index 70f1173a7d..418be136b8 100644 --- a/drivers/gles2/rasterizer_storage_gles2.cpp +++ b/drivers/gles2/rasterizer_storage_gles2.cpp @@ -2427,6 +2427,18 @@ void RasterizerStorageGLES2::mesh_add_surface(RID p_mesh, uint32_t p_format, VS: } surface->data = array; surface->index_data = p_index_array; +#else + // Even on non-tools builds, a copy of the surface->data is needed in certain circumstances. + // Rigged meshes using the USE_SKELETON_SOFTWARE path need to read bone data + // from surface->data. + + // if USE_SKELETON_SOFTWARE is active + if (!config.float_texture_supported) { + // if this geometry is used specifically for skinning + if (p_format & (VS::ARRAY_FORMAT_BONES | VS::ARRAY_FORMAT_WEIGHTS)) + surface->data = array; + } + // An alternative is to always make a copy of surface->data. #endif surface->total_data_size += surface->array_byte_size + surface->index_array_byte_size; diff --git a/drivers/png/resource_saver_png.h b/drivers/png/resource_saver_png.h index 584ccd4908..9267f2d678 100644 --- a/drivers/png/resource_saver_png.h +++ b/drivers/png/resource_saver_png.h @@ -35,7 +35,6 @@ #include "core/io/resource_saver.h" class ResourceSaverPNG : public ResourceFormatSaver { - GDCLASS(ResourceSaverPNG, ResourceFormatSaver) public: static Error save_image(const String &p_path, const Ref<Image> &p_img); diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index e471993fc7..8b3c537fe3 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -587,6 +587,26 @@ FindReplaceBar::FindReplaceBar() { /*** CODE EDITOR ****/ +// This function should be used to handle shortcuts that could otherwise +// be handled too late if they weren't handled here. +void CodeTextEditor::_input(const Ref<InputEvent> &event) { + + const Ref<InputEventKey> key_event = event; + if (!key_event.is_valid() || !key_event->is_pressed()) + return; + + if (ED_IS_SHORTCUT("script_text_editor/move_up", key_event)) { + move_lines_up(); + accept_event(); + return; + } + if (ED_IS_SHORTCUT("script_text_editor/move_down", key_event)) { + move_lines_down(); + accept_event(); + return; + } +} + void CodeTextEditor::_text_editor_gui_input(const Ref<InputEvent> &p_event) { Ref<InputEventMouseButton> mb = p_event; @@ -1375,6 +1395,9 @@ void CodeTextEditor::_notification(int p_what) { warning_button->set_icon(get_icon("NodeWarning", "EditorIcons")); add_constant_override("separation", 4 * EDSCALE); } break; + case NOTIFICATION_VISIBILITY_CHANGED: { + set_process_input(is_visible_in_tree()); + } break; default: break; } @@ -1454,6 +1477,7 @@ void CodeTextEditor::remove_all_bookmarks() { void CodeTextEditor::_bind_methods() { + ClassDB::bind_method(D_METHOD("_input"), &CodeTextEditor::_input); ClassDB::bind_method("_text_editor_gui_input", &CodeTextEditor::_text_editor_gui_input); ClassDB::bind_method("_line_col_changed", &CodeTextEditor::_line_col_changed); ClassDB::bind_method("_text_changed", &CodeTextEditor::_text_changed); diff --git a/editor/code_editor.h b/editor/code_editor.h index 0ef8ec7061..ce219f340c 100644 --- a/editor/code_editor.h +++ b/editor/code_editor.h @@ -165,6 +165,7 @@ class CodeTextEditor : public VBoxContainer { void _font_resize_timeout(); bool _add_font_size(int p_delta); + void _input(const Ref<InputEvent> &event); void _text_editor_gui_input(const Ref<InputEvent> &p_event); void _zoom_in(); void _zoom_out(); diff --git a/editor/editor_feature_profile.cpp b/editor/editor_feature_profile.cpp index 36a8772faf..c6646eb28b 100644 --- a/editor/editor_feature_profile.cpp +++ b/editor/editor_feature_profile.cpp @@ -42,7 +42,7 @@ const char *EditorFeatureProfile::feature_names[FEATURE_MAX] = { TTRC("Scene Tree Editing"), TTRC("Import Dock"), TTRC("Node Dock"), - TTRC("Filesystem Dock") + TTRC("FileSystem and Import Docks") }; const char *EditorFeatureProfile::feature_identifiers[FEATURE_MAX] = { @@ -378,18 +378,21 @@ void EditorFeatureProfileManager::_profile_action(int p_action) { switch (p_action) { case PROFILE_CLEAR: { + EditorSettings::get_singleton()->set("_default_feature_profile", ""); EditorSettings::get_singleton()->save(); current_profile = ""; current.unref(); + _update_profile_list(); + _emit_current_profile_changed(); } break; case PROFILE_SET: { String selected = _get_selected_profile(); ERR_FAIL_COND(selected == String()); if (selected == current_profile) { - return; //nothing to do here + return; // Nothing to do here. } EditorSettings::get_singleton()->set("_default_feature_profile", selected); EditorSettings::get_singleton()->save(); @@ -397,7 +400,7 @@ void EditorFeatureProfileManager::_profile_action(int p_action) { current = edited; _update_profile_list(); - + _emit_current_profile_changed(); } break; case PROFILE_IMPORT: { @@ -415,6 +418,7 @@ void EditorFeatureProfileManager::_profile_action(int p_action) { new_profile_name->grab_focus(); } break; case PROFILE_ERASE: { + String selected = _get_selected_profile(); ERR_FAIL_COND(selected == String()); @@ -809,7 +813,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() { profile_actions[PROFILE_CLEAR]->set_disabled(true); profile_actions[PROFILE_CLEAR]->connect("pressed", this, "_profile_action", varray(PROFILE_CLEAR)); - main_vbc->add_margin_child(TTR("Current Profile"), name_hbc); + main_vbc->add_margin_child(TTR("Current Profile:"), name_hbc); HBoxContainer *profiles_hbc = memnew(HBoxContainer); profile_list = memnew(OptionButton); @@ -844,7 +848,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() { profile_actions[PROFILE_EXPORT]->set_disabled(true); profile_actions[PROFILE_EXPORT]->connect("pressed", this, "_profile_action", varray(PROFILE_EXPORT)); - main_vbc->add_margin_child(TTR("Available Profiles"), profiles_hbc); + main_vbc->add_margin_child(TTR("Available Profiles:"), profiles_hbc); h_split = memnew(HSplitContainer); h_split->set_v_size_flags(SIZE_EXPAND_FILL); @@ -855,9 +859,8 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() { class_list_vbc->set_h_size_flags(SIZE_EXPAND_FILL); class_list = memnew(Tree); - class_list_vbc->add_margin_child(TTR("Enabled Classes"), class_list, true); + class_list_vbc->add_margin_child(TTR("Enabled Classes:"), class_list, true); class_list->set_hide_root(true); - class_list->set_hide_folding(true); class_list->set_edit_checkbox_cell_only_when_checkbox_is_pressed(true); class_list->connect("cell_selected", this, "_class_list_item_selected"); class_list->connect("item_edited", this, "_class_list_item_edited", varray(), CONNECT_DEFERRED); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index b6d28dce29..2d2f67314d 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -5044,7 +5044,9 @@ void EditorNode::_feature_profile_changed() { main_editor_buttons[EDITOR_3D]->set_visible(!profile->is_feature_disabled(EditorFeatureProfile::FEATURE_3D)); main_editor_buttons[EDITOR_SCRIPT]->set_visible(!profile->is_feature_disabled(EditorFeatureProfile::FEATURE_SCRIPT)); main_editor_buttons[EDITOR_ASSETLIB]->set_visible(!profile->is_feature_disabled(EditorFeatureProfile::FEATURE_ASSET_LIB)); - if (profile->is_feature_disabled(EditorFeatureProfile::FEATURE_3D) || profile->is_feature_disabled(EditorFeatureProfile::FEATURE_SCRIPT) || profile->is_feature_disabled(EditorFeatureProfile::FEATURE_ASSET_LIB)) { + if ((profile->is_feature_disabled(EditorFeatureProfile::FEATURE_3D) && singleton->main_editor_buttons[EDITOR_3D]->is_pressed()) || + (profile->is_feature_disabled(EditorFeatureProfile::FEATURE_SCRIPT) && singleton->main_editor_buttons[EDITOR_SCRIPT]->is_pressed()) || + (profile->is_feature_disabled(EditorFeatureProfile::FEATURE_ASSET_LIB) && singleton->main_editor_buttons[EDITOR_ASSETLIB]->is_pressed())) { _editor_select(EDITOR_2D); } } else { @@ -5056,6 +5058,7 @@ void EditorNode::_feature_profile_changed() { node_dock->set_visible(true); filesystem_dock->set_visible(true); main_editor_buttons[EDITOR_3D]->set_visible(true); + main_editor_buttons[EDITOR_SCRIPT]->set_visible(true); main_editor_buttons[EDITOR_ASSETLIB]->set_visible(true); } diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index fbf01a9405..3c24fd19b6 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -731,6 +731,8 @@ Vector2 CanvasItemEditor::_position_to_anchor(const Control *p_control, Vector2 ERR_FAIL_COND_V(!p_control, Vector2()); Rect2 parent_rect = p_control->get_parent_anchorable_rect(); + ERR_FAIL_COND_V(parent_rect.size.x == 0, Vector2()); + ERR_FAIL_COND_V(parent_rect.size.y == 0, Vector2()); return (p_control->get_transform().xform(position) - parent_rect.position) / parent_rect.size; } @@ -3348,9 +3350,6 @@ void CanvasItemEditor::_notification(int p_what) { presets_menu->set_visible(true); anchor_mode_button->set_visible(true); - // Set the pressed state of the node - anchor_mode_button->set_pressed(anchors_mode); - // Disable if the selected node is child of a container if (has_container_parents) { presets_menu->set_disabled(true); @@ -3521,6 +3520,7 @@ void CanvasItemEditor::_selection_changed() { } } anchors_mode = (nbValidControls == nbAnchorsMode); + anchor_mode_button->set_pressed(anchors_mode); } void CanvasItemEditor::edit(CanvasItem *p_canvas_item) { @@ -3742,6 +3742,7 @@ void CanvasItemEditor::_set_anchors_and_margins_preset(Control::LayoutPreset p_p undo_redo->commit_action(); anchors_mode = false; + anchor_mode_button->set_pressed(anchors_mode); } void CanvasItemEditor::_set_anchors_and_margins_to_keep_ratio() { @@ -3766,6 +3767,7 @@ void CanvasItemEditor::_set_anchors_and_margins_to_keep_ratio() { undo_redo->add_undo_method(control, "set_meta", "_edit_use_anchors_", use_anchors); anchors_mode = true; + anchor_mode_button->set_pressed(anchors_mode); } } @@ -3912,7 +3914,6 @@ void CanvasItemEditor::_button_toggle_anchor_mode(bool p_status) { } anchors_mode = p_status; - viewport->update(); } diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index df9ce73914..b4719b2e6d 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -1249,7 +1249,7 @@ void ScriptEditor::_menu_option(int p_option) { if (p_option >= WINDOW_SELECT_BASE) { tab_container->set_current_tab(p_option - WINDOW_SELECT_BASE); - script_list->select(p_option - WINDOW_SELECT_BASE); + _update_script_names(); } } } @@ -1376,6 +1376,8 @@ void ScriptEditor::_notification(int p_what) { script_forward->set_icon(get_icon("Forward", "EditorIcons")); script_back->set_icon(get_icon("Back", "EditorIcons")); members_overview_alphabeta_sort_button->set_icon(get_icon("Sort", "EditorIcons")); + filter_scripts->set_right_icon(get_icon("Search", "EditorIcons")); + filter_methods->set_right_icon(get_icon("Search", "EditorIcons")); } break; case NOTIFICATION_READY: { @@ -1633,8 +1635,12 @@ void ScriptEditor::_update_members_overview() { } for (int i = 0; i < functions.size(); i++) { - members_overview->add_item(functions[i].get_slice(":", 0)); - members_overview->set_item_metadata(i, functions[i].get_slice(":", 1).to_int() - 1); + String filter = filter_methods->get_text(); + String name = functions[i].get_slice(":", 0); + if (filter == "" || filter.is_subsequence_ofi(name)) { + members_overview->add_item(name); + members_overview->set_item_metadata(members_overview->get_item_count() - 1, functions[i].get_slice(":", 1).to_int() - 1); + } } String path = se->get_edited_resource()->get_path(); @@ -1853,20 +1859,26 @@ void ScriptEditor::_update_script_names() { _sort_list_on_update = false; } + Vector<_ScriptEditorItemData> sedata_filtered; for (int i = 0; i < sedata.size(); i++) { + String filter = filter_scripts->get_text(); + if (filter == "" || filter.is_subsequence_ofi(sedata[i].name)) { + sedata_filtered.push_back(sedata[i]); + } + } - script_list->add_item(sedata[i].name, sedata[i].icon); + for (int i = 0; i < sedata_filtered.size(); i++) { + script_list->add_item(sedata_filtered[i].name, sedata_filtered[i].icon); int index = script_list->get_item_count() - 1; - script_list->set_item_tooltip(index, sedata[i].tooltip); - script_list->set_item_metadata(index, sedata[i].index); - if (sedata[i].used) { - + script_list->set_item_tooltip(index, sedata_filtered[i].tooltip); + script_list->set_item_metadata(index, sedata_filtered[i].index); /* Saving as metadata the script's index in the tab container and not the filtered one */ + if (sedata_filtered[i].used) { script_list->set_item_custom_bg_color(index, Color(88 / 255.0, 88 / 255.0, 60 / 255.0)); } - if (tab_container->get_current_tab() == sedata[i].index) { + if (tab_container->get_current_tab() == sedata_filtered[i].index) { script_list->select(index); - script_name_label->set_text(sedata[i].name); - script_icon->set_texture(sedata[i].icon); + script_name_label->set_text(sedata_filtered[i].name); + script_icon->set_texture(sedata_filtered[i].icon); } } @@ -2049,7 +2061,7 @@ bool ScriptEditor::edit(const RES &p_resource, int p_line, int p_col, bool p_gra if (should_open) { if (tab_container->get_current_tab() != i) { _go_to_tab(i); - script_list->select(script_list->find_metadata(i)); + _update_script_names(); } if (is_visible_in_tree()) se->ensure_focus(); @@ -2427,7 +2439,7 @@ void ScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Co ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(node); EditorHelp *eh = Object::cast_to<EditorHelp>(node); if (se || eh) { - int new_index = script_list->get_item_at_position(p_point); + int new_index = script_list->get_item_metadata(script_list->get_item_at_position(p_point)); tab_container->move_child(node, new_index); tab_container->set_current_tab(new_index); _update_script_names(); @@ -2444,7 +2456,7 @@ void ScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Co ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(node); EditorHelp *eh = Object::cast_to<EditorHelp>(node); if (se || eh) { - int new_index = script_list->get_item_at_position(p_point); + int new_index = script_list->get_item_metadata(script_list->get_item_at_position(p_point)); tab_container->move_child(node, new_index); tab_container->set_current_tab(new_index); _update_script_names(); @@ -2455,7 +2467,7 @@ void ScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Co Vector<String> files = d["files"]; - int new_index = script_list->get_item_at_position(p_point); + int new_index = script_list->get_item_metadata(script_list->get_item_at_position(p_point)); int num_tabs_before = tab_container->get_child_count(); for (int i = 0; i < files.size(); i++) { String file = files[i]; @@ -2467,7 +2479,7 @@ void ScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Co if (tab_container->get_child_count() > num_tabs_before) { tab_container->move_child(tab_container->get_child(tab_container->get_child_count() - 1), new_index); num_tabs_before = tab_container->get_child_count(); - } else { + } else { /* Maybe script was already open */ tab_container->move_child(tab_container->get_child(tab_container->get_current_tab()), new_index); } } @@ -2962,6 +2974,14 @@ void ScriptEditor::_on_find_in_files_modified_files(PoolStringArray paths) { _update_modified_scripts_for_external_editor(); } +void ScriptEditor::_filter_scripts_text_changed(const String &p_newtext) { + _update_script_names(); +} + +void ScriptEditor::_filter_methods_text_changed(const String &p_newtext) { + _update_members_overview(); +} + void ScriptEditor::_bind_methods() { ClassDB::bind_method("_file_dialog_action", &ScriptEditor::_file_dialog_action); @@ -3013,6 +3033,8 @@ void ScriptEditor::_bind_methods() { ClassDB::bind_method("_toggle_members_overview_alpha_sort", &ScriptEditor::_toggle_members_overview_alpha_sort); ClassDB::bind_method("_update_members_overview", &ScriptEditor::_update_members_overview); ClassDB::bind_method("_script_changed", &ScriptEditor::_script_changed); + ClassDB::bind_method("_filter_scripts_text_changed", &ScriptEditor::_filter_scripts_text_changed); + ClassDB::bind_method("_filter_methods_text_changed", &ScriptEditor::_filter_methods_text_changed); ClassDB::bind_method("_update_recent_scripts", &ScriptEditor::_update_recent_scripts); ClassDB::bind_method("_on_find_in_files_requested", &ScriptEditor::_on_find_in_files_requested); ClassDB::bind_method("_start_find_in_files", &ScriptEditor::_start_find_in_files); @@ -3059,8 +3081,18 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { script_split->add_child(list_split); list_split->set_v_size_flags(SIZE_EXPAND_FILL); + scripts_vbox = memnew(VBoxContainer); + scripts_vbox->set_v_size_flags(SIZE_EXPAND_FILL); + list_split->add_child(scripts_vbox); + + filter_scripts = memnew(LineEdit); + filter_scripts->set_placeholder(TTR("Filter scripts")); + filter_scripts->set_clear_button_enabled(true); + filter_scripts->connect("text_changed", this, "_filter_scripts_text_changed"); + scripts_vbox->add_child(filter_scripts); + script_list = memnew(ItemList); - list_split->add_child(script_list); + scripts_vbox->add_child(script_list); script_list->set_custom_minimum_size(Size2(150, 90) * EDSCALE); //need to give a bit of limit to avoid it from disappearing script_list->set_v_size_flags(SIZE_EXPAND_FILL); script_split->set_split_offset(140); @@ -3096,6 +3128,12 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { buttons_hbox->add_child(members_overview_alphabeta_sort_button); + filter_methods = memnew(LineEdit); + filter_methods->set_placeholder(TTR("Filter methods")); + filter_methods->set_clear_button_enabled(true); + filter_methods->connect("text_changed", this, "_filter_methods_text_changed"); + overview_vbox->add_child(filter_methods); + members_overview = memnew(ItemList); overview_vbox->add_child(members_overview); diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h index 549af1ca31..0d9168261a 100644 --- a/editor/plugins/script_editor_plugin.h +++ b/editor/plugins/script_editor_plugin.h @@ -38,6 +38,7 @@ #include "editor/editor_plugin.h" #include "editor/script_create_dialog.h" #include "scene/gui/item_list.h" +#include "scene/gui/line_edit.h" #include "scene/gui/menu_button.h" #include "scene/gui/split_container.h" #include "scene/gui/tab_container.h" @@ -213,6 +214,9 @@ class ScriptEditor : public PanelContainer { ItemList *script_list; HSplitContainer *script_split; ItemList *members_overview; + LineEdit *filter_scripts; + LineEdit *filter_methods; + VBoxContainer *scripts_vbox; VBoxContainer *overview_vbox; HBoxContainer *buttons_hbox; Label *filename; @@ -341,6 +345,8 @@ class ScriptEditor : public PanelContainer { void _update_members_overview_visibility(); void _update_members_overview(); void _toggle_members_overview_alpha_sort(bool p_alphabetic_sort); + void _filter_scripts_text_changed(const String &p_newtext); + void _filter_methods_text_changed(const String &p_newtext); void _update_script_names(); void _update_script_connections(); bool _sort_list_on_update; diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 9a3991bef1..4b3d468a61 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -919,28 +919,37 @@ public: struct ProjectItem { String project; + String project_name; String path; String conf; - int config_version; + String icon; + String main_scene; uint64_t last_modified; bool favorite; bool grayed; - bool ordered_latest_modification; + ProjectListFilter::FilterOption filter_order_option; ProjectItem() {} - ProjectItem(const String &p_project, const String &p_path, const String &p_conf, int p_config_version, uint64_t p_last_modified, bool p_favorite = false, bool p_grayed = false, const bool p_ordered_latest_modification = true) { + ProjectItem(const String &p_project, const String &p_name, const String &p_path, const String &p_conf, const String &p_icon, const String &p_main_scene, uint64_t p_last_modified, bool p_favorite = false, bool p_grayed = false, const ProjectListFilter::FilterOption p_filter_order_option = ProjectListFilter::FILTER_NAME) { project = p_project; + project_name = p_name; path = p_path; conf = p_conf; - config_version = p_config_version; + icon = p_icon; + main_scene = p_main_scene; last_modified = p_last_modified; favorite = p_favorite; grayed = p_grayed; - ordered_latest_modification = p_ordered_latest_modification; + filter_order_option = p_filter_order_option; } _FORCE_INLINE_ bool operator<(const ProjectItem &l) const { - if (ordered_latest_modification) - return last_modified > l.last_modified; - return project < l.project; + switch (filter_order_option) { + case ProjectListFilter::FILTER_PATH: + return project < l.project; + case ProjectListFilter::FILTER_MODIFIED: + return last_modified > l.last_modified; + default: + return project_name < l.project_name; + } } _FORCE_INLINE_ bool operator==(const ProjectItem &l) const { return project == l.project; } }; @@ -1256,13 +1265,7 @@ void ProjectManager::_load_recent_projects() { Color font_color = gui_base->get_color("font_color", "Tree"); - bool set_ordered_latest_modification; ProjectListFilter::FilterOption filter_order_option = project_order_filter->get_filter_option(); - if (filter_order_option == ProjectListFilter::FILTER_NAME) { - set_ordered_latest_modification = false; - } else { - set_ordered_latest_modification = true; - } EditorSettings::get_singleton()->set("project_manager/sorting_order", (int)filter_order_option); List<ProjectItem> projects; @@ -1280,10 +1283,30 @@ void ProjectManager::_load_recent_projects() { String project = _name.get_slice("/", 1); String conf = path.plus_file("project.godot"); - int config_version = 0; // Assume 0 until we know better bool favorite = (_name.begins_with("favorite_projects/")) ? true : false; bool grayed = false; + Ref<ConfigFile> cf = memnew(ConfigFile); + Error cf_err = cf->load(conf); + + int config_version = 0; + String project_name = TTR("Unnamed Project"); + if (cf_err == OK) { + + String cf_project_name = static_cast<String>(cf->get_value("application", "config/name", "")); + if (cf_project_name != "") + project_name = cf_project_name.xml_unescape(); + config_version = (int)cf->get_value("", "config_version", 0); + } + + if (config_version > ProjectSettings::CONFIG_VERSION) { + // Comes from an incompatible (more recent) Godot version, grey it out + grayed = true; + } + + String icon = cf->get_value("application", "config/icon", ""); + String main_scene = cf->get_value("application", "run/main_scene", ""); + uint64_t last_modified = 0; if (FileAccess::exists(conf)) { last_modified = FileAccess::get_modified_time(conf); @@ -1298,7 +1321,7 @@ void ProjectManager::_load_recent_projects() { grayed = true; } - ProjectItem item(project, path, conf, config_version, last_modified, favorite, grayed, set_ordered_latest_modification); + ProjectItem item(project, project_name, path, conf, icon, main_scene, last_modified, favorite, grayed, filter_order_option); if (favorite) favorite_projects.push_back(item); else @@ -1326,43 +1349,23 @@ void ProjectManager::_load_recent_projects() { String path = item.path; String conf = item.conf; - Ref<ConfigFile> cf = memnew(ConfigFile); - Error cf_err = cf->load(conf); - - String project_name = TTR("Unnamed Project"); - if (cf_err == OK && cf->has_section_key("application", "config/name")) { - project_name = static_cast<String>(cf->get_value("application", "config/name")).xml_unescape(); - } - - if (filter_option == ProjectListFilter::FILTER_NAME && search_term != "" && project_name.findn(search_term) == -1) + if (filter_option == ProjectListFilter::FILTER_NAME && search_term != "" && item.project_name.findn(search_term) == -1) continue; Ref<Texture> icon; - String main_scene; - - if (cf_err == OK) { - item.config_version = (int)cf->get_value("", "config_version", 0); - if (item.config_version > ProjectSettings::CONFIG_VERSION) { - // Comes from an incompatible (more recent) Godot version, grey it out - item.grayed = true; - } - String appicon = cf->get_value("application", "config/icon", ""); - if (appicon != "") { - Ref<Image> img; - img.instance(); - Error err = img->load(appicon.replace_first("res://", path + "/")); - if (err == OK) { - - Ref<Texture> default_icon = get_icon("DefaultProjectIcon", "EditorIcons"); - img->resize(default_icon->get_width(), default_icon->get_height()); - Ref<ImageTexture> it = memnew(ImageTexture); - it->create_from_image(img); - icon = it; - } + if (item.icon != "") { + Ref<Image> img; + img.instance(); + Error err = img->load(item.icon.replace_first("res://", path + "/")); + if (err == OK) { + + Ref<Texture> default_icon = get_icon("DefaultProjectIcon", "EditorIcons"); + img->resize(default_icon->get_width(), default_icon->get_height()); + Ref<ImageTexture> it = memnew(ImageTexture); + it->create_from_image(img); + icon = it; } - - main_scene = cf->get_value("application", "run/main_scene", ""); } if (icon.is_null()) { @@ -1376,7 +1379,7 @@ void ProjectManager::_load_recent_projects() { HBoxContainer *hb = memnew(HBoxContainer); hb->set_meta("name", project); - hb->set_meta("main_scene", main_scene); + hb->set_meta("main_scene", item.main_scene); hb->set_meta("favorite", is_favorite); hb->connect("draw", this, "_panel_draw", varray(hb)); hb->connect("gui_input", this, "_panel_input", varray(hb)); @@ -1406,7 +1409,7 @@ void ProjectManager::_load_recent_projects() { ec->set_custom_minimum_size(Size2(0, 1)); ec->set_mouse_filter(MOUSE_FILTER_PASS); vb->add_child(ec); - Label *title = memnew(Label(project_name)); + Label *title = memnew(Label(item.project_name)); title->add_font_override("font", gui_base->get_font("title", "EditorFonts")); title->add_color_override("font_color", font_color); title->set_clip_text(true); @@ -2020,6 +2023,7 @@ ProjectManager::ProjectManager() { sort_filters->add_child(sort_label); Vector<String> sort_filter_titles; sort_filter_titles.push_back("Name"); + sort_filter_titles.push_back("Path"); sort_filter_titles.push_back("Last Modified"); project_order_filter = memnew(ProjectListFilter); project_order_filter->_setup_filters(sort_filter_titles); diff --git a/editor/project_manager.h b/editor/project_manager.h index a7cc6549f5..d75d7164cc 100644 --- a/editor/project_manager.h +++ b/editor/project_manager.h @@ -131,17 +131,19 @@ class ProjectListFilter : public HBoxContainer { GDCLASS(ProjectListFilter, HBoxContainer); +public: + enum FilterOption { + FILTER_NAME, + FILTER_PATH, + FILTER_MODIFIED, + }; + private: friend class ProjectManager; OptionButton *filter_option; LineEdit *search_box; bool has_search_box; - - enum FilterOption { - FILTER_NAME, - FILTER_PATH, - }; FilterOption _current_filter; void _search_text_changed(const String &p_newtext); diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index e8f5139cd5..a15ae2efda 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -269,7 +269,7 @@ void SceneTreeDock::_replace_with_branch_scene(const String &p_file, Node *base) bool SceneTreeDock::_cyclical_dependency_exists(const String &p_target_scene_path, Node *p_desired_node) { int childCount = p_desired_node->get_child_count(); - if (p_desired_node->get_filename() == p_target_scene_path) { + if (_track_inherit(p_target_scene_path, p_desired_node)) { return true; } @@ -284,6 +284,33 @@ bool SceneTreeDock::_cyclical_dependency_exists(const String &p_target_scene_pat return false; } +bool SceneTreeDock::_track_inherit(const String &p_target_scene_path, Node *p_desired_node) { + Node *p = p_desired_node; + bool result = false; + Vector<Node *> instances; + while (true) { + if (p->get_filename() == p_target_scene_path) { + result = true; + break; + } + Ref<SceneState> ss = p->get_scene_inherited_state(); + if (ss.is_valid()) { + String path = ss->get_path(); + Ref<PackedScene> data = ResourceLoader::load(path); + if (data.is_valid()) { + p = data->instance(PackedScene::GEN_EDIT_STATE_INSTANCE); + instances.push_back(p); + } else + break; + } else + break; + } + for (int i = 0; i < instances.size(); i++) { + memdelete(instances[i]); + } + return result; +} + void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { current_option = p_tool; diff --git a/editor/scene_tree_dock.h b/editor/scene_tree_dock.h index 9f9e93f2df..b645c22295 100644 --- a/editor/scene_tree_dock.h +++ b/editor/scene_tree_dock.h @@ -165,6 +165,7 @@ class SceneTreeDock : public VBoxContainer { void _script_open_request(const Ref<Script> &p_script); bool _cyclical_dependency_exists(const String &p_target_scene_path, Node *p_desired_node); + bool _track_inherit(const String &p_target_scene_path, Node *p_desired_node); void _node_selected(); void _node_renamed(); diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp index 3b086c6316..3167abb745 100644 --- a/editor/script_editor_debugger.cpp +++ b/editor/script_editor_debugger.cpp @@ -1121,10 +1121,13 @@ void ScriptEditorDebugger::_notification(int p_what) { last_warning_count = warning_count; } - if (connection.is_null()) { - - if (server->is_connection_available()) { - + if (server->is_connection_available()) { + if (connection.is_valid()) { + // We already have a valid connection. Disconnecting any new connecting client to prevent it from hanging. + // (If we don't keep a reference to the connection it will be destroyed and disconnect_from_host will be called internally) + server->take_connection(); + } else { + // We just got the first connection. connection = server->take_connection(); if (connection.is_null()) break; @@ -1158,12 +1161,11 @@ void ScriptEditorDebugger::_notification(int p_what) { if (profiler->is_profiling()) { _profiler_activate(true); } - - } else { - - break; } - }; + } + + if (connection.is_null()) + break; if (!connection->is_connected_to_host()) { stop(); diff --git a/main/main.cpp b/main/main.cpp index 61f54b1b0a..c51ffd9124 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1104,6 +1104,8 @@ Error Main::setup2(Thread::ID p_main_tid_override) { return err; } + print_line(" "); //add a blank line for readability + if (init_use_custom_pos) { OS::get_singleton()->set_window_position(init_custom_pos); } diff --git a/modules/cvtt/image_compress_cvtt.cpp b/modules/cvtt/image_compress_cvtt.cpp index 0a70ff535f..024e9ffc3b 100644 --- a/modules/cvtt/image_compress_cvtt.cpp +++ b/modules/cvtt/image_compress_cvtt.cpp @@ -145,7 +145,7 @@ void image_compress_cvtt(Image *p_image, float p_lossy_quality, Image::CompressS int h = p_image->get_height(); bool is_ldr = (p_image->get_format() <= Image::FORMAT_RGBA8); - bool is_hdr = (p_image->get_format() == Image::FORMAT_RGBH); + bool is_hdr = (p_image->get_format() >= Image::FORMAT_RH) && (p_image->get_format() <= Image::FORMAT_RGBE9995); if (!is_ldr && !is_hdr) { return; // Not a usable source format @@ -175,6 +175,10 @@ void image_compress_cvtt(Image *p_image, float p_lossy_quality, Image::CompressS bool is_signed = false; if (is_hdr) { + if (p_image->get_format() != Image::FORMAT_RGBH) { + p_image->convert(Image::FORMAT_RGBH); + } + PoolVector<uint8_t>::Read rb = p_image->get_data().read(); const uint16_t *source_data = reinterpret_cast<const uint16_t *>(&rb[0]); diff --git a/modules/dds/texture_loader_dds.h b/modules/dds/texture_loader_dds.h index 585f2891bf..6ddef4e770 100644 --- a/modules/dds/texture_loader_dds.h +++ b/modules/dds/texture_loader_dds.h @@ -35,7 +35,6 @@ #include "scene/resources/texture.h" class ResourceFormatDDS : public ResourceFormatLoader { - GDCLASS(ResourceFormatDDS, ResourceFormatLoader) public: virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL); virtual void get_recognized_extensions(List<String> *p_extensions) const; diff --git a/modules/etc/texture_loader_pkm.h b/modules/etc/texture_loader_pkm.h index 860fe8b5df..79c17953fc 100644 --- a/modules/etc/texture_loader_pkm.h +++ b/modules/etc/texture_loader_pkm.h @@ -35,7 +35,6 @@ #include "scene/resources/texture.h" class ResourceFormatPKM : public ResourceFormatLoader { - GDCLASS(ResourceFormatPKM, ResourceFormatLoader) public: virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL); virtual void get_recognized_extensions(List<String> *p_extensions) const; diff --git a/modules/gdnative/config.py b/modules/gdnative/config.py index 7898de5523..b9e5afcdf3 100644 --- a/modules/gdnative/config.py +++ b/modules/gdnative/config.py @@ -6,6 +6,7 @@ def configure(env): def get_doc_classes(): return [ + "@NativeScript", "ARVRInterfaceGDNative", "GDNative", "GDNativeLibrary", @@ -13,7 +14,6 @@ def get_doc_classes(): "NativeScript", "PacketPeerGDNative", "PluginScript", - "ResourceFormatLoaderVideoStreamGDNative", "StreamPeerGDNative", "VideoStreamGDNative", "WebRTCPeerConnectionGDNative", diff --git a/doc/classes/@NativeScript.xml b/modules/gdnative/doc_classes/@NativeScript.xml index cb5de198ac..cb5de198ac 100644 --- a/doc/classes/@NativeScript.xml +++ b/modules/gdnative/doc_classes/@NativeScript.xml diff --git a/modules/gdnative/doc_classes/ResourceFormatLoaderVideoStreamGDNative.xml b/modules/gdnative/doc_classes/ResourceFormatLoaderVideoStreamGDNative.xml deleted file mode 100644 index cd8b336778..0000000000 --- a/modules/gdnative/doc_classes/ResourceFormatLoaderVideoStreamGDNative.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="ResourceFormatLoaderVideoStreamGDNative" inherits="ResourceFormatLoader" category="Core" version="3.2"> - <brief_description> - </brief_description> - <description> - </description> - <tutorials> - </tutorials> - <methods> - </methods> - <constants> - </constants> -</class> diff --git a/modules/gdnative/gdnative.h b/modules/gdnative/gdnative.h index ef57387059..1590994ab4 100644 --- a/modules/gdnative/gdnative.h +++ b/modules/gdnative/gdnative.h @@ -165,7 +165,6 @@ public: }; class GDNativeLibraryResourceLoader : public ResourceFormatLoader { - GDCLASS(GDNativeLibraryResourceLoader, ResourceFormatLoader) public: virtual RES load(const String &p_path, const String &p_original_path, Error *r_error); virtual void get_recognized_extensions(List<String> *p_extensions) const; @@ -174,7 +173,6 @@ public: }; class GDNativeLibraryResourceSaver : public ResourceFormatSaver { - GDCLASS(GDNativeLibraryResourceSaver, ResourceFormatSaver) public: virtual Error save(const String &p_path, const RES &p_resource, uint32_t p_flags); virtual bool recognize(const RES &p_resource) const; diff --git a/modules/gdnative/nativescript/nativescript.h b/modules/gdnative/nativescript/nativescript.h index be1c499714..d60e3ae1ae 100644 --- a/modules/gdnative/nativescript/nativescript.h +++ b/modules/gdnative/nativescript/nativescript.h @@ -382,7 +382,6 @@ public: }; class ResourceFormatLoaderNativeScript : public ResourceFormatLoader { - GDCLASS(ResourceFormatLoaderNativeScript, ResourceFormatLoader) public: virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL); virtual void get_recognized_extensions(List<String> *p_extensions) const; @@ -391,7 +390,6 @@ public: }; class ResourceFormatSaverNativeScript : public ResourceFormatSaver { - GDCLASS(ResourceFormatSaverNativeScript, ResourceFormatSaver) virtual Error save(const String &p_path, const RES &p_resource, uint32_t p_flags = 0); virtual bool recognize(const RES &p_resource) const; virtual void get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const; diff --git a/modules/gdnative/pluginscript/pluginscript_loader.h b/modules/gdnative/pluginscript/pluginscript_loader.h index 69a2ac6bfe..6218037a15 100644 --- a/modules/gdnative/pluginscript/pluginscript_loader.h +++ b/modules/gdnative/pluginscript/pluginscript_loader.h @@ -40,8 +40,6 @@ class PluginScriptLanguage; class ResourceFormatLoaderPluginScript : public ResourceFormatLoader { - GDCLASS(ResourceFormatLoaderPluginScript, ResourceFormatLoader) - PluginScriptLanguage *_language; public: @@ -54,8 +52,6 @@ public: class ResourceFormatSaverPluginScript : public ResourceFormatSaver { - GDCLASS(ResourceFormatSaverPluginScript, ResourceFormatSaver) - PluginScriptLanguage *_language; public: diff --git a/modules/gdnative/videodecoder/video_stream_gdnative.h b/modules/gdnative/videodecoder/video_stream_gdnative.h index aafd02f33d..b9f1c8e4da 100644 --- a/modules/gdnative/videodecoder/video_stream_gdnative.h +++ b/modules/gdnative/videodecoder/video_stream_gdnative.h @@ -197,7 +197,6 @@ public: }; class ResourceFormatLoaderVideoStreamGDNative : public ResourceFormatLoader { - GDCLASS(ResourceFormatLoaderVideoStreamGDNative, ResourceFormatLoader) public: virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL); virtual void get_recognized_extensions(List<String> *p_extensions) const; diff --git a/modules/gdscript/config.py b/modules/gdscript/config.py index 95b40d90af..a525eedaaa 100644 --- a/modules/gdscript/config.py +++ b/modules/gdscript/config.py @@ -6,6 +6,7 @@ def configure(env): def get_doc_classes(): return [ + "@GDScript", "GDScript", "GDScriptFunctionState", "GDScriptNativeClass", diff --git a/doc/classes/@GDScript.xml b/modules/gdscript/doc_classes/@GDScript.xml index b6de5dbf62..b6de5dbf62 100644 --- a/doc/classes/@GDScript.xml +++ b/modules/gdscript/doc_classes/@GDScript.xml diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h index 40b773d99f..1756f6eabc 100644 --- a/modules/gdscript/gdscript.h +++ b/modules/gdscript/gdscript.h @@ -509,7 +509,6 @@ public: }; class ResourceFormatLoaderGDScript : public ResourceFormatLoader { - GDCLASS(ResourceFormatLoaderGDScript, ResourceFormatLoader) public: virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL); virtual void get_recognized_extensions(List<String> *p_extensions) const; @@ -519,7 +518,6 @@ public: }; class ResourceFormatSaverGDScript : public ResourceFormatSaver { - GDCLASS(ResourceFormatSaverGDScript, ResourceFormatSaver) public: virtual Error save(const String &p_path, const RES &p_resource, uint32_t p_flags = 0); virtual void get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const; diff --git a/modules/gdscript/gdscript_function.cpp b/modules/gdscript/gdscript_function.cpp index cff9ba55b8..bae5eca218 100644 --- a/modules/gdscript/gdscript_function.cpp +++ b/modules/gdscript/gdscript_function.cpp @@ -133,35 +133,13 @@ Variant *GDScriptFunction::_get_variant(int p_address, GDScriptInstance *p_insta return NULL; } -String GDScriptFunction::_get_call_error(const Variant::CallError &p_err, const String &p_where, const Variant **argptrs) const { - - String err_text; - - if (p_err.error == Variant::CallError::CALL_ERROR_INVALID_ARGUMENT) { - int errorarg = p_err.argument; - err_text = "Invalid type in " + p_where + ". Cannot convert argument " + itos(errorarg + 1) + " from " + Variant::get_type_name(argptrs[errorarg]->get_type()) + " to " + Variant::get_type_name(p_err.expected) + "."; - } else if (p_err.error == Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS) { - err_text = "Invalid call to " + p_where + ". Expected " + itos(p_err.argument) + " arguments."; - } else if (p_err.error == Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS) { - err_text = "Invalid call to " + p_where + ". Expected " + itos(p_err.argument) + " arguments."; - } else if (p_err.error == Variant::CallError::CALL_ERROR_INVALID_METHOD) { - err_text = "Invalid call. Nonexistent " + p_where + "."; - } else if (p_err.error == Variant::CallError::CALL_ERROR_INSTANCE_IS_NULL) { - err_text = "Attempt to call " + p_where + " on a null instance."; - } else { - err_text = "Bug, call error: #" + itos(p_err.error); - } - - return err_text; -} - #ifdef DEBUG_ENABLED -static String _get_var_type(const Variant *p_type) { +static String _get_var_type(const Variant *p_var) { String basestr; - if (p_type->get_type() == Variant::OBJECT) { - Object *bobj = *p_type; + if (p_var->get_type() == Variant::OBJECT) { + Object *bobj = *p_var; if (!bobj) { basestr = "null instance"; } else { @@ -176,12 +154,42 @@ static String _get_var_type(const Variant *p_type) { } } else { - basestr = Variant::get_type_name(p_type->get_type()); + basestr = Variant::get_type_name(p_var->get_type()); } return basestr; } -#endif +#endif // DEBUG_ENABLED + +String GDScriptFunction::_get_call_error(const Variant::CallError &p_err, const String &p_where, const Variant **argptrs) const { + + String err_text; + + if (p_err.error == Variant::CallError::CALL_ERROR_INVALID_ARGUMENT) { + int errorarg = p_err.argument; + // Handle the Object to Object case separately as we don't have further class details. +#ifdef DEBUG_ENABLED + if (p_err.expected == Variant::OBJECT && argptrs[errorarg]->get_type() == p_err.expected) { + err_text = "Invalid type in " + p_where + ". The Object-derived class of argument " + itos(errorarg + 1) + " (" + _get_var_type(argptrs[errorarg]) + ") is not a subclass of the expected argument class."; + } else +#endif // DEBUG_ENABLED + { + err_text = "Invalid type in " + p_where + ". Cannot convert argument " + itos(errorarg + 1) + " from " + Variant::get_type_name(argptrs[errorarg]->get_type()) + " to " + Variant::get_type_name(p_err.expected) + "."; + } + } else if (p_err.error == Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS) { + err_text = "Invalid call to " + p_where + ". Expected " + itos(p_err.argument) + " arguments."; + } else if (p_err.error == Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS) { + err_text = "Invalid call to " + p_where + ". Expected " + itos(p_err.argument) + " arguments."; + } else if (p_err.error == Variant::CallError::CALL_ERROR_INVALID_METHOD) { + err_text = "Invalid call. Nonexistent " + p_where + "."; + } else if (p_err.error == Variant::CallError::CALL_ERROR_INSTANCE_IS_NULL) { + err_text = "Attempt to call " + p_where + " on a null instance."; + } else { + err_text = "Bug, call error: #" + itos(p_err.error); + } + + return err_text; +} #if defined(__GNUC__) #define OPCODES_TABLE \ diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h index 4a1fb8e5ed..7b16b5609e 100644 --- a/modules/mono/csharp_script.h +++ b/modules/mono/csharp_script.h @@ -440,7 +440,6 @@ public: }; class ResourceFormatLoaderCSharpScript : public ResourceFormatLoader { - GDCLASS(ResourceFormatLoaderCSharpScript, ResourceFormatLoader) public: virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL); virtual void get_recognized_extensions(List<String> *p_extensions) const; @@ -449,7 +448,6 @@ public: }; class ResourceFormatSaverCSharpScript : public ResourceFormatSaver { - GDCLASS(ResourceFormatSaverCSharpScript, ResourceFormatSaver) public: virtual Error save(const String &p_path, const RES &p_resource, uint32_t p_flags = 0); virtual void get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const; diff --git a/modules/opensimplex/doc_classes/OpenSimplexNoise.xml b/modules/opensimplex/doc_classes/OpenSimplexNoise.xml index dc7fc7fe31..894a1b3ced 100644 --- a/modules/opensimplex/doc_classes/OpenSimplexNoise.xml +++ b/modules/opensimplex/doc_classes/OpenSimplexNoise.xml @@ -41,6 +41,8 @@ <argument index="0" name="x" type="float"> </argument> <description> + Returns the 1D noise value [code][-1,1][/code] at the given x-coordinate. + Note: This method actually returns the 2D noise value [code][-1,1][/code] with fixed y-coordinate value 0.0. </description> </method> <method name="get_noise_2d"> diff --git a/modules/opus/audio_stream_opus.h b/modules/opus/audio_stream_opus.h index f53bff0288..fd07e19e2e 100644 --- a/modules/opus/audio_stream_opus.h +++ b/modules/opus/audio_stream_opus.h @@ -132,7 +132,6 @@ public: }; class ResourceFormatLoaderAudioStreamOpus : public ResourceFormatLoader { - GDCLASS(ResourceFormatLoaderAudioStreamOpus, ResourceFormatLoader) public: virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL); virtual void get_recognized_extensions(List<String> *p_extensions) const; diff --git a/modules/pvr/texture_loader_pvr.h b/modules/pvr/texture_loader_pvr.h index 2808b4ff03..606268e447 100644 --- a/modules/pvr/texture_loader_pvr.h +++ b/modules/pvr/texture_loader_pvr.h @@ -35,7 +35,6 @@ #include "scene/resources/texture.h" class ResourceFormatPVR : public ResourceFormatLoader { - GDCLASS(ResourceFormatPVR, ResourceFormatLoader) public: virtual RES load(const String &p_path, const String &p_original_path, Error *r_error = NULL); virtual void get_recognized_extensions(List<String> *p_extensions) const; diff --git a/modules/stb_vorbis/config.py b/modules/stb_vorbis/config.py index d75e41797a..200b8dfd50 100644 --- a/modules/stb_vorbis/config.py +++ b/modules/stb_vorbis/config.py @@ -7,7 +7,6 @@ def configure(env): def get_doc_classes(): return [ "AudioStreamOGGVorbis", - "ResourceImporterOGGVorbis", ] def get_doc_path(): diff --git a/modules/stb_vorbis/doc_classes/ResourceImporterOGGVorbis.xml b/modules/stb_vorbis/doc_classes/ResourceImporterOGGVorbis.xml deleted file mode 100644 index 4dd77fed34..0000000000 --- a/modules/stb_vorbis/doc_classes/ResourceImporterOGGVorbis.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="ResourceImporterOGGVorbis" inherits="ResourceImporter" category="Core" version="3.2"> - <brief_description> - </brief_description> - <description> - </description> - <tutorials> - </tutorials> - <methods> - </methods> - <constants> - </constants> -</class> diff --git a/modules/stb_vorbis/register_types.cpp b/modules/stb_vorbis/register_types.cpp index 88a1766e47..ce64626e4b 100644 --- a/modules/stb_vorbis/register_types.cpp +++ b/modules/stb_vorbis/register_types.cpp @@ -29,15 +29,22 @@ /*************************************************************************/ #include "register_types.h" + #include "audio_stream_ogg_vorbis.h" + +#ifdef TOOLS_ENABLED +#include "core/engine.h" #include "resource_importer_ogg_vorbis.h" +#endif void register_stb_vorbis_types() { #ifdef TOOLS_ENABLED - Ref<ResourceImporterOGGVorbis> ogg_import; - ogg_import.instance(); - ResourceFormatImporter::get_singleton()->add_importer(ogg_import); + if (Engine::get_singleton()->is_editor_hint()) { + Ref<ResourceImporterOGGVorbis> ogg_import; + ogg_import.instance(); + ResourceFormatImporter::get_singleton()->add_importer(ogg_import); + } #endif ClassDB::register_class<AudioStreamOGGVorbis>(); } diff --git a/modules/theora/config.py b/modules/theora/config.py index 7504166237..c7713d7607 100644 --- a/modules/theora/config.py +++ b/modules/theora/config.py @@ -6,7 +6,6 @@ def configure(env): def get_doc_classes(): return [ - "ResourceImporterTheora", "VideoStreamTheora", ] diff --git a/modules/theora/video_stream_theora.h b/modules/theora/video_stream_theora.h index 85d73d3c0d..0c37d33358 100644 --- a/modules/theora/video_stream_theora.h +++ b/modules/theora/video_stream_theora.h @@ -186,7 +186,6 @@ public: }; class ResourceFormatLoaderTheora : public ResourceFormatLoader { - GDCLASS(ResourceFormatLoaderTheora, ResourceFormatLoader) public: virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL); virtual void get_recognized_extensions(List<String> *p_extensions) const; diff --git a/modules/visual_script/config.py b/modules/visual_script/config.py index 07a0450734..04e1a40b81 100644 --- a/modules/visual_script/config.py +++ b/modules/visual_script/config.py @@ -6,6 +6,7 @@ def configure(env): def get_doc_classes(): return [ + "@VisualScript", "VisualScriptBasicTypeConstant", "VisualScriptBuiltinFunc", "VisualScriptClassConstant", diff --git a/doc/classes/@VisualScript.xml b/modules/visual_script/doc_classes/@VisualScript.xml index 8d9408e6d4..8d9408e6d4 100644 --- a/doc/classes/@VisualScript.xml +++ b/modules/visual_script/doc_classes/@VisualScript.xml diff --git a/modules/vorbis/audio_stream_ogg_vorbis.h b/modules/vorbis/audio_stream_ogg_vorbis.h index fa9d5fe664..a37867d9f9 100644 --- a/modules/vorbis/audio_stream_ogg_vorbis.h +++ b/modules/vorbis/audio_stream_ogg_vorbis.h @@ -127,7 +127,6 @@ public: }; class ResourceFormatLoaderAudioStreamOGGVorbis : public ResourceFormatLoader { - GDCLASS(ResourceFormatLoaderAudioStreamOGGVorbis, ResourceFormatLoader) public: virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL); virtual void get_recognized_extensions(List<String> *p_extensions) const; diff --git a/modules/webm/config.py b/modules/webm/config.py index 72a4073423..ba4dcce2f5 100644 --- a/modules/webm/config.py +++ b/modules/webm/config.py @@ -6,7 +6,6 @@ def configure(env): def get_doc_classes(): return [ - "ResourceImporterWebm", "VideoStreamWebm", ] diff --git a/modules/webm/video_stream_webm.h b/modules/webm/video_stream_webm.h index 992095ba4c..4e07c86775 100644 --- a/modules/webm/video_stream_webm.h +++ b/modules/webm/video_stream_webm.h @@ -127,7 +127,6 @@ public: }; class ResourceFormatLoaderWebm : public ResourceFormatLoader { - GDCLASS(ResourceFormatLoaderWebm, ResourceFormatLoader) public: virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL); virtual void get_recognized_extensions(List<String> *p_extensions) const; diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h index 0ca94e3a63..1e996608af 100644 --- a/platform/osx/os_osx.h +++ b/platform/osx/os_osx.h @@ -188,6 +188,7 @@ public: virtual void warp_mouse_position(const Point2 &p_to); virtual Point2 get_mouse_position() const; virtual int get_mouse_button_state() const; + void update_real_mouse_position(); virtual void set_window_title(const String &p_title); virtual Size2 get_window_size() const; diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index dade07ffda..4f84ae9c50 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -1569,6 +1569,9 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a if (p_desired.layered) { set_window_per_pixel_transparency_enabled(true); } + + update_real_mouse_position(); + return OK; } @@ -1907,6 +1910,12 @@ void OS_OSX::warp_mouse_position(const Point2 &p_to) { } } +void OS_OSX::update_real_mouse_position() { + + get_mouse_pos([window_object mouseLocationOutsideOfEventStream], [window_view backingScaleFactor]); + input->set_mouse_position(Point2(mouse_x, mouse_y)); +} + Point2 OS_OSX::get_mouse_position() const { return Vector2(mouse_x, mouse_y); @@ -2357,6 +2366,8 @@ void OS_OSX::set_window_position(const Point2 &p_position) { // Godot passes a positive value position.y *= -1; set_native_window_position(get_screens_origin() + position); + + update_real_mouse_position(); }; Size2 OS_OSX::get_window_size() const { diff --git a/platform/x11/detect_prime.cpp b/platform/x11/detect_prime.cpp index 0fde2a0c04..26008feade 100644 --- a/platform/x11/detect_prime.cpp +++ b/platform/x11/detect_prime.cpp @@ -159,10 +159,11 @@ int detect_prime() { if (!stat_loc) { // No need to do anything complicated here. Anything less than // PIPE_BUF will be delivered in one read() call. - read(fdset[0], string, sizeof(string) - 1); - - vendors[i] = string; - renderers[i] = string + strlen(string) + 1; + // Leave it 'Unknown' otherwise. + if (read(fdset[0], string, sizeof(string) - 1) > 0) { + vendors[i] = string; + renderers[i] = string + strlen(string) + 1; + } } close(fdset[0]); @@ -190,8 +191,9 @@ int detect_prime() { memcpy(&string, vendor, vendor_len); memcpy(&string[vendor_len], renderer, renderer_len); - write(fdset[1], string, vendor_len + renderer_len); - + if (write(fdset[1], string, vendor_len + renderer_len) == -1) { + print_verbose("Couldn't write vendor/renderer string."); + } close(fdset[1]); exit(0); } diff --git a/platform/x11/joypad_linux.cpp b/platform/x11/joypad_linux.cpp index 3e9e8033e8..21c3b0ac91 100644 --- a/platform/x11/joypad_linux.cpp +++ b/platform/x11/joypad_linux.cpp @@ -414,7 +414,9 @@ void JoypadLinux::joypad_vibration_start(int p_id, float p_weak_magnitude, float play.type = EV_FF; play.code = effect.id; play.value = 1; - write(joy.fd, (const void *)&play, sizeof(play)); + if (write(joy.fd, (const void *)&play, sizeof(play)) == -1) { + print_verbose("Couldn't write to Joypad device."); + } joy.ff_effect_id = effect.id; joy.ff_effect_timestamp = p_timestamp; diff --git a/scene/3d/area.cpp b/scene/3d/area.cpp index 3557f0425c..4247266e3d 100644 --- a/scene/3d/area.cpp +++ b/scene/3d/area.cpp @@ -752,7 +752,7 @@ Area::Area() : gravity_is_point = false; gravity_distance_scale = 0; linear_damp = 0.1; - angular_damp = 1; + angular_damp = 0.1; priority = 0; monitoring = false; monitorable = false; diff --git a/scene/animation/animation_node_state_machine.cpp b/scene/animation/animation_node_state_machine.cpp index 60f8806b25..a2411743d4 100644 --- a/scene/animation/animation_node_state_machine.cpp +++ b/scene/animation/animation_node_state_machine.cpp @@ -599,6 +599,9 @@ void AnimationNodeStateMachine::remove_node(const StringName &p_name) { { Ref<AnimationNode> node = states[p_name].node; + + ERR_FAIL_COND(node.is_null()); + node->disconnect("tree_changed", this, "_tree_changed"); } diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index bca3471091..b6abfdd6a8 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -93,6 +93,28 @@ void ColorPicker::set_focus_on_line_edit() { void ColorPicker::_update_controls() { + const char *rgb[3] = { "R", "G", "B" }; + const char *hsv[3] = { "H", "S", "V" }; + + if (hsv_mode_enabled) { + for (int i = 0; i < 3; i++) + labels[i]->set_text(hsv[i]); + } else { + for (int i = 0; i < 3; i++) + labels[i]->set_text(rgb[i]); + } + + if (hsv_mode_enabled) { + set_raw_mode(false); + btn_raw->set_disabled(true); + } else if (raw_mode_enabled) { + set_hsv_mode(false); + btn_hsv->set_disabled(true); + } else { + btn_raw->set_disabled(false); + btn_hsv->set_disabled(false); + } + if (edit_alpha) { values[3]->show(); scroll[3]->show(); @@ -104,7 +126,7 @@ void ColorPicker::_update_controls() { } } -void ColorPicker::set_pick_color(const Color &p_color) { +void ColorPicker::set_pick_color(const Color &p_color, bool p_update_sliders) { color = p_color; if (color != last_hsv) { @@ -117,7 +139,7 @@ void ColorPicker::set_pick_color(const Color &p_color) { if (!is_inside_tree()) return; - _update_color(); + _update_color(p_update_sliders); } void ColorPicker::set_edit_alpha(bool p_show) { @@ -142,11 +164,18 @@ void ColorPicker::_value_changed(double) { if (updating) return; - for (int i = 0; i < 4; i++) { - color.components[i] = scroll[i]->get_value() / (raw_mode_enabled ? 1.0 : 255.0); + if (hsv_mode_enabled) { + color.set_hsv(scroll[0]->get_value() / 360.0, + scroll[1]->get_value() / 100.0, + scroll[2]->get_value() / 100.0, + scroll[3]->get_value() / 100.0); + } else { + for (int i = 0; i < 4; i++) { + color.components[i] = scroll[i]->get_value() / (raw_mode_enabled ? 1.0 : 255.0); + } } - set_pick_color(color); + set_pick_color(color, false); emit_signal("color_changed", color); } @@ -167,22 +196,40 @@ void ColorPicker::_html_entered(const String &p_html) { emit_signal("color_changed", color); } -void ColorPicker::_update_color() { +void ColorPicker::_update_color(bool p_update_sliders) { updating = true; - for (int i = 0; i < 4; i++) { - if (raw_mode_enabled) { - scroll[i]->set_step(0.01); - scroll[i]->set_max(100); - if (i == 3) - scroll[i]->set_max(1); - scroll[i]->set_value(color.components[i]); + if (p_update_sliders) { + + if (hsv_mode_enabled) { + for (int i = 0; i < 4; i++) { + scroll[i]->set_step(0.1); + } + + scroll[0]->set_max(360); + scroll[0]->set_value(h * 360.0); + scroll[1]->set_max(100); + scroll[1]->set_value(s * 100.0); + scroll[2]->set_max(100); + scroll[2]->set_value(v * 100.0); + scroll[3]->set_max(100); + scroll[3]->set_value(color.components[3] * 100.0); } else { - scroll[i]->set_step(1); - const float byte_value = color.components[i] * 255.0; - scroll[i]->set_max(next_power_of_2(MAX(255, byte_value)) - 1); - scroll[i]->set_value(byte_value); + for (int i = 0; i < 4; i++) { + if (raw_mode_enabled) { + scroll[i]->set_step(0.01); + scroll[i]->set_max(100); + if (i == 3) + scroll[i]->set_max(1); + scroll[i]->set_value(color.components[i]); + } else { + scroll[i]->set_step(1); + const float byte_value = color.components[i] * 255.0; + scroll[i]->set_max(next_power_of_2(MAX(255, byte_value)) - 1); + scroll[i]->set_value(byte_value); + } + } } } @@ -272,13 +319,33 @@ PoolColorArray ColorPicker::get_presets() const { return arr; } +void ColorPicker::set_hsv_mode(bool p_enabled) { + + if (hsv_mode_enabled == p_enabled || raw_mode_enabled) + return; + hsv_mode_enabled = p_enabled; + if (btn_hsv->is_pressed() != p_enabled) + btn_hsv->set_pressed(p_enabled); + + if (!is_inside_tree()) + return; + + _update_controls(); + _update_color(); +} + +bool ColorPicker::is_hsv_mode() const { + + return hsv_mode_enabled; +} + void ColorPicker::set_raw_mode(bool p_enabled) { - if (raw_mode_enabled == p_enabled) + if (raw_mode_enabled == p_enabled || hsv_mode_enabled) return; raw_mode_enabled = p_enabled; - if (btn_mode->is_pressed() != p_enabled) - btn_mode->set_pressed(p_enabled); + if (btn_raw->is_pressed() != p_enabled) + btn_raw->set_pressed(p_enabled); if (!is_inside_tree()) return; @@ -592,6 +659,8 @@ void ColorPicker::_bind_methods() { ClassDB::bind_method(D_METHOD("set_pick_color", "color"), &ColorPicker::set_pick_color); ClassDB::bind_method(D_METHOD("get_pick_color"), &ColorPicker::get_pick_color); + ClassDB::bind_method(D_METHOD("set_hsv_mode", "mode"), &ColorPicker::set_hsv_mode); + ClassDB::bind_method(D_METHOD("is_hsv_mode"), &ColorPicker::is_hsv_mode); ClassDB::bind_method(D_METHOD("set_raw_mode", "mode"), &ColorPicker::set_raw_mode); ClassDB::bind_method(D_METHOD("is_raw_mode"), &ColorPicker::is_raw_mode); ClassDB::bind_method(D_METHOD("set_deferred_mode", "mode"), &ColorPicker::set_deferred_mode); @@ -623,6 +692,7 @@ void ColorPicker::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), "set_pick_color", "get_pick_color"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "edit_alpha"), "set_edit_alpha", "is_editing_alpha"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "hsv_mode"), "set_hsv_mode", "is_hsv_mode"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "raw_mode"), "set_raw_mode", "is_raw_mode"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "deferred_mode"), "set_deferred_mode", "is_deferred_mode"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "presets_enabled"), "set_presets_enabled", "are_presets_enabled"); @@ -639,6 +709,7 @@ ColorPicker::ColorPicker() : updating = true; edit_alpha = true; text_is_constructor = false; + hsv_mode_enabled = false; raw_mode_enabled = false; deferred_mode_enabled = false; changing_color = false; @@ -689,13 +760,12 @@ ColorPicker::ColorPicker() : VBoxContainer *vbr = memnew(VBoxContainer); add_child(vbr); vbr->set_h_size_flags(SIZE_EXPAND_FILL); - const char *lt[4] = { "R", "G", "B", "A" }; for (int i = 0; i < 4; i++) { HBoxContainer *hbc = memnew(HBoxContainer); - labels[i] = memnew(Label(lt[i])); + labels[i] = memnew(Label()); labels[i]->set_custom_minimum_size(Size2(get_constant("label_width"), 0)); labels[i]->set_v_size_flags(SIZE_SHRINK_CENTER); hbc->add_child(labels[i]); @@ -719,14 +789,20 @@ ColorPicker::ColorPicker() : vbr->add_child(hbc); } + labels[3]->set_text("A"); HBoxContainer *hhb = memnew(HBoxContainer); vbr->add_child(hhb); - btn_mode = memnew(CheckButton); - hhb->add_child(btn_mode); - btn_mode->set_text(TTR("Raw Mode")); - btn_mode->connect("toggled", this, "set_raw_mode"); + btn_hsv = memnew(CheckButton); + hhb->add_child(btn_hsv); + btn_hsv->set_text(TTR("HSV")); + btn_hsv->connect("toggled", this, "set_hsv_mode"); + + btn_raw = memnew(CheckButton); + hhb->add_child(btn_raw); + btn_raw->set_text(TTR("Raw")); + btn_raw->connect("toggled", this, "set_raw_mode"); text_type = memnew(Button); hhb->add_child(text_type); diff --git a/scene/gui/color_picker.h b/scene/gui/color_picker.h index b5ddf2d0c2..94640be4f0 100644 --- a/scene/gui/color_picker.h +++ b/scene/gui/color_picker.h @@ -58,7 +58,8 @@ private: Button *bt_add_preset; List<Color> presets; ToolButton *btn_pick; - CheckButton *btn_mode; + CheckButton *btn_hsv; + CheckButton *btn_raw; HSlider *scroll[4]; SpinBox *values[4]; Label *labels[4]; @@ -70,6 +71,7 @@ private: Color color; bool raw_mode_enabled; + bool hsv_mode_enabled; bool deferred_mode_enabled; bool updating; bool changing_color; @@ -81,7 +83,7 @@ private: void _html_entered(const String &p_html); void _value_changed(double); void _update_controls(); - void _update_color(); + void _update_color(bool p_update_sliders = true); void _update_presets(); void _update_text_value(); void _text_type_toggled(); @@ -106,13 +108,16 @@ public: void set_edit_alpha(bool p_show); bool is_editing_alpha() const; - void set_pick_color(const Color &p_color); + void set_pick_color(const Color &p_color, bool p_update_sliders = true); Color get_pick_color() const; void add_preset(const Color &p_color); void erase_preset(const Color &p_color); PoolColorArray get_presets() const; + void set_hsv_mode(bool p_enabled); + bool is_hsv_mode() const; + void set_raw_mode(bool p_enabled); bool is_raw_mode() const; diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 9d7c08d3f3..0845b56828 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -1749,6 +1749,9 @@ Rect2 Control::_compute_child_rect(const float p_anchors[4], const float p_margi void Control::_compute_anchors(Rect2 p_rect, const float p_margins[4], float (&r_anchors)[4]) { Size2 parent_rect_size = get_parent_anchorable_rect().size; + ERR_FAIL_COND(parent_rect_size.x == 0.0); + ERR_FAIL_COND(parent_rect_size.y == 0.0); + r_anchors[0] = (p_rect.position.x - p_margins[0]) / parent_rect_size.x; r_anchors[1] = (p_rect.position.y - p_margins[1]) / parent_rect_size.y; r_anchors[2] = (p_rect.position.x + p_rect.size.x - p_margins[2]) / parent_rect_size.x; diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp index 89f3d509d0..4da11b671e 100644 --- a/scene/gui/dialogs.cpp +++ b/scene/gui/dialogs.cpp @@ -406,12 +406,20 @@ void AcceptDialog::set_hide_on_ok(bool p_hide) { hide_on_ok = p_hide; } - bool AcceptDialog::get_hide_on_ok() const { return hide_on_ok; } +void AcceptDialog::set_autowrap(bool p_autowrap) { + + label->set_autowrap(p_autowrap); +} +bool AcceptDialog::has_autowrap() { + + return label->has_autowrap(); +} + void AcceptDialog::register_text_enter(Node *p_line_edit) { ERR_FAIL_NULL(p_line_edit); @@ -530,6 +538,8 @@ void AcceptDialog::_bind_methods() { ClassDB::bind_method(D_METHOD("_custom_action"), &AcceptDialog::_custom_action); ClassDB::bind_method(D_METHOD("set_text", "text"), &AcceptDialog::set_text); ClassDB::bind_method(D_METHOD("get_text"), &AcceptDialog::get_text); + ClassDB::bind_method(D_METHOD("set_autowrap", "autowrap"), &AcceptDialog::set_autowrap); + ClassDB::bind_method(D_METHOD("has_autowrap"), &AcceptDialog::has_autowrap); ADD_SIGNAL(MethodInfo("confirmed")); ADD_SIGNAL(MethodInfo("custom_action", PropertyInfo(Variant::STRING, "action"))); @@ -537,6 +547,7 @@ void AcceptDialog::_bind_methods() { ADD_GROUP("Dialog", "dialog"); ADD_PROPERTY(PropertyInfo(Variant::STRING, "dialog_text", PROPERTY_HINT_MULTILINE_TEXT, "", PROPERTY_USAGE_DEFAULT_INTL), "set_text", "get_text"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "dialog_hide_on_ok"), "set_hide_on_ok", "get_hide_on_ok"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "dialog_autowrap"), "set_autowrap", "has_autowrap"); } bool AcceptDialog::swap_ok_cancel = false; @@ -555,7 +566,6 @@ AcceptDialog::AcceptDialog() { label->set_anchor(MARGIN_BOTTOM, ANCHOR_END); label->set_begin(Point2(margin, margin)); label->set_end(Point2(-margin, -button_margin - 10)); - //label->set_autowrap(true); add_child(label); hbc = memnew(HBoxContainer); diff --git a/scene/gui/dialogs.h b/scene/gui/dialogs.h index 4b89ac54c5..c1a7f26a85 100644 --- a/scene/gui/dialogs.h +++ b/scene/gui/dialogs.h @@ -145,6 +145,9 @@ public: void set_text(String p_text); String get_text() const; + void set_autowrap(bool p_autowrap); + bool has_autowrap(); + AcceptDialog(); ~AcceptDialog(); }; diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp index e4da659b0d..1ca643cd7a 100644 --- a/scene/resources/animation.cpp +++ b/scene/resources/animation.cpp @@ -1425,7 +1425,9 @@ void Animation::track_set_key_value(int p_track, int p_key_idx, const Variant &p TransformTrack *tt = static_cast<TransformTrack *>(t); ERR_FAIL_INDEX(p_key_idx, tt->transforms.size()); + Dictionary d = p_value; + if (d.has("location")) tt->transforms.write[p_key_idx].value.loc = d["location"]; if (d.has("rotation")) @@ -1438,6 +1440,7 @@ void Animation::track_set_key_value(int p_track, int p_key_idx, const Variant &p ValueTrack *vt = static_cast<ValueTrack *>(t); ERR_FAIL_INDEX(p_key_idx, vt->values.size()); + vt->values.write[p_key_idx].value = p_value; } break; @@ -1445,11 +1448,14 @@ void Animation::track_set_key_value(int p_track, int p_key_idx, const Variant &p MethodTrack *mt = static_cast<MethodTrack *>(t); ERR_FAIL_INDEX(p_key_idx, mt->methods.size()); + Dictionary d = p_value; + if (d.has("method")) mt->methods.write[p_key_idx].method = d["method"]; if (d.has("args")) mt->methods.write[p_key_idx].params = d["args"]; + } break; case TYPE_BEZIER: { @@ -1469,6 +1475,7 @@ void Animation::track_set_key_value(int p_track, int p_key_idx, const Variant &p case TYPE_AUDIO: { AudioTrack *at = static_cast<AudioTrack *>(t); + ERR_FAIL_INDEX(p_key_idx, at->values.size()); Dictionary k = p_value; ERR_FAIL_COND(!k.has("start_offset")); @@ -1483,6 +1490,7 @@ void Animation::track_set_key_value(int p_track, int p_key_idx, const Variant &p case TYPE_ANIMATION: { AnimationTrack *at = static_cast<AnimationTrack *>(t); + ERR_FAIL_INDEX(p_key_idx, at->values.size()); at->values.write[p_key_idx].value = p_value; diff --git a/scene/resources/dynamic_font.h b/scene/resources/dynamic_font.h index 887c7b42c8..8d60ea1798 100644 --- a/scene/resources/dynamic_font.h +++ b/scene/resources/dynamic_font.h @@ -303,7 +303,6 @@ VARIANT_ENUM_CAST(DynamicFont::SpacingType); ///////////// class ResourceFormatLoaderDynamicFont : public ResourceFormatLoader { - GDCLASS(ResourceFormatLoaderDynamicFont, ResourceFormatLoader) public: virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL); virtual void get_recognized_extensions(List<String> *p_extensions) const; diff --git a/scene/resources/dynamic_font_stb.h b/scene/resources/dynamic_font_stb.h index 4c98487600..caee6e7e32 100644 --- a/scene/resources/dynamic_font_stb.h +++ b/scene/resources/dynamic_font_stb.h @@ -180,7 +180,6 @@ public: ///////////// class ResourceFormatLoaderDynamicFont : public ResourceFormatLoader { - GDCLASS(ResourceFormatLoaderDynamicFont, ResourceFormatLoader) public: virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL); virtual void get_recognized_extensions(List<String> *p_extensions) const; diff --git a/scene/resources/font.h b/scene/resources/font.h index def2c2285a..436ed43c42 100644 --- a/scene/resources/font.h +++ b/scene/resources/font.h @@ -202,7 +202,6 @@ public: }; class ResourceFormatLoaderBMFont : public ResourceFormatLoader { - GDCLASS(ResourceFormatLoaderBMFont, ResourceFormatLoader) public: virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL); virtual void get_recognized_extensions(List<String> *p_extensions) const; diff --git a/scene/resources/resource_format_text.h b/scene/resources/resource_format_text.h index 06c841229b..0041989f09 100644 --- a/scene/resources/resource_format_text.h +++ b/scene/resources/resource_format_text.h @@ -128,7 +128,6 @@ public: }; class ResourceFormatLoaderText : public ResourceFormatLoader { - GDCLASS(ResourceFormatLoaderText, ResourceFormatLoader) public: static ResourceFormatLoaderText *singleton; virtual Ref<ResourceInteractiveLoader> load_interactive(const String &p_path, const String &p_original_path = "", Error *r_error = NULL); @@ -187,7 +186,6 @@ public: }; class ResourceFormatSaverText : public ResourceFormatSaver { - GDCLASS(ResourceFormatSaverText, ResourceFormatSaver) public: static ResourceFormatSaverText *singleton; virtual Error save(const String &p_path, const RES &p_resource, uint32_t p_flags = 0); diff --git a/scene/resources/shader.h b/scene/resources/shader.h index fb493046fc..6e7447839f 100644 --- a/scene/resources/shader.h +++ b/scene/resources/shader.h @@ -100,7 +100,6 @@ public: VARIANT_ENUM_CAST(Shader::Mode); class ResourceFormatLoaderShader : public ResourceFormatLoader { - GDCLASS(ResourceFormatLoaderShader, ResourceFormatLoader) public: virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL); virtual void get_recognized_extensions(List<String> *p_extensions) const; @@ -109,7 +108,6 @@ public: }; class ResourceFormatSaverShader : public ResourceFormatSaver { - GDCLASS(ResourceFormatSaverShader, ResourceFormatSaver) public: virtual Error save(const String &p_path, const RES &p_resource, uint32_t p_flags = 0); virtual void get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const; diff --git a/scene/resources/texture.h b/scene/resources/texture.h index 021673f072..59d243484d 100644 --- a/scene/resources/texture.h +++ b/scene/resources/texture.h @@ -239,7 +239,6 @@ public: }; class ResourceFormatLoaderStreamTexture : public ResourceFormatLoader { - GDCLASS(ResourceFormatLoaderStreamTexture, ResourceFormatLoader) public: virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL); virtual void get_recognized_extensions(List<String> *p_extensions) const; @@ -537,7 +536,6 @@ public: }; class ResourceFormatLoaderTextureLayered : public ResourceFormatLoader { - GDCLASS(ResourceFormatLoaderTextureLayered, ResourceFormatLoader) public: enum Compression { COMPRESSION_LOSSLESS, diff --git a/servers/audio/effects/audio_effect_pitch_shift.cpp b/servers/audio/effects/audio_effect_pitch_shift.cpp index ca2a88f858..c250f2e2bd 100644 --- a/servers/audio/effects/audio_effect_pitch_shift.cpp +++ b/servers/audio/effects/audio_effect_pitch_shift.cpp @@ -293,14 +293,16 @@ void AudioEffectPitchShiftInstance::process(const AudioFrame *p_src_frames, Audi float *out_l = (float *)p_dst_frames; float *out_r = out_l + 1; - shift_l.PitchShift(base->pitch_scale, p_frame_count, 2048, 4, sample_rate, in_l, out_l, 2); - shift_r.PitchShift(base->pitch_scale, p_frame_count, 2048, 4, sample_rate, in_r, out_r, 2); + shift_l.PitchShift(base->pitch_scale, p_frame_count, fft_size, base->oversampling, sample_rate, in_l, out_l, 2); + shift_r.PitchShift(base->pitch_scale, p_frame_count, fft_size, base->oversampling, sample_rate, in_r, out_r, 2); } Ref<AudioEffectInstance> AudioEffectPitchShift::instance() { Ref<AudioEffectPitchShiftInstance> ins; ins.instance(); ins->base = Ref<AudioEffectPitchShift>(this); + static const int fft_sizes[FFT_SIZE_MAX] = { 256, 512, 1024, 2048, 4096 }; + ins->fft_size = fft_sizes[fft_size]; return ins; } @@ -315,14 +317,50 @@ float AudioEffectPitchShift::get_pitch_scale() const { return pitch_scale; } +void AudioEffectPitchShift::set_oversampling(int p_oversampling) { + ERR_FAIL_COND(p_oversampling < 4); + oversampling = p_oversampling; +} + +int AudioEffectPitchShift::get_oversampling() const { + + return oversampling; +} + +void AudioEffectPitchShift::set_fft_size(FFT_Size p_fft_size) { + ERR_FAIL_INDEX(p_fft_size, FFT_SIZE_MAX); + fft_size = p_fft_size; +} + +AudioEffectPitchShift::FFT_Size AudioEffectPitchShift::get_fft_size() const { + return fft_size; +} + void AudioEffectPitchShift::_bind_methods() { ClassDB::bind_method(D_METHOD("set_pitch_scale", "rate"), &AudioEffectPitchShift::set_pitch_scale); ClassDB::bind_method(D_METHOD("get_pitch_scale"), &AudioEffectPitchShift::get_pitch_scale); + ClassDB::bind_method(D_METHOD("set_oversampling", "amount"), &AudioEffectPitchShift::set_oversampling); + ClassDB::bind_method(D_METHOD("get_oversampling"), &AudioEffectPitchShift::get_oversampling); + + ClassDB::bind_method(D_METHOD("set_fft_size", "size"), &AudioEffectPitchShift::set_fft_size); + ClassDB::bind_method(D_METHOD("get_fft_size"), &AudioEffectPitchShift::get_fft_size); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "pitch_scale", PROPERTY_HINT_RANGE, "0.01,16,0.01"), "set_pitch_scale", "get_pitch_scale"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "oversampling", PROPERTY_HINT_RANGE, "4,32,1"), "set_oversampling", "get_oversampling"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "fft_size", PROPERTY_HINT_ENUM, "256,512,1024,2048,4096"), "set_fft_size", "get_fft_size"); + + BIND_ENUM_CONSTANT(FFT_SIZE_256); + BIND_ENUM_CONSTANT(FFT_SIZE_512); + BIND_ENUM_CONSTANT(FFT_SIZE_1024); + BIND_ENUM_CONSTANT(FFT_SIZE_2048); + BIND_ENUM_CONSTANT(FFT_SIZE_4096); + BIND_ENUM_CONSTANT(FFT_SIZE_MAX); } AudioEffectPitchShift::AudioEffectPitchShift() { pitch_scale = 1.0; + oversampling = 4; + fft_size = FFT_SIZE_2048; } diff --git a/servers/audio/effects/audio_effect_pitch_shift.h b/servers/audio/effects/audio_effect_pitch_shift.h index febc20e9d5..0c80cb6344 100644 --- a/servers/audio/effects/audio_effect_pitch_shift.h +++ b/servers/audio/effects/audio_effect_pitch_shift.h @@ -76,6 +76,7 @@ class AudioEffectPitchShiftInstance : public AudioEffectInstance { friend class AudioEffectPitchShift; Ref<AudioEffectPitchShift> base; + int fft_size; SMBPitchShift shift_l; SMBPitchShift shift_r; @@ -85,11 +86,22 @@ public: class AudioEffectPitchShift : public AudioEffect { GDCLASS(AudioEffectPitchShift, AudioEffect) +public: + enum FFT_Size { + FFT_SIZE_256, + FFT_SIZE_512, + FFT_SIZE_1024, + FFT_SIZE_2048, + FFT_SIZE_4096, + FFT_SIZE_MAX + }; +public: friend class AudioEffectPitchShiftInstance; float pitch_scale; - int window_size; + int oversampling; + FFT_Size fft_size; float wet; float dry; bool filter; @@ -103,7 +115,15 @@ public: void set_pitch_scale(float p_pitch_scale); float get_pitch_scale() const; + void set_oversampling(int p_oversampling); + int get_oversampling() const; + + void set_fft_size(FFT_Size); + FFT_Size get_fft_size() const; + AudioEffectPitchShift(); }; +VARIANT_ENUM_CAST(AudioEffectPitchShift::FFT_Size); + #endif // AUDIO_EFFECT_PITCH_SHIFT_H diff --git a/servers/audio/effects/audio_effect_spectrum_analyzer.cpp b/servers/audio/effects/audio_effect_spectrum_analyzer.cpp index f5ac0afefa..305f9046c3 100644 --- a/servers/audio/effects/audio_effect_spectrum_analyzer.cpp +++ b/servers/audio/effects/audio_effect_spectrum_analyzer.cpp @@ -111,9 +111,10 @@ void AudioEffectSpectrumAnalyzerInstance::process(const AudioFrame *p_src_frames float *fftw = temporal_fft.ptrw(); for (int i = 0; i < to_fill; i++) { //left and right buffers - fftw[(i + temporal_fft_pos) * 2] = p_src_frames[i].l; + float window = -0.5 * Math::cos(2.0 * Math_PI * (double)i / (double)to_fill) + 0.5; + fftw[(i + temporal_fft_pos) * 2] = window * p_src_frames[i].l; fftw[(i + temporal_fft_pos) * 2 + 1] = 0; - fftw[(i + temporal_fft_pos + fft_size * 2) * 2] = p_src_frames[i].r; + fftw[(i + temporal_fft_pos + fft_size * 2) * 2] = window * p_src_frames[i].r; fftw[(i + temporal_fft_pos + fft_size * 2) * 2 + 1] = 0; } diff --git a/servers/physics/area_sw.cpp b/servers/physics/area_sw.cpp index 9d68869bc2..ad3e40916d 100644 --- a/servers/physics/area_sw.cpp +++ b/servers/physics/area_sw.cpp @@ -250,7 +250,7 @@ AreaSW::AreaSW() : gravity_is_point = false; gravity_distance_scale = 0; point_attenuation = 1; - angular_damp = 1.0; + angular_damp = 0.1; linear_damp = 0.1; priority = 0; set_ray_pickable(false); |