Closed Zalunda closed 2 years ago
This one is rather annoying to implement.
However I do think it would be useful for OFS to detect if it's idling and lower the framerate & CPU usage during idle. For the environment 🌳🐦
So if I get around doing that I may add time tracking.
I added an idle mode so I guess I have to look into adding this 🙃
Nice. Soon, I might know for sure that I spend way too much time making scripts. 😁
I added a very simple implementation of this. It's just a float stored in the project which counts the seconds. It's displayed in the "Project->Configure" window (formatted HH:MM:SS including milliseconds 😂). So while "IdleMode" isn't active the timer keeps incrementing.
Some things to consider are that the "IdleMode" timer is set to be fairly aggressive. It kicks in after only 3 seconds of inactivity which means u need an APM (actions per minute) of 20 to keep the 'Time spent' timer going.
All of these events are waking OFS from idle mode and would count as 'actions'. https://github.com/OpenFunscripter/OFS/blob/ce9e0d5f0932bcf975687a97872df228e8f15499/src/OpenFunscripter.cpp#L1592-L1607
Idle mode doesn't activate during video playback even if the user is doing nothing, so if you're playing the video in a loop but are not doing anything the 'Time spent' timer will still increase.
Despite these minor issues I hope this implementation does suffice.
And another thing the timer gets saved with the project so not saving looses the time spent.
From what I understand, the only thing that wouldn't be counted is when I spend time in "Funscript Generator". In that case, I think OFS will go idle, which is good because it should allow Funscript Generator to use more CPU/GPU resources.
For me, that's great. It doesn't need to be perfect, it's just to give me an idea.
FYI, I cloned, compiled, and tested from the master branch.
From my limited tests, it seems to work well (idle & time spent).
From what I understand, the only thing that wouldn't be counted is when I spend time in "Funscript Generator"
Yes that is correct. I actually haven't tested that yet. Idle mode does affect Lua extensions by slowing the update rate to 10 ticks per second globally. But the process that is spawned by the extension should be unaffected.
Could OFS calculate and show the time spent on a project?
It would need to detect if the user is really doing something because I often leave OFS in the background for hours and I wouldn't want that time to be counted.
I must admit that I hesitated before asking for this feature because I'm not certain that I really want to know... ;)