...Always on the PresetBrowser



  • Ok I found a kind of solution. So when you save your project all of the controls that are set to be saveInPreset are saved. And when you open the project those controls will be restored. So you need to make it so the label you use to display the preset name is set to be saveInPreset. Then in your code where you are setting the text of that label when a preset is loaded you need to check to make sure the presetName is not an empty string.

    if (Engine.getCurrentUserPresetName() != "") lblPreset.set("text", Engine.getCurrentUserPresetName());

    The only really issue is that it's a little awkward (at least in my case) to save the presets because you have to turn off saveInPreset to get the name to load and then turn it back on and resave the preset. Actually it might be quicker just to edit the preset xml for this.



  • @d-healey said in ...Always on the PresetBrowser:

    Ok I found a kind of solution. So when you save your project all of the controls that are set to be saveInPreset are saved. And when you open the project those controls will be restored. So you need to make it so the label you use to display the preset name is set to be saveInPreset. Then in your code where you are setting the text of that label when a preset is loaded you need to check to make sure the presetName is not an empty string.

    if (Engine.getCurrentUserPresetName() != "") lblPreset.set("text", Engine.getCurrentUserPresetName());

    The only really issue is that it's a little awkward (at least in my case) to save the presets because you have to turn off saveInPreset to get the name to load and then turn it back on and resave the preset. Actually it might be quicker just to edit the preset xml for this.

    Thank you David, I now check it πŸ™‚



  • @d-healey The label return empty for the same 😞 It seems that without the "Engine.loadNextUserPreset(true);" or the "Engine.loadPreviousUserPreset(true);" lines the PresetBrowser is empty when the project is open... though the sound of the preset is loaded the PresetBrowser looks as initialized.



  • I suggest the following thing that I am doing at HEXERACT:

    • make a init preset and call it Init.
    • whenever you save your project XML, load the Init patch - this also makes sure there is no noise in the Git commits because of parameter changes.
    • the preset label is obviously saveInPreset = false (everything else is just nasty). In the onInit callback you just check whether its empty and do this:
    if(!Engine.getCurrentUserPresetName())
        Label.set(β€žtextβ€œ, β€žInitβ€œ);
    


  • @Christoph-Hart said in ...Always on the PresetBrowser:

    I suggest the following thing that I am doing at HEXERACT:

    make a init preset and call it Init.
    whenever you save your project XML, load the Init patch - this also makes sure there is no noise in the Git commits because of parameter changes.
    the preset label is obviously saveInPreset = false (everything else is just nasty). In the onInit callback you just check whether its empty and do this:

    if(!Engine.getCurrentUserPresetName())
    Label.set(β€žtextβ€œ, β€žInitβ€œ);

    Thank you Christoph πŸ™‚



  • @Christoph-Hart said in ...Always on the PresetBrowser:

    if(!Engine.getCurrentUserPresetName())

    I had to change this to if(Engine.getCurrentUserPresetName() == "")



  • @d-healey said in ...Always on the PresetBrowser:

    if(Engine.getCurrentUserPresetName() == "")

    I checked both the ways, same result. If I don't put "Engine.loadNextUserPreset(true);" or the "Engine.loadPreviousUserPreset(true);" the label will be empty and the PresetBrowser without the preset list 😞



  • @ossian1961 Yes Christoph's code doesn't solve the preset browser issue but it should fix the label problem.



  • @d-healey said in ...Always on the PresetBrowser:

    @ossian1961 Yes Christoph's code doesn't solve the preset browser issue but it should fix the label problem.

    Unluckily it doesn't fix nothing 😞



  • @ossian1961 If you rename your preset title

    - Init
    

    it will be on top of the presets, and you can use

    Engine.loadNextUserPreset(true);
    


  • My example
    Untitled-1.jpg



  • @orange said in ...Always on the PresetBrowser:

    @ossian1961 If you rename your preset title

    - Init
    

    it will be on top of the presets, and you can use

    Engine.loadNextUserPreset(true);
    

    That works! Thanks!!!!!! πŸ™‚



  • @ossian1961 I've just recognized that, it works everytime but except first initialization of the plugin.
    Because when the plugin is opened for the first time, after succesfully loading, plugin creates the user preset folders and presets.
    But since presets haven't been created (because the plugin hasn't been loaded yet for the first time) on first initialization, the label box will be empty.

    If you load plugin again, the label box will be ok and show - Init preset since the presets have been created on previous plugin opening.

    There should be a fix for that.


Log in to reply
 

9
Online

517
Users

1.9k
Topics

14.6k
Posts