Removed all commented out curve code.

This commit is contained in:
Relintai 2020-04-01 02:11:27 +02:00
parent 1fae51e51f
commit 44e7d2b63c
4 changed files with 1 additions and 74 deletions

View File

@ -179,20 +179,6 @@ void ProceduralAnimation::set_keyframe_transition(const int keyframe_index, cons
process_animation_data(); process_animation_data();
} }
/*
Ref<Curve> ProceduralAnimation::get_keyframe_in_curve(const int keyframe_index) const {
ERR_FAIL_COND_V(!_keyframes.has(keyframe_index), Ref<Curve>());
return _keyframes[keyframe_index]->in_curve;
}
void ProceduralAnimation::set_keyframe_in_curve(const int keyframe_index, const Ref<Curve> &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 { Vector2 ProceduralAnimation::get_keyframe_node_position(const int keyframe_index) const {
ERR_FAIL_COND_V(!_keyframes.has(keyframe_index), Vector2()); 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]; AnimationKeyFrame *frame = _keyframes[keyframe_index];
track_insert_key(i, target_keyframe_time, key_value, frame->transition); 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<Curve> in_curve = frame->in_curve;
float targ_step_val = (target_keyframe_time - previous_keyframe_time) / static_cast<float>(steps);
float step_val = 1.0 / static_cast<float>(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(); optimize();
@ -390,9 +358,6 @@ bool ProceduralAnimation::_set(const StringName &p_name, const Variant &p_value)
keyframe->transition = p_value; keyframe->transition = p_value;
return true; return true;
//} else if (keyframe_name == "in_curve") {
// keyframe->in_curve = p_value;
// return true;
} else if (keyframe_name == "position") { } else if (keyframe_name == "position") {
keyframe->position = p_value; keyframe->position = p_value;
@ -440,10 +405,6 @@ bool ProceduralAnimation::_get(const StringName &p_name, Variant &r_ret) const {
r_ret = keyframe->transition; r_ret = keyframe->transition;
return true; return true;
//} else if (keyframe_prop_name == "in_curve") {
// r_ret = keyframe->in_curve;
// return true;
} else if (keyframe_prop_name == "position") { } else if (keyframe_prop_name == "position") {
r_ret = keyframe->position; r_ret = keyframe->position;
@ -469,7 +430,6 @@ void ProceduralAnimation::_get_property_list(List<PropertyInfo> *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::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()) + "/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::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::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)); p_list->push_back(PropertyInfo(Variant::VECTOR2, "keyframe/" + itos(K->key()) + "/position", PROPERTY_HINT_NONE, "", property_usange));
} }

View File

@ -41,7 +41,6 @@ protected:
String name; String name;
int animation_keyframe_index; int animation_keyframe_index;
int next_keyframe; int next_keyframe;
//Ref<Curve> in_curve;
Vector2 position; Vector2 position;
float transition; float transition;
@ -49,11 +48,9 @@ protected:
animation_keyframe_index = 0; animation_keyframe_index = 0;
transition = 1.0; transition = 1.0;
next_keyframe = -1; next_keyframe = -1;
//in_curve.instance();
} }
~AnimationKeyFrame() { ~AnimationKeyFrame() {
//in_curve.unref();
} }
}; };
@ -93,9 +90,6 @@ public:
float get_keyframe_transition(const int keyframe_index) const; float get_keyframe_transition(const int keyframe_index) const;
void set_keyframe_transition(const int keyframe_index, const float value); void set_keyframe_transition(const int keyframe_index, const float value);
//Ref<Curve> get_keyframe_in_curve(const int keyframe_index) const;
//void set_keyframe_in_curve(const int keyframe_index, const Ref<Curve> &value);
Vector2 get_keyframe_node_position(const int keyframe_index) const; Vector2 get_keyframe_node_position(const int keyframe_index) const;
void set_keyframe_node_position(const int keyframe_index, const Vector2 &value); void set_keyframe_node_position(const int keyframe_index, const Vector2 &value);

View File

@ -324,27 +324,6 @@ void ProceduralAnimationEditorGraphNode::set_transition(const float value) {
changed(); changed();
} }
/*
Ref<Curve> ProceduralAnimationEditorGraphNode::get_in_curve() const {
return _in_curve;
}
void ProceduralAnimationEditorGraphNode::set_in_curve(const Ref<Curve> &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<ProceduralAnimation> ProceduralAnimationEditorGraphNode::get_animation() { Ref<ProceduralAnimation> ProceduralAnimationEditorGraphNode::get_animation() {
return _animation; return _animation;
} }
@ -358,7 +337,6 @@ void ProceduralAnimationEditorGraphNode::set_animation(const Ref<ProceduralAnima
set_keyframe_name(animation->get_keyframe_name(_id)); set_keyframe_name(animation->get_keyframe_name(_id));
set_next_keyframe(animation->get_keyframe_next_keyframe_index(_id)); set_next_keyframe(animation->get_keyframe_next_keyframe_index(_id));
set_transition(animation->get_keyframe_transition(_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)); set_animation_keyframe_index(animation->get_keyframe_animation_keyframe_index(_id));
_animation = animation; _animation = animation;
@ -392,7 +370,7 @@ ProceduralAnimationEditorGraphNode::ProceduralAnimationEditorGraphNode() {
add_child(_animation_keyframe_spinbox); add_child(_animation_keyframe_spinbox);
Label *l3 = memnew(Label); Label *l3 = memnew(Label);
l3->set_text("In Curve"); l3->set_text("Easing");
add_child(l3); add_child(l3);
_curve_editor = memnew(CurveEditor); _curve_editor = memnew(CurveEditor);
@ -403,7 +381,6 @@ ProceduralAnimationEditorGraphNode::ProceduralAnimationEditorGraphNode() {
} }
ProceduralAnimationEditorGraphNode::~ProceduralAnimationEditorGraphNode() { ProceduralAnimationEditorGraphNode::~ProceduralAnimationEditorGraphNode() {
//_in_curve.unref();
} }
void ProceduralAnimationEditorGraphNode::on_animation_keyframe_spinbox_value_changed(float value) { void ProceduralAnimationEditorGraphNode::on_animation_keyframe_spinbox_value_changed(float value) {

View File

@ -97,9 +97,6 @@ public:
int get_next_keyframe() const; int get_next_keyframe() const;
void set_next_keyframe(const int value); void set_next_keyframe(const int value);
//Ref<Curve> get_in_curve() const;
//void set_in_curve(const Ref<Curve> &value);
float get_transition() const; float get_transition() const;
void set_transition(const float value); void set_transition(const float value);
@ -126,7 +123,6 @@ private:
int _animation_keyframe_index; int _animation_keyframe_index;
int _next_keyframe; int _next_keyframe;
CurveEditor *_curve_editor; CurveEditor *_curve_editor;
//Ref<Curve> _in_curve;
float _transition; float _transition;
Ref<ProceduralAnimation> _animation; Ref<ProceduralAnimation> _animation;