Update expansion presets
-
This post is deleted! -
@d-healey, I would find a way to remove the save preset btn if a preset in the Default-Preset is loaded
-
@d-healey Yeah, that would solve a big part of the problem!
-
Hmm, it's not entirely trivial to come up with a solution that works for most scenarios, so I think we have to divide it into multiple steps:
- A new function to delete an expansion (but it will not delete the user presets).
- A new parameter to
installExpansionFromPackage()
with a function that is executed once the installation is completed (just like anything with the server API). - A function that extracts the user presets from a .hr1 file over existing presets (I think right now the default is doing nothing if a UserPreset folder is present), but it could simply reuse the logic from the Import all presets from Collection context menu which keeps user made presets and just updates the ones from the expansion.
It would also be good to get the option to delete the hr files automatically after installation is completed.
This could be easily implemented by deleting the file in the finished callback. You could even ask the user in a modal window with
Engine.showYesNoWindow()
... -
@Christoph-Hart This implementation looks good to me. Is there a way to make the "factory" preset read-only?
-
So Mr Freedom wants to restrict his users from modifying the factory content :)
-
@Christoph-Hart Haha not at all. They can use save as, but if they f*** up their factory presets I don't want to deal with support.
-
@Christoph-Hart hahaha!
-
@Christoph-Hart said in Update expansion presets:
).
A function that extracts the user presets from a .hr1 file over existing presetsThat would be much appreciated :)
-
-
The install callback also seems like a good oppertunity to activate a license on a remote server.
-
Will this work for deleting multi-part hr archives?
-
Is it possible to call rebuildUserPresets() without using the expansion installer?
I'm looking to add a button in my maintenance panel to rebuild expansion presets, but I can't quite get it to work yet.
I'm using an encryped expansion, and my plug already has an expansion handler in place:const var expHandler = Engine.createExpansionHandler();
Then I'm calling the following with a button:
inline function onRebuild_YesControl(component, value) { if(value) { expHandler.rebuildUserPresets(); } }; Content.getComponent("Rebuild_Yes").setControlCallback(onRebuild_YesControl);
But it's doing nothing.
I've tried the example in docs like this:function installCallback(obj) { if(obj.Status == 2 && isDefined(obj.Expansion)) { // make sure the user presets are updated obj.Expansion.rebuildUserPresets(); } };
But that doesn't work either because obj is waiting for an argument (which never happens cause I'm not using the installer).