HISE Logo Forum
    • Categories
    • Register
    • Login

    Save Panel Data to Preset

    Scheduled Pinned Locked Moved Solved Scripting
    3 Posts 2 Posters 136 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.
    • HISEnbergH
      HISEnberg
      last edited by HISEnberg

      I am reordering my panel positions. Currently I am just passing my panel data into the panel value so that I can restore the data, but it seems like a pretty restricted workaround. Is there a better way to do this?

      In this particular situation it is fine, I am just trying to reorder my panels based on the index they are saved into (so its a 1-to-1 match). However, if I wanted to store more panel data and load that with the preset, how would I go about this? Is there a way to attach a list like JSON data which can be recalled?

      Content.makeFrontInterface(400, 300);
      
      const var panels = [
          Content.getComponent("Panel1"),
          Content.getComponent("Panel2"),
          Content.getComponent("Panel3")
      ];
      
      const var panelWidth = 120;
      
      // Layout panels based on their saved value
      inline function layoutPanelsFromSavedValues()
      {
      	for (i = 0; i < panels.length; i++)
      	{
      	    local order = panels[i].getValue();
      	    panels[i].set("x", order * panelWidth + 10);
      	}
      }
      
      // Control callback for preset loading
      inline function onPanelControl(panel, value)
      {
      	panel.data.index = value; 
      	layoutPanelsFromSavedValues(); 
      }
      
      // Assign setup + callback
      for (i = 0; i < panels.length; i++) 
      {
      	panels[i].setValue(i); 
      	panels[i].set("saveInPreset", true); 
      	panels[i].setControlCallback(onPanelControl); 
      	panels[i].data.index = i; 
      }
      
      
      HiseSnippet 1451.3ocsWstaaaCElxIZnVsEsEXO.BA6GNsFoR9ta2PcbtrYrlVu3trMDTzQKQayUYRCJpjXTTf8DsGm8bz2fsCojsjuzVOiU8Gaxuyg766PxCOrqf6QBC4Bjg0qlNgfLtiYuoL4niFgoLTmiQFllQSFgZOcBNLj3iLL146UPF42Eo+9vyZiCvLORZWHzEbpG44zwTYZuca8izffSw9jWQGmw5Js53wYGwC3Q.M1wzAMA68V7PxKvJyxYh9Ab3HjwCM6654PJ22Ci6iaRZznZ+JMp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hgAUVD8gob+cNy2AWXumJYh5tf1QRIms2Sz4hKNC4jafLrgPNsvCCgAIZrxhA3fvTSzkcIVu6pbqgqLlPpuXyW.JsaHar5Zgm.2XN2oC88W+TbNgAEZtdriIAD4GAqGAK7F0FKxBbJ9Jt.BXpRZmyhTRjEdA2hBB5hkilgGtPPJQqcf3nOostzfEveQz33PqxMWcWws0ENbNrohC.wUo4bP4k9J9eren6WqmimSCkGJH345LYFJttel6ULyNmecWrupFkM0u4g617HluRoWFCbFWjrBsLR5txkQlEmWA058vCUVolZnZdteT.VtXI9pGBk..avWntZUsyvxkbZ1Kw9eqt+MkhOvrKU5MZ8bL2Z3HbE4WBNl7Zo6ZdxfADOYJA207ze8KySiPmCEqBauNCKETHWpIbHoGjByi.yNSUymJucNUYIwscTsUQfdDlutw+.eIftyRxq.cmAhFi8D723EWZh58X2R2CvIl9sq4MOS01dMUCMFdd3a77VbnVwwRaqik2VGqrsNVcacr115X8s0wFedGUud+vHIeb7wFD5rtmnu1yv3DFF1Ap2sh9W.bIH2.
      

      vid.gif

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

        @HISEnberg Presets only restore component values, so you are going to have to store the data in the panel's value - or depending on what the specifics are you might store the data in a sliderpack or some other control.

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

        HISEnbergH 1 Reply Last reply Reply Quote 0
        • HISEnbergH
          HISEnberg @d.healey
          last edited by

          @d-healey Ahh I see thank you David that does make a lot of sense!

          1 Reply Last reply Reply Quote 0
          • HISEnbergH HISEnberg has marked this topic as solved on
          • First post
            Last post

          13

          Online

          1.7k

          Users

          11.9k

          Topics

          103.6k

          Posts