<?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 Execute a Modifier plugin in Expression priority]]></title><description><![CDATA[<p dir="auto">Hi,<br />
I have created a <strong>object modifier plugin</strong> and I want it to <strong>work once</strong> in <strong>priority  Expression 10</strong>, and then again in <strong>Generator 1</strong>. How can I make it work as expected?<br />
In the code, <strong>AddToExecution()</strong> and <strong>Execute()</strong> do not seem to work (the documentation states that switching priorities requires calling these two functions).</p>
<pre><code>import c4d
from c4d import plugins, bitmaps


PLUGIN_ID = 1000001

class S_Temp(plugins.ObjectData):


    def Execute(self, op, doc, bt, priority, flags) -&gt; int:
        print("Execute")
        return c4d.EXECUTIONRESULT_OK

    def AddToExecution(self, op, list) -&gt; bool:
        print("AddToExecution")
        return True


    def Init(self, node, isCloneInit: bool) -&gt; bool:
        self.InitAttr(node, c4d.BaseList2D, c4d.S_TEMP_POSEDTARGETS)
        self.InitAttr(node, c4d.BaseList2D, c4d.S_TEMP_POSEDSOURCEADD)
        self.InitAttr(node, c4d.PriorityData, c4d.S_TEMP_PRIORITY)

        if not isCloneInit:
            pridata = c4d.PriorityData()
            pridata.SetPriorityValue(c4d.PRIORITYVALUE_MODE, c4d.CYCLE_EXPRESSION)
            pridata.SetPriorityValue(c4d.PRIORITYVALUE_PRIORITY, 10)
            node[c4d.S_TEMP_PRIORITY] = pridata
        return True

    def ModifyObject(self, mod, doc, op, op_mg, mod_mg, lod, flags, thread):
        allp = [pos + c4d.Vector(0,100,0) for pos in op.GetAllPoints()]
        op.SetAllPoints(allp)
        op.Message(c4d.MSG_UPDATE)

        return True


if __name__ == '__main__':
    plugins.RegisterObjectPlugin(id=PLUGIN_ID, str="S_Temp", g=S_Temp, description="stemp", info=c4d.OBJECT_MODIFIER,
                                 icon=None)
</code></pre>
<p dir="auto">Here is the file of this plugin --&gt; <a href="/forum/assets/uploads/files/1743076325240-s_temp.zip">s_Temp.zip</a></p>
<p dir="auto">Thanks for any help!</p>
]]></description><link>http://developers.maxon.net/forum/topic/16137/how-to-execute-a-modifier-plugin-in-expression-priority</link><generator>RSS for Node</generator><lastBuildDate>Mon, 20 Apr 2026 19:36:21 GMT</lastBuildDate><atom:link href="http://developers.maxon.net/forum/topic/16137.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 27 Mar 2025 11:54:34 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to Execute a Modifier plugin in Expression priority on Mon, 14 Apr 2025 14:34:10 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/i_mazlov">@<bdi>i_mazlov</bdi></a> Thanks,it works!</p>
]]></description><link>http://developers.maxon.net/forum/post/76288</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/76288</guid><dc:creator><![CDATA[chuanzhen]]></dc:creator><pubDate>Mon, 14 Apr 2025 14:34:10 GMT</pubDate></item><item><title><![CDATA[Reply to How to Execute a Modifier plugin in Expression priority on Mon, 14 Apr 2025 08:49:56 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/chuanzhen">@<bdi>chuanzhen</bdi></a>,</p>
<p dir="auto">The issue you're seeing is because I misused the <a href="https://developers.maxon.net/docs/py/2025_2_0/modules/c4d.plugins/PriorityList/index.html#PriorityList.Add" target="_blank" rel="noopener noreferrer nofollow ugc">list.Add()</a> function in my previous example, sorry for that. Namely, the arguments are different, from how I used them. If you like to have priority "Expression 10", you'd need to use the following line:</p>
<pre><code class="language-python">list.Add(op, c4d.EXECUTIONPRIORITY_EXPRESSION + 10, c4d.EXECUTIONFLAGS_NONE)
</code></pre>
<p dir="auto">I've updated the script in my previous posting with the proper usage of the list.Add() function.</p>
<p dir="auto">Please refer to an adjacent thread regarding execution flags: <a href="https://developers.maxon.net/forum/topic/11296/priority-prioritydata-and-prioritylist" target="_blank" rel="noopener noreferrer nofollow ugc">Priority: PriorityData and PriorityList</a></p>
<p dir="auto">Cheers,<br />
Ilia</p>
]]></description><link>http://developers.maxon.net/forum/post/76284</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/76284</guid><dc:creator><![CDATA[i_mazlov]]></dc:creator><pubDate>Mon, 14 Apr 2025 08:49:56 GMT</pubDate></item><item><title><![CDATA[Reply to How to Execute a Modifier plugin in Expression priority on Wed, 09 Apr 2025 08:49:30 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/i_mazlov">@<bdi>i_mazlov</bdi></a> Thanks,in my code I found an error and directly used the value obtained from PRIORITYVALUEMYODE in the priority GUI to set the list The priority parameter in Add() is a low-level error.<br />
<strong>But</strong> there is still a problem. When I used your code and adjusted the priority of **Python tag*to <strong>expression 1</strong>, the calculation order did not execute as expected. Where exactly is the problem？<br />
My version is also 2025.2.0<br />
<img src="/forum/assets/uploads/files/1744188259235-aa3b604f-b0ba-49cc-8b40-6276b19dca35-image.png" alt="aa3b604f-b0ba-49cc-8b40-6276b19dca35-image.png" class=" img-fluid img-markdown" /><br />
<img src="/forum/assets/uploads/files/1744188469486-c438db28-6569-45f8-b1d8-82049db07a2b-image.png" alt="c438db28-6569-45f8-b1d8-82049db07a2b-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>http://developers.maxon.net/forum/post/76260</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/76260</guid><dc:creator><![CDATA[chuanzhen]]></dc:creator><pubDate>Wed, 09 Apr 2025 08:49:30 GMT</pubDate></item><item><title><![CDATA[Reply to How to Execute a Modifier plugin in Expression priority on Mon, 14 Apr 2025 08:51:26 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/chuanzhen">@<bdi>chuanzhen</bdi></a>,</p>
<p dir="auto">With the code snippet below and Cinema 4D 2025.2.0 I cannot reproduce your issue. Namely the python tag with Expression-0 and the object modifier with Expression-10 work as expected:<br />
<img src="/forum/assets/uploads/files/1744182056424-d6bc0ded-7a01-4ac0-8557-ac7b30b0600b-image.png" alt="d6bc0ded-7a01-4ac0-8557-ac7b30b0600b-image.png" class=" img-fluid img-markdown" /><br />
<img src="/forum/assets/uploads/files/1744182063055-c2f05105-1d54-4dbb-9b0d-885d0d7997b9-image.png" alt="c2f05105-1d54-4dbb-9b0d-885d0d7997b9-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Cheers,<br />
Ilia</p>
<p dir="auto">Python tag code:</p>
<pre><code class="language-python">import c4d
def main() -&gt; None:
    print('tag')
</code></pre>
<p dir="auto">stemp.pyp code:<br />
<strong>Upd 14/04/25:</strong> fixed the list.Add() function</p>
<pre><code class="language-python">import c4d
PLUGIN_ID = 1051592
class S_Temp(c4d.plugins.ObjectData):
    def Init(self, node, isCloneInit: bool) -&gt; bool:
        print('stemp-Init')
        return True
    
    def AddToExecution(self, op, list) -&gt; bool:
        print("stemp-AddToExecution")
        list.Add(op, c4d.EXECUTIONPRIORITY_EXPRESSION + 10, c4d.EXECUTIONFLAGS_NONE)
        return True
    
    def Execute(self, op, doc, bt, priority, flags) -&gt; int:
        print(f"stemp-Execute: {priority}")
        return c4d.EXECUTIONRESULT_OK

    def ModifyObject(self, mod, doc, op, op_mg, mod_mg, lod, flags, thread):
        print(f"stemp-ModifyObject: {op.GetName()}")
        allp = [pos + c4d.Vector(0, 100, 0) for pos in op.GetAllPoints()]
        op.SetAllPoints(allp)
        op.Message(c4d.MSG_UPDATE)
        return True

if __name__ == '__main__':
    c4d.plugins.RegisterObjectPlugin(
        id=PLUGIN_ID,
        str="S_Temp",
        g=S_Temp,
        description="stemp",
        info=c4d.OBJECT_MODIFIER | c4d.OBJECT_CALL_ADDEXECUTION,
        icon=None
    )
</code></pre>
]]></description><link>http://developers.maxon.net/forum/post/76257</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/76257</guid><dc:creator><![CDATA[i_mazlov]]></dc:creator><pubDate>Mon, 14 Apr 2025 08:51:26 GMT</pubDate></item><item><title><![CDATA[Reply to How to Execute a Modifier plugin in Expression priority on Wed, 09 Apr 2025 05:26:28 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/i_mazlov">@<bdi>i_mazlov</bdi></a> Thanks for reply!<br />
I added this flag and modified the content of <strong>AddToExecution()</strong>. <strong>Execute()</strong> was <strong>successfully called</strong>, but it did <strong>not</strong> run in the expected calculation order. In the image below, The <strong>Cube</strong> object has a <strong>Python tag</strong> with <strong>priority=expression 0</strong> and <strong>objectplugin</strong> with <strong>priority=expression 10</strong>. My expected work order should be <em><strong>python tag (priority=expression 0) -&gt; objectplugin (priority=expression 10)</strong></em>, but why is the actual running result <em><strong>objectplugin (priority=expression 10) -&gt;python tags (priority=expression 10)</strong></em><br />
<img src="/forum/assets/uploads/files/1744176113432-bd57c2f7-c340-4c85-a9f3-ed22600fbb19-image.png" alt="bd57c2f7-c340-4c85-a9f3-ed22600fbb19-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">my code:</p>
<pre><code>    def Execute(self, op, doc, bt, priority, flags) -&gt; int:

        print("Execute")
        return c4d.EXECUTIONRESULT_OK

    def AddToExecution(self, op, list) -&gt; bool:
        print("AddToExecution")
        mode = op[c4d.S_TEMP_PRIORITY].GetPriorityValue(c4d.PRIORITYVALUE_MODE)
        list.Add(op, mode,c4d.EXECUTIONFLAGS_NONE)
</code></pre>
]]></description><link>http://developers.maxon.net/forum/post/76256</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/76256</guid><dc:creator><![CDATA[chuanzhen]]></dc:creator><pubDate>Wed, 09 Apr 2025 05:26:28 GMT</pubDate></item><item><title><![CDATA[Reply to How to Execute a Modifier plugin in Expression priority on Tue, 08 Apr 2025 16:02:47 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/chuanzhen">@<bdi>chuanzhen</bdi></a>,</p>
<p dir="auto">Sorry for the late answer and thanks for providing a great explanation of your question with the code snippet and a sample plugin, highly appreciated!</p>
<p dir="auto">I suspect, the missing bit in your case is the <a href="https://developers.maxon.net/docs/py/2025_2_0/modules/c4d.plugins/index.html#c4d.plugins.RegisterObjectPlugin" target="_blank" rel="noopener noreferrer nofollow ugc">c4d.OBJECT_CALL_ADDEXECUTION</a> flag that you need to add for your object plugin registration function call.</p>
<p dir="auto">However, this will allow you to structure the sequence of calling the <a href="https://developers.maxon.net/docs/py/2025_2_0/modules/c4d.plugins/BaseData/NodeData/ObjectData/index.html#ObjectData.Execute" target="_blank" rel="noopener noreferrer nofollow ugc">Execute()</a> function. You cannot queue the execution of the <a href="https://developers.maxon.net/docs/py/2025_2_0/modules/c4d.plugins/BaseData/NodeData/ObjectData/index.html#ObjectData.ModifyObject" target="_blank" rel="noopener noreferrer nofollow ugc">ModifyObject()</a> function.</p>
<p dir="auto">Cheers,<br />
Ilia</p>
]]></description><link>http://developers.maxon.net/forum/post/76254</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/76254</guid><dc:creator><![CDATA[i_mazlov]]></dc:creator><pubDate>Tue, 08 Apr 2025 16:02:47 GMT</pubDate></item></channel></rss>