<?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[C4D crashes when removing node via MSG_MENUPREPARE]]></title><description><![CDATA[<p dir="auto">What am I doing wrong? Need to remove the node under certain circumstances via MSG_MENUPREPARE but it crashes the C4D.<br />
Is it possible to somehow bypass this behavior? Is this a bug?</p>
<pre><code>
import c4d
import os


class OBug_Check(c4d.plugins.ObjectData):

    def Message(self, node, type, data):
        if type == c4d.MSG_MENUPREPARE:
            node.Remove()

        return True


if __name__ == "__main__":
    c4d.plugins.RegisterObjectPlugin(id=1000003,
                                     str="Bug Check",
                                     g=OBug_Check,
                                     description="OBug_Check",
                                     info=c4d.OBJECT_GENERATOR,
                                     icon=None)
</code></pre>
]]></description><link>http://developers.maxon.net/forum/topic/15375/c4d-crashes-when-removing-node-via-msg_menuprepare</link><generator>RSS for Node</generator><lastBuildDate>Tue, 16 Jun 2026 09:26:55 GMT</lastBuildDate><atom:link href="http://developers.maxon.net/forum/topic/15375.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 11 Feb 2024 17:16:51 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to C4D crashes when removing node via MSG_MENUPREPARE on Tue, 13 Feb 2024 13:49:20 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/merkvilson">@<bdi>merkvilson</bdi></a> I would say what you are trying to do is not well supported and MSG_MENUPREPARE was never designed for the current node to be removed.</p>
<p dir="auto">The correct way to do so, is to return <code>False</code> within your <a href="https://developers.maxon.net/docs/py/2024_0_0a/modules/c4d.plugins/BaseData/NodeData/index.html?highlight=nodedata#NodeData.Init" target="_blank" rel="noopener noreferrer nofollow ugc">NodeData.Init</a> method, this way the object is not created and therefor you do not have to remove it.</p>
<p dir="auto">Cheers,<br />
Maxime.</p>
]]></description><link>http://developers.maxon.net/forum/post/73760</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/73760</guid><dc:creator><![CDATA[m_adam]]></dc:creator><pubDate>Tue, 13 Feb 2024 13:49:20 GMT</pubDate></item><item><title><![CDATA[Reply to C4D crashes when removing node via MSG_MENUPREPARE on Sun, 11 Feb 2024 18:35:12 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/merkvilson">@<bdi>merkvilson</bdi></a> ,<br />
try to add check for main thread scope:</p>
<pre><code>    def Message(self, node, type, data):
        if c4d.threading.GeIsMainThread() and type == c4d.MSG_MENUPREPARE:
            node.Remove()
</code></pre>
]]></description><link>http://developers.maxon.net/forum/post/73736</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/73736</guid><dc:creator><![CDATA[baca]]></dc:creator><pubDate>Sun, 11 Feb 2024 18:35:12 GMT</pubDate></item></channel></rss>