@xxanx
Figured it out.
In case anyone else wants a preset browser that kinda works, with opening and closing (with preset overwrite prompt)
heres my code:
// SHOW AND HIDE PRESET BROWSER WITH BUTTON
const var FloatingTile1 = Content.getComponent("FloatingTile1");
const var Button1 = Content.getComponent("Button1");
Button1.setControlCallback(Button1CB);
inline function Button1CB(control, value)
{
FloatingTile1.showControl(value);
};
// Timer for handling delay after saving a preset
const var saveTimer = Engine.createTimerObject();
var saveTimerCounter = 0;
saveTimer.setTimerCallback(function()
{
if (saveTimerCounter > 0)
{
saveTimerCounter--;
if (saveTimerCounter == 0)
{
FloatingTile1.set("visible", false);
Button1.setValue(false);
saveTimer.stopTimer();
}
}
});
// Close Preset browser after save
const var uph = Engine.createUserPresetHandler();
uph.setPostSaveCallback(function()
{
saveTimerCounter = 1; // Set the counter for a brief delay
saveTimer.startTimer(5500); // 500 milliseconds delay
});
// Logic for handling preset loading (remains unchanged)
uph.setPostCallback(function()
{
FloatingTile1.set("visible", false);
Button1.setValue(false);
});