Hey @GillesKontrol,
as I said, the message MSG_MULTI_RENDERNOTIFICATION
is an atom/node message. So, there is no easy way for you to use it, since you do not implement a node.
You need either a plugin hook which derrives from NodeData
and therefore can implement NodeData::Message
or one of the scripting objects as for example the Python Generator object or the Python tag which implement a message
method (which is just a thin wrapper arround NodeData::Message
). See Python API: Message Manual for details on the message system.
Implementation-wise there is not really much to it, you just listen for the mesage and then look at the message data. Here is a very simple example in the context of a Python Generator object:
import c4d
import pprint
def main() -> c4d.BaseObject:
"""Irrelevant for the example.
"""
return c4d.BaseObject(c4d.Onull)
def message(mid: int, data: object) -> bool:
"""Called by Cinema 4D to convey events to the node.
"""
if mid == c4d.MSG_MULTI_RENDERNOTIFICATION:
print (f"Render event:\n{pprint.pformat(data)}")
return True
Scene file: render_notification.c4d
When I then first started a picture viewer rendering and then an editor rendering, the output has been as follows (note that only editor renderings have start and end events, PV renderings just end):
Render event:
{'animated': False,
'doc': <c4d.documents.BaseDocument object called with ID 110059 at 140163486535680>,
'external': True,
'render': <capsule object "render" at 0x7f7a5a944300>,
'start': False}
Render event:
{'animated': False,
'doc': <c4d.documents.BaseDocument object called with ID 110059 at 140163836713408>,
'external': False,
'render': <capsule object "render" at 0x7f7a6f294a00>,
'start': True}
Render event:
{'animated': False,
'doc': <c4d.documents.BaseDocument object called with ID 110059 at 140163836720896>,
'external': False,
'render': <capsule object "render" at 0x7f7a6f284d00>,
'start': False}
For more information about the event data I would suggest reading the links I have provided above. You can either place a dummy node in your scene which propagtes such information to a command data plugin, or just setup shop in a TagData
plugin or a Python scripting tag in the first place. I.e., you add a button to your tag and when the user presses that button, you execute your "command script". The actual TagData::Excute
method or the main
method of a Python tag would then remain an unused dummy implementation, just as in my little example. But just as in my example, you would then also have access to the node message stream.
Cheers,
Ferdinand