Commit 185075a8 authored by Lázár Bence Kis's avatar Lázár Bence Kis
Browse files

AnimationTrack cleaned up + random heap corruption discovered

parent 84a106fe
Loading
Loading
Loading
Loading
Compare a29ee6ba to 392e8edd
Original line number Diff line number Diff line
Subproject commit a29ee6ba23857cd8fab4cefb7db3b1f92b75eb08
Subproject commit 392e8edd6f35b6fcd8e41b6f905e22589015206d
+8 −2
Original line number Diff line number Diff line
@@ -119,7 +119,7 @@ void renderAnimationTrackCurve(const anim::AnimationTrack* animation, const vec3
        double t = keyframes.front().time() + 
                    (i / (numSamples - 1.0)) * (keyframes.back().time() - keyframes.front().time());
        times.push_back(t);
        values.push_back(animation->evaluate_scalar(t));
        values.push_back(std::get<scalar>(animation->get_value(t)));
    }
    
    ImPlot::PlotLine("##curve", times.data(), values.data(), numSamples);
@@ -270,6 +270,11 @@ void render() {
        blended->blend(anim::animation_system()->find_animation((blend_button) ? "wave.anim" : "leg.anim"), 0.5f);
    }

    ImGui::SameLine();
    if (ImGui::Button("Jump")) {
        edited_track->set_keyframe_time(segment, 3.f);
    }
    
    ImGui::PushItemWidth(100);
    ImGui::Combo("##player", &edited_player_index, label_to_cstr, &player_labels, static_cast<int>(player_labels.size())); ImGui::SameLine();
    ImGui::PopItemWidth();
@@ -350,9 +355,10 @@ void render() {
            std::get<scalar>(selectedKeyframe.value()),
            std::move(anim::create_default_interpolator(interpolationType))
        );
        /// TODO: heap corruption when switching between constant/linear and ease
        
        // Replace old keyframe with new one
        edited_track->update_keyframe(segment, std::move(newKeyframe));
        edited_track->update_keyframe(segment, newKeyframe);

        prevInterpolationIdx = interpolationIdx;
    }