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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Creating a preference dialog?

    SDK Help
    0
    3
    349
    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 27/03/2004 at 08:35, xxxxxxxx wrote:

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

      ---------
      Hi,

      Im trying to create a preferences dialog but im not sure what I need to do.

      I created the basic classes to represent a preference dialog

        
      class MyPrefsDialog: public PrefsDlg_Base  
      {  
      public:  
           MyPrefsDialog(PrefsDialogHookClass *hook) : PrefsDlg_Base(ID_PLUGIN,hook) { }  
        
      };  
        
        
      class MyPrefs: public PrefsDialogHookClass  
      {  
      public:  
           virtual SubDialog *Alloc() { return gNew MyPrefsDialog(this); }  
           virtual void Free(SubDialog *dlg) { gDelete(dlg); }  
        
      };  
      

      But I don't know how to actually initialize it, this is what I thought it would be

        
      MyPrefs prefs;  
      MyPrefsDialog *dlg=static_cast<MyPrefsDialog*>(prefs.Alloc());  
      prefs.Register(ID_PLUGIN,"Testing");  
      

      But this crashes cinema when clicking on preferences under the edit menu.

      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 29/03/2004 at 05:13, xxxxxxxx wrote:

        hi geespot,

        to start your plug-in use this code:

          
        MyPrefs mp;  
        SubDialog *sd;  
        Bool PluginStart(void)  
        {  
             if (!mp.Register(ID_PLUGIN,"Testing")) return FALSE;  
             if (!sd) sd = mp.Alloc();     // create a new element in preferences dialog  
          
             return TRUE;  
        }  
          
        void PluginEnd(void)  
        {  
             if (sd) mp.Free(sd);  
        }  
        

        that's what's suggested by c++ documentation and it won't crash.

        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 29/03/2004 at 14:50, xxxxxxxx wrote:

          Thanks!
          your a star 🙂

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