PDA

View Full Version : ctlrefresh() slowdowns



Alexx
03-19-2010, 05:19 PM
Hi,

Is it possible to reduce the ctlrefresh() "fire rate" when continously updating values from a slider ?
It makes my script hanging for nothing while quick sliding the control.
or maybe their is another solution ?

thanks

evenflcw
03-19-2010, 06:35 PM
Well you could try to use an iterator that is reset after n calls to the function and only then does it do full processing. But you'll probably need to do mouse processing to detect the mouse up so you can make sure all values are up to date once editing is over.

But you really shouldn't have to. What are you doing inside this ctlrefresh callback (and what other processes might it trigger)?

Alexx
03-20-2010, 05:04 AM
Well you could try to use an iterator that is reset after n calls to the function and only then does it do full processing. But you'll probably need to do mouse processing to detect the mouse up so you can make sure all values are up to date once editing is over.

I tried exactly this idea, but the mouseup event doesn't seems to work within a modeler script, so it was impossible to get the last value in the slider to be always applied to my mesh :(


But you really shouldn't have to. What are you doing inside this ctlrefresh callback (and what other processes might it trigger)?

I'm updating many points positions

[EDIT] : in fact the mouse functions seems to work, except on controls... if I click somewhere on an empty area of the panel, the reqmousedown or reqmouseup handler are executed, but nothing happend on an input... very useful... :(

evenflcw
03-20-2010, 11:23 AM
hmm...

I'd advice you to checkout MentalFish's Polygon Island script. It can push alot of points in an interactive manner. Although slow it doesn't lock up, but I also don't think it does anything special, except avoid unnecessary (re)transformation when values haven't changed.

Alexx
03-20-2010, 01:38 PM
hmm...

I'd advice you to checkout MentalFish's Polygon Island script. It can push alot of points in an interactive manner. Although slow it doesn't lock up, but I also don't think it does anything special, except avoid unnecessary (re)transformation when values haven't changed.

well.... how to say.... :D I'm currently working with him on this script to update it and to have something even faster, that's why I'm searching a way to do this :D

For now, I do the update every 5th call from the slider, their is no more hang, but of course the displayed mesh doesn't alway match the displayed values.
If only I had a way to catch the mouseup event...

by the way, it seems to be possible to fake a slider with a Glyph (and then catch every mouse actions), but I can't find a damn working (and complete) sample code to display a glyph onto my script panel.

I would be grateful to get one ^^

evenflcw
03-20-2010, 03:54 PM
:-) It's a small world. And LW-world is even smaller.

Creating your own controls is indeed entirely possible by drawing directly onto the panel, in a ctlinfo() or ctlviewport() and do all the mouse processing yourself. I've done that. If NT fix a few things then lscripters could create their own libraries of controls that are as easy to use and setup as the native ones and share them (even compiled!). Even really complex ones and even compounds.

http://people.dsv.su.se/~dan-dulb/evenflow3d/wip/lscript_table_control.avi

evenflcw
03-20-2010, 04:43 PM
Sorry, I'm getting abit carried away as usual. I guess the idea is not to build an entirely new control but rather to use something like a ctldistance and then just stick a glyph or draw a minislider to the right of that and make believe there all one control but in reality when the user presses and drags on the glyph it issues setvalue on the control. Sounds possible. However there is one thing to look out for, reqmousemove will not continue offscreen, but stop at the edge of the screen. Perhaps not a big issue for this but a caveat.

Alexx
03-20-2010, 05:53 PM
Sorry, I'm getting abit carried away as usual. I guess the idea is not to build an entirely new control but rather to use something like a ctldistance and then just stick a glyph or draw a minislider to the right of that and make believe there all one control but in reality when the user presses and drags on the glyph it issues setvalue on the control. Sounds possible. However there is one thing to look out for, reqmousemove will not continue offscreen, but stop at the edge of the screen. Perhaps not a big issue for this but a caveat.

this is my idea, and reqmousetrack seems to do the job outside the panel instead of reqmousemove...
so now, I only need a good tutorial on how to make my glyph... any link to share ?

evenflcw
03-20-2010, 06:13 PM
I skipped the glyphs and just used regular draw functions, ie drawbox, drawline etc. LWs gui is so simple to draw and it's unlikely you'd notice any performance issues because your panel is so small. Ie you simply don't have enough space to draw LW to a crawl. If I could draw two spreadsheets (even the checkmarks are drawn using drawline) then you should have no problem drawing 10 faked minisliders.

PS: I think I tried glyphs but bumped into the fact that glyphs can't do transparency (no panel draw function can I think). Since glyphs are images you have to define a rectangular area for them, ie hardcode the color of their background. Using regular draw functions you don't have this problem. You only draw were you need to draw, and can draw layer upon layer with no problems.

Alexx
03-21-2010, 10:00 AM
ok,

anyway, glyph are working now, problem almost solved :)

so now, I've my displayed updated every 2nd call only
and when the mouse button is released

but how could I do to have it done when the mouse stops ? is their anyway to have some timeout functions ? or something like this ?