CustomGUI in description

On 21/02/2018 at 01:25, xxxxxxxx wrote:

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


I need to write a new CustomGUI that will go in a description resource for the attribute manager, NOT into a dialog. I can see from the SDK example how to use iCustomGui and iCustomDataType, which I assume is what I need, but the example uses dialogs and I can't see how to add the GUI to a description.

Is this also how it's done for descriptions (i.e. using a GeUserArea in a dialog in a description - seems sort of odd), or is it some different method altogether? I could really use a pointer on how to get started, not having done this before.



On 21/02/2018 at 02:15, xxxxxxxx wrote:

To use the custom GUI in a description you'll need to use CustomGuiData (which you pass your iCustomGui) to. You can see an example of this here.

You'd still need to use it with an existing datatype i.e.


You can also create a custom datatype with iCustomDataType and register that with CustomDataType.

And then do something like


Definitely take a look at this, specifically the CustomGUI section.
Hopefully that helps you get started :-)

On 21/02/2018 at 04:34, xxxxxxxx wrote:

Thank you, that's very helpful. I'll give it a try and see how I get on.


On 21/02/2018 at 05:55, xxxxxxxx wrote:

Hm, not getting very far with this. I have the SDK examples built and installed, and this should have a custom GUI which returns the resource symbol 'CUSTOMGUISTRING'. It's base datatype is DTYPE_STRING, so if I understand it correctly, I should be able to to do this in my description resource:


But trying that just gives a resource error when the object using the resource is created. What am I missing?


On 21/02/2018 at 06:30, xxxxxxxx wrote:

NVM, I've got the custom gui dots example from the R18 SDK working fine in my description, so I can work from there. Thanks again for your help, much appreciated.

On 22/02/2018 at 03:07, xxxxxxxx wrote:

Hi Steve,

You can find information on descriptions and custom GUIs inside these 2 manuals:
Description Manual
Description Settings Manual

On 22/02/2018 at 04:33, xxxxxxxx wrote:

Thanks Yannick. Those are both helpful. The problem I find with custom guis is that the information is scattered around various places and not easy to find. The SDK example (the dots one) is extremely useful but it doesn't answer all questions.

For example, I can add a custom property to my custom gui as an integer value - call it NUM_SWITCHES. Then unless I'm completely off track I think I can use that in the resource file like so:


But I can't see how to retrieve the value of NUM_SWITCHES in my code. It's that sort of thing that the docs and examples don't quite cover.

If anyone at MAXON is looking for a topic to add to the developer blogroll, custom guis would be a great one to do.


On 23/02/2018 at 08:28, xxxxxxxx wrote:

Hi Steve,

If you define a NUM_SWITCHES property for a custom GUI:

CustomProperty mycustomgui_properties[] =
  {CUSTOMTYPE_END, 0, nullptr }

Returns mycustomgui_properties in the override of CustomDataTypeClass::GetProperties() and CustomGuiData::GetProperties().
With the definition of a member in the custom GUI class:

class MyCustomGui : public iBaseCustomGui
  INSTANCEOF(MyCustomGui, iBaseCustomGui)
  Int32 _numSwitches;

Then retrieve  _NUM_SWITCHES  _property value in the custom GUI constructor with the settings container:

MyCustomGui::MyCustomGui(const BaseContainer &settings, CUSTOMGUIPLUGIN *plugin) : iBaseCustomGui(settings, plugin)
  _numSwitches = settings.GetInt32(MYCUSTOMGUI_NUM_SWITCHES);

Thanks for the feedback. It will help us improve the custom GUI examples.

For quite some time now we decided to improve the C++ SDK documentation with manuals instead of posting blog articles.

On 24/02/2018 at 00:39, xxxxxxxx wrote:

This is great stuff Yannick, thanks! Sorry but I have two more questions since you're here :-)

First, how would I go about adding a property like a CYCLE or ACCEPT property - which can be followed by a list of ID values? None of the custom types seem to fit for this.

Second, once I get my custom data type working, I'm wondering how to access it from another plugin. So for example, if I add a gradient custom gui to a resource I can access it from code like so:

Gradient *grad = (Gradient* )bc->GetCustomDataType (MY_GRADIENT, CUSTOMDATATYPE_GRADIENT);   

I assumed that it was a CustomDataTypeClass that would be returned, so if I had this code snippet:

class MyCustomData : public CustomDataTypeClass   
Int32 MyCustomData::GetId()   
    return MYCUSTOMDATA_ID;    // unique ID   
// plus other functions of course   

Then in a plugin hosting my custom gui I tried this:

MyCustomData *mcd = (MyCustomData* )bc->GetCustomDataType(MY_CUSTOMGUI, MYCUSTOMDATA_ID);   
// where MY_CUSTOMGUI is the resource ID for custom gui   

But it always returns a null pointer. Is this correct or is GetCustomDataType() trying to find the wrong thing?



On 28/02/2018 at 08:52, xxxxxxxx wrote:


attributes like "CYCLE" and "ACCEPT" are hard-coded in the Cinema 4D core and not implemented using the plugin infrastructure. So I'm afraid it is not possible to implement something similar in a custom data type.

To have access to internal data of another plugin, this plugin must expose internal data in the form of a public API. Such a public API is created using the library system. See Creating Libraries. Or look at the source of any existing custom data type in the c4d_customgui folder of your cinema.framework.

When you register your custom GUI you call InstallLibrary(). You can use that library to define functions that give access to internal data and thus your data type. Creating such a library is quite an advanced and complex topic.

best wishes,