Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    PrefsDialogHookClass

    SDK Help
    0
    9
    856
    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
      Helper
      last edited by

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

      On 13/08/2003 at 15:38, xxxxxxxx wrote:

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

      ---------
      Hi,

      I've built my own preferences category with PrefsDialogHookClass as outlined in the SDK documentation. But: How can I retrieve these data? I need them outside of the preferences dialog. Where can I get a pointer to the BaseContainer with my preference data?

      Thanks in advance!

      Regards,
      jl

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

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

        On 14/08/2003 at 05:42, xxxxxxxx wrote:

        Use PrefsDialogHookClass::GetData() on the allocated instance. (Or store your preferences somewhere else that in the supplied container, for example with SetWorldPluginData().)

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

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

          On 14/08/2003 at 07:58, xxxxxxxx wrote:

          Hi,

          but PrefsDialogHookClass::GetData() does only work after one has opened the preferences window in the current session?

          SetWorldPluginData has a wrong declaration in c4d_general.h: The "const" for the second parameter is missing. This causes a linker error.

          Even with the "const" added, I can't get SetWorldPluginData to work. It seems to write an empty container.

          Regards,
          jl

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

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

            On 14/08/2003 at 14:04, xxxxxxxx wrote:

            Oops, by mistake I used the 8.0 SDK. In the 8.1 SDK the "const" is in place. But the rest still doesn't work!?!

            Regards,
            jl

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

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

              On 14/08/2003 at 14:51, xxxxxxxx wrote:

              Hi,
              it works fine for me here. Here is a snipped that should work:
              BaseContainer *wpdo = GetWorldPluginData(PLUGIN_ID);
              if(wpdo) GePrint(wpdo->GetString(1111));
              BaseContainer wpd;
              wpd.SetString(1111,"Works fine");
              SetWorldPluginData(PLUGIN_ID,wpd,FALSE);
              Hope that helps
              Samir

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

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

                On 14/08/2003 at 14:54, xxxxxxxx wrote:

                but PrefsDialogHookClass::GetData() does only work after one has opened the preferences window in the current session?
                ----------
                yes, that´s true because they are only preferences 🙂 If you want to have a constant "background" check you could use the SceneHookData class.
                For some information: I have just recently answered a question here in the forum about the registration of it.
                Best
                Samir

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

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

                  On 15/08/2003 at 01:15, xxxxxxxx wrote:

                  Hi,

                  the BaseContainer that I store with SetWorldPluginData doesn't live long enough.

                  I want to set it inside CommandValues:

                    
                  LONG FXPrefsDialog::CommandValues(LONG id, const BaseContainer &msg;, BaseContainer *data)  
                  {  
                       String editorPath;  
                       if(!GetString(IDC_EDITOR_PATH, editorPath))  
                            return FALSE;  
                    
                       BaseContainer bc;  
                       bc.SetString(10000, editorPath);  
                       SetWorldPluginData(ID_PREFERENCES, bc);  
                    
                       MessageDialog(GetWorldPluginData(ID_PREFERENCES)  
                            ->GetString(IDC_EDITOR_PATH)); // This works!  
                    
                       return true;  
                  }  
                  

                  But from elsewhere GetWorldPluginData(ID_PREFERENCES) always returns NULL. For example, here:

                    
                  void FXPrefsDialog::SetValues(BaseContainer *data)  
                  {  
                       String editorPath;  
                    
                       BaseContainer* bc = GetWorldPluginData(ID_PREFERENCES);  
                       if(bc != NULL)  
                       {  
                            editorPath = bc->GetString(10000);  
                       }  
                       else  
                       {  
                            BaseContainer bc;  
                            SetWorldPluginData(ID_PREFERENCES, bc, FALSE);  
                       }  
                    
                       SetString(IDC_EDITOR_PATH, editorPath);  
                  }  
                  
                  1 Reply Last reply Reply Quote 0
                  • H
                    Helper
                    last edited by

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

                    On 15/08/2003 at 15:38, xxxxxxxx wrote:

                    I give up!

                    1. PrefsDialogHookClass::GetData() won't work until the preferences dialog has been opened at least once in the Cinema 4D session.

                    2. GetWorldPluginData receives a NULL pointer if it's not executed quite immediately after SetWorldPluginData.

                    3. SceneHook doesn't seem to be offer a straightforward solution.

                    So now I wrote code for a preferences file of my own.

                    😞

                    Regards,
                    Jörn

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

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

                      On 17/08/2003 at 12:50, xxxxxxxx wrote:

                      I cannot confirm 2). The following code seems to work:

                          
                          
                          Bool MenuTest::Execute(BaseDocument *doc)  
                          {  
                            {  
                              BaseContainer* bc = GetWorldPluginData(1012173);  
                              if (bc)  
                              {  
                                GePrint("before: " + bc->GetString(101));  
                              }  
                            }  
                            {  
                              BaseContainer bc;  
                              bc.SetString(101, "Hello World!");  
                              SetWorldPluginData(1012173, bc, FALSE);  
                            }  
                            {  
                              BaseContainer* bc = GetWorldPluginData(1012173);  
                              if (bc)  
                              {  
                                GePrint("after: " + bc->GetString(101));  
                              }  
                            }  
                            return TRUE;  
                          }  
                          
                      

                      This first time I ran it only "after" was output, but after that "before" is output as well, even after closing C4D. (At first I thought it didn't work, since when I forced C4D to quit it didn't save the preferences. Perhaps you did that as well?)
                      You're probably right about 1). I think that the internal preference panes store their data in the GetWorldContainer() space, so perhaps that's where your data ends up as well. (The preference library was originally only used by internal modules.) But using GetWorldPluginData() sounds safer, if it works.

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