GUI Progression Bar

  • On 25/01/2018 at 03:12, xxxxxxxx wrote:

    Hi everyone,

    I'm trying to create a progression bar into my UI, but having difficulties in making it progress and stop when it finishes.

    Base on this great example, I manage to make it work, but there is a difference that want to happen.

    Instead of having a timer, would like the bar to progress when a function finishes.
    For example:

    |_______| 0%

    Def 1:
    Do Something
    progressbar += 1

    |==|____| 33%

    Def 2:
    Do Something
    progressbar += 1

    |====|__| 66%

    Def 3:
    Do Something
    progressbar += 1

    |======| 100%

    If I create a function that adds the progress, unfortunately when it gets to end it does not display the message, has it seems is not running the Message Built-In Function.

    def Message(self, msg, result) :
            if msg.GetId() == c4d.BFM_TIMER_MESSAGE:
                if self.progress==10:
                    return True
            return gui.GeDialog.Message(self, msg, result)

    I'm trying to understand the logic for this and been struggling for a bit.
    Apologies if this sounds confusion and will try my best to add any information needed.

    Thank you in advance! 🙂


  • On 26/01/2018 at 03:40, xxxxxxxx wrote:


    As I understand, you don't use a timer in your dialog so BFM_TIMER_MESSAGE is never send.
    For each of the 3 progress step send the update message to the progress bar with:

    self.progress += 1.0/3.0
    progressMsg[c4d.BFM_STATUSBAR_PROGRESS] = self.progress

    Then after the last step with a progress of 1.0 the progress dialog can be closed.

    Note there's an issue in the code I posted in the thread you linked. The dialog is closed after 11 timer calls while this should be done after 10.
    self.progress==10 is checked in BFM_TIMER_MESSAGE after the 11th timer call. To fix this the code in Message() for BFM_TIMER_MESSAGE should be moved at the end of Timer().
    In fact Timer() is called for each BFM_TIMER_MESSAGE so there's no reason to use both in a dialog. Moreover this has lead to the previous issue.

  • On 30/01/2018 at 01:23, xxxxxxxx wrote:

    Hi Yannick,

    Apologies for the slow reply! Just had a chance of seeing this today.

    Thank you very much for your time and help!
    Will have a look and come back to you. But it does make sense.

    Thank you again! 🙂

  • On 30/01/2018 at 03:25, xxxxxxxx wrote:

    Just to let everyone know that it works like a charm!

    You're a star Yannick! 🙂

Log in to reply