Engine.loadUserPreset | Load Preset From Button
-
Hey Gang,
So I was trying to get a Button to load a Preset that I have saved as my "INIT" preset. Unfortunately, it didnt work. So I came on the forum to see what I was doing wrong and I came across a slew of threads about the
Engine.loadUserPreset()
function not working. Has this ever been fixed? Is there a work around that is reliable?
Here is a snippet. I feel like I've done everything correctly here, yes?
HiseSnippet 1145.3ocsV0raabCDlqrViJ01jFf9.rvnGjATMjxesHAAQVxRABwxQvxIs.FEAz6RIQ3cIEH4ZGgVCja8ZeD5CPuzGo1C8bu0ityrbk1U1xtxBn6Aaw42uY32Px9JoOSqkJhSoilNgQb9L2ASElwsFS4BR28HN2ysGUaXJOqnlSmP0ZV.wwYiWgBbJUjj782urIMjJ7YYhHj2I49r84QbSlz9MdMOLrCMfcDOJm0OtQWeonkLTFC3YC2ZjIT+SoiXGPQyJ3Rb1rc.2HUCLTCSC1zTFLcvX44Bq8uiq4mDxvE0ICf.YESZMlGFzeVspIDmh8yp7MrU9W51iGvmKOqC7EIJ7x7HeOvovsAo52AH4jCREsP5AtC7U7IlLMHd9T2tBXCYHEZ04gh0VRgeywskDrPX1IhdJqiBVL2iJOsVspdve194kK2VLhKX6LhYdqlo5qXZlYet1TAUxEgfRugwBeCWJ7jh8kzftBtoYrwfaTBiRFVwWFMQJfrU06LZXLa6x+XYO7iOrRh.uW7Bu5aW1JLMkgPnxxYks5dP2i1Bx5EPhmAd.VslE6JasXx2Z6czn5DHzhFFdBPUpbCPDhatp3.og8FQEDlkJeQYuqpZ3vkpKMVgL0RUiTY0s4XEQbzILUtlThgvd8hDnMWMBjusIkyPo.K72LgkttiLL.IF3uuNcij1kAhWgTDBlZRnc2Kk1YahDd.NCrXmkjTE4mzI2TTFDxCXpjnT1cOVj70B4IK3+u9p+3OeI4sc2iZn3fPJz.3NgoLbrq3rG6L3jD6XQIHL5SMxIPtlyPf4BS5brMuc.NlgKFcDG5dX1uuadQ0IeXN7+3wMllUKeUiT.Xy18csjzlJ44.ikbxnYGQUZSv5+AcgaXQYR+8K+kKWT5CSMN4KoLK7yEbw4jsvcvAzyXo75m4YTwrpyzz9CSnBMPjz6pgPEGgVLjFpyLIYeVM28EUhLZ80jhLNqC57ILSLLD.ULnqds4NsaPvxw3gLAb.8x0sGKjYtAccnmIUPOBO0eAHlBstPgGvZJUP4sf9Chir8BD80SDYW+c7.y3CgsXIn33jCbpsyitxW06nbP7OjjC7jwcUL57lSZFptr+M2KKxNTddeZP.v8VU+FvnJ+wMoplxXQ.VoGaUzSpRanWUSFM5pZl0pul1xWPNGaZDGWmexgPFy3iFavU+kcld9zk6pe1vMLX0XRCttmLBBGUAhcJjO9EWkSMxhbCYtH+wyZPt9smv81xf3PpYwKywWsjp.lqV3FT7VRfzYll+UM2ga3qcq2vupP7At84F+wKGiEVBFwyv+e.iouK5ycaObHy2jAvhtc9908QP+Go+PYLd.cOpQwgMaWXTe.b9oOCxtPvB0H0r.xLsqqgqwNv.lHHYwkvWpx53ZmTk0mojDQ8Ux26autBe40mjHAvjH4glkfW7Bq8pO6RJW2Z6TiDAOB7899X4+0vMpK2mGtF97n0vmGuF97j0vmmtF97MqgOe6s5C996ciMxH63.Hne6jaQcbZKn.yJgER9WLUoFxC
-
@trillbilly What if you change to
Engine.loadUserPreset("INIT.preset");
-
That won't work. Your button is set to save in preset, that will trigger the button's callback each time a preset loads and create an endless loop.
You don't need an init preset. Just load the preset you want to be the init state before you compile your project and that will be the initial state the plugin is in when the user opens it.
-
@d-healey but what if I want a quick way for users to reset the default values without having to search the Preset browser?
-
@trillbilly Then have a button on the UI that isn't set to
saveInPreset
that can be used to load a preset. -
Also you need to pass in a file object or path, not a preset name:
Here's an example: loadPresetTest.zip
-
@d-healey Aayaya (my Mario voice), I got it, thank you...
-
@d-healey why this example not working for me , I am trying to use the button to load the presets , but fail.....
-
@huen97 its set up like this
inline function onResetButtonControl(component, value) { Engine.loadUserPreset("Factory/INIT.preset"); }; Content.getComponent("ResetButton").setControlCallback(onResetButtonControl);
with "Factory/INIT.preset" being the File Loaction and name or preset.
-
@trillbilly otherwise in the callback of your Button, put the state of each button or setting of your project. longer to perform but if the "init" preset is deleted, this function will remain unchanged
-
@yall Didnt think of this. Great observation!