Break Render



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 11/10/2006 at 21:10, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   9.0 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    Hi ...

    Now I render my document using the statement below ...

    RenderDocument(doc, bc,MyProgressHook,pd, bmOutput,RENDERFLAG_EXTERNAL,NULL);

    It's working like "Render To PictureViewer"
    It's working ... but if the user want to break the render using Ctrl+Break ... it's not responding ...
    I read the threads about breaking render ...
    I try to use TestBreak ... but it's not working ...
    Please anybody can tell me in detail ...? ;-)

    Thanks in advance ...
    Zaw Min Tun



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 11/10/2006 at 23:27, xxxxxxxx wrote:

    i think you have to give it a Thread in stead of NULL.
    The thread is waiting for the testbreak and should then stop the rendering



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 16/10/2006 at 20:41, xxxxxxxx wrote:

    But I don't know how I can make it ...
    Can you show me some code sample?
    But I'll try it again ...

    Anyway ... I really thank you ...
    Zaw Min Tun



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 16/10/2006 at 21:00, xxxxxxxx wrote:

    Take a look at the section of code where RenderDocument() is called in simplematerial.cpp and particlevolume.cpp in the plugins:cinema4dsdk folder. There you see how they get the thread.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 16/10/2006 at 21:25, xxxxxxxx wrote:

    Then I take a look at them ...
    I pray they can really help me ... ;-)
    I've already spent nearly 5 days on this ...

    Zaw Min Tun
    ありがとう ... 本当に ...



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 16/10/2006 at 21:56, xxxxxxxx wrote:

    My plugin is a dialog plugin ...
    When the user presses a button ... The user will see the Picture Viewer rendering ...
    When redering is done the user will get a bitmap file ...
    But while rendering ... the user cannot have a break on that render ... bcos I render like this ...

    RenderDocument(doc, bc,MyProgressHook,pd, bmOutput,RENDERFLAG_EXTERNAL,NULL);

    Some old threads told me to use TestBreak() ...
    For that I create a class called myThread ...

    class myThread:public Thread
    {
    public:
         myThread();
         virtual void Main(void);
    };

    myThread::myThread()
    {
    }

    void myThread::Main(void)
    {
    //...
    }

    Then when I call RenderDocument() ...

    myThread *thdRender=new myThread;
    RenderDocument(doc, bc,MyProgressHook,pd, bmOutput,RENDERFLAG_EXTERNAL,thdRender->Get());

    If I did like above ... the code that I wrote in MyProgressHook was not running ...
    And if I insert the line thdRender->TestBreak() ... it's not still working ...

    But I'd go on ... ;-)

    Zaw Min Tun ...



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 16/10/2006 at 22:37, xxxxxxxx wrote:

    If you want to use your own thread to test for breaks, make sure that it is running!

    You're going to need to call thdRender->Start() before calling RenderDocument() and End() afterwards. You will also need to implement myThread::TestDBreak() unless you want a deadlock situation.

    Try something like this and see if it works:

    class myThread:public Thread  
    {  
    public:  
         myThread();  
         virtual void Main(void);  
         virtual Bool TestDBreak();  
    };  
      
    myThread::myThread()  
    {  
    }  
      
    void myThread::Main(void)  
    {  
    //...  
    }  
      
    // This tests for the Esc key to break the thread  
    Bool myThread::TestDBreak()  
    {  
         BaseContainer     keyinput;  
         return (GetInputEvent(BFM_INPUT_KEYBOARD, keyinput) && (keyinput.GetLong(BFM_INPUT_CHANNEL) == KEY_ESC));  
    }  
      
    ...  
      
    myThread *thdRender=new myThread;  
    if (!thdRender->Start(TRUE)) // Error starting thread  
      
    RenderDocument(doc, bc,MyProgressHook,pd, bmOutput,RENDERFLAG_EXTERNAL,thdRender->Get());  
      
    thdRender->End();
    


  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 17/10/2006 at 20:12, xxxxxxxx wrote:

    Really thank you again ...

    Now I try to check if ESC is pressed ( in ProgressHook ) ... and it's OK ... The plugin knows when ESC is pressed ... But I don't know how to stop the rendering ...
    I forgot to tell that I'm still using NULL as the last parameter instead of thdRender->Get() ... bcos' if I didn't use NULL ... the code I'm writing in ProgressHook is not working ...
    In ProgressHook I call the ShowBitmap with the current bitmap ... So it's changing all the time while rendering ...

    So I'm a bit lost ...
    But Robert ... you answers helped a lot ...
    And I hope you will go on ... ;-)

    Zaw Min Tun



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 18/10/2006 at 02:13, xxxxxxxx wrote:

    Hmmm, the way the documentation reads, RenderDocument() should be using the passed Thread as a sort of 'overlord' to test for a user break. This should stop the render automatically - theoretically and assuming these points.

    One question though: Are you using a clone of the BaseDocument!!? As the docs state: Must be a clone of the real document! This might have an impact.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 19/10/2006 at 00:10, xxxxxxxx wrote:

    Yeah ...

    When I use the clone doc ... the way it's working really changed ... I can use ESC to stop rendering ...
    But after stopping the render ... C4D also stop responding ... When the ESC is pressed ... I ended the thread ...
    What more do I need to do?

    But I think I can move a new step ... ;-)

    Thank you a lot ...

    Zaw Min Tun



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 19/10/2006 at 01:12, xxxxxxxx wrote:

    Hello ... Robert ...

    I came here to let you know that now it's working ... and to say thank you ...
    Thank you ... a lot ...

    May god bless each and every one ...
    Zaw Min Tun


Log in to reply