diff options
Diffstat (limited to 'scene/3d/path_3d.cpp')
-rw-r--r-- | scene/3d/path_3d.cpp | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/scene/3d/path_3d.cpp b/scene/3d/path_3d.cpp index 4a425d1e0e..6f57bf81c4 100644 --- a/scene/3d/path_3d.cpp +++ b/scene/3d/path_3d.cpp @@ -37,7 +37,6 @@ void Path3D::_notification(int p_what) { } void Path3D::_curve_changed() { - if (is_inside_tree() && Engine::get_singleton()->is_editor_hint()) update_gizmo(); if (is_inside_tree()) { @@ -57,7 +56,6 @@ void Path3D::_curve_changed() { } void Path3D::set_curve(const Ref<Curve3D> &p_curve) { - if (curve.is_valid()) { curve->disconnect("changed", callable_mp(this, &Path3D::_curve_changed)); } @@ -71,12 +69,10 @@ void Path3D::set_curve(const Ref<Curve3D> &p_curve) { } Ref<Curve3D> Path3D::get_curve() const { - return curve; } void Path3D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_curve", "curve"), &Path3D::set_curve); ClassDB::bind_method(D_METHOD("get_curve"), &Path3D::get_curve); @@ -86,14 +82,12 @@ void Path3D::_bind_methods() { } Path3D::Path3D() { - set_curve(Ref<Curve3D>(memnew(Curve3D))); //create one by default } ////////////// void PathFollow3D::_update_transform() { - if (!path) return; @@ -124,7 +118,6 @@ void PathFollow3D::_update_transform() { // will be replaced by "Vector3(h_offset, v_offset, 0)" where it was formerly used if (rotation_mode == ROTATION_ORIENTED) { - Vector3 forward = c->interpolate_baked(o_next, cubic) - pos; if (forward.length_squared() < CMP_EPSILON2) @@ -213,11 +206,8 @@ void PathFollow3D::_update_transform() { } void PathFollow3D::_notification(int p_what) { - switch (p_what) { - case NOTIFICATION_ENTER_TREE: { - Node *parent = get_parent(); if (parent) { path = Object::cast_to<Path3D>(parent); @@ -228,26 +218,21 @@ void PathFollow3D::_notification(int p_what) { } break; case NOTIFICATION_EXIT_TREE: { - path = nullptr; } break; } } void PathFollow3D::set_cubic_interpolation(bool p_enable) { - cubic = p_enable; } bool PathFollow3D::get_cubic_interpolation() const { - return cubic; } void PathFollow3D::_validate_property(PropertyInfo &property) const { - if (property.name == "offset") { - float max = 10000; if (path && path->get_curve().is_valid()) max = path->get_curve()->get_baked_length(); @@ -257,7 +242,6 @@ void PathFollow3D::_validate_property(PropertyInfo &property) const { } String PathFollow3D::get_configuration_warning() const { - if (!is_visible_in_tree() || !is_inside_tree()) return String(); @@ -274,7 +258,6 @@ String PathFollow3D::get_configuration_warning() const { } void PathFollow3D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_offset", "offset"), &PathFollow3D::set_offset); ClassDB::bind_method(D_METHOD("get_offset"), &PathFollow3D::get_offset); @@ -336,42 +319,35 @@ void PathFollow3D::set_offset(float p_offset) { } void PathFollow3D::set_h_offset(float p_h_offset) { - h_offset = p_h_offset; if (path) _update_transform(); } float PathFollow3D::get_h_offset() const { - return h_offset; } void PathFollow3D::set_v_offset(float p_v_offset) { - v_offset = p_v_offset; if (path) _update_transform(); } float PathFollow3D::get_v_offset() const { - return v_offset; } float PathFollow3D::get_offset() const { - return offset; } void PathFollow3D::set_unit_offset(float p_unit_offset) { - if (path && path->get_curve().is_valid() && path->get_curve()->get_baked_length()) set_offset(p_unit_offset * path->get_curve()->get_baked_length()); } float PathFollow3D::get_unit_offset() const { - if (path && path->get_curve().is_valid() && path->get_curve()->get_baked_length()) return get_offset() / path->get_curve()->get_baked_length(); else @@ -379,7 +355,6 @@ float PathFollow3D::get_unit_offset() const { } void PathFollow3D::set_rotation_mode(RotationMode p_rotation_mode) { - rotation_mode = p_rotation_mode; update_configuration_warning(); @@ -387,22 +362,18 @@ void PathFollow3D::set_rotation_mode(RotationMode p_rotation_mode) { } PathFollow3D::RotationMode PathFollow3D::get_rotation_mode() const { - return rotation_mode; } void PathFollow3D::set_loop(bool p_loop) { - loop = p_loop; } bool PathFollow3D::has_loop() const { - return loop; } PathFollow3D::PathFollow3D() { - offset = 0; delta_offset = 0; h_offset = 0; |