Engine.loadUserPreset for expansions?
-
@d-healey Oh yeah I forget the folder, but still is returning a wrong full path with this.
The console returns:
User preset /Volumes/Ben/Hise Projects/Raizes Player/UserPresets/{EXP::Auralis}UserPresets/Category 3/Native Preset.preset doesn't existBecause it adds "UserPresets" before the {EXP::Auralis}
-
@bendurso What happens if you don't include "UserPresets/" in your relative path?
-
@d-healey It returns this:
User preset /Volumes/Ben/Hise Projects/Raizes Player/UserPresets/{EXP::Auralis}Category 3/Native Preset.preset doesn't exist
If I print this:
local wildcardReference = expHandler.getCurrentExpansion().getWildcardReference("UserPresets/Category 3/Native Preset.preset"); Console.print(wildcardReference);
It returns the correct path: {EXP::Auralis}Category 3/Native Preset.preset
But.. after inserting it on Engine.loadUserPreset, it adds the "User Preset" plugin full path (non expansion) at the beginning.
-
@bendurso I wonder if it only works in the compiled plugin
-
@bendurso I just found an example of where I used it, might help..
RhapsodyBoilerplate/includes/Expansions.js at main
RhapsodyBoilerplate - Boilerplate code used by Rhapsody.
Codeberg.org (codeberg.org)
-
@d-healey Thanks, I'm going to try... today I spent all day trying to make a custom preset browser with viewports (I almost got it), but I can't load the presets hehe.
-
@bendurso said in Engine.loadUserPreset for expansions?:
I spent all day trying to make a custom preset browser with viewports
Why?
-
@d-healey Because the searchbar don't work on expansions, and the button bounds "Add, Rename, Delete" can't be increased. Mainly for these two things.
-
@Christoph-Hart Does Engine.loadUserPreset works for expansion presets? How should be the proper way to reference the path? Thanks :)
-
@bendurso Did you try using
{EXP::Auralis}Category 3/Native Preset.preset
directly? -
@d-healey Yeap, doesnt work.
When you use a string path it adds "Plugin/User Presets" + the string path. (that's the error log of the console)
like this:
Plugin/User Presets/{EXP::Auralis}Category 3/Native Preset.preset -
@bendurso The only way it doesnt return an error is if I use a object full path to the preset with FileSystem.fromAboslutePath(), it starts loading a bit and Hise crashes.
-
@bendurso said in Engine.loadUserPreset for expansions?:
When you use a string path it adds "Plugin/User Presets" + the string path.
You mean
Engine.loadUserPreset("{EXP::Auralis}Category 3/Native Preset.preset");
? -
@d-healey Yeap, if you use that, the console returns:
User preset /Volumes/Ben/Hise Projects/Raizes Player/UserPresets/{EXP::Auralis}Category 3/Native Preset.preset doesn't exist
It directly searches inside the main plugin User Presets folder, so it's impossible to make it work.
-
@bendurso You said using a File object causes a crash. What about instead of using
fromAbsolutePath
you piece the path together, something like this:local rootFolder = Expansion.getRootFolder(); // I can't remember the proper function name local preset = rootFolder.createDirectory("UserPresets").getChildFile("myPreset.preset");
-
@d-healey I had also previously tried building the entire path that way and it doesn't work either :( I mean, it doesn't throw an error but it crashes.
I just tried in the compiled plugin, and it also crashes :(
-
@bendurso I'll do some tests
-
@bendurso Ok it's an issue with the
loadUserPreset
functionThis is what it looks like in the source
File userPresetRoot = FrontendHandler::getUserPresetDirectory(); userPresetToLoad = userPresetRoot.getChildFile(file.toString());
As you can see, no matter what we pass in (
file
) it's always going to try and load it from theuserPresetRoot
which is the project's user presets folder not the expansion's. I'll see if I can implement a fix. -
I've played around with it but it would take me quite a while to find a solution and I don't have the time at the moment to really dig into it.
Either we need to modify the
loadUserPreset
function to use the expansion's preset folder when the filename is an expansion wildcard reference. Or we need a separateExpansion.loadUserPreset()
function. My preference would be for the former. -
@d-healey Nice, maybe I could post a feature request and see if anyone else is interested? I find it strange that no one has found this before.