Home › Forums › General › Programming › don't run if panel is loading
- This topic has 8 replies, 3 voices, and was last updated 9 years, 10 months ago by dasfaker.
-
AuthorPosts
-
June 11, 2014 at 10:08 pm #24614
I know there was a thread about this but I can’t seem to find it.
I have an editor panel that has buttons to save and load data to a file. When I open the exported instance the scripts fire for the buttons while the panel is loading. What is the code I put into the scripts for the save/load buttons that says “Do not run this script if the panel is loading” I only want the scripts to run when the button is pressed – NOT when the panel is loading. It causes all sorts of confusion.
Thank you
Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen
June 11, 2014 at 10:20 pm #24615Hi
if mod:getComponent():getChildComponent(normally 0 for a uiButton):isMouseButtonDown then ….
You tried this ?
June 12, 2014 at 2:03 am #24623Ok. your line was missing the function arguments… i suspect you meant:
if mod:getComponent():getChildComponent(0):isMouseButtonDown() --stuff to do end
This just prevents anything within the if statement from running period, even when the button is clicked/pressed/true/on. I’m mainly using 1590 but also tried that in the latest mac rev.
- This reply was modified 9 years, 10 months ago by msepsis.
Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen
June 12, 2014 at 10:58 am #24643You mean that’not working ?
I use latest ctrlr pc
I’ve done this on uiImageButton-- -- Called when a modulator value changes -- @mod http://ctrlr.org/api/class_ctrlr_modulator.html -- @value new numeric value of the modulator -- BankD = function(mod, newValue) md5 = mod:getComponent():getChildComponent(0) stab = panel:getModulatorByName("TabValue"):getModulatorValue() part = panel:getModulatorByName("PartSelect"):getModulatorValue() + 1 spaint = panel:getModulatorByName(string.format("PartSamplNb-%s",part )) dnsnd = (spaint:getModulatorValue()) - 128 if stab == 2 then if md5:isMouseButtonDown() then if dnsnd >= 0 then spaint:setModulatorValue(dnsnd,false,true,false) end end end end
-- -- Called when a modulator value changes -- @mod http://ctrlr.org/api/class_ctrlr_modulator.html -- @value new numeric value of the modulator -- BankU = function(mod, newValue) md6 = mod:getComponent():getChildComponent(0) stab = panel:getModulatorByName("TabValue"):getModulatorValue() part = panel:getModulatorByName("PartSelect"):getModulatorValue() + 1 spaint = panel:getModulatorByName(string.format("PartSamplNb-%s",part )) upsnd = (spaint:getModulatorValue()) + 128 if stab == 2 then if md6:isMouseButtonDown() then if upsnd <= 1023 then spaint:setModulatorValue(upsnd,false,true,false) end end end end
In pc this works with all versions
somethimes the compchild is not 0 and that’s hell
Ex:inc/dec buttons mode changes the index or add one and can’t find the good index
even tried to look into the ccp
that’s why I replaced the slider by 2 image buttons
to replace inc/dec button function I use uiButtonRepeatI had at first same startup issue…
Attachments:
You must be logged in to view attached files.June 13, 2014 at 12:35 am #24667The exact code I gave prevents anything within the if statement from running when the button the script is attached to is pressed on any mac version I’ve tried since 1590.
I’ll check it out on a pc when I’m around a PC. Thanks zeoka.
Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen
June 29, 2014 at 10:58 am #25415so the suggestion didn’t work cross-platform so what I did was a bit more complex but worked, at least for my purpose within an exported instance.
I have a simple button (panelLoading) off canvas that’s turned off then a timercallback thats triggered from the “called when panel is loading” script which sets the value to 1 after a few ms.
Then the scripts on the “modulators” that for some reason like to fire off on panel load start off like:
if panelLoading == 0 then elseif panelLoading == 1 then if panel:getBootstrapState() then return end --then the actual stuff the button does end
This resolved my problem on mac, pc and linux in both VST instances and standalone instances. I know there is a method that is supposed to do this (check if the panel is loading) but for some dumb reason (me?) it never worked for me across the board.
Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen
June 29, 2014 at 12:50 pm #25418The “called when the panel has finished loading” script is not being called in exported instances (at least on Win), this has been discussed several times and it’s and old issue, it has never worked for me.
You can click the option “Log everything to file” in Ctrlr settings and load an exported instance, you’ll see in the log file that this script is not executed, a big problem as we use it to setup the panel once is loaded.
July 3, 2014 at 10:49 pm #25618The “called when the panel has finished loading” script is not being called in exported instances (at least on Win), this has been discussed several times and it’s and old issue, it has never worked for me.
I dont know what to say – 1590 triggers the timer and then callback which is initiated from the script I have on “called when the panel has finished loading” – working on both windows and mac exported stand-alone AND VST instances. If that didn’t work I would have not posted how I worked to resolve the issue I was originally posting about here. I tested this until (more of) my hair turned grey. Even the users who had reported the issue have reported it is now resolved in VST instances on Windows.
It seems what’s more accurate to say is that some things work within “called when the panel has finished loading” script – some things do not. The timer I put there does work or my workaround would not and I would be getting flooded with complaints from people using the VST on windows – as that was the only place the issue manifested.
I hope these details help you with the other issue you’re reporting regarding vst instances etc.
Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen
July 4, 2014 at 12:12 am #25623Yea, I managed to find out that the method is in fact executed.
-
AuthorPosts
- The forum ‘Programming’ is closed to new topics and replies.