Solved Knowing if C4D is actually rendering

In our Anima plugin we receive several calls to GetVirtualObjects and that's ok but we've found a issue, if I want to check if I'm in render right now I could use

HierarchyHelp *hh;
if (hh->GetBuildFlags() & A_INTERNAL_RENDERER || hh->GetBuildFlags() & A_EXTERNAL_RENDERER)
   rendering = true;

The problems is that I receive the same flag if I press 'C' (make editable) in my object and we'll need a different behaviour for rendering and make editable.

Is there any other tag I could check in the document or whatever?

Thank you in advance for any tip.

Hi @victor, sorry for the late reply, you can use CheckIsRunning, for this purpose.
Here a code sample from a Python Generator.

import c4d

# main == GetVirtualObject
def main():
    if c4d.CheckIsRunning(c4d.CHECKISRUNNING_EDITORRENDERING) or c4d.CheckIsRunning(c4d.CHECKISRUNNING_EXTERNALRENDERING):
        return c4d.BaseObject(c4d.Osphere)
    return c4d.BaseObject(c4d.Ocube)

Another option that will be more consistent is to listen to MSG_MULTI_RENDERNOTIFICATION which is a message sent to all BaseList2D of a scene, before and at the end of the rendering.

Cheers,
Maxime.

Hi @victor, sorry for the late reply, you can use CheckIsRunning, for this purpose.
Here a code sample from a Python Generator.

import c4d

# main == GetVirtualObject
def main():
    if c4d.CheckIsRunning(c4d.CHECKISRUNNING_EDITORRENDERING) or c4d.CheckIsRunning(c4d.CHECKISRUNNING_EXTERNALRENDERING):
        return c4d.BaseObject(c4d.Osphere)
    return c4d.BaseObject(c4d.Ocube)

Another option that will be more consistent is to listen to MSG_MULTI_RENDERNOTIFICATION which is a message sent to all BaseList2D of a scene, before and at the end of the rendering.

Cheers,
Maxime.

Hello @victor,

without any further questions, we will consider this topic as solved by Monday and flag it accordingly.

Thank you for your understanding,
Ferdinand

MAXON SDK Specialist
developers.maxon.net