From 44e7d2b63cd2d29bf9c1eb419a95e3d01e88ad2c Mon Sep 17 00:00:00 2001 From: Relintai Date: Wed, 1 Apr 2020 02:11:27 +0200 Subject: [PATCH] Removed all commented out curve code. --- procedural_animation.cpp | 40 -------------------------- procedural_animation.h | 6 ---- procedural_animation_editor_plugin.cpp | 25 +--------------- procedural_animation_editor_plugin.h | 4 --- 4 files changed, 1 insertion(+), 74 deletions(-) diff --git a/procedural_animation.cpp b/procedural_animation.cpp index 2677d8e..7ee2ddc 100644 --- a/procedural_animation.cpp +++ b/procedural_animation.cpp @@ -179,20 +179,6 @@ void ProceduralAnimation::set_keyframe_transition(const int keyframe_index, cons process_animation_data(); } -/* -Ref ProceduralAnimation::get_keyframe_in_curve(const int keyframe_index) const { - ERR_FAIL_COND_V(!_keyframes.has(keyframe_index), Ref()); - - return _keyframes[keyframe_index]->in_curve; -} -void ProceduralAnimation::set_keyframe_in_curve(const int keyframe_index, const Ref &value) { - ERR_FAIL_COND(!_keyframes.has(keyframe_index)); - - _keyframes[keyframe_index]->in_curve = value; - - process_animation_data(); -}*/ - Vector2 ProceduralAnimation::get_keyframe_node_position(const int keyframe_index) const { ERR_FAIL_COND_V(!_keyframes.has(keyframe_index), Vector2()); @@ -313,24 +299,6 @@ void ProceduralAnimation::load_keyframe_data(const float target_keyframe_time, c AnimationKeyFrame *frame = _keyframes[keyframe_index]; track_insert_key(i, target_keyframe_time, key_value, frame->transition); - - /* - if (!frame->in_curve.is_valid()) { - track_insert_key(i, target_keyframe_time, key_value); - - continue; - } - - Ref in_curve = frame->in_curve; - - float targ_step_val = (target_keyframe_time - previous_keyframe_time) / static_cast(steps); - float step_val = 1.0 / static_cast(steps); - for (int j = 0; j < steps; ++j) { - float tr = in_curve->interpolate(j * step_val); - - track_insert_key(i, previous_keyframe_time + (j * targ_step_val), key_value, tr); - } - */ } optimize(); @@ -390,9 +358,6 @@ bool ProceduralAnimation::_set(const StringName &p_name, const Variant &p_value) keyframe->transition = p_value; return true; - //} else if (keyframe_name == "in_curve") { - // keyframe->in_curve = p_value; - // return true; } else if (keyframe_name == "position") { keyframe->position = p_value; @@ -440,10 +405,6 @@ bool ProceduralAnimation::_get(const StringName &p_name, Variant &r_ret) const { r_ret = keyframe->transition; return true; - //} else if (keyframe_prop_name == "in_curve") { - // r_ret = keyframe->in_curve; - - // return true; } else if (keyframe_prop_name == "position") { r_ret = keyframe->position; @@ -469,7 +430,6 @@ void ProceduralAnimation::_get_property_list(List *p_list) const { p_list->push_back(PropertyInfo(Variant::STRING, "keyframe/" + itos(K->key()) + "/name", PROPERTY_HINT_NONE, "", property_usange)); p_list->push_back(PropertyInfo(Variant::INT, "keyframe/" + itos(K->key()) + "/animation_keyframe_index", PROPERTY_HINT_NONE, "", property_usange)); p_list->push_back(PropertyInfo(Variant::INT, "keyframe/" + itos(K->key()) + "/next_keyframe", PROPERTY_HINT_NONE, "", property_usange)); - //p_list->push_back(PropertyInfo(Variant::OBJECT, "keyframe/" + itos(K->key()) + "/in_curve", PROPERTY_HINT_RESOURCE_TYPE, "Curve", property_usange)); p_list->push_back(PropertyInfo(Variant::REAL, "keyframe/" + itos(K->key()) + "/transition", PROPERTY_HINT_EXP_EASING, "", property_usange)); p_list->push_back(PropertyInfo(Variant::VECTOR2, "keyframe/" + itos(K->key()) + "/position", PROPERTY_HINT_NONE, "", property_usange)); } diff --git a/procedural_animation.h b/procedural_animation.h index 9395ba5..6aac942 100644 --- a/procedural_animation.h +++ b/procedural_animation.h @@ -41,7 +41,6 @@ protected: String name; int animation_keyframe_index; int next_keyframe; - //Ref in_curve; Vector2 position; float transition; @@ -49,11 +48,9 @@ protected: animation_keyframe_index = 0; transition = 1.0; next_keyframe = -1; - //in_curve.instance(); } ~AnimationKeyFrame() { - //in_curve.unref(); } }; @@ -93,9 +90,6 @@ public: float get_keyframe_transition(const int keyframe_index) const; void set_keyframe_transition(const int keyframe_index, const float value); - //Ref get_keyframe_in_curve(const int keyframe_index) const; - //void set_keyframe_in_curve(const int keyframe_index, const Ref &value); - Vector2 get_keyframe_node_position(const int keyframe_index) const; void set_keyframe_node_position(const int keyframe_index, const Vector2 &value); diff --git a/procedural_animation_editor_plugin.cpp b/procedural_animation_editor_plugin.cpp index 0fb251b..3f1b7ab 100644 --- a/procedural_animation_editor_plugin.cpp +++ b/procedural_animation_editor_plugin.cpp @@ -324,27 +324,6 @@ void ProceduralAnimationEditorGraphNode::set_transition(const float value) { changed(); } -/* -Ref ProceduralAnimationEditorGraphNode::get_in_curve() const { - return _in_curve; -} -void ProceduralAnimationEditorGraphNode::set_in_curve(const Ref &value) { - if (_in_curve.is_valid()) { - _in_curve->disconnect(CoreStringNames::get_singleton()->changed, this, "changed"); - } - - _in_curve = value; - _curve_editor->set_curve(value); - _in_curve->connect(CoreStringNames::get_singleton()->changed, this, "changed"); - - if (!_animation.is_valid()) - return; - - _animation->set_keyframe_in_curve(_id, _in_curve); - - changed(); -}*/ - Ref ProceduralAnimationEditorGraphNode::get_animation() { return _animation; } @@ -358,7 +337,6 @@ void ProceduralAnimationEditorGraphNode::set_animation(const Refget_keyframe_name(_id)); set_next_keyframe(animation->get_keyframe_next_keyframe_index(_id)); set_transition(animation->get_keyframe_transition(_id)); - //set_in_curve(animation->get_keyframe_in_curve(_id)); set_animation_keyframe_index(animation->get_keyframe_animation_keyframe_index(_id)); _animation = animation; @@ -392,7 +370,7 @@ ProceduralAnimationEditorGraphNode::ProceduralAnimationEditorGraphNode() { add_child(_animation_keyframe_spinbox); Label *l3 = memnew(Label); - l3->set_text("In Curve"); + l3->set_text("Easing"); add_child(l3); _curve_editor = memnew(CurveEditor); @@ -403,7 +381,6 @@ ProceduralAnimationEditorGraphNode::ProceduralAnimationEditorGraphNode() { } ProceduralAnimationEditorGraphNode::~ProceduralAnimationEditorGraphNode() { - //_in_curve.unref(); } void ProceduralAnimationEditorGraphNode::on_animation_keyframe_spinbox_value_changed(float value) { diff --git a/procedural_animation_editor_plugin.h b/procedural_animation_editor_plugin.h index 14460d5..a4917e4 100644 --- a/procedural_animation_editor_plugin.h +++ b/procedural_animation_editor_plugin.h @@ -97,9 +97,6 @@ public: int get_next_keyframe() const; void set_next_keyframe(const int value); - //Ref get_in_curve() const; - //void set_in_curve(const Ref &value); - float get_transition() const; void set_transition(const float value); @@ -126,7 +123,6 @@ private: int _animation_keyframe_index; int _next_keyframe; CurveEditor *_curve_editor; - //Ref _in_curve; float _transition; Ref _animation;