<?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[2024 NodeData Init isCloneInit argument for older version]]></title><description><![CDATA[<p dir="auto">Hello!<br />
In R2024 for NodeData plugins <strong>Init</strong> method now requires <a href="https://developers.maxon.net/docs/py/2024_0_0a/modules/c4d.plugins/BaseData/NodeData/index.html?highlight=iscloneinit#NodeData.Init" target="_blank" rel="noopener noreferrer nofollow ugc">isCloneInit</a> argument. But now, after code changing, older versions gives an error:</p>
<pre><code>TypeError: Init() takes exactly 3 arguments (2 given)
</code></pre>
<p dir="auto">Is there a way to make this new code feature compatible with older Cinema 4D versions? Now I have to create two pypv files: <strong>up_to_2024.pypv</strong> and <strong>2024_and_after.pypv</strong>. Which is not convinient for developement obviously.<br />
Thank you!</p>
]]></description><link>http://developers.maxon.net/forum/topic/15168/2024-nodedata-init-iscloneinit-argument-for-older-version</link><generator>RSS for Node</generator><lastBuildDate>Sun, 17 May 2026 05:47:21 GMT</lastBuildDate><atom:link href="http://developers.maxon.net/forum/topic/15168.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 08 Nov 2023 10:43:25 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to 2024 NodeData Init isCloneInit argument for older version on Wed, 08 Nov 2023 18:42:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/baca">@<bdi>baca</bdi></a> Thank you! Works like a charm!</p>
]]></description><link>http://developers.maxon.net/forum/post/72961</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/72961</guid><dc:creator><![CDATA[mikeudin]]></dc:creator><pubDate>Wed, 08 Nov 2023 18:42:24 GMT</pubDate></item><item><title><![CDATA[Reply to 2024 NodeData Init isCloneInit argument for older version on Wed, 08 Nov 2023 17:21:19 GMT]]></title><description><![CDATA[<p dir="auto">Hey <a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/mikeudin">@<bdi>mikeudin</bdi></a>,</p>
<p dir="auto">Thank you for reaching out to us. <a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/baca">@<bdi>baca</bdi></a> is right, default values are an elegant way to achieve signature overloading in Python. In cases where this does not suffice, you can also make use of the fact that everything is an object in Python, which means syntax akin to a preprocessor macro will work in Python.</p>
<pre><code class="language-py">"""Realizes a class with a method Bar which has a different number of arguments and output depending
on a global constant, here the version of Cinema 4D.

This makes use of the fact that functions are first class objects in Python. While Python has no
function overloading in the strict sense, we can simply attach functions based on context. We could
even do this at runtime based on a non-constant value.
"""

import c4d

class Foo:
    """Implements Foo.Bar differently based on the version of Cinema 4D.
    """
    if c4d.GetC4DVersion() &gt;= 2024000:
        def Bar(self, arg1: int, arg2: bool) -&gt; None:
            print ("NEW", arg1, arg2)
    else:
        def Bar(self, arg1: int) -&gt; None:
            print ("OLD", arg1)

# Calls Foo.Bar. The version guard is only here so that this example can be run in all versions of
# Cinema without throwing an error (as the number of arguments changed).
if c4d.GetC4DVersion() &gt;= 2024000:
    Foo().Bar(42, True)
else:
    Foo().Bar(42)
</code></pre>
<p dir="auto"><code>2024.0.0</code> and higher will run the two argument version and print <code>NEW 42 True</code>, everything else will run the other version and print <code>OLD 42</code>.</p>
<p dir="auto">Cheers,<br />
Ferdinand</p>
]]></description><link>http://developers.maxon.net/forum/post/72959</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/72959</guid><dc:creator><![CDATA[ferdinand]]></dc:creator><pubDate>Wed, 08 Nov 2023 17:21:19 GMT</pubDate></item><item><title><![CDATA[Reply to 2024 NodeData Init isCloneInit argument for older version on Wed, 08 Nov 2023 13:57:14 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/mikeudin">@<bdi>mikeudin</bdi></a>,</p>
<p dir="auto">I changed my python plugins to</p>
<pre><code>def Init(self, op, isCloneInit=False):
</code></pre>
<p dir="auto">So in older versions of Cinema4D it supposed to act as it act before</p>
]]></description><link>http://developers.maxon.net/forum/post/72951</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/72951</guid><dc:creator><![CDATA[baca]]></dc:creator><pubDate>Wed, 08 Nov 2023 13:57:14 GMT</pubDate></item></channel></rss>