<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to check if document is rendering?]]></title><description><![CDATA[<p dir="auto">Hello everyone,</p>
<p dir="auto">some objects like the Subdivision Surface or the Metaballs have different parameters to be applied if the document is rendering.</p>
<p dir="auto">Is there a way in python to check if the document is currently being rendered or not, to make if/else statements that only apply during rendering?</p>
]]></description><link>http://developers.maxon.net/forum/topic/13605/how-to-check-if-document-is-rendering</link><generator>RSS for Node</generator><lastBuildDate>Mon, 10 Aug 2026 17:27:26 GMT</lastBuildDate><atom:link href="http://developers.maxon.net/forum/topic/13605.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 15 Sep 2021 23:45:19 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to check if document is rendering? on Sat, 13 Jul 2024 11:41:08 GMT]]></title><description><![CDATA[<p dir="auto">Hey sorry for gravedigging.</p>
<p dir="auto">i have the problem that my tag plugin recognises the difference between rendering and not rendering. unfortunately it also always changes the state in the doc itself and not only in the doc that is rendered</p>
<p dir="auto"><img src="/forum/assets/uploads/files/1720870787719-6484d884-61c7-454c-a256-0f1167238772-grafik.png" alt="grafik.png" class=" img-fluid img-markdown" /></p>
]]></description><link>http://developers.maxon.net/forum/post/74569</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/74569</guid><dc:creator><![CDATA[pyr]]></dc:creator><pubDate>Sat, 13 Jul 2024 11:41:08 GMT</pubDate></item><item><title><![CDATA[Reply to How to check if document is rendering? on Thu, 16 Sep 2021 12:19:51 GMT]]></title><description><![CDATA[<p dir="auto">Thanks Ferdinand,</p>
<p dir="auto"><em>"if it does run, it runs ;)"</em></p>
<p dir="auto">Haha, that's my motto.</p>
<p dir="auto">In this case I'm doing a brute-force script for a specific 1-time use, I'm sure it won't pass the test of approval. But if I see a sign of problem I'll fall-back to other solutions.</p>
<p dir="auto">It seems to work well and I'll keep that solution for future uses.<br />
Thanks again. <img src="http://developers.maxon.net/forum/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=0b8ddba251d" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:23px;width:auto;vertical-align:middle" title=":)" alt="🙂" /></p>
]]></description><link>http://developers.maxon.net/forum/post/67680</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/67680</guid><dc:creator><![CDATA[orestiskon]]></dc:creator><pubDate>Thu, 16 Sep 2021 12:19:51 GMT</pubDate></item><item><title><![CDATA[Reply to How to check if document is rendering? on Thu, 16 Sep 2021 10:45:13 GMT]]></title><description><![CDATA[<p dir="auto">Hey <a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/orestiskon">@<bdi>orestiskon</bdi></a>,</p>
<p dir="auto">no worries, was no hassle for me.</p>
<blockquote>
<p dir="auto">and it seems to work. You mentioned that I couldn't affect other objects, but I guess in this case it's ok?</p>
</blockquote>
<p dir="auto">Hard to say because I still do not know what you are doing specifically, but if it does run, it runs <img src="http://developers.maxon.net/forum/assets/plugins/nodebb-plugin-emoji/emoji/android/1f609.png?v=0b8ddba251d" class="not-responsive emoji emoji-android emoji--wink" style="height:23px;width:auto;vertical-align:middle" title=";)" alt="😉" /> It would be best if you would share your setup and/code if you want an assessment on if what you are doing can lead to problems. In general, there is not much which can go wrong with <code>CheckIsRunning</code> on a technical level, it is just that when you want for example drive the color of a shader (which you have not implemented yourself) in this way, you will run into obstacles in Python, not necessarily unsolvable ones, but still obstacles.</p>
<p dir="auto">I really cannot say much more than that without the concrete thing you are trying to achieve.</p>
<p dir="auto">Cheers,<br />
Ferdinand</p>
]]></description><link>http://developers.maxon.net/forum/post/67668</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/67668</guid><dc:creator><![CDATA[ferdinand]]></dc:creator><pubDate>Thu, 16 Sep 2021 10:45:13 GMT</pubDate></item><item><title><![CDATA[Reply to How to check if document is rendering? on Thu, 16 Sep 2021 10:08:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/ferdinand">@<bdi>ferdinand</bdi></a> Hey Ferdinand, thanks for the elaborate reply.</p>
<p dir="auto">I didn't mean to put you through all of this work, I was literally searching for an "if rendering" statement. I'm trying to use a python expression tag, and only run a line of the code if it's rendering externally (picture viewer or render queue) .</p>
<p dir="auto">Based on your solution, I tried:</p>
<pre><code>value = 10
if c4d.CheckIsRunning(c4d.CHECKISRUNNING_EXTERNALRENDERING):
    value = 20
</code></pre>
<p dir="auto">and it seems to work. You mentioned that I couldn't affect other objects but I guess in this case it's ok?</p>
]]></description><link>http://developers.maxon.net/forum/post/67666</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/67666</guid><dc:creator><![CDATA[orestiskon]]></dc:creator><pubDate>Thu, 16 Sep 2021 10:08:24 GMT</pubDate></item><item><title><![CDATA[Reply to How to check if document is rendering? on Thu, 16 Sep 2021 09:01:46 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/orestiskon">@<bdi>orestiskon</bdi></a>,</p>
<p dir="auto">thank you for reaching out to us. Please remember to add the required tags to your posting as lined out in the <a href="https://plugincafe.maxon.net/guidlines_cp" target="_blank" rel="noopener noreferrer nofollow ugc">Forum Guidelines</a>, most notably the tags and the information on what plugin interface you are implementing. I am going to assume here Python and S24/R25 for the tag information.</p>
<p dir="auto">About your question: The answer to that heavily depends on what you are trying to do precisely, as you do not make clear if you are implementing your own node and want to change its behavior on rendering or want to change the behavior of other nodes which are not being implemented by you.</p>
<p dir="auto">Generally, there are two relevant bits of the Python SDK for this topic: The function <a href="https://developers.maxon.net/docs/py/2023_2/modules/c4d/index.html?#c4d.CheckIsRunning" target="_blank" rel="noopener noreferrer nofollow ugc">c4d.CheckIsRunning()</a> and the node message <a href="https://developers.maxon.net/docs/py/2023_2/consts/MSG_PLUGINS.html?highlight=c4d%20msg_multi_rendernotification#msg-multi-rendernotification-plugins" target="_blank" rel="noopener noreferrer nofollow ugc">c4d.MSG_MULTI_RENDERNOTIFICATION</a>. Both convey information about a rendering status. There are however multiple rendering types (internal, external, interactive) and one must mix both approaches in some cases to cover all of them. For an <code>ObjectData</code> plugin, i.e., the case that you implement your own node, I have provided a pattern below. For the other case things will get more complicated because you would then have to hook into the specific parameter set an arbitrary other node can have. This can be solved via implementing a <code>TagData</code> plugin for <code>BaseObjects</code> targeted in such fashion in Python, although this would probably be quite a bit of work. Driving in such external fashion shader, materials and other node types will be very hard or even impossible in Python, because for that you would truly need <code>SceneHookData</code> which are not available in Python.</p>
<p dir="auto">The example below is a Python generator object which acts as a cube while in the editor and as a sphere when being rendered.</p>
<p dir="auto">I hope this helps and cheers,<br />
Ferdinand</p>
<p dir="auto">The file: <a href="https://developers.maxon.net/forum/assets/uploads/files/1631782879897-render_cube_sphere.c4d" target="_blank" rel="noopener noreferrer nofollow ugc">render_cube_sphere.c4d</a><br />
The result:<br />
<img src="https://developers.maxon.net/forum/assets/uploads/files/1631782889732-render_cube_sphere.gif" alt="render_cube_sphere.gif" class=" img-fluid img-markdown" /><br />
The code:</p>
<pre><code>"""The example below is for a Python generator object which acts as a cube 
while in the editor and as a sphere when being rendered.

As discussed in:
    https://developers.maxon.net/forum/topic/13605/

"""
import c4d

# A boolean parameter we use to store the current rendering for the node.
ID_IS_EDITOR_RENDERING = (c4d.ID_USERDATA, 1)

def message(mid, mdata):
    """Processes messages send to the node.
    
    Used here to react to the MSG_MULTI_RENDERNOTIFICATION message.
    
    Args:
        mid (int): The message id
        mdata (any): The message data (in case of RENDERNOTIFICATION a dict)
    """
    # The render notification for an editor rendering does come in a pair. One
    # for the start of the rendering and one for the end. We set our object
    # parameter ID_IS_EDITOR_RENDERING to the value that message data to be
    # used later in the cache building.

    if mid == c4d.MSG_MULTI_RENDERNOTIFICATION and isinstance(mdata, dict):
        # Set the render flag parameter we did attach to our generator with
        # the start field of the message data.
        op[ID_IS_EDITOR_RENDERING] = mdata.get("start", False)

def main():
    """Provides the cache for the generator.
    """
    is_render = (op[ID_IS_EDITOR_RENDERING] or
                 c4d.CheckIsRunning(c4d.CHECKISRUNNING_EXTERNALRENDERING) or
                 c4d.CheckIsRunning(c4d.CHECKISRUNNING_INTERACTIVERENDERING))

    # Return a sphere while rendering.
    if is_render:
        return c4d.BaseObject(c4d.Osphere)
    # Or a cube while not.
    return c4d.BaseObject(c4d.Ocube)
</code></pre>
]]></description><link>http://developers.maxon.net/forum/post/67665</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/67665</guid><dc:creator><![CDATA[ferdinand]]></dc:creator><pubDate>Thu, 16 Sep 2021 09:01:46 GMT</pubDate></item></channel></rss>