@cuinjune hello, i expanded the vslider with a jump on click argument, there you can toggle between jump on click and continuous.
vslider2.pd for the others: if you want to use this slider/abstraction you need to put it into the folder ofelia/examples/gui/pdgui
-
Ofelia Jump On Click Slider
-
and here is a multislider that i build together with @ingox, based on the slider from the ofelia guiexamples. there is a little problem with the start position, but everything else works nice so far: multislider.pd multislider-demo.pd
-
@Jona Hey, really nice work!
One small thing I found is that you don't need to use [ofGetTranslate] in vslider2.pd because it is already used inside "_argParse5.pd" abstraction and the resulting value are assigned to the variable @xpos and @ypos.So all you need to do is replace "$i2" with @ypos.
Here's the patch which I applied the fix. vslider2.pdAnd the multislider looks nice as well. One small thing I notice is it loads font internally which is not a problem in a small patch but I think it would be better to pass the font name as an argument so GUIs can reuse the loaded font.
You can take a look at "pdgui/numbox.pd" to see how font name can be passed as an argument.
Anyways, thanks for sharing your work. -
@cuinjune thanks. now you can pass the font as an argument. and use the pdgui.public.properties for the multislider too. i have 2 questions: why do i need to set the background color for the second multislider again? Did I patch something wrong with push and popStyle? And is it possible to "interpolate" the mouse movement, so that every slider position changes, also if the mouse movement is very fast and the sliders very thin(like in the left example)? If I understand it right, the slider updates every frame at the moment and if the mouse position passes more than one slider per frame, only one of the slider gets updated (so i could increase the framerate for a better response).
pdguiExampleMslider.pd
multislider.pd
-
@Jona Hey, I see what is causing the problem.
Currently ofelia is polling events every frame so it is causing the skip.
You won't have the problem when you run it as a standalone though.Please give me a day or two. I will quickly fix this and let you know.
Thank you for your finding. -
there is no rush, very nice to hear that there is a solution at all. its kind of fun to build gui elements with ofelia compared to data structures, because its much more flexible and efficient
-
and here is a small oscilloscope
oscilloscope.pd
-
@Jona Nice work! Here's a simplified oscilloscope.pd
You can use [ofLoadPolyline2d] when you simply render lines.
And you can initialize the loader's array size by sending "insert" message. (see the help file)And here's a simplified vslider2.pd and multislider.pd
I changed [ofLoadMesh2d] to [ofLoadVec2f] in multislider patch because it didn't directly draw mesh anyway.
I hope this helps.
-
@cuinjune thats nice, thanks. insert is a nice way for initializing arrays. ofLoadPolyline seems to make the patches not much faster, but still a little, and good to learn about the different properties. also the jump on click mechanism is much simpler the way you solved it. i combined it with the (optional) mode argument. and in multislider i use ofSeparate now to seperate numbers and elements, this way i can bring the numbers into the foreground.
multislider.pd
vslider2.pd -
@cuinjune hi. i tested the gui as a standalone app because you wrote that wont skip mouse movement. but i experience some strange behaviour: at the very top of the window i can scroll the orange hslider and in the upper left corner i can control both multisliders at once, everything else doesnt react (with windows 10/ 64bit). also the font disappears (i put the path like i did with the lissa patch textures where it works). while opening the patch with pure data everything works as expected.
-
@Jona Hey I just learned that the problem still exist even on standalone apps.
I just tested with an empty openFrameworks example(without ofelia) and I could check the mouse listener listens to the movement of the mouse "every frame". I've always thought the event listeners work independently from the drawing callback but maybe I was wrong.
I'll leave a question about this on the OF forum to see if there's any way to separate the event polling from the drawing. I will let you know as soon as I find the solution.
I just tried with the standalone version on macOS and it worked fine except for the skipping behavior just like on external.
Make sure you load font from the correct path. I had to correct "../data/font" to "data/font" because "main.pd" and "data" folder are in the same directory. Also, check if you actually have the fonts in the "data" folder otherwise the [ofLoadFont] object won't create.
If the GUI still doesn't work properly, please let me know. Or you can upload your standalone app file if possible. Thanks!
-
@cuinjune i did everything like you described above, but perhaps i miss something else? here is the standalone app: https://we.tl/RnYgP7bBwx
-
@Jona I think you compiled it using the previous version before v1.0.6 update.
[ofGetTranslate] is newly added on v1.0.6 update so the GUI abstractions won't work properly on the previous versions.
Your file didn't work properly but when I compiled again using the same "data" and "main.pd", it worked.Here's an archive. bin.7z password is 1234
-
@cuinjune thanks a lot. that was exactly my error. everything works fine now
-
@Jona Since you asked how to get the previous mouse position, I created a patch that shows how to do this. getPrevMousePos.pd
Of course, I could implement them as global getters (e.g. [ofGetMousePreviousX]) later at some point but I personally don't think they are really needed for now.
-
@cuinjune thanks, thats great. basically the same functionality as ofGetMousePreviousX/Y. i will implement it when i am at home. now the multislider should work like i wanted it to.
-
@Jona I quickly tried to implement the mouse interpolation in your multislider patch.
Here's the patch. multislider.pdYou will notice I added "@mouseX = $i1;" in [ofDefine] below [ofTouchListener] and I also added a subpatch called "pd interpolate".
Although it seems to work fine, it currently interpolates the value hundred times at once using [ofCountUntil 0 99]. I think there should be a solution to calculate the minimum step needed to interpolate the value. (according to @width maybe?) If this fix is applied, it would be more efficient.
-
@cuinjune nice ways/concept of using value, expression and send/receive in general. i already learned a lot from your patches i will think about how to implement the minimum step solution, thanks for the hints.
-
@Jona I just tried getting the minimum step. multislider.pd
Although this seems to work, I'm not 100% sure if the algorithm is correct.
It could at least be faster than the previous one I think. -
@cuinjune thats very nice, thanks for your work now it also interpolates on the y axis. i am really satisfied with the result
multislider.pd
pdguiExampleMslider.pd -
@Jona Wow, I didn't know interpolation on the y axis was also needed but now it seems to work much more accurately. Thank you for your work. I think it will be very useful.