Rendering in Picture Viewer

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

On 02/08/2012 at 13:16, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   R13 
Platform:      Mac OSX  ; 
Language(s) :     C++  ;

---------
Hi, I have a question about C++ plugins: are there any possibility to know if rendering in Picture Viewer is done?

I have achieved it with a VideoPost plugin Execute and VIDEOPOSTCALL_FRAMESEQUENCE, which i found here, but it seams that the message is sent after the last frame is rendered, but before saving it to the disk. So if the frame is very big - Picture Viewer is still doing something (in this case - writing an image to the disk) and I've already received VIDEOPOSTCALL_FRAMESEQUENCE message.

Are there any way to know if the rendering is totally finished? (rendering + saving to disk + whatever Picture Viewer is doing after rendering)

Thank you for all the answers in advance 🙂

P.S.: Sorry if my question is totally stupid 😠 - I'm building my first plugin in C4D 😄

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

On 03/08/2012 at 01:23, xxxxxxxx wrote:

You must check for the value of VideoPostStruct::open member. It's FALSE for closing calls and TRUE for opening calls.

Example:

RENDERRESULT MyVideoPost::Execute(BaseVideoPost *node, VideoPostStruct *vps)
{
	if (vps->vp==VIDEOPOSTCALL_FRAMESEQUENCE && !vps->open && *vps->error==RENDERRESULT_OK && !vps->thread->TestBreak())
	{
...

cheers,
Matthias

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

On 03/08/2012 at 03:48, xxxxxxxx wrote:

Thank you, Matthias, but I'm checking open member already:

RENDERRESULT MyVideoPost::Execute(BaseVideoPost *node, VideoPostStruct *vps)
{
    if(vps->vp != VIDEOPOSTCALL_FRAMESEQUENCE)
    {
        return RENDERRESULT_OK;
    }
    if(vps->open)
    {
        return RENDERRESULT_OK;
    }
    else
    {
        if(vps->renderflags & RENDERFLAGS_EXTERNAL)
        {
            // Rendering in picture viewer is done.
            // Send message.
            SpecialEventAdd(MYVIDEOPOST_ID);
        }
    }
    return RENDERRESULT_OK;
}

I expect SpecialEventAdd(MYVIDEOPOST_ID) call only when picture viewer is finished, but it is not.

If in the other place, when I get CoreMessage with MYVIDEOPOST_ID, I call CallCommand(12099) to start rendering again - Picture Viewer  asks if I need to stop previous rendering... So, as I understand, I can not identify if rendering is done this way.

Thanks,
Simonas

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

On 03/08/2012 at 04:45, xxxxxxxx wrote:

You need to check for  VIDEOPOSTCALL_FRAMESEQUENCE AND !vps- >open if rendering is finished.
 Please have a look again at my example, it's checking if rendering is finished.

cheers,
Matthias

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

On 03/08/2012 at 11:59, xxxxxxxx wrote:

Sorry Matthias that I'm still struggling and wasting your time 😊 I know my code posted above may look awkward 😄 but it works almost the same way you suggested.

Any way - I have rewritten it as you suggested, but the problem does not disappear.

RENDERRESULT MyVideoPost::Execute(BaseVideoPost *node, VideoPostStruct *vps)
{
    if(vps->vp==VIDEOPOSTCALL_FRAMESEQUENCE && !vps->open && *vps->error==RENDERRESULT_OK && !vps->thread->TestBreak())
    {
        // Rendering in picture viewer is done.
        // Send message.
        SpecialEventAdd(RENDERMASTER_VIDEOPOST_ID);
    }
    return RENDERRESULT_OK;
}

Thanks,
Simonas

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

On 09/08/2012 at 07:31, xxxxxxxx wrote:

Hi Simonas,

Here's more information I got from the developers:

If you are in VideoPost::Execute() the render process is still ongoing (even if it is shortly before exiting), so stopping it will ask if the current render shall be stopped.
If you set RDATA_FINISHMESSAGE in the render settings to TRUE, then you'll get a message EVMSG_RAYTRACER_FINISHED at a much later time, however even then the render thread needs a couple more milliseconds to exit.

The only reliable way is to set a (global) finished flag either in VideoPost::Execute() or EVMSG_RAYTRACER_FINISHED (better) and then periodically check (using a timer in a message plugin) if the rendering is done (calling CheckIsRunning()). It also would be possible to just surveil CheckIsRunning() in a message plugin.

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

On 11/08/2012 at 08:36, xxxxxxxx wrote:

Super duper - it works! 😄

Thanks Yannick - you saved my life Handshake