Rename PathFollow2D rotate bool

This commit is contained in:
Aaron Franke 2019-12-25 07:48:27 -05:00
parent 888deca827
commit ce9d87ddfd
No known key found for this signature in database
GPG Key ID: 40A1750B977E56BF
3 changed files with 11 additions and 11 deletions

View File

@ -29,8 +29,8 @@
<member name="offset" type="float" setter="set_offset" getter="get_offset" default="0.0">
The distance along the path in pixels.
</member>
<member name="rotate" type="bool" setter="set_rotate" getter="is_rotating" default="true">
If [code]true[/code], this node rotates to follow the path, making its descendants rotate.
<member name="rotates" type="bool" setter="set_rotates" getter="is_rotating" default="true">
If [code]true[/code], this node rotates to follow the path, with the +X direction facing forward on the path.
</member>
<member name="unit_offset" type="float" setter="set_unit_offset" getter="get_unit_offset" default="0.0">
The distance along the path as a number in the range 0.0 (for the first vertex) to 1.0 (for the last). This is just another way of expressing the offset within the path, as the offset supplied is multiplied internally by the path's length.

View File

@ -170,7 +170,7 @@ void PathFollow2D::_update_transform() {
}
Vector2 pos = c->interpolate_baked(offset, cubic);
if (rotate) {
if (rotates) {
float ahead = offset + lookahead;
if (loop && ahead >= path_length) {
@ -279,7 +279,7 @@ void PathFollow2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_unit_offset", "unit_offset"), &PathFollow2D::set_unit_offset);
ClassDB::bind_method(D_METHOD("get_unit_offset"), &PathFollow2D::get_unit_offset);
ClassDB::bind_method(D_METHOD("set_rotate", "enable"), &PathFollow2D::set_rotate);
ClassDB::bind_method(D_METHOD("set_rotates", "enable"), &PathFollow2D::set_rotates);
ClassDB::bind_method(D_METHOD("is_rotating"), &PathFollow2D::is_rotating);
ClassDB::bind_method(D_METHOD("set_cubic_interpolation", "enable"), &PathFollow2D::set_cubic_interpolation);
@ -295,7 +295,7 @@ void PathFollow2D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "unit_offset", PROPERTY_HINT_RANGE, "0,1,0.0001,or_lesser,or_greater", PROPERTY_USAGE_EDITOR), "set_unit_offset", "get_unit_offset");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "h_offset"), "set_h_offset", "get_h_offset");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "v_offset"), "set_v_offset", "get_v_offset");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "rotate"), "set_rotate", "is_rotating");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "rotates"), "set_rotates", "is_rotating");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "cubic_interp"), "set_cubic_interpolation", "get_cubic_interpolation");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "loop"), "set_loop", "has_loop");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "lookahead", PROPERTY_HINT_RANGE, "0.001,1024.0,0.001"), "set_lookahead", "get_lookahead");
@ -371,13 +371,13 @@ float PathFollow2D::get_lookahead() const {
return lookahead;
}
void PathFollow2D::set_rotate(bool p_rotate) {
rotate = p_rotate;
void PathFollow2D::set_rotates(bool p_rotates) {
rotates = p_rotates;
_update_transform();
}
bool PathFollow2D::is_rotating() const {
return rotate;
return rotates;
}
void PathFollow2D::set_loop(bool p_loop) {
@ -393,7 +393,7 @@ PathFollow2D::PathFollow2D() {
h_offset = 0;
v_offset = 0;
path = nullptr;
rotate = true;
rotates = true;
cubic = true;
loop = true;
lookahead = 4;

View File

@ -70,7 +70,7 @@ private:
real_t lookahead;
bool cubic;
bool loop;
bool rotate;
bool rotates;
void _update_transform();
@ -99,7 +99,7 @@ public:
void set_loop(bool p_loop);
bool has_loop() const;
void set_rotate(bool p_rotate);
void set_rotates(bool p_rotates);
bool is_rotating() const;
void set_cubic_interpolation(bool p_enable);