Solved Reusing customGUI in different plugins

I have created a custom GUI which I am using in the Attribute Manager.
No problems there.

I am registering the custom gadget using following piece of code:

Bool RegisterMyGadgetDataTypeGui()
	static BaseCustomGuiLib myMyGadgetGUIlib;

	ClearMem(&myMyGadgetGUIlib, sizeof(myMyGadgetGUIlib));

	// register the custom gadget as version (= 1000)
	if (!InstallLibrary(MYGADGET_CUSTOMGUI_PLUGINID, &myMyGadgetGUIlib, 1000, sizeof(myMyGadgetGUIlib)))
		return false;

	if (!RegisterCustomGuiPlugin(GeLoadString(IDS_MYGADGETCUSTOMGUISTRING), 0, NewObjClear(MyGadgetCustomGUI)))
		return false;

	return true;

Now, I was wondering, since this is registered inside a plugin, what if I want to reuse this gadget in a different plugin project?
Do I simply copy over the source code for this gadget and perform the same registration call, using the same pluginID?
I understand that MyGadgetCustomGUI - which is derived from CustomGuiData - only needs to be registered once in a Cinema 4D session. But how to know if one or more plugins are installed which want to use the same custom GUI, and thus only one of these plugins should register the custom GUI?
Is there a manual, or detailed documentation available discussing this topic?

I did a search on "library" and all I could find was IsLibraryInstalled(Int32 id) , which makes me assume I should check in every plugin for the particular custom GUI library, and only install the library of not already installed. But then? Should I still perform the RegisterCustomGuiPlugin for this custom gadget, in every plugin?


while RegisterCustomGuiPlugin could be called in all your plugins, the issue is that you will have a message in the console indicating that the id is already used / in conflict.

So you can check, as you stated, if the library is already installed with IsLibraryInstalled or using FindPlugin and only register and install the library if you find nothing.

The load order here should not be a problem as all modules should be loaded before you need to call anything related to the UI.

FindCustomDataTypePlugin or FindResourceDataTypePlugin


MAXON SDK Specialist

MAXON Registered Developer