Issue with changing SliderPack amount having saved presets previously...
-
I'm using a SliderPack to switch between filter modes.
The SliderPack is hidden and is controlled by 6 buttons on the interface. The sixth button is new.
However, when I select the presets I made when there were only 5 buttons the SliderPack reverts to 5 sliders and breaks the system. A newly saved preset will create the sixth slider, but it won't fire the callback properly. I'm guessing that the slider amount is saved within the preset data.
Any ideas how to get around this problem?! Snippet and link to Project below which has the saved presets in so you can see what I mean....
HiseSnippet 1980.3oc0Y07aibaEeFudbiUZR1cwhhVffBBCT.YrJtRV1NEMMIRxRpQX8GZkztoKLLRnmgxhvyLb5LbVasAKPZO0dK25+A8b6sdr+Ozq8Ohbn.831GIGMC0W1xVH.cEfsE46qe78d7wGoaGxrIQQrPCy06MLfXX9is5NzmOX+AXpuQq5FluqU21ndM51CUxn1v.bTDwwvz7d+VAClqupg7y2+40vtXeaR1TFFOmQsIGP8n7rYaW4ITW2lXGROpmF26TokMyeelKKF.y8rJZDfsu.eN4HrfsUrLLWqgCkyB6xwbRDvSMlyvtCXW5q3+4zH5YtDwfRFcAEol1X+ATWm1iVnQFFlq1NaYeO0x9QVGRcnoyms7uuj.JSBcef4JWGjJcKfjoFjVUAoGX00NjFvynnBGs74jv9XvUqCEEuFq7WWyZeFvgOeKO7EjlgvfTIxuWwhEPvu17SxkCb2QbzKwgnlTWfgRnOEIi8acNg2neehMO+FIj1.DHi+ttTGRXaH9TFjYj4.o1m4Ev7gA42PiGgv49kvm1GCYQMacPuFcP0dVudGeT2bJJiOKpc0iZbfflfHpdilsNpApZmNUeQWcbGzuVLmCCATbxrggPuJlf0PgbnY+4ljc2kP1xKgr6rDxt8RH6dar4oPLaNROUlygLGhLFrWATocfe1t.B9yGCea2SUwdz9UO3fZU2+InlG2A0tYZ3uOKDk+LD0OKZtozvmsUj.c97Pl69XW2yfTo7L+TtRHA4VRLQ8co9DT+XeaNk4illy71iVpE.r6FS1L22Hk0kYicAD3PtBVDohskbli6mI2lI9DIlo.uE+DDE8aP6A+4wOVA6uI0qkpnSnmJV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Ip5AP1AOLlTXDkFWEf8ifHXTU3lNtwd9ixeRYQ1RT3rEWz6WDLYwLEB8kkz6sNyYSCsJBKVfVoLgp53La82g3CwkYSqNwEhXylVS7KgTUNQ7pP5zRPVKXI6PpwBgE1Xq2ih8TdAA32VNkZ7WJRo5.AWFP3DY+wE2p7DeJbKmGl9ToMNfFwqFRvo9lDKTXV+IUJEx5vtrM1wAx5VT45Rvg1CpgCqAUbcDqzSTDNjEl3OmjRVBzjTF4omhJT+Ice3GN19v+s7k7l5EqtuEbIjXWLe7GPS7RgIDDEZze0JwKSAQR9P8RMS9pZqN+qFTT6pA2Pi+KHbefUaJ2dvrw6Jy.uP2e+Pi2j2n78rTuJWFXW0p4u6ZePxUWraUkAka7wISdl3GZ0l4NLX.ymZqJAKATV8347Twe8+3m+vJYEm0Zl9o5o.GJOQXz36W4owXWcu929GqTiFvbwgKTD4t+trqtfoM+jrSbPuEkqKhLu8f2elURPGIb1u8f6225o+e.X6vhEc1bHF5LSzpFbRYWnwCaB.Teehajnx9JhljUiKJFK.TWhuibfn82DhkDiMSHVZDQCOrcH6qrU2oVr+4cjy.XxW9uwYcqCEiQoWl1xp3VEEshR+JaaQAsOBv9rkY66fLkuCxrycPlcuCxr2cPlO9NHyu5ZkQ7e2pZLm4oxMgIZ2PcOFyF9XHKSllZ7+Pune3I
-
@DanH said in Issue with changing SliderPack amount having saved presets previously...:
I'm guessing that the slider amount is saved within the preset data.
Yup, it stores the slider data as float array so if the length isn't the same, it will resize the sliders.
You can solve this like any other issue related to backwards-compatibilty of presets: assign a preload-callback to the user preset handler where you preprocess the data and add the missing slider.
- Add a SliderPack
- Create two presets with different amount of sliders (one should be 16, the other one some smaller number for this example)
- Use this script:
const var SliderPack1 = Content.getComponent("SliderPack1"); const var uph = Engine.createUserPresetHandler(); uph.setEnableUserPresetPreprocessing(true, // enable preprocessing true); // unpack complex data (so the slider pack data is available as array) uph.setPreCallback(function(presetData) { // You can check the preset version against the current project version // to avoid preprocessing if the presets are up to date // (this saves a bit of time but isn't 100% necessary...) var oldVersion = uph.isOldVersion(presetData.version); //if(!oldVersion) // return; for(d in presetData.Content) { if(d.id == "SliderPack1") { while(d.data.length < 16) d.data.push(Math.random()); // fill it up with random values so you see the effect } } });