Added more options to control the Custom Curve#103
Conversation
02e4d34 to
1394ec3
Compare
|
I'm sorry, I'm converting this into a draft, I did review the code and did more testing and it still needs work. |
95427e0 to
cce14dd
Compare
cce14dd to
ccd51f9
Compare
|
I did quite a bit of testing, I hope I haven't forget a thing. I think it is now ready for review. |
ccd51f9 to
1e8ef3b
Compare
|
Hey, I did not forget. I'll take a look at the changes next month. Thanks for your work! |
|
|
||
| ImPlot::GetPlotDrawList()->AddLine(p1, pc1, ImColor(0.7, 0.1f, 0.8, 0.8)); | ||
| ImPlot::GetPlotDrawList()->AddLine(p2, pc2, ImColor(0.7, 0.1f, 0.8, 0.8)); | ||
| // we will only |
There was a problem hiding this comment.
Yep, I was about to comment about something and I forgot, I should remove that or take a third look, yes 😅
There was a problem hiding this comment.
I did push with I think is a better comment 😅 , sorry for that
| if ((idx % 8 == 0) || (idx % 8 == 2) || (idx % 8 == 5)) | ||
| p_x = p; | ||
| else { | ||
| else if ((idx % 8 == 1) || (idx % 8 == 3) || (idx % 8 == 6)) { | ||
| p_y = p; | ||
| if (idx % 6 == 1) { | ||
| if (idx % 8 == 1) { | ||
| points.emplace_back(p_x, p_y); | ||
| } | ||
| else { | ||
| if (idx % 6 == 3) | ||
| control_points.emplace_back(); | ||
| auto j = idx % 6 - 2; | ||
| control_points.back()[j / 2] = {p_x, p_y}; | ||
| } | ||
| else if ((idx % 8 == 4) || (idx % 8 == 7)) { | ||
| if (idx % 8 == 4) { | ||
| control_points.emplace_back(); | ||
| } | ||
| auto j = (idx % 8) % 2; | ||
| control_points.back()[j] = {p_x, p_y, (bool)p}; |
There was a problem hiding this comment.
Is there some sort of safety mechanism for scenarios where the user loads a config with the old formatting? We could have some kind of fallback that parses the old format as well. Or at least exits cleanly without loading any data that might otherwise be invalid. Technically backwards compatibility doesn't have to be maintained, as there are no releases yet.
There was a problem hiding this comment.
If the data is invalid, it just cleans the points and you end up with the default curve, take a look at:
catch (std::exception& exception) {
points.clear();
control_points.clear();
return false;
}
// 1 element is not enough for a linear interpolation, and n = 3(i - 2) + 4 (where i is the number of nodes), idx 2x because of x/y coordinate
if (idx <= 2 || idx % 8 - 2 != 0) {
points.clear();
control_points.clear();
return false;
}I also thought about that and because and after thinking, any solution felt like a way to make the code less elegant so I ended up preferring for the curve to go default if the collection doesn't make sense
|
Hey, I didn't have time to run the code yet, but I just looked through it and left some comments. About this:
It's a safety guard, meant to ensure the Bezier splines create a function in a mathematical sense |
I did some testing and control points seem to behave as it should with limits such a |
- Update `BezierCalc` and derivative helpers to switch between cubic, quadratic, and linear modes based on active control points. - Add UI checkboxes in the curve editor to enable/disable control points. - Update serialization (Export/Import) as now new. information is needed to keep track of the enabled/disabled control points - Corrected p_min and p_max. - Add the ability to align control points with points when using linear segments.
1e8ef3b to
1ef7ee0
Compare
Alright, sounds good! I'll try to run the code this week, and if everything goes well, I'll merge the change! |
|
I've tested the code, and it all works as expected. Although the Custom Curve GUI is getting more and more complex, right now, even I can barely tell what's where. So I'm gonna have to come up with some way to tidy it up. But that's beyond the scope of this PR, and I'm probably going to take care of the absolute mess in the code and the UI all at once, some time in the future. Thanks for the input! |
I should be the one thanking you, I'm very grateful that this project exists and that I'm able to contribute to it! It is being a pleasure to work with you and I hope to keep contributing! |
Greetings, I've been studying what people do with a mouse accel software called
Custom Curveand I wanted YeetMouse to have more of that functionality.I considered building on top of you approach and use the quadratic function present in the ImGui stack.
Better to show with a video:
Screencast.From.2026-05-18.20-35-50.mp4
Now you can more easily have curves like "precision" with this new functionality (yes, that profile is quite popular among 1 frame flickers).
I'm sorry for saying this but it seems that something in master broke the action of refreshing curve when one drags control points (I tested master without my changes and it doesn't work). The demo I made was made before I rebased the commit with the latest changes from master. (see issue #102)
Btw, why this limit?
#define CURVE_POINTS_MARGIN 0.2fwhy 0.2?Thank you a lot for your work. I love this driver.