<?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[CommandData Plugin with submenu]]></title><description><![CDATA[<p dir="auto"><em>On 28/08/2018 at 02:32, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">Hi there,</p>
<p dir="auto">i'm failing to get a submenu with a commanddata plugin...<br />
could anybody more experienced maybe have a look at this code?</p>
<p dir="auto">best, index</p>
<p dir="auto">my folder structure is:<br />
plugins<br />
Test<br />
test.pyp<br />
icon.png</p>
<p dir="auto">what i would like to get in the plugin menu is:<br />
Plugins<br />
Test Plugin<br />
Submenu1<br />
Submenu2</p>
<p dir="auto">but what i get with the following code is just: (no submenu!)<br />
Plugins<br />
Test</p>
<p dir="auto">import c4d<br />
from c4d import bitmaps<br />
import os.path</p>
<p dir="auto">PLUGIN_ID = 1234567  # unique ID (obtained from <a href="http://www.plugincafe.com" target="_blank" rel="noopener noreferrer nofollow ugc">www.plugincafe.com</a>)<br />
PLUGIN_SHORT = "Test Plugin"</p>
<p dir="auto">MENUID_SUB1 = 1000<br />
MENUID_SUB2 = 1010</p>
<p dir="auto">class MenuHandler(c4d.plugins.CommandData) :</p>
<pre><code>def Register(self) :
	bmp = bitmaps.BaseBitmap()
	dir, f = os.path.split(\__file\_\_)
	fn = os.path.join(dir, "icon.png")
	bmp.InitWith(fn)
	return c4d.plugins.RegisterCommandPlugin(
		id=PLUGIN_ID,
		str=PLUGIN_SHORT,
		info=c4d.PLUGINFLAG_COMMAND_HOTKEY,
		icon=bmp,
		help="",
		dat=self
	)


def GetSubContainer(self, doc, submenu) :
	bc = c4d.BaseContainer()
	bc.SetString(1, PLUGIN_SHORT)
	bc.SetString(MENUID_SUB1, "Submenu1")
	bc.SetString(MENUID_SUB2, "Submenu2")
	submenu.InsData(0, bc)
	return True


def ExecuteSubID(self, doc, id) :
	if id == MENUID_SUB1: print "Submenu1"
	elif id == MENUID_SUB2: print "Submenu2"
	return True


def Execute(self, doc) :
	return True
</code></pre>
<p dir="auto">if __name__ == "__main__":<br />
MenuHandler().Register()</p>
]]></description><link>http://developers.maxon.net/forum/topic/10938/14398_commanddata-plugin-with-submenu</link><generator>RSS for Node</generator><lastBuildDate>Wed, 13 May 2026 03:39:21 GMT</lastBuildDate><atom:link href="http://developers.maxon.net/forum/topic/10938.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 01 Sep 2018 10:59:43 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to CommandData Plugin with submenu on Sat, 01 Sep 2018 11:00:00 GMT]]></title><description><![CDATA[<p dir="auto"><em>On 31/08/2018 at 00:22, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">Your workaround with a popup dialog sounds too hacky to me.</p>
<p dir="auto">The command can be registered with c4d.PLUGINFLAG_HIDEPLUGINMENU flag (plugin won't be shown in "Plugins" menu).<br />
Then manually add the command to any other menu/command palette with "Customize Commands" and "Customize Menu". The menu structure returned by the command's GetSubContainer() should be dynamically added as expected.</p>
<p dir="auto">Note it is possible to customize the Cinema menu by code from a plugin.</p>
<p dir="auto">If you have questions related to another subject, please create a new thread.</p>
]]></description><link>http://developers.maxon.net/forum/post/55520</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/55520</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 11:00:00 GMT</pubDate></item><item><title><![CDATA[Reply to CommandData Plugin with submenu on Sat, 01 Sep 2018 10:59:57 GMT]]></title><description><![CDATA[<p dir="auto"><em>On 30/08/2018 at 14:58, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">a followup question to the post above:</p>
<p dir="auto">ShowPopupDialog() has these flags <br />
c4d.POPUP_ALLOWUNDOCK<br />
c4d.POPUP_ALLOWUNDOCK_REC</p>
<p dir="auto"><a href="https://developers.maxon.net/docs/py/2023_2/modules/c4d.gui/index.html?highlight=first_popup_id#c4d.gui.ShowPopupDialog" target="_blank" rel="noopener noreferrer nofollow ugc">https://developers.maxon.net/docs/py/2023_2/modules/c4d.gui/index.html?highlight=first_popup_id#c4d.gui.ShowPopupDialog</a></p>
<p dir="auto">what are these for?<br />
i was hoping that you get a drag off handle, <br />
but i cant see anything happen if i use these flags</p>
<p dir="auto">is there a way to make a PopupDialog sticky?<br />
or can i create a palette containing my command?</p>
<p dir="auto">best index</p>
]]></description><link>http://developers.maxon.net/forum/post/55519</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/55519</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:59:57 GMT</pubDate></item><item><title><![CDATA[Reply to CommandData Plugin with submenu on Sat, 01 Sep 2018 10:59:54 GMT]]></title><description><![CDATA[<p dir="auto"><em>On 30/08/2018 at 03:36, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">thanks yannick,</p>
<p dir="auto">i actually had that idea this morning, but couldnt make it work</p>
<p dir="auto">i added a 2nd pyp to the plugin with c4d.PLUGINFLAG_HIDEPLUGINMENU<br />
but the main pyp didnt show its submenu then</p>
<p dir="auto">are you sure this works?<br />
(maybe i dont understand correctly)<br />
it also needs a bogus plugin id, which is a bit odd, right?</p>
<p dir="auto">another approach i'm trying is:<br />
generate a PopupDialog and show it with ShowPopupDialog when the menu is selected (works already)<br />
but i would also like to be able to have a drag off window with the (main) menu items as buttons<br />
that could be generated by opt-selecting the menu (any tips on how to create such a window?)</p>
<p dir="auto">best index</p>
]]></description><link>http://developers.maxon.net/forum/post/55518</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/55518</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:59:54 GMT</pubDate></item><item><title><![CDATA[Reply to CommandData Plugin with submenu on Sat, 01 Sep 2018 10:59:51 GMT]]></title><description><![CDATA[<p dir="auto"><em>On 30/08/2018 at 03:03, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">Hi,</p>
<p dir="auto">Sorry for the late answer.</p>
<p dir="auto">There are limitations with GetSubContainer() and the "Plugins" menu.<br />
If there is only one plugin registered then its menu structure returned by GetSubContainer() is not taken into account. But if the plugin is added to another menu then it is shown as expected.</p>
<p dir="auto">So the solution is to register a CommandData plugin with c4d.PLUGINFLAG_HIDEPLUGINMENU flag. Then the plugin can be added to any other menu either manually or with code using the menu functions in c4d.gui module.</p>
]]></description><link>http://developers.maxon.net/forum/post/55517</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/55517</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:59:51 GMT</pubDate></item><item><title><![CDATA[Reply to CommandData Plugin with submenu on Sat, 01 Sep 2018 10:59:48 GMT]]></title><description><![CDATA[<p dir="auto"><em>On 30/08/2018 at 01:17, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">no help here? <br />
i tried for hours, but still cant create a plugin <br />
with a sub menu to execute different actions<br />
<img src="http://developers.maxon.net/forum/assets/plugins/nodebb-plugin-emoji/emoji/android/1f615.png?v=0b8ddba251d" class="not-responsive emoji emoji-android emoji--confused" style="height:23px;width:auto;vertical-align:middle" title=":/" alt="😕" /></p>
]]></description><link>http://developers.maxon.net/forum/post/55516</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/55516</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:59:48 GMT</pubDate></item><item><title><![CDATA[Reply to CommandData Plugin with submenu on Sat, 01 Sep 2018 10:59:45 GMT]]></title><description><![CDATA[<p dir="auto"><em>On 29/08/2018 at 00:03, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">strange!<br />
if i add a copy of this source in the same plugin folder <br />
then i get two plugin entries, both with the two desired submenus:</p>
<p dir="auto">folder structure:<br />
plugins<br />
Test<br />
test1.pyp<br />
test2.pyp<br />
icon.png<br />
now i get:<br />
Plugins<br />
Test<br />
Test1 Plugin<br />
Submenu1<br />
Submenu2<br />
Test2 Plugin<br />
Submenu1<br />
Submenu2</p>
<p dir="auto">but if i remove one pyp,<br />
the remaining one does not show the submenus!<br />
how can i use only one pyp and show a submenu?</p>
<p dir="auto">???</p>
]]></description><link>http://developers.maxon.net/forum/post/55515</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/55515</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:59:45 GMT</pubDate></item></channel></rss>