don't run if panel is loading

Home Forums General Programming don't run if panel is loading

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #24614
    msepsis
    Participant
      • Topics: 219
      • Replies: 732
      • Total: 951
      • ★★★

      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

      #24615
      zeoka
      Participant
        • Topics: 73
        • Replies: 466
        • Total: 539
        • ★★★

        Hi

        if mod:getComponent():getChildComponent(normally 0 for a uiButton):isMouseButtonDown then ….

        You tried this ?

        #24623
        msepsis
        Participant
          • Topics: 219
          • Replies: 732
          • Total: 951
          • ★★★

          Ok. 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

          #24643
          zeoka
          Participant
            • Topics: 73
            • Replies: 466
            • Total: 539
            • ★★★

            You 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 uiButtonRepeat

            I had at first same startup issue…

            Attachments:
            You must be logged in to view attached files.
            #24667
            msepsis
            Participant
              • Topics: 219
              • Replies: 732
              • Total: 951
              • ★★★

              The 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

              #25415
              msepsis
              Participant
                • Topics: 219
                • Replies: 732
                • Total: 951
                • ★★★

                so 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

                #25418
                dasfaker
                Keymaster
                  • Topics: 80
                  • Replies: 793
                  • Total: 873
                  • ★★★

                  The “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.

                  #25618
                  msepsis
                  Participant
                    • Topics: 219
                    • Replies: 732
                    • Total: 951
                    • ★★★

                    The “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

                    #25623
                    dasfaker
                    Keymaster
                      • Topics: 80
                      • Replies: 793
                      • Total: 873
                      • ★★★

                      Yea, I managed to find out that the method is in fact executed.

                    Viewing 9 posts - 1 through 9 (of 9 total)
                    • The forum ‘Programming’ is closed to new topics and replies.
                    There is currently 0 users and 72 guests online
                    No users are currently active
                    Forum Statistics
                    Threads: 2,495, Posts: 17,374, Members: 77,605
                    Most users ever online was 12 on January 22, 2019 3:47 pm
                    Ctrlr