An Inline Progress Bar for Y'all
-
Here's a progress bar for y'all. I use it for displaying progress bars on the UI (instead of a pop-up window). Each progress bar instance has a unique ID so a completion function can be called for each. Below is the raw code from my plugin; it's easy to adapt to your own.
Progress bar code:
//////////////// DISPLAY PROGRESS WINDOW ////////////////// const var panel_HEADER_progressIndicator_Frame_ART = Content.getComponent("panel_HEADER_progressIndicator_Frame_ART"); const var panel_HEADER_progressIndicator_Bar_GUI = Content.getComponent("panel_HEADER_progressIndicator_Bar_GUI"); const var panel_HEADER_progressIndicator_Backing_ART = Content.getComponent("panel_HEADER_progressIndicator_Backing_ART"); // ------------- Fade In Function inline function FadeInProgressBar () { panel_HEADER_progressIndicator_Bar_GUI.fadeComponent(true, 500); }; // ------------- Fade Out Function inline function FadeOutProgressBacking () { panel_HEADER_progressIndicator_Backing_ART.fadeComponent(false, 500); }; // ------------- Progress Bar Animation Function inline function DisplayProgressWindow (timing) { // Draw bar. panel_HEADER_progressIndicator_Backing_ART.fadeComponent(true, 500); panel_HEADER_progressIndicator_Bar_GUI.set("width", 0); Content.callAfterDelay(500, FadeInProgressBar, this.Object); panel_HEADER_progressIndicator_Bar_GUI.startTimer(timing); } // ------------- Progress Bar Callback Function panel_HEADER_progressIndicator_Bar_GUI.setTimerCallback(function() { Animate.increase("width", panel_HEADER_progressIndicator_Frame_ART.getWidth(), 1); }); // ------------- Post Animation Functions inline function PostAnimationActions() { // Handle calling function specifics. switch (global_animationCaller) { case "smart_settings": SetSmartSettingsActivation (true); break; case "automix": SetAutoMixActivation(true); break; case "infinite_dr": SetInfiniteDynamicRangeActivation(true); break; case "extractprofile": DoProfileExtracted (); break; } global_animationCaller = "none"; };
Example of calling/creating a progress bar:
///////////////////////////////////// SMART SETTINGS //////////////////////////////////////// // ------------- Callback Function // Register the callback function for when the button is pressed. button_SIMPLE_SmartSettings_GUI.setControlCallback(on_SIMPLE_SmartSettings_Control); inline function on_SIMPLE_SmartSettings_Control(component, value) { if (value) { global_animationCaller = "smart_settings"; DisplayProgressWindow(65); } else { SetSmartSettingsActivation(false); } };
Enjoy!