SOLVED Creating my own color preferences

Hi everyone,

I'm trying to add my own color preferences and add them to the "Scheme Colors" section in the Cinema 4D preferences, similarly to what Hair does.

To do so, I successfully add and register a PrefsDialogObject. I used a description similar to the Hair one in prefshaircolor.res/prefshaircolor.h and it displays fine. The implementation is based on an earlier thread from the forum (and a bit of prior experience): https://plugincafe.maxon.net/topic/11737/default-startup-settings/4

It works pretty much fine, the preferences show up in the right place and I am able to control the colors in the list view the same way it works in all the other color preferences. I even added that "Reset..." button. The only problem is that the data in the ListViewData element does not appear to be restored properly when Cinema 4D starts up again. I tried other data types like Int32 and those are brought over into a new session just fine.

When looking at the BaseContainer with my Plugins' settings I see that when I call BaseContainer::GetData() on it, the resulting GeData is of type DA_MISSINGPLUG, which to me looks like Cinema 4D is somehow not able to restore the data element from the preferences. It looks a little like that might be because the ListViewData custom datatype hasn't been registered when the preferences are restored?

However, I am assuming that the regular Cinema 4D color scheme preferences somehow store their setting and when loading the Hair preferences via HairLibrary::GetPrefsInstance(), I see the container it returns contains elements of type CUSTOMDATA_LISTVIEW (1018397), so it somehow must be possible to store values of that type in the preferences.

Did anybody run into similar problems before and can help me? I'm feel like I must be missing something trivial here.

Thanks in advance for any help!

Best
Timm

Hi @tdapper, the hair color preferences are automatically loaded from a file during C4DPL_STARTACTIVITY and saved within C4DPL_ENDACTIVITY, So you will need something similar for your plugin to properly serialize and load data.

If you still have issue, could you share your code, so we can have a look of what is wrong.
Thanks in advance,
Cheers,
Maxime.

Hi @tdapper, the hair color preferences are automatically loaded from a file during C4DPL_STARTACTIVITY and saved within C4DPL_ENDACTIVITY, So you will need something similar for your plugin to properly serialize and load data.

If you still have issue, could you share your code, so we can have a look of what is wrong.
Thanks in advance,
Cheers,
Maxime.

Hello @tdapper ,

Without any further questions, we will regard this topic as solved and flag it accordingly by Monday, September, the 8th.

Thank you for your understanding,
Ferdinand