Detecting render state in a scenehook

On 03/03/2013 at 11:23, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   12-14 
Platform:   Windows  ; Mac  ;  Mac OSX  ; 
Language(s) :     C++  ;


I am struggling with getting the information if my current SceneHookData::Execute() call is done from within a rendering or not.

The passed execution flags contain a bit named "_Render" but it is never set.
I also cannot use CheckIsRunning because it returns true when e.g. the editor scene hook is called and there is a rendering running in the picture viewer.

So I am wondering how to get this bit of information in the aforementioned execute function?

Thank you iA

On 06/03/2013 at 05:47, xxxxxxxx wrote:

Anyone an idea? I really am in need of finding a solution for this.. :frowning2:

On 06/03/2013 at 06:19, xxxxxxxx wrote:

reminds me
sorry, miss your notification...

On 06/03/2013 at 06:25, xxxxxxxx wrote:

Are you not able to check the different rendering types ala:

else if (CheckIsRunning(CHECKISRUNNING_EDITORRENDERING)) // do that

On 06/03/2013 at 06:33, xxxxxxxx wrote:

Originally posted by xxxxxxxx

Are you not able to check the different rendering types ala:

else if (CheckIsRunning(CHECKISRUNNING_EDITORRENDERING)) // do that


thanks but unfortunately not, because that's not the issue.

For example: If the user clicks to render to the picture viewer and the render scenehook execute() is called and CheckIsRunning returns true. Now due to the click of the user the editor scene hook execute() is also called and CheckIsRunning is then true too. So there is no way to identify which code should now be called, the one for rendering or for editor. Editor rendering is of no relevance as it is either running or the user is working. In any case my code will call the editor code. But with a running renderer I don't know where my scene hook is called from currently (which would be no problem if the render flag would be set 🙂 ).

On 06/03/2013 at 07:06, xxxxxxxx wrote:

Hi Katachi,

MSG_MULTI_RENDERNOTIFICATION is sent to each node in the document before rendering. You can
catch this message and set a flag in your node.

Bool MySceneHook::Message(GeListNode\* node, LONG msgType, void\* pData) {
    switch (msgType) {
        auto data = static_cast<RenderNotificationData\*>(pData);
        this->rendering = TRUE;
        this->external = data->external;

    return SceneHookData::Message(node, msgType, pData);


On 06/03/2013 at 07:09, xxxxxxxx wrote:

excellent idea Niklas. Thanks!

On 06/03/2013 at 07:24, xxxxxxxx wrote:

For completeness: works just fine.

On 06/03/2013 at 10:44, xxxxxxxx wrote:

I was half-awake so that was my only consideration but Niklas got it exactly.  If only I had a brain. 🙂

Best of luck on whatever you're doing Samir!

On 07/03/2013 at 07:18, xxxxxxxx wrote:

hehe 🙂 thanks Robert.