Plugins Menu ID

On 20/07/2014 at 15:20, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   R15 
Platform:   Windows  ;   Mac OSX  ; 
Language(s) :     C++  ;

---------
Thought the ID would be M_PLUGINS like the custom menu example that uses M_EDITOR.  Run through a few of the plugin ids in the symbols file but haven't found it.

Anyone know the id of the plugin menu off hand?

Ama

On 20/07/2014 at 16:20, xxxxxxxx wrote:

Just off the top of my head but if you do something like:

BaseContainer *pluginsMenu = SearchPluginMenuResource();    # Get 'Plugins' main menu resource
LONG *menuID = pluginsMenu->GetId();                        # Get id of menu basecontainer
GePrint(LongToString(menuID));

Or something along those lines you should be able to get the ID of the menu container..  I think it would have to be done inside the C4DPL_BUILDMENU pluginmessage..

On 21/07/2014 at 06:05, xxxxxxxx wrote:

It's IDS_EDITOR_PLUGINS and is inside the M_EDITOR menu container.

Best,
-Niklas

On 21/07/2014 at 06:13, xxxxxxxx wrote:

Thank you both!

Now that I have the menu I want to place my menu in the plugins list.  Right now I get the second index in the plugin menu container and insert after it ( the separator ).  Seems like this could be an issue in the future.  I could search for the separator and place after that but that is still making some bad assumptions.

Any ideas?

thank you,
Ama

On 21/07/2014 at 16:04, xxxxxxxx wrote:

Prob either search for the last thing in the menu container or search for the last separator ( whatever works ) and insert after that?

Heres how the SDK examples does the menu insert in Main.cpp ( in case its useful and you havent seen it ).  Theres also a good example somewhere in the python docs i cant find:

void EnhanceMainMenu(void)
{
	// do this only if necessary - otherwise the user will end up with dozens of menus!
  
	BaseContainer *bc = GetMenuResource(String("M_EDITOR"));
	if (!bc) return;
  
	// search for the most important menu entry. if present, the user has customized the settings
	// -> don't add menu again
	if (SearchMenuResource(bc,String("PLUGIN_CMD_1000472")))
		return;
  
	GeData *last = SearchPluginMenuResource();
  
	BaseContainer sc;
	sc.InsData(MENURESOURCE_SUBTITLE,String("SDK Test"));
	sc.InsData(MENURESOURCE_COMMAND,String("IDM_NEU")); // add C4D's new scene command to menu
	sc.InsData(MENURESOURCE_SEPERATOR,TRUE);
	sc.InsData(MENURESOURCE_COMMAND,String("PLUGIN_CMD_1000472")); // add ActiveObject dialog to menu
  
	if (last)
		bc->InsDataAfter(MENURESOURCE_STRING,sc,last);
	else // user killed plugin menu - add as last overall entry
		bc->InsData(MENURESOURCE_STRING,sc);
}
  
Bool PluginMessage(LONG id, void *data)
{
	switch (id)
	{
		case C4DPL_BUILDMENU:
		  //react to this message to dynamically enhance the menu
			EnhanceMainMenu();
			break;
	}
}

On 22/07/2014 at 00:17, xxxxxxxx wrote:

Originally posted by xxxxxxxx

Theres also a good example somewhere in the python docs i cant find:

The example in the Python documentation can be found at the page "Plugin Structure" and section "Enhancing the Main Menu".