Loading age @ a29ee6ba Compare 3861087a to a29ee6ba Original line number Diff line number Diff line Subproject commit 3861087a9ee209f781faac1d2d01ced26691acff Subproject commit a29ee6ba23857cd8fab4cefb7db3b1f92b75eb08 src/maker/src/gui.cpp +13 −5 Original line number Diff line number Diff line Loading @@ -46,10 +46,9 @@ void process_event(const SDL_Event *event) { ImGui_ImplSDL2_ProcessEvent(event); } void renderAnimationTrackCurve(const anim::AnimationTrack* animation, ImPlotDragToolFlags flags) { void renderAnimationTrackCurve(const anim::AnimationTrack* animation, const vec3& track_color, ImPlotDragToolFlags flags) { const auto& keyframes = animation->keyframes(); const vec3& trackColor = animation->color(); ImVec4 plotColor(trackColor.x, trackColor.y, trackColor.z, 1); ImVec4 plotColor(track_color.x, track_color.y, track_color.z, 1); if (keyframes.empty() || !keyframes.front().holds_type<scalar>()) return; Loading Loading @@ -353,7 +352,7 @@ void render() { ); // Replace old keyframe with new one edited_track->update_keyframe(segment, anim::Keyframe(std::move(newKeyframe))); edited_track->update_keyframe(segment, std::move(newKeyframe)); prevInterpolationIdx = interpolationIdx; } Loading @@ -364,9 +363,18 @@ void render() { ImPlot::SetupAxes(nullptr, nullptr, ax_flags, ax_flags); ImPlot::SetupAxesLimits(0, edited_animation->length(), -5, 5); int color_index = 0; for (auto link : edited_animation->links()) { if (auto at = dynamic_cast<anim::AnimationTrack*>(link)) { renderAnimationTrackCurve(at, flags); const static std::array<vec3, 4> colors = { vec3{0.9, 0, 0}, vec3{0, 0.9, 0}, vec3{0, 0, 0.9}, vec3{0.8, 0.4, 0} }; renderAnimationTrackCurve(at, colors[color_index % colors.size()], flags); color_index++; } } // renderAnimationTrackCurve(animfold->locate<anim::AnimationTrack>({""}), ImVec4(0.9f, 0.f, 0.f, 1.f), flags); Loading src/maker/src/presenter.cpp +11 −2 Original line number Diff line number Diff line Loading @@ -302,6 +302,16 @@ void main() { // shader->set_uniform("bones", ) auto test_anim = anim::animation_system()->insert_animation_with_player("test_anim"); test_anim->add_track( "cube_x", frame, "set_origin_x", anim::Keyframes{ {0, 0.f}, {1, 1.f}, {2, 0.f} } ); // test_anim->push_back<anim::AnimationTrack>( // "anim_X.anim", // "set_x", Loading Loading @@ -643,7 +653,6 @@ void main() { gfx::object_system()->insert_light(obj, ambient_light); } print_tree(com::Folder::root(), std::cout); } Loading Loading
age @ a29ee6ba Compare 3861087a to a29ee6ba Original line number Diff line number Diff line Subproject commit 3861087a9ee209f781faac1d2d01ced26691acff Subproject commit a29ee6ba23857cd8fab4cefb7db3b1f92b75eb08
src/maker/src/gui.cpp +13 −5 Original line number Diff line number Diff line Loading @@ -46,10 +46,9 @@ void process_event(const SDL_Event *event) { ImGui_ImplSDL2_ProcessEvent(event); } void renderAnimationTrackCurve(const anim::AnimationTrack* animation, ImPlotDragToolFlags flags) { void renderAnimationTrackCurve(const anim::AnimationTrack* animation, const vec3& track_color, ImPlotDragToolFlags flags) { const auto& keyframes = animation->keyframes(); const vec3& trackColor = animation->color(); ImVec4 plotColor(trackColor.x, trackColor.y, trackColor.z, 1); ImVec4 plotColor(track_color.x, track_color.y, track_color.z, 1); if (keyframes.empty() || !keyframes.front().holds_type<scalar>()) return; Loading Loading @@ -353,7 +352,7 @@ void render() { ); // Replace old keyframe with new one edited_track->update_keyframe(segment, anim::Keyframe(std::move(newKeyframe))); edited_track->update_keyframe(segment, std::move(newKeyframe)); prevInterpolationIdx = interpolationIdx; } Loading @@ -364,9 +363,18 @@ void render() { ImPlot::SetupAxes(nullptr, nullptr, ax_flags, ax_flags); ImPlot::SetupAxesLimits(0, edited_animation->length(), -5, 5); int color_index = 0; for (auto link : edited_animation->links()) { if (auto at = dynamic_cast<anim::AnimationTrack*>(link)) { renderAnimationTrackCurve(at, flags); const static std::array<vec3, 4> colors = { vec3{0.9, 0, 0}, vec3{0, 0.9, 0}, vec3{0, 0, 0.9}, vec3{0.8, 0.4, 0} }; renderAnimationTrackCurve(at, colors[color_index % colors.size()], flags); color_index++; } } // renderAnimationTrackCurve(animfold->locate<anim::AnimationTrack>({""}), ImVec4(0.9f, 0.f, 0.f, 1.f), flags); Loading
src/maker/src/presenter.cpp +11 −2 Original line number Diff line number Diff line Loading @@ -302,6 +302,16 @@ void main() { // shader->set_uniform("bones", ) auto test_anim = anim::animation_system()->insert_animation_with_player("test_anim"); test_anim->add_track( "cube_x", frame, "set_origin_x", anim::Keyframes{ {0, 0.f}, {1, 1.f}, {2, 0.f} } ); // test_anim->push_back<anim::AnimationTrack>( // "anim_X.anim", // "set_x", Loading Loading @@ -643,7 +653,6 @@ void main() { gfx::object_system()->insert_light(obj, ambient_light); } print_tree(com::Folder::root(), std::cout); } Loading