How to make it
-
@pluginboi when opening the snippet is giving me this error
-
@Jay Do you have different sub Preset folders set up in your Userpreset project folder? and then edit this line to be the names of each folder
var presetFolders = ["Factory", "User"]; // update this with your actual folder names
-
@pluginboi Thanks a lot.
-
@pluginboi what to add, to make it show the selected preset on a label?
-
@Jay I figure it out
-
@pluginboi I was wondering if you know how to save a preset to a file because I'm using this and is not working
inline function onsaveOkControl(component, value)
{
Engine.saveUserPreset(presetNametoSave);
};
Content.getComponent("saveOk").setControlCallback(onsaveOkControl);any idea why?
Thanks in advance!!!
-
@Jay this is how i save them to the 'user' sub folder but you could get rid of the child folder to make it general. I found this in an old thread I think @Dan-Korneff posted about out so he may have more info if you're doing more customization
var pre_folder = FileSystem.getFolder(FileSystem.UserPresets).getChildFile("User"); function save(file) { Engine.saveUserPreset(file); } //// Save as Button inline function onSaveasBTNControl(component, value) { if (value) FileSystem.browse(pre_folder, true, "*.preset", save); PresetHandler.init(); populatePanel1(); UpdatePresetLabel(); }; Content.getComponent("SaveasBTN").setControlCallback(onSaveasBTNControl);
-
@pluginboi T h a n k Y o u
-
This is always showing one preset name behind it. Do you think you can help me with this?
note: it's doing it in both examplesnamespace UserPresetWidgets { inline function createPresetButton(name, x, y, up) { local widget = Content.addPanel(name, x, y); Content.setPropertiesFromJSON(name, { "width": 10, "height": 15, "saveInPreset": false, "allowCallbacks": "Clicks & Hover" }); widget.data.up = up; widget.setPaintRoutine(function(g) { g.setColour(this.data.hover ? 0xFF65B17c : 0xFF2C4433); g.fillTriangle([0, 0, this.getWidth(), this.getHeight()], this.data.up ? Math.PI/2 : 1.5 * Math.PI); }); widget.setMouseCallback(function(event) { this.data.hover = event.hover; if(event.clicked) { if(this.data.up) { convoLbl1.set("text", Engine.getCurrentUserPresetName()); Engine.loadNextUserPreset(true); } else { convoLbl1.set("text", Engine.getCurrentUserPresetName()); Engine.loadPreviousUserPreset(true); } } this.repaint(); }); return widget; }; } const var UpButton = UserPresetWidgets.createPresetButton("UpButton", 749, 10, true); const var DownButton = UserPresetWidgets.createPresetButton("DownButton", 736, 10, false); // ============== second attemp // next inline function onnextBtnControl(component, value) { convoLbl1.set("text", Engine.getCurrentUserPresetName()); Engine.loadNextUserPreset(true); }; Content.getComponent("nextBtn").setControlCallback(onnextBtnControl); // prev inline function onprevBtnControl(component, value) { convoLbl1.set("text", Engine.getCurrentUserPresetName()); Engine.loadPreviousUserPreset(true); }; Content.getComponent("prevBtn").setControlCallback(onprevBtnControl);
-
@Jay You have to load the preset first, then get the name, you have it the other way around
if(this.data.up) { // First load the preset Engine.loadNextUserPreset(true); // Then get the loaded preset name convoLbl1.set("text", Engine.getCurrentUserPresetName()); }
-
@ulrik Thank you so much, you're right