HISE Logo Forum
    • Categories
    • Register
    • Login

    Plugin doesn't respect UI Zoom Factor onInit

    Scheduled Pinned Locked Moved Scripting
    25 Posts 6 Posters 873 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      ccbl
      last edited by ccbl

      Hey folks, so I've set up a few zoom levels that are controlled by button on a radio group. The default button engaged is 50%. But I found that when I loaded my plugin it actually defaulted to 100% UI scale. So I added a raw UI setting but that doesn't seem to work either. Any pointers?

      I even tried setting non of the buttons to 1 on init, that had the interesting result of the first time the 50% button is pressed, nothing happened, but then after that the buttons all worked as expected.

      Content.makeFrontInterface(1200, 900);
      
      Engine.loadAudioFilesIntoPool();
      Settings.setZoomLevel(0.5);
      
      const var Fifty = Content.getComponent("Fifty");
      const var Sevfive = Content.getComponent("Sevfive");
      const var Hundred = Content.getComponent("Hundred");
      
      /* This controls the zoom level of the plugin. By default it's set to 50% for people on smaller screens */
      inline function onFiftyControl(component, value)
      {
      	Settings.setZoomLevel(0.5);
      };
      Content.getComponent("Fifty").setControlCallback(onFiftyControl);
      
      inline function onSevfiveControl(component, value)
      {
      	Settings.setZoomLevel(0.75);
      };
      Content.getComponent("Sevfive").setControlCallback(onSevfiveControl);
      
      inline function onHundredControl(component, value)
      {
      	Settings.setZoomLevel(1.0);
      };
      Content.getComponent("Hundred").setControlCallback(onHundredControl);
      
      d.healeyD 1 Reply Last reply Reply Quote 0
      • d.healeyD
        d.healey @ccbl
        last edited by

        @ccbl Have you set the buttons to save in preset?

        Libre Wave - Freedom respecting instruments and effects
        My Patreon - HISE tutorials
        YouTube Channel - Public HISE tutorials

        C 1 Reply Last reply Reply Quote 0
        • C
          ccbl @d.healey
          last edited by

          @d-healey Save in Preset is enabled yeah

          d.healeyD 1 Reply Last reply Reply Quote 0
          • d.healeyD
            d.healey @ccbl
            last edited by d.healey

            @ccbl Which button did you have enabled when you exported your plugin (or in the default preset if you're using one)?

            You can also condense your code quite a bit.

            const buttons = Content.getAllComponents("Button\\d"); // This assumes all your buttons are called "Button" - give them a sensible name of course.
            
            for (x in buttons)
                x.setControlCallback(onButtonControl);
            	
            inline function onButtonControl(component, value)
            {
                local index = buttons.indexOf(component);
                local values = [0.5, 0.75, 1.0];
            
                Settings.setZoomLevel(values[index]);
            }
            

            Libre Wave - Freedom respecting instruments and effects
            My Patreon - HISE tutorials
            YouTube Channel - Public HISE tutorials

            C MorphoiceM 2 Replies Last reply Reply Quote 0
            • C
              ccbl @d.healey
              last edited by

              @d-healey The 50% button is the default, and that is the one that is pressed upon export.

              d.healeyD 1 Reply Last reply Reply Quote 0
              • d.healeyD
                d.healey @ccbl
                last edited by

                @ccbl Does using Engine.setZoomLevel make a difference?

                Libre Wave - Freedom respecting instruments and effects
                My Patreon - HISE tutorials
                YouTube Channel - Public HISE tutorials

                C 1 Reply Last reply Reply Quote 0
                • C
                  ccbl @d.healey
                  last edited by

                  @d-healey I'll give it a try. I used

                  Settings.setZoomLevel(0.5)
                  

                  because the compiler said that

                  Engine.setZoomLevel
                  

                  was depreciated.

                  d.healeyD 1 Reply Last reply Reply Quote 0
                  • d.healeyD
                    d.healey @ccbl
                    last edited by

                    @ccbl ah case in that case it probably won't help

                    Libre Wave - Freedom respecting instruments and effects
                    My Patreon - HISE tutorials
                    YouTube Channel - Public HISE tutorials

                    C 1 Reply Last reply Reply Quote 0
                    • C
                      ccbl @d.healey
                      last edited by

                      @d-healey yeah it didn't make a difference. Do you think it could be the buttons being in a radio group that is messing things up? Or do you think that it's just the script doesn't read the state of the buttons until one of them is pressed for the first time?

                      Still a little puzzled why Settings.setZoomLevel(0.5); outside of the button callbacks doesn't correctly set the zoom level on init though.

                      oskarshO 1 Reply Last reply Reply Quote 0
                      • oskarshO
                        oskarsh @ccbl
                        last edited by

                        @ccbl when using toggle buttons make sure to always use if (value) {}

                        if (value) { Settings.setZoomLevel(0.75); }

                        in your case the callback fires for each button and executes the statement even if the button value is false but it should only set the value when its true.

                        that should do the trick.

                        breathing HISE

                        C 1 Reply Last reply Reply Quote 0
                        • C
                          ccbl @oskarsh
                          last edited by

                          @oskarsh how would that look in context?

                          inline function onFiftyControl(component, value)
                          {
                          	Settings.setZoomLevel(0.5);
                          };
                          Content.getComponent("Fifty").setControlCallback(onFiftyControl)
                          

                          Do you define the value as 1.0?

                          I really don't know coding very well.

                          d.healeyD LindonL 2 Replies Last reply Reply Quote 0
                          • MorphoiceM
                            Morphoice @d.healey
                            last edited by Morphoice

                            @d-healey just out of interest, is there a way to detect the screen resolution by any chance? it would be a nice way to set a default zoom level accordingly so the user doesn't have to. e.g. I'm always having a hard time on a 5k monitor with plugins being microscopic and many manufacturers aren't even bothered to make the GUI sizable at all... those are the plugins I ususally don't buy because they are unusable for me. I have a ruptured retina and very poor eyesight so I'm naturally paying attention to usability and visibility a lot

                            https://instagram.com/morphoice - 80s inspired Synthwave Music, Arcade & Gameboy homebrew!

                            ustkU 1 Reply Last reply Reply Quote 0
                            • ustkU
                              ustk @Morphoice
                              last edited by ustk

                              @Morphoice Settings.getUserDesktopSize() might help you

                              Can't help pressing F5 in the forum...

                              1 Reply Last reply Reply Quote 0
                              • d.healeyD
                                d.healey @ccbl
                                last edited by

                                @ccbl Setting it in on init won't work because the button callbacks are triggered after on init so it will overwrite it.

                                Just as a test, what happens if you disable saveInPreset on all the buttons, except the one you want?

                                Libre Wave - Freedom respecting instruments and effects
                                My Patreon - HISE tutorials
                                YouTube Channel - Public HISE tutorials

                                MorphoiceM 1 Reply Last reply Reply Quote 0
                                • MorphoiceM
                                  Morphoice @d.healey
                                  last edited by

                                  @d-healey saving the gui size in a preset doesn't make much sense though, so disabling that shouldn't be a problem

                                  https://instagram.com/morphoice - 80s inspired Synthwave Music, Arcade & Gameboy homebrew!

                                  d.healeyD 1 Reply Last reply Reply Quote 0
                                  • d.healeyD
                                    d.healey @Morphoice
                                    last edited by

                                    @Morphoice said in Plugin doesn't respect UI Zoom Factor onInit:

                                    saving the gui size in a preset doesn't make much sense though, so disabling that shouldn't be a problem

                                    I'm just suggesting this as a test to figure out the source of the issue. But you don't want it to always open at 50% so we need to find a better solution after.

                                    Libre Wave - Freedom respecting instruments and effects
                                    My Patreon - HISE tutorials
                                    YouTube Channel - Public HISE tutorials

                                    ustkU 1 Reply Last reply Reply Quote 1
                                    • ustkU
                                      ustk @d.healey
                                      last edited by ustk

                                      @d-healey but the zoom level is always restored to the last state right? So why bother with all that? You just need to read what is the current zoom to reflect this to the right button, at least this is how I see it...

                                      Can't help pressing F5 in the forum...

                                      d.healeyD 1 Reply Last reply Reply Quote 0
                                      • d.healeyD
                                        d.healey @ustk
                                        last edited by

                                        @ustk said in Plugin doesn't respect UI Zoom Factor onInit:

                                        but the zoom level is always restored to the last state right?

                                        Only if you use the built in custom settings floating tile which saves it to the generalSettings.xml file.

                                        Libre Wave - Freedom respecting instruments and effects
                                        My Patreon - HISE tutorials
                                        YouTube Channel - Public HISE tutorials

                                        ustkU 1 Reply Last reply Reply Quote 0
                                        • ustkU
                                          ustk @d.healey
                                          last edited by ustk

                                          @d-healey Hmm... should be the same thing no? I thought it was always saved in the xml no matter where the call is coming from (when the plugin/standalone is closed)

                                          Can't help pressing F5 in the forum...

                                          d.healeyD 1 Reply Last reply Reply Quote 0
                                          • d.healeyD
                                            d.healey @ustk
                                            last edited by

                                            @ustk Yeah just tested and seems you are correct.

                                            Libre Wave - Freedom respecting instruments and effects
                                            My Patreon - HISE tutorials
                                            YouTube Channel - Public HISE tutorials

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            49

                                            Online

                                            1.7k

                                            Users

                                            11.7k

                                            Topics

                                            101.8k

                                            Posts