Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    PrefsDialog

    Scheduled Pinned Locked Moved SDK Help
    5 Posts 0 Posters 401 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 23/10/2008 at 09:30, xxxxxxxx wrote:

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

      ---------
      Hi 🙂

      Can anyone help me? I created a PrefsDialog object for settings. But within PluginStart() i can't get the settings (only the default values).

      It seems, they are loaded after PluginStart(). Can I change it?

      Thanks and bye.

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 24/10/2008 at 02:59, xxxxxxxx wrote:

        This is working fine for me, see code below.

        > \> Bool PluginStart(void) \> { \>      if(!RegisterMyPrefs()) return FALSE; \> \>      BaseContainer wc = GetWorldContainer(); \>      BaseContainer \*bc = wc.GetContainerInstance(1023052); \> //prefs are stored in a subcontainer in the worldcontainer. the subcontainer has the same ID as the pref hook \> \>      if(!bc) return FALSE; \> \>      if(bc->GetBool(1000)) GePrint("set"); //a Bool element in my prefs \>      else GePrint("not set"); \> } \>

        here the code of the pref hook and dialog

        > \> #include "c4d.h" \> #include "c4d_symbols.h" \> \> #include "lib_prefs.h" \> \> \> #define MY_PREFS_ID 1023052 \> \> enum pref_ids \> { \>      PREFS_ITEM1 = 1000 \> }; \> \> class MyPrefsDialog : public PrefsDlg_Base \> { \>      public: \>           MyPrefsDialog(PrefsDialogHookClass\* hook) : PrefsDlg_Base(DLG_MY_PREFS, hook) { } \> \>           virtual void SetValues(BaseContainer \*data); \>           virtual void EnableValues(BaseContainer \*data); \>           virtual LONG CommandValues(LONG id, const BaseContainer &msg;, BaseContainer \*data); \> }; \> \> void MyPrefsDialog::SetValues(BaseContainer \*data) \> { \>      if(!data) return; \> \>      BaseContainer \*bc = data->GetContainerInstance(MY_PREFS_ID); \>      if(!bc) return; \> \>      SetBool(MY_PREFS_ITEM1, bc, PREFS_ITEM1); \> } \> \> void MyPrefsDialog::EnableValues(BaseContainer \*data) \> { \>      if(!data) return; \> } \> \> LONG MyPrefsDialog::CommandValues(LONG id, const BaseContainer &msg;, BaseContainer \*data) \> { \>      BaseContainer \*bc = data->GetContainerInstance(MY_PREFS_ID); \>      if(!bc) return FALSE; \> \>      switch(id) \>      { \>           case MY_PREFS_ITEM1: GetBool(id, bc, PREFS_ITEM1); break; \>      } \>       \>      return TRUE; \> } \> \> \> class MyPrefs : public PrefsDialogHookClass \> { \>      public: \>           virtual SubDialog \*Alloc() { return gNew MyPrefsDialog(this); } \>           virtual void Free(SubDialog \*dlg) { gDelete(dlg); } \>           virtual void InitPrefs(BaseContainer \*bc); \> }; \> \> void MyPrefs::InitPrefs(BaseContainer \*bc) \> { \>      BaseContainer defbc; \>      CheckPrefsData(bc, MY_PREFS_ID, GeData(defbc)); \> } \> \> MyPrefs \*myprefs = NULL; \> \> Bool RegisterMyPrefs(void) \> { \>      String name=GeLoadString(IDS_MY_PREFS); if (!name.Content()) return TRUE; \>      myprefs = gNew MyPrefs; \>      if(!myprefs) return FALSE; \>      return myprefs->Register(MY_PREFS_ID, name, 0, 0); \> } \> \> void FreeMyPrefs(void) \> { \>      if(myprefs) \>      { \>           gDelete(myprefs); \>           myprefs = NULL; \>      } \> } \>

        cheers,
        Matthias

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 24/10/2008 at 06:57, xxxxxxxx wrote:

          Thanks Matthias,

          do you call the register function in PluginStart()?
          Bye 🙂

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 24/10/2008 at 06:59, xxxxxxxx wrote:

            Yes, I call the register function in PluginStart(). Just take a look at my code, it's there at the top of PluginStart() 🙂

            cheers,
            Matthias

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 24/10/2008 at 08:01, xxxxxxxx wrote:

              Ooops, I did overlook that the function is PluginStart()... 🙂

              Bye.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post