06-22-2016, 03:59 PM
After some experimentation, it appears as though this might be a bug in the underlying AIMenu suite in the Illustrator SDK. No workaround is immediately coming to mind, but I did notice that if one plugin initially creates the menu group with the "mergeTop_" parameter set to false and a secondary plugin creates the (same) menu group with the "mergeTop_" parameter set to true then it works as expected.
If both set "mergeTop_" to true then obviously whichever plugin loads first will create the group as fully merged with the parent, which is not desired. However, if the first plugin to load sets it to false then a new group is created, and all subsequent plugins setting it to true cause them to merge with the parent (yielding the desired menu item layout).
This is sort of a nasty solution, but for now it's all I can think of. And I say it's nasty because all of your plugins (that you want to share this menu group) will need to message one another immediately before creating the group to see if one has already done it. If not, set mergeTop_ to false, otherwise set it to true. This sort of messaging can be accomplished pretty easily with the hdi::core::ThirdPartyPlugin class and its message() method (and other supporting methods).
If both set "mergeTop_" to true then obviously whichever plugin loads first will create the group as fully merged with the parent, which is not desired. However, if the first plugin to load sets it to false then a new group is created, and all subsequent plugins setting it to true cause them to merge with the parent (yielding the desired menu item layout).
This is sort of a nasty solution, but for now it's all I can think of. And I say it's nasty because all of your plugins (that you want to share this menu group) will need to message one another immediately before creating the group to see if one has already done it. If not, set mergeTop_ to false, otherwise set it to true. This sort of messaging can be accomplished pretty easily with the hdi::core::ThirdPartyPlugin class and its message() method (and other supporting methods).