Skip to content

Commit

Permalink
Merge pull request #43310 from akien-mga/doc-classref-sync
Browse files Browse the repository at this point in the history
doc: Sync classref with current source
  • Loading branch information
akien-mga committed Nov 4, 2020
2 parents 89f605c + 424cd00 commit 8e13b93
Show file tree
Hide file tree
Showing 56 changed files with 576 additions and 571 deletions.
12 changes: 6 additions & 6 deletions core/math/rect2.h
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,8 @@ struct Rect2i {
new_rect.position.x = MAX(p_rect.position.x, position.x);
new_rect.position.y = MAX(p_rect.position.y, position.y);

Point2 p_rect_end = p_rect.position + p_rect.size;
Point2 end = position + size;
Point2i p_rect_end = p_rect.position + p_rect.size;
Point2i end = position + size;

new_rect.size.x = (int)(MIN(p_rect_end.x, end.x) - new_rect.position.x);
new_rect.size.y = (int)(MIN(p_rect_end.y, end.y) - new_rect.position.y);
Expand All @@ -390,7 +390,7 @@ struct Rect2i {

return new_rect;
}
bool has_point(const Point2 &p_point) const {
bool has_point(const Point2i &p_point) const {
if (p_point.x < position.x) {
return false;
}
Expand Down Expand Up @@ -485,10 +485,10 @@ struct Rect2i {
size(p_r2.size) {
}
Rect2i(int p_x, int p_y, int p_width, int p_height) :
position(Point2(p_x, p_y)),
size(Size2(p_width, p_height)) {
position(Point2i(p_x, p_y)),
size(Size2i(p_width, p_height)) {
}
Rect2i(const Point2 &p_pos, const Size2 &p_size) :
Rect2i(const Point2i &p_pos, const Size2i &p_size) :
position(p_pos),
size(p_size) {
}
Expand Down
40 changes: 16 additions & 24 deletions core/variant_call.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1357,7 +1357,7 @@ void register_variant_methods() {
_VariantCall::construct_funcs = memnew_arr(_VariantCall::ConstructFunc, Variant::VARIANT_MAX);
_VariantCall::constant_data = memnew_arr(_VariantCall::ConstantData, Variant::VARIANT_MAX);

/* STRING */
/* String */

bind_method(String, casecmp_to, sarray("to"), varray());
bind_method(String, nocasecmp_to, sarray("to"), varray());
Expand Down Expand Up @@ -1405,7 +1405,7 @@ void register_variant_methods() {
bind_method(String, plus_file, sarray("file"), varray());
bind_method(String, ord_at, sarray("at"), varray());
bind_method(String, dedent, sarray(), varray());
//string needs to be immutable when binding
// FIXME: String needs to be immutable when binding
//bind_method(String, erase, sarray("position", "chars"), varray());
bind_method(String, hash, sarray(), varray());
bind_method(String, md5_text, sarray(), varray());
Expand All @@ -1415,7 +1415,7 @@ void register_variant_methods() {
bind_method(String, sha1_buffer, sarray(), varray());
bind_method(String, sha256_buffer, sarray(), varray());
bind_method(String, empty, sarray(), varray());
//static function, not sure how to bind
// FIXME: Static function, not sure how to bind
//bind_method(String, humanize_size, sarray("size"), varray());

bind_method(String, is_abs_path, sarray(), varray());
Expand Down Expand Up @@ -1457,7 +1457,7 @@ void register_variant_methods() {
bind_method(String, to_utf16_buffer, sarray(), varray());
bind_method(String, to_utf32_buffer, sarray(), varray());

/* VECTOR2 */
/* Vector2 */

bind_method(Vector2, angle, sarray(), varray());
bind_method(Vector2, angle_to, sarray("to"), varray());
Expand Down Expand Up @@ -1490,15 +1490,16 @@ void register_variant_methods() {
bind_method(Vector2, cross, sarray("with"), varray());
bind_method(Vector2, abs, sarray(), varray());
bind_method(Vector2, sign, sarray(), varray());
bind_method(Vector2, snapped, sarray("by"), varray());
bind_method(Vector2, clamped, sarray("length"), varray());

/* VECTOR2I */
/* Vector2i */

bind_method(Vector2i, aspect, sarray(), varray());
bind_method(Vector2i, sign, sarray(), varray());
bind_method(Vector2i, abs, sarray(), varray());

/* RECT2 */
/* Rect2 */

bind_method(Rect2, get_area, sarray(), varray());
bind_method(Rect2, has_no_area, sarray(), varray());
Expand Down Expand Up @@ -1585,7 +1586,7 @@ void register_variant_methods() {
bind_methodv(intersects_ray, &Plane::intersects_ray_bind, sarray("from", "dir"), varray());
bind_methodv(intersects_segment, &Plane::intersects_segment_bind, sarray("from", "to"), varray());

/* Quaternion */
/* Quat */

bind_method(Quat, length, sarray(), varray());
bind_method(Quat, length_squared, sarray(), varray());
Expand All @@ -1594,13 +1595,12 @@ void register_variant_methods() {
bind_method(Quat, is_equal_approx, sarray("to"), varray());
bind_method(Quat, inverse, sarray(), varray());
bind_method(Quat, dot, sarray("with"), varray());
bind_method(Quat, xform, sarray("v3"), varray());
bind_method(Quat, slerp, sarray("b", "t"), varray());
bind_method(Quat, slerpni, sarray("b", "t"), varray());
bind_method(Quat, cubic_slerp, sarray("b", "pre_a", "post_b", "t"), varray());
bind_method(Quat, get_euler, sarray(), varray());

//Quat is atomic, this should be done via construcror
// FIXME: Quat is atomic, this should be done via construcror
//ADDFUNC1(QUAT, NIL, Quat, set_euler, VECTOR3, "euler", varray());
//ADDFUNC2(QUAT, NIL, Quat, set_axis_angle, VECTOR3, "axis", FLOAT, "angle", varray());

Expand All @@ -1621,7 +1621,7 @@ void register_variant_methods() {
bind_method(Color, to_html, sarray("with_alpha"), varray(true));
bind_method(Color, blend, sarray("over"), varray());

//Color is immutable, need to probably find a way to do this via constructor
// FIXME: Color is immutable, need to probably find a way to do this via constructor
//ADDFUNC4R(COLOR, COLOR, Color, from_hsv, FLOAT, "h", FLOAT, "s", FLOAT, "v", FLOAT, "a", varray(1.0));
bind_method(Color, is_equal_approx, sarray("to"), varray());

Expand Down Expand Up @@ -1651,8 +1651,6 @@ void register_variant_methods() {
bind_method(Callable, hash, sarray(), varray());
bind_method(Callable, unbind, sarray("argcount"), varray());

//#define bind_custom(m_type, m_name, m_method, m_flags, m_arg_types, m_ret_type, m_arg_names) _VariantCall::_bind_custom(m_type, m_name, m_method, m_flags, m_arg_types, m_ret_type)

bind_custom(Variant::CALLABLE, "call", _VariantCall::func_Callable_call, Variant::InternalMethod::FLAG_VARARGS | Variant::InternalMethod::FLAG_RETURNS_VARIANT, Vector<Variant::Type>(), Variant::NIL, sarray());
bind_custom(Variant::CALLABLE, "call_deferred", _VariantCall::func_Callable_call_deferred, Variant::InternalMethod::FLAG_VARARGS, Vector<Variant::Type>(), Variant::NIL, sarray());
bind_custom(Variant::CALLABLE, "bind", _VariantCall::func_Callable_bind, Variant::InternalMethod::FLAG_VARARGS, Vector<Variant::Type>(), Variant::CALLABLE, sarray());
Expand Down Expand Up @@ -1682,9 +1680,6 @@ void register_variant_methods() {
bind_method(Transform2D, rotated, sarray("phi"), varray());
bind_method(Transform2D, scaled, sarray("scale"), varray());
bind_method(Transform2D, translated, sarray("offset"), varray());
//too complex to bind this, operator * should be used instead
//ADDFUNC1R(TRANSFORM2D, NIL, Transform2D, xform, NIL, "v", varray());
//ADDFUNC1R(TRANSFORM2D, NIL, Transform2D, xform_inv, NIL, "v", varray());
bind_method(Transform2D, basis_xform, sarray("v"), varray());
bind_method(Transform2D, basis_xform_inv, sarray("v"), varray());
bind_method(Transform2D, interpolate_with, sarray("xform", "t"), varray());
Expand All @@ -1703,9 +1698,6 @@ void register_variant_methods() {
bind_method(Basis, tdotx, sarray("with"), varray());
bind_method(Basis, tdoty, sarray("with"), varray());
bind_method(Basis, tdotz, sarray("with"), varray());
//use the operators instead
//ADDFUNC1R(BASIS, VECTOR3, Basis, xform, VECTOR3, "v", varray());
//ADDFUNC1R(BASIS, VECTOR3, Basis, xform_inv, VECTOR3, "v", varray());
bind_method(Basis, get_orthogonal_index, sarray(), varray());
bind_method(Basis, slerp, sarray("b", "t"), varray());
bind_method(Basis, is_equal_approx, sarray("b"), varray());
Expand Down Expand Up @@ -1748,9 +1740,6 @@ void register_variant_methods() {
bind_method(Transform, looking_at, sarray("target", "up"), varray());
bind_method(Transform, interpolate_with, sarray("xform", "weight"), varray());
bind_method(Transform, is_equal_approx, sarray("xform"), varray());
//use the operators instead
//ADDFUNC1R(TRANSFORM, NIL, Transform, xform, NIL, "v", varray());
//ADDFUNC1R(TRANSFORM, NIL, Transform, xform_inv, NIL, "v", varray());

/* Dictionary */

Expand Down Expand Up @@ -1923,6 +1912,7 @@ void register_variant_methods() {
bind_method(PackedVector2Array, invert, sarray(), varray());
bind_method(PackedVector2Array, subarray, sarray("from", "to"), varray());
bind_method(PackedVector2Array, to_byte_array, sarray(), varray());
bind_method(PackedVector2Array, sort, sarray(), varray());

/* Vector3 Array */

Expand All @@ -1939,6 +1929,7 @@ void register_variant_methods() {
bind_method(PackedVector3Array, invert, sarray(), varray());
bind_method(PackedVector3Array, subarray, sarray("from", "to"), varray());
bind_method(PackedVector3Array, to_byte_array, sarray(), varray());
bind_method(PackedVector3Array, sort, sarray(), varray());

/* Color Array */

Expand All @@ -1955,16 +1946,17 @@ void register_variant_methods() {
bind_method(PackedColorArray, invert, sarray(), varray());
bind_method(PackedColorArray, subarray, sarray("from", "to"), varray());
bind_method(PackedColorArray, to_byte_array, sarray(), varray());
bind_method(PackedColorArray, sort, sarray(), varray());

/* REGISTER CONSTRUCTORS */
/* Register constructors */

_VariantCall::add_constructor(_VariantCall::Vector2_init1, Variant::VECTOR2, "x", Variant::FLOAT, "y", Variant::FLOAT);
_VariantCall::add_constructor(_VariantCall::Vector2i_init1, Variant::VECTOR2I, "x", Variant::INT, "y", Variant::INT);

_VariantCall::add_constructor(_VariantCall::Rect2_init1, Variant::RECT2, "position", Variant::VECTOR2, "size", Variant::VECTOR2);
_VariantCall::add_constructor(_VariantCall::Rect2_init2, Variant::RECT2, "x", Variant::FLOAT, "y", Variant::FLOAT, "width", Variant::FLOAT, "height", Variant::FLOAT);

_VariantCall::add_constructor(_VariantCall::Rect2i_init1, Variant::RECT2I, "position", Variant::VECTOR2, "size", Variant::VECTOR2);
_VariantCall::add_constructor(_VariantCall::Rect2i_init1, Variant::RECT2I, "position", Variant::VECTOR2I, "size", Variant::VECTOR2I);
_VariantCall::add_constructor(_VariantCall::Rect2i_init2, Variant::RECT2I, "x", Variant::INT, "y", Variant::INT, "width", Variant::INT, "height", Variant::INT);

_VariantCall::add_constructor(_VariantCall::Transform2D_init2, Variant::TRANSFORM2D, "rotation", Variant::FLOAT, "position", Variant::VECTOR2);
Expand Down Expand Up @@ -1997,7 +1989,7 @@ void register_variant_methods() {
_VariantCall::add_constructor(_VariantCall::Callable_init2, Variant::CALLABLE, "object", Variant::OBJECT, "method_name", Variant::STRING_NAME);
_VariantCall::add_constructor(_VariantCall::Signal_init2, Variant::SIGNAL, "object", Variant::OBJECT, "signal_name", Variant::STRING_NAME);

/* REGISTER CONSTANTS */
/* Register constants */

_populate_named_colors();
for (Map<String, Color>::Element *color = _named_colors.front(); color; color = color->next()) {
Expand Down
12 changes: 11 additions & 1 deletion doc/classes/AABB.xml
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,18 @@
Returns [code]true[/code] if the [AABB] is on both sides of a plane.
</description>
</method>
<method name="intersects_ray">
<return type="Variant">
</return>
<argument index="0" name="from" type="Vector3">
</argument>
<argument index="1" name="dir" type="Vector3">
</argument>
<description>
</description>
</method>
<method name="intersects_segment">
<return type="bool">
<return type="Variant">
</return>
<argument index="0" name="from" type="Vector3">
</argument>
Expand Down
6 changes: 0 additions & 6 deletions doc/classes/AnimatedSprite2D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,6 @@
<member name="playing" type="bool" setter="_set_playing" getter="_is_playing" default="false">
If [code]true[/code], the [member animation] is currently playing.
</member>
<member name="shininess" type="float" setter="set_shininess" getter="get_shininess" default="1.0">
Strength of the specular light effect of this [AnimatedSprite2D].
</member>
<member name="specular_color" type="Color" setter="set_specular_color" getter="get_specular_color" default="Color( 1, 1, 1, 1 )">
The color of the specular light effect.
</member>
<member name="speed_scale" type="float" setter="set_speed_scale" getter="get_speed_scale" default="1.0">
The animation speed is multiplied by this value.
</member>
Expand Down
6 changes: 3 additions & 3 deletions doc/classes/Array.xml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
</argument>
<argument index="1" name="obj" type="Object">
</argument>
<argument index="2" name="func" type="String">
<argument index="2" name="func" type="StringName">
</argument>
<argument index="3" name="before" type="bool" default="true">
</argument>
Expand Down Expand Up @@ -362,7 +362,7 @@
</description>
</method>
<method name="resize">
<return type="void">
<return type="int">
</return>
<argument index="0" name="size" type="int">
</argument>
Expand Down Expand Up @@ -433,7 +433,7 @@
</return>
<argument index="0" name="obj" type="Object">
</argument>
<argument index="1" name="func" type="String">
<argument index="1" name="func" type="StringName">
</argument>
<description>
Sorts the array using a custom method. The arguments are an object that holds the method and the name of such method. The custom method receives two arguments (a pair of elements from the array) and must return either [code]true[/code] or [code]false[/code].
Expand Down
19 changes: 0 additions & 19 deletions doc/classes/Basis.xml
Original file line number Diff line number Diff line change
Expand Up @@ -187,25 +187,6 @@
Returns the transposed version of the matrix.
</description>
</method>
<method name="xform">
<return type="Vector3">
</return>
<argument index="0" name="v" type="Vector3">
</argument>
<description>
Returns a vector transformed (multiplied) by the matrix.
</description>
</method>
<method name="xform_inv">
<return type="Vector3">
</return>
<argument index="0" name="v" type="Vector3">
</argument>
<description>
Returns a vector transformed (multiplied) by the transposed basis matrix.
[b]Note:[/b] This results in a multiplication by the inverse of the matrix only if it represents a rotation-reflection.
</description>
</method>
</methods>
<members>
<member name="x" type="Vector3" setter="" getter="" default="Vector3( 1, 0, 0 )">
Expand Down
4 changes: 0 additions & 4 deletions doc/classes/CPUParticles2D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,6 @@
<member name="local_coords" type="bool" setter="set_use_local_coordinates" getter="get_use_local_coordinates" default="true">
If [code]true[/code], particles use the parent node's coordinate space. If [code]false[/code], they use global coordinates.
</member>
<member name="normalmap" type="Texture2D" setter="set_normalmap" getter="get_normalmap">
Normal map to be used for the [member texture] property.
[b]Note:[/b] Godot expects the normal map to use X+, Y-, and Z+ coordinates. See [url=http://wiki.polycount.com/wiki/Normal_Map_Technical_Details#Common_Swizzle_Coordinates]this page[/url] for a comparison of normal map coordinates expected by popular engines.
</member>
<member name="one_shot" type="bool" setter="set_one_shot" getter="get_one_shot" default="false">
If [code]true[/code], only one emission cycle occurs. If set [code]true[/code] during a cycle, emission will stop at the cycle's end.
</member>
Expand Down
2 changes: 1 addition & 1 deletion doc/classes/Callable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
</description>
</method>
<method name="bind" qualifiers="vararg">
<return type="void">
<return type="Callable">
</return>
<description>
</description>
Expand Down
21 changes: 21 additions & 0 deletions doc/classes/CanvasGroup.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="CanvasGroup" inherits="Node2D" version="4.0">
<brief_description>
</brief_description>
<description>
</description>
<tutorials>
</tutorials>
<methods>
</methods>
<members>
<member name="clear_margin" type="float" setter="set_clear_margin" getter="get_clear_margin" default="10.0">
</member>
<member name="fit_margin" type="float" setter="set_fit_margin" getter="get_fit_margin" default="10.0">
</member>
<member name="use_mipmaps" type="bool" setter="set_use_mipmaps" getter="is_using_mipmaps" default="false">
</member>
</members>
<constants>
</constants>
</class>
Loading

0 comments on commit 8e13b93

Please sign in to comment.