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

    Multiple dialogs

    Scheduled Pinned Locked Moved SDK Help
    9 Posts 0 Posters 675 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 03/04/2011 at 06:41, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   11.5&12 
      Platform:   Windows  ; Mac  ;  
      Language(s) :   C.O.F.F.E.E  ;

      ---------
      Hi !

      I created a MenuPlugin that opens a dialog, my  problem is that each time I run the menuplugin its opens a new instance of the dialog ... I tried multiple tricks but didn't really found the equivalent of the MultipleAllowed() of the expression tag plugin.

      Any idea welcome.

      Thanks !

      Mike

      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 03/04/2011 at 07:06, xxxxxxxx wrote:

        Could you provide a snippet of code to show how you call for the dialogue to open?  Might help us help you.  🙂

        Thanks,

        Shawn

        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 03/04/2011 at 08:49, xxxxxxxx wrote:

          Simply :

          Plugin::Execute(doc)  
            {  
              
                      
                dialog = new(plugintools_gui);   
                dialog->Open(TRUE,-1,-1);   
            
                  
              
          }  
          

          plugintools_gui is a GeDialog derived class and Plugin a menuplugin

          Hope it's enough.

          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 03/04/2011 at 10:07, xxxxxxxx wrote:

            is it possible to check if there is an instance dialog already in use?

            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 03/04/2011 at 12:14, xxxxxxxx wrote:

              hello,
              first of all use restorelayout metod in dialog and command ....
              then if you need a pointer to the dialog from other part of cinema you have to create a kind of singletone of your command data and retrive the pointer from it.
              in activeobject there is an example of this! if you need some more help tell me .. i can share some example.

              all the best
              Franz

              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 03/04/2011 at 12:15, xxxxxxxx wrote:

                sorry i never seen is a coffee problem ... my reply was refereed to c++ 😞

                sorry
                Franz

                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 03/04/2011 at 13:25, xxxxxxxx wrote:

                  Thanks Franz... No problem, I often have this problem too 🙂

                  Shawn :
                  In fact I already tested something like

                    
                  if (!dialog)   
                         {  
                         dialog = new(plugintools_gui);  
                         dialog->Open(TRUE,-1,-1);  
                         }  
                  

                  But even when closed, the dialog object stays as existing. The result in cinema4d is that once I close the plugin dialog I cannot run it anymore because if (!dialog) always returns false.

                  Mike

                  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 03/04/2011 at 15:51, xxxxxxxx wrote:

                    Here is how I do it.  It will not reopen the dialog if already open and supports adding it to the layout:

                    ////////////////////////////////////////////////////////////////  
                    // dropobject.cof  
                    ////////////////////////////////////////////////////////////////  
                    // Drop object onto target object or floor (X-Z plane).  
                    // - If no object intersection, alert user.  
                    ////////////////////////////////////////////////////////////////  
                    // V0.3 2005.02.20 (c) Robert Templeton  
                    ////////////////////////////////////////////////////////////////  
                      
                    // Included symbols  
                    include "c4d_symbols.h"  
                      
                    // Global references  
                    var resource;  
                    var plugin_path;  
                    var plugin_icon;  
                    var d;  
                      
                    include "floordialog.h"  
                      
                    // CLASS: Drop Object Menu - Register plugin in menu  
                    class DropObject_MenuPlugin : MenuPlugin  
                    {  
                      public:  
                          DropObject_MenuPlugin();  
                          GetID();  
                          GetIcon();  
                          GetName();  
                          GetHelp();  
                          Execute(doc);  
                          RestoreLayout(secret);  
                    }  
                    DropObject_MenuPlugin::DropObject_MenuPlugin()    { super(); }  
                    DropObject_MenuPlugin::GetID()                        { return PLUGIN_MENU_ID; }  
                    DropObject_MenuPlugin::GetIcon()                        { return plugin_icon; }  
                    DropObject_MenuPlugin::GetName()                        { return resource->GetString(PLUGIN_MENU_TEXT); }  
                    DropObject_MenuPlugin::GetHelp()                        { return resource->GetString(PLUGIN_MENU_HELP_TEXT); }  
                    DropObject_MenuPlugin::Execute(doc)  
                    {  
                      // Perform operation  
                      d->Open(TRUE,-1,-1);  
                    }  
                    DropObject_MenuPlugin::RestoreLayout(secret)  
                    {  
                      // Called by C4D to restore the dialog  
                      if (!d) d = new(FloorDialog);  
                      d->RestoreLayout(secret);  
                    }  
                      
                      
                    // Start of plugin  
                    main()  
                    {  
                      // Load Resource  
                      if (!(plugin_path = GeGetRootFilename())) println("Unable to find plugin!");  
                      plugin_path->RemoveLast();  
                      if (!(resource = new(GeResource, plugin_path))) println("Unable to load resource!");  
                      
                      // Load Icons  
                      var icon_file = plugin_path->GetClone();  
                      icon_file->AddLast("pluginicon.tif");  
                      plugin_icon = new(BaseBitmap,1,1);  
                      plugin_icon->Load(icon_file);  
                      
                      // Register Plugins  
                      Register(DropObject_MenuPlugin);  
                      
                      // Create non-modal dialog  
                      d = new(FloorDialog);  
                    }
                    
                    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 03/04/2011 at 16:34, xxxxxxxx wrote:

                      Ok, so if I understand well, the key was to declare the floordialog object only ONE time when launching cinema4d, this way it avoids to get multiple instances ...this is as brilliant as it seems obvious now ...

                      You're my hero once more

                      Thanks everyone.

                      M!ke

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