How to show a progress bar
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 24/08/2008 at 08:37, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 10
Platform: Windows ;
Language(s) : C++ ;---------
Hi!We are working on a shader plugin. For the shader we need to create a new texture for rendering. This new texture depends on the properties of the shader and the creation takes time (up to a minute and more). Once the textures were created the rendering is very fast. To avoid the permanent texture generation we cache the textures and only recreate them when the user change the shader properties. In the current approach the user has to push a 'generate-button' within shader property dialog and then the texture generation starts in the GUI-Thread.
Due to this generation the whole GUI cannot respond. To solve the issue we created a custom dialog and a separate thread. Within the thread we do our texture generation and the GUI dialog is used to inform the user about the progress. The problem is we have no clou how the thread can inform the dialog that it is done.
>
\> // Generation-Thread \> \> void Main() \> { \> publicGenerateTileset(m_settings, m_bitmap); \> // texture is generated \> \> // and what now? \> // m_receive is my custom dialog \> m_receive->Close(); \> } \>
The dialog doesn't respond to the 'Close' command. We assume this is because we send the close command from a none-gui thread but how can we avoid that?
In short: how can we inform the user that the shader plugin is doing some important preparation stuff and that he has to wait until the process is ready? Remember, this should happen in the property dialog of the shader.
So hopefully it wasn't that confusing
It's our first plugin and it may be the complete wrong approach... -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 27/08/2008 at 06:24, xxxxxxxx wrote:
Howdy,
In c4d_general.h in the SDK documentation, you'll find these functions for Cinema 4D's status bar:
void StatusClear(void)
Clear the status bar text.void StatusSetSpin(void)
Set the status bar progress bar spinning. Use this to indicate that your plugin is still processing even if the progress bar isn't increasing.void StatusSetBar(LONG p)
Set the status bar progress bar.Parameters
LONG p
The percentage of the bar (0-100).void StatusSetText(const String& str)
Set the status bar text.Parameters
const String& str
The text to display.Adios,
Cactus Dan -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/08/2008 at 02:28, xxxxxxxx wrote:
thanks.
I'll try it -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/08/2008 at 08:56, xxxxxxxx wrote:
It works!
With the help of the StatusXXX functions we can inform the user about the texture creation progress.
With the help of a modal dialog we provide a cancel opportunity. When the user push cancel a flag is set which indicates "user want to stop the texture creation". The thread checks this flag occasionally and if it's true the thread exits.
The dialog uses a timer function (see GeDialog::SetTimer) to check if the texture creation thread is ready. The advantage of the timer approach is that the timer function works within the GUI thread and can close the window and do further GUI stuff.
Thanks for help
Christoph
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/08/2008 at 10:00, xxxxxxxx wrote:
Howdy,
You're welcome.
If you also use the StatusSetText() function you can let the user know what processes are running. The text will appear to the right of the status bar.
Adios,
Cactus Dan